From f951497a4fdf47e7c839f71df7a1b06660540ec9 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 1 Mar 2025 20:24:37 +0000 Subject: [PATCH] Code brevity. --- 3d-viewer/dialogs/panel_preview_3d_model.cpp | 6 +- bitmap2component/bitmap2cmp_frame.cpp | 18 +- bitmap2component/bitmap2cmp_panel.cpp | 8 +- common/dialog_shim.cpp | 22 +-- common/dialogs/dialog_grid_settings.cpp | 12 +- common/eda_base_frame.cpp | 2 +- common/eda_draw_frame.cpp | 28 ++-- common/eda_units.cpp | 154 ++++++------------ common/import_gfx/dxf_import_plugin.cpp | 12 +- common/import_gfx/dxf_import_plugin.h | 6 +- common/jobs/job_export_pcb_3d.cpp | 41 ++--- common/jobs/job_export_pcb_3d.h | 13 +- common/jobs/job_export_pcb_drill.cpp | 32 ++-- common/jobs/job_export_pcb_drill.h | 38 ++--- common/jobs/job_export_pcb_dxf.cpp | 14 +- common/jobs/job_export_pcb_dxf.h | 7 +- common/jobs/job_export_pcb_ipc2581.cpp | 28 ++-- common/jobs/job_export_pcb_ipc2581.h | 25 +-- common/jobs/job_export_pcb_odb.cpp | 16 +- common/jobs/job_export_pcb_odb.h | 13 +- common/jobs/job_export_pcb_pos.cpp | 30 ++-- common/jobs/job_export_pcb_pos.h | 34 ++-- common/jobs/job_rc.cpp | 12 +- common/jobs/job_rc.h | 15 +- common/libeval/numeric_evaluator.cpp | 12 +- common/plotters/DXF_plotter.cpp | 4 +- common/plotters/GERBER_plotter.cpp | 50 +++--- common/preview_items/preview_utils.cpp | 16 +- common/settings/app_settings.cpp | 4 +- common/settings/grid_settings.cpp | 18 +- common/tool/actions.cpp | 4 +- common/tool/common_tools.cpp | 8 +- common/widgets/wx_html_report_box.cpp | 2 +- cvpcb/display_footprints_frame.cpp | 10 +- eeschema/connection_graph.cpp | 4 +- eeschema/dialogs/dialog_label_properties.cpp | 2 +- eeschema/dialogs/dialog_text_properties.cpp | 2 +- eeschema/eeschema.cpp | 2 +- eeschema/eeschema_jobs_handler.cpp | 9 +- eeschema/import_gfx/dialog_import_gfx_sch.cpp | 10 +- eeschema/lib_symbol.cpp | 2 +- eeschema/sch_connection.cpp | 2 +- eeschema/sch_edit_frame.cpp | 5 +- eeschema/symbol_editor/symbol_edit_frame.cpp | 4 +- gerbview/gerbview.cpp | 2 +- gerbview/gerbview_frame.cpp | 4 +- gerbview/toolbars_gerber.cpp | 4 +- gerbview/tools/gerbview_inspection_tool.cpp | 4 +- include/eda_units.h | 18 +- include/plotters/plotter.h | 4 +- include/plotters/plotter_dxf.h | 5 +- include/reporter.h | 2 +- include/units_provider.h | 8 +- kicad/cli/command_pcb_drc.cpp | 4 +- kicad/cli/command_pcb_export_3d.cpp | 4 +- kicad/cli/command_pcb_export_drill.cpp | 4 +- kicad/cli/command_pcb_export_dxf.cpp | 4 +- kicad/cli/command_pcb_export_ipc2581.cpp | 4 +- kicad/cli/command_pcb_export_odb.cpp | 4 +- kicad/cli/command_pcb_export_pos.cpp | 4 +- kicad/cli/command_sch_erc.cpp | 4 +- .../dialogs/properties_frame.cpp | 6 +- pagelayout_editor/pl_editor.cpp | 2 +- pagelayout_editor/pl_editor_frame.cpp | 22 +-- pcbnew/api/api_pcb_enums.cpp | 12 +- pcbnew/board.cpp | 2 +- pcbnew/board_design_settings.cpp | 2 +- .../dialogs/dialog_dimension_properties.cpp | 24 +-- pcbnew/dialogs/dialog_export_2581.cpp | 6 +- pcbnew/dialogs/dialog_export_odbpp.cpp | 2 +- .../dialogs/dialog_gen_footprint_position.cpp | 17 +- pcbnew/dialogs/dialog_gendrill.cpp | 7 +- pcbnew/dialogs/dialog_plot.cpp | 10 +- .../dialogs/panel_pcbnew_color_settings.cpp | 2 +- pcbnew/dialogs/panel_setup_constraints.cpp | 18 +- pcbnew/drc/drc_engine.cpp | 20 +-- pcbnew/drc/drc_test_provider.cpp | 3 +- .../drc/drc_test_provider_library_parity.cpp | 4 +- pcbnew/exporters/gen_drill_report_files.cpp | 5 +- pcbnew/exporters/gendrill_Excellon_writer.cpp | 4 +- pcbnew/exporters/place_file_exporter.cpp | 4 +- pcbnew/exporters/step/step_pcb_model.cpp | 10 +- pcbnew/files.cpp | 4 +- pcbnew/footprint_chooser_frame.cpp | 4 +- pcbnew/footprint_edit_frame.cpp | 4 +- pcbnew/footprint_editor_settings.cpp | 4 +- pcbnew/footprint_viewer_frame.cpp | 4 +- pcbnew/generators/pcb_tuning_pattern.cpp | 2 +- pcbnew/import_gfx/dialog_import_graphics.cpp | 10 +- pcbnew/pcb_dimension.cpp | 42 ++--- pcbnew/pcb_dimension.h | 4 +- pcbnew/pcb_edit_frame.cpp | 4 +- pcbnew/pcb_io/altium/altium_parser_pcb.cpp | 6 +- pcbnew/pcb_io/altium/altium_parser_pcb.h | 8 +- pcbnew/pcb_io/altium/altium_pcb.cpp | 34 ++-- .../cadstar/cadstar_pcb_archive_loader.cpp | 4 +- pcbnew/pcb_io/eagle/pcb_io_eagle.cpp | 6 +- .../kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp | 2 +- pcbnew/pcb_painter.cpp | 13 +- pcbnew/pcb_plot_params.cpp | 9 +- pcbnew/pcb_plotter.cpp | 6 +- pcbnew/pcbexpr_evaluator.cpp | 4 +- pcbnew/pcbnew.cpp | 2 +- pcbnew/pcbnew_jobs_handler.cpp | 42 +++-- pcbnew/pcbnew_settings.cpp | 2 +- pcbnew/router/pns_kicad_iface.h | 2 +- pcbnew/router/pns_shove.cpp | 3 +- pcbnew/toolbars_pcb_editor.cpp | 25 +-- pcbnew/tools/drawing_stackup_table_tool.cpp | 14 +- .../common/libeval/test_numeric_evaluator.cpp | 3 +- qa/tests/eeschema/erc/test_erc_four_way.cpp | 2 +- .../eeschema/erc/test_erc_global_labels.cpp | 4 +- .../erc/test_erc_hierarchical_schematics.cpp | 2 +- .../erc/test_erc_label_multiple_wires.cpp | 2 +- .../eeschema/erc/test_erc_label_names.cpp | 4 +- .../erc/test_erc_label_not_connected.cpp | 2 +- .../erc/test_erc_multiple_pin_to_pin.cpp | 2 +- qa/tests/eeschema/erc/test_erc_no_connect.cpp | 2 +- .../eeschema/erc/test_erc_stacking_pins.cpp | 2 +- .../test_erc_unconnected_wire_endpoints.cpp | 2 +- .../eeschema/erc/test_erc_wire_bus_entry.cpp | 2 +- .../drc/test_custom_rule_severities.cpp | 4 +- .../pcbnew/drc/test_drc_component_classes.cpp | 11 +- qa/tests/pcbnew/drc/test_drc_copper_conn.cpp | 4 +- .../pcbnew/drc/test_drc_copper_graphics.cpp | 4 +- .../pcbnew/drc/test_drc_copper_sliver.cpp | 14 +- .../pcbnew/drc/test_drc_courtyard_invalid.cpp | 2 +- .../pcbnew/drc/test_drc_courtyard_overlap.cpp | 2 +- .../drc/test_drc_incorrect_text_mirror.cpp | 7 +- .../pcbnew/drc/test_drc_multi_netclasses.cpp | 4 +- qa/tests/pcbnew/drc/test_drc_regressions.cpp | 12 +- qa/tests/pcbnew/drc/test_drc_skew.cpp | 4 +- .../pcbnew/drc/test_drc_starved_thermal.cpp | 4 +- .../pcbnew/drc/test_solder_mask_bridging.cpp | 4 +- qa/tests/pcbnew/test_tracks_cleaner.cpp | 59 +++---- qa/tests/pcbnew/test_zone_filler.cpp | 27 ++- qa/tools/drc_proto/drc_proto.cpp | 2 +- 137 files changed, 684 insertions(+), 794 deletions(-) diff --git a/3d-viewer/dialogs/panel_preview_3d_model.cpp b/3d-viewer/dialogs/panel_preview_3d_model.cpp index 9c0854e965..4e2f826390 100644 --- a/3d-viewer/dialogs/panel_preview_3d_model.cpp +++ b/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; diff --git a/bitmap2component/bitmap2cmp_frame.cpp b/bitmap2component/bitmap2cmp_frame.cpp index 59f6cfcf31..90cd267fb2 100644 --- a/bitmap2component/bitmap2cmp_frame.cpp +++ b/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; } diff --git a/bitmap2component/bitmap2cmp_panel.cpp b/bitmap2component/bitmap2cmp_panel.cpp index 0ef40a5028..d2da155228 100644 --- a/bitmap2component/bitmap2cmp_panel.cpp +++ b/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; } } diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index 13e69d83b0..7b90b1b9ab 100644 --- a/common/dialog_shim.cpp +++ b/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; diff --git a/common/dialogs/dialog_grid_settings.cpp b/common/dialogs/dialog_grid_settings.cpp index 41c57fa9a6..f3dcc9fc05 100644 --- a/common/dialogs/dialog_grid_settings.cpp +++ b/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; } diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 703ab67b82..5299c3ed2d 100644 --- a/common/eda_base_frame.cpp +++ b/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; diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 7be50ede2e..830e6bc8f9 100644 --- a/common/eda_draw_frame.cpp +++ b/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( 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 { diff --git a/common/eda_units.cpp b/common/eda_units.cpp index 44cbe624b3..2c15a196ab 100644 --- a/common/eda_units.cpp +++ b/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 { diff --git a/common/import_gfx/dxf_import_plugin.cpp b/common/import_gfx/dxf_import_plugin.cpp index aaf2de0f85..ef555593dd 100644 --- a/common/import_gfx/dxf_import_plugin.cpp +++ b/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; diff --git a/common/import_gfx/dxf_import_plugin.h b/common/import_gfx/dxf_import_plugin.h index ab84ee9c86..c0ae7e74ce 100644 --- a/common/import_gfx/dxf_import_plugin.h +++ b/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, diff --git a/common/jobs/job_export_pcb_3d.cpp b/common/jobs/job_export_pcb_3d.cpp index d78ac569ca..cb6c69241d 100644 --- a/common/jobs/job_export_pcb_3d.cpp +++ b/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( "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; } } diff --git a/common/jobs/job_export_pcb_3d.h b/common/jobs/job_export_pcb_3d.h index 1ddc2385f6..d6bcfd1e0f 100644 --- a/common/jobs/job_export_pcb_3d.h +++ b/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 diff --git a/common/jobs/job_export_pcb_drill.cpp b/common/jobs/job_export_pcb_drill.cpp index 2693faed7d..7e72f86448 100644 --- a/common/jobs/job_export_pcb_drill.cpp +++ b/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( "excellon.mirror_y", &m_excellonMirrorY, diff --git a/common/jobs/job_export_pcb_drill.h b/common/jobs/job_export_pcb_drill.h index 9a42f9ffb0..c49cd47d60 100644 --- a/common/jobs/job_export_pcb_drill.h +++ b/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 diff --git a/common/jobs/job_export_pcb_dxf.cpp b/common/jobs/job_export_pcb_dxf.cpp index cee89487b4..6110407d60 100644 --- a/common/jobs/job_export_pcb_dxf.cpp +++ b/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; diff --git a/common/jobs/job_export_pcb_dxf.h b/common/jobs/job_export_pcb_dxf.h index 51ea233935..f75521fc3a 100644 --- a/common/jobs/job_export_pcb_dxf.h +++ b/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 diff --git a/common/jobs/job_export_pcb_ipc2581.cpp b/common/jobs/job_export_pcb_ipc2581.cpp index cdfe06290f..6a8918bb5d 100644 --- a/common/jobs/job_export_pcb_ipc2581.cpp +++ b/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( "drawing_sheet", &m_drawingSheet, m_drawingSheet ) ); m_params.emplace_back( new JOB_PARAM( "units", &m_units, m_units ) ); diff --git a/common/jobs/job_export_pcb_ipc2581.h b/common/jobs/job_export_pcb_ipc2581.h index d3ffba4b2c..32d22aca08 100644 --- a/common/jobs/job_export_pcb_ipc2581.h +++ b/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 diff --git a/common/jobs/job_export_pcb_odb.cpp b/common/jobs/job_export_pcb_odb.cpp index 3772c31023..2b4fc0b832 100644 --- a/common/jobs/job_export_pcb_odb.cpp +++ b/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( "drawing_sheet", &m_drawingSheet, m_drawingSheet ) ); m_params.emplace_back( new JOB_PARAM( "units", &m_units, m_units ) ); diff --git a/common/jobs/job_export_pcb_odb.h b/common/jobs/job_export_pcb_odb.h index 0153b37571..4d2d46219c 100644 --- a/common/jobs/job_export_pcb_odb.h +++ b/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; }; diff --git a/common/jobs/job_export_pcb_pos.cpp b/common/jobs/job_export_pcb_pos.cpp index f37f94ca79..3d0828423a 100644 --- a/common/jobs/job_export_pcb_pos.cpp +++ b/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( "use_drill_place_file_origin", &m_useDrillPlaceFileOrigin, diff --git a/common/jobs/job_export_pcb_pos.h b/common/jobs/job_export_pcb_pos.h index bc0ca34f58..3ef35a66af 100644 --- a/common/jobs/job_export_pcb_pos.h +++ b/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 \ No newline at end of file diff --git a/common/jobs/job_rc.cpp b/common/jobs/job_rc.cpp index 063d339a10..bdde645728 100644 --- a/common/jobs/job_rc.cpp +++ b/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 ) diff --git a/common/jobs/job_rc.h b/common/jobs/job_rc.h index 3cbeef5d02..9a565935f1 100644 --- a/common/jobs/job_rc.h +++ b/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; }; \ No newline at end of file diff --git a/common/libeval/numeric_evaluator.cpp b/common/libeval/numeric_evaluator.cpp index fb88dc69b9..ac55ea54e0 100644 --- a/common/libeval/numeric_evaluator.cpp +++ b/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; } } diff --git a/common/plotters/DXF_plotter.cpp b/common/plotters/DXF_plotter.cpp index 76dfe608a9..b748fb60ba 100644 --- a/common/plotters/DXF_plotter.cpp +++ b/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; diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index 8285413005..8c45e20cb8 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/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& aCornerList, if( clearTA_AperFunction ) { if( m_useX2format ) - { fputs( "%TD.AperFunction*%\n", m_outputFile ); - } else - { fputs( "G04 #@! TD.AperFunction*\n", m_outputFile ); - } } } diff --git a/common/preview_items/preview_utils.cpp b/common/preview_items/preview_utils.cpp index 6077ef7273..d110df6c60 100644 --- a/common/preview_items/preview_utils.cpp +++ b/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 ) ); diff --git a/common/settings/app_settings.cpp b/common/settings/app_settings.cpp index 649e7abd5b..ee0d3511e4 100644 --- a/common/settings/app_settings.cpp +++ b/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( "system.units", - &m_System.units, static_cast( EDA_UNITS::MILLIMETRES ) ) ); + &m_System.units, static_cast( EDA_UNITS::MM ) ) ); } m_params.emplace_back( new PARAM( "system.last_metric_units", - &m_System.last_metric_units, static_cast( EDA_UNITS::MILLIMETRES ) ) ); + &m_System.last_metric_units, static_cast( EDA_UNITS::MM ) ) ); m_params.emplace_back( new PARAM( "system.last_imperial_units", &m_System.last_imperial_units, static_cast( EDA_UNITS::MILS ) ) ); diff --git a/common/settings/grid_settings.cpp b/common/settings/grid_settings.cpp index c48c277bb8..2648174a99 100644 --- a/common/settings/grid_settings.cpp +++ b/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 ) ); } diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index 4da5ad8750..22932ea471 100644 --- a/common/tool/actions.cpp +++ b/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" ) diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index 99e8f42f8b..ba4d94c953 100644 --- a/common/tool/common_tools.cpp +++ b/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( gridSizeX ), diff --git a/common/widgets/wx_html_report_box.cpp b/common/widgets/wx_html_report_box.cpp index b8ceda74d8..89726ed9c4 100644 --- a/common/widgets/wx_html_report_box.cpp +++ b/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(); diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp index 46152a4bfc..eeb65c4e30 100644 --- a/cvpcb/display_footprints_frame.cpp +++ b/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() ) ); diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 4521efc4bd..a3dee0eb49 100644 --- a/eeschema/connection_graph.cpp +++ b/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, " diff --git a/eeschema/dialogs/dialog_label_properties.cpp b/eeschema/dialogs/dialog_label_properties.cpp index 1242775456..98ece8d560 100644 --- a/eeschema/dialogs/dialog_label_properties.cpp +++ b/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 ); diff --git a/eeschema/dialogs/dialog_text_properties.cpp b/eeschema/dialogs/dialog_text_properties.cpp index 42e2157dc5..a2ce2a6930 100644 --- a/eeschema/dialogs/dialog_text_properties.cpp +++ b/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 ); diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index f4c6fcda7b..5883e3b9e7 100644 --- a/eeschema/eeschema.cpp +++ b/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; diff --git a/eeschema/eeschema_jobs_handler.cpp b/eeschema/eeschema_jobs_handler.cpp index 05837f7882..1903c394ea 100644 --- a/eeschema/eeschema_jobs_handler.cpp +++ b/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 markersProvider = diff --git a/eeschema/import_gfx/dialog_import_gfx_sch.cpp b/eeschema/import_gfx/dialog_import_gfx_sch.cpp index 66ecddb5b2..5796d3da46 100644 --- a/eeschema/import_gfx/dialog_import_gfx_sch.cpp +++ b/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 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" ) }, }; diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 83392ac180..bcae105ba6 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -1433,7 +1433,7 @@ std::vector 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; diff --git a/eeschema/sch_connection.cpp b/eeschema/sch_connection.cpp index 62b5cd28d1..4d1e542b8c 100644 --- a/eeschema/sch_connection.cpp +++ b/eeschema/sch_connection.cpp @@ -471,7 +471,7 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( std::vector& 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 ), diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 2afc57876b..546544337a 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/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, diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index d95bd7cf3a..797451d2bf 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/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 ) ); diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index 741ca09dfd..109cc6a84a 100644 --- a/gerbview/gerbview.cpp +++ b/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; diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index d95617ded5..97dd77f32c 100644 --- a/gerbview/gerbview_frame.cpp +++ b/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 = diff --git a/gerbview/toolbars_gerber.cpp b/gerbview/toolbars_gerber.cpp index b51c3e3f9e..c90b3cb019 100644 --- a/gerbview/toolbars_gerber.cpp +++ b/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; diff --git a/gerbview/tools/gerbview_inspection_tool.cpp b/gerbview/tools/gerbview_inspection_tool.cpp index 290d1b4979..773012c987 100644 --- a/gerbview/tools/gerbview_inspection_tool.cpp +++ b/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; diff --git a/include/eda_units.h b/include/eda_units.h index ad435335bc..1548e668ef 100644 --- a/include/eda_units.h +++ b/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. diff --git a/include/plotters/plotter.h b/include/plotters/plotter.h index 127d8d709e..edf95443e7 100644 --- a/include/plotters/plotter.h +++ b/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 }; diff --git a/include/plotters/plotter_dxf.h b/include/plotters/plotter_dxf.h index 8dc308e8e4..bb6eae4d86 100644 --- a/include/plotters/plotter_dxf.h +++ b/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 diff --git a/include/reporter.h b/include/reporter.h index 26dc369f6d..9cfffabc2c 100644 --- a/include/reporter.h +++ b/include/reporter.h @@ -129,7 +129,7 @@ public: virtual EDA_UNITS GetUnits() const { - return EDA_UNITS::MILLIMETRES; + return EDA_UNITS::MM; } virtual ~REPORTER() diff --git a/include/units_provider.h b/include/units_provider.h index d9ac49ceae..adac5a175c 100644 --- a/include/units_provider.h +++ b/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; } diff --git a/kicad/cli/command_pcb_drc.cpp b/kicad/cli/command_pcb_drc.cpp index 1f6ac07fbf..1e18e3d038 100644 --- a/kicad/cli/command_pcb_drc.cpp +++ b/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" ) ) { diff --git a/kicad/cli/command_pcb_export_3d.cpp b/kicad/cli/command_pcb_export_3d.cpp index f59f4fb655..4fb5ce8972 100644 --- a/kicad/cli/command_pcb_export_3d.cpp +++ b/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( 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" ) ) diff --git a/kicad/cli/command_pcb_export_drill.cpp b/kicad/cli/command_pcb_export_drill.cpp index 0d3d3dde4b..cc9003cd13 100644 --- a/kicad/cli/command_pcb_export_drill.cpp +++ b/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 { diff --git a/kicad/cli/command_pcb_export_dxf.cpp b/kicad/cli/command_pcb_export_dxf.cpp index 7da9d15296..7210d6b71f 100644 --- a/kicad/cli/command_pcb_export_dxf.cpp +++ b/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 { diff --git a/kicad/cli/command_pcb_export_ipc2581.cpp b/kicad/cli/command_pcb_export_ipc2581.cpp index 5639351ef8..76f9bc19d8 100644 --- a/kicad/cli/command_pcb_export_ipc2581.cpp +++ b/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( 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( ARG_BOM_COL_INT_ID ).c_str() ); diff --git a/kicad/cli/command_pcb_export_odb.cpp b/kicad/cli/command_pcb_export_odb.cpp index 8944145126..3f558c15dc 100644 --- a/kicad/cli/command_pcb_export_odb.cpp +++ b/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( 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( ARG_COMPRESS ).c_str() ).Lower(); diff --git a/kicad/cli/command_pcb_export_pos.cpp b/kicad/cli/command_pcb_export_pos.cpp index 660a12a6fb..82ffb4b5ac 100644 --- a/kicad/cli/command_pcb_export_pos.cpp +++ b/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 { diff --git a/kicad/cli/command_sch_erc.cpp b/kicad/cli/command_sch_erc.cpp index a972d1a72f..449b57f174 100644 --- a/kicad/cli/command_sch_erc.cpp +++ b/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" ) ) { diff --git a/pagelayout_editor/dialogs/properties_frame.cpp b/pagelayout_editor/dialogs/properties_frame.cpp index 18bcc0aa0d..646f7d777f 100644 --- a/pagelayout_editor/dialogs/properties_frame.cpp +++ b/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 ); } diff --git a/pagelayout_editor/pl_editor.cpp b/pagelayout_editor/pl_editor.cpp index df761a1799..0f3f345ebb 100644 --- a/pagelayout_editor/pl_editor.cpp +++ b/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; diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index 573f07196d..e4add66f4d 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/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; diff --git a/pcbnew/api/api_pcb_enums.cpp b/pcbnew/api/api_pcb_enums.cpp index 03d5e4122b..3b5939a89e 100644 --- a/pcbnew/api/api_pcb_enums.cpp +++ b/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; diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index 85395cad36..51d4cff202 100644 --- a/pcbnew/board.cpp +++ b/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 ) diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index ed0d443163..01b0725951 100644 --- a/pcbnew/board_design_settings.cpp +++ b/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( "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( "defaults.dimension_precision", diff --git a/pcbnew/dialogs/dialog_dimension_properties.cpp b/pcbnew/dialogs/dialog_dimension_properties.cpp index 8d91677a35..522615d587 100644 --- a/pcbnew/dialogs/dialog_dimension_properties.cpp +++ b/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( m_dimension->GetUnitsFormat() ) ); @@ -390,16 +390,16 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( PCB_DIMENSION_BASE* aTarget->SetLayer( static_cast( 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( m_cbUnitsFormat->GetSelection() ) ); diff --git a/pcbnew/dialogs/dialog_export_2581.cpp b/pcbnew/dialogs/dialog_export_2581.cpp index e0882939b1..7931e624df 100644 --- a/pcbnew/dialogs/dialog_export_2581.cpp +++ b/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( 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(); } diff --git a/pcbnew/dialogs/dialog_export_odbpp.cpp b/pcbnew/dialogs/dialog_export_odbpp.cpp index efb4fde7ac..421041d7f4 100644 --- a/pcbnew/dialogs/dialog_export_odbpp.cpp +++ b/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 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 diff --git a/pcbnew/dialogs/dialog_gen_footprint_position.cpp b/pcbnew/dialogs/dialog_gen_footprint_position.cpp index 45b7fe7b9e..0b3183a7e4 100644 --- a/pcbnew/dialogs/dialog_gen_footprint_position.cpp +++ b/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( 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; diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index 40943c9ee2..04ee08d8bd 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/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( 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( m_job->m_zeroFormat ) ); updatePrecisionOptions(); m_Check_Minimal->SetValue( m_job->m_excellonMinimalHeader ); diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 3cb963a600..88541274ab 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/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( 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 ); diff --git a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp index 321e099291..69ab5795de 100644 --- a/pcbnew/dialogs/panel_pcbnew_color_settings.cpp +++ b/pcbnew/dialogs/panel_pcbnew_color_settings.cpp @@ -682,7 +682,7 @@ std::set 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 ), diff --git a/pcbnew/dialogs/panel_setup_constraints.cpp b/pcbnew/dialogs/panel_setup_constraints.cpp index db5d125603..2bff75b721 100644 --- a/pcbnew/dialogs/panel_setup_constraints.cpp +++ b/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() diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index d6af174d09..27dcf36dda 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/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 ); diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index d9b052f037..ce54e7a540 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/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 ) { } diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index 012cfec742..9ebb54aac5 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/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& 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; diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index 40c76091e0..6ac4b2a4d5 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/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 ); diff --git a/pcbnew/exporters/gendrill_Excellon_writer.cpp b/pcbnew/exporters/gendrill_Excellon_writer.cpp index 694ced43f4..f90261648c 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.cpp +++ b/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. diff --git a/pcbnew/exporters/place_file_exporter.cpp b/pcbnew/exporters/place_file_exporter.cpp index c55870ee7e..c241209fbf 100644 --- a/pcbnew/exporters/place_file_exporter.cpp +++ b/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() diff --git a/pcbnew/exporters/step/step_pcb_model.cpp b/pcbnew/exporters/step/step_pcb_model.cpp index 3e977b426c..1550623c89 100644 --- a/pcbnew/exporters/step/step_pcb_model.cpp +++ b/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; } diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 2f51c96524..edf4e59593 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -1442,8 +1442,8 @@ void PCB_EDIT_FRAME::GenODBPPFiles( wxCommandEvent& event ) job.m_compressionMode = static_cast( 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; diff --git a/pcbnew/footprint_chooser_frame.cpp b/pcbnew/footprint_chooser_frame.cpp index 959c9895d5..59c296e945 100644 --- a/pcbnew/footprint_chooser_frame.cpp +++ b/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() ) ); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 217519eb5c..81f547c12b 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/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() ) ); diff --git a/pcbnew/footprint_editor_settings.cpp b/pcbnew/footprint_editor_settings.cpp index 17e7ca9d54..1342e3c219 100644 --- a/pcbnew/footprint_editor_settings.cpp +++ b/pcbnew/footprint_editor_settings.cpp @@ -289,7 +289,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() : // Dimension settings m_params.emplace_back( new PARAM_ENUM( "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( "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( aCfg->ReadLong( f + "PcbUserGrid_Unit", - static_cast( EDA_UNITS::INCHES ) ) ); + static_cast( EDA_UNITS::IN ) ) ); // Convert to internal units x = EDA_UNIT_UTILS::UI::FromUserUnit( pcbIUScale, u, x ); diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index 00628b5fa6..c9211aff7d 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/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 ) ); diff --git a/pcbnew/generators/pcb_tuning_pattern.cpp b/pcbnew/generators/pcb_tuning_pattern.cpp index 87b04d5c25..2ee49a7cf2 100644 --- a/pcbnew/generators/pcb_tuning_pattern.cpp +++ b/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( aTool->GetManager()->GetSettings()->m_System.units ); diff --git a/pcbnew/import_gfx/dialog_import_graphics.cpp b/pcbnew/import_gfx/dialog_import_graphics.cpp index 14ed3256d6..04778aa3ff 100644 --- a/pcbnew/import_gfx/dialog_import_graphics.cpp +++ b/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 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" ) }, }; diff --git a/pcbnew/pcb_dimension.cpp b/pcbnew/pcb_dimension.cpp index d68b71ff52..8575d48470 100644 --- a/pcbnew/pcb_dimension.cpp +++ b/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::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::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 ); diff --git a/pcbnew/pcb_dimension.h b/pcbnew/pcb_dimension.h index 4c9b06fae5..dc00bf5ddf 100644 --- a/pcbnew/pcb_dimension.h +++ b/pcbnew/pcb_dimension.h @@ -70,9 +70,9 @@ enum class DIM_TEXT_POSITION */ enum class DIM_UNITS_MODE { - INCHES, + IN, MILS, - MILLIMETRES, + MM, AUTOMATIC }; diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 92005510cb..1535f6757c 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/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() ) ); diff --git a/pcbnew/pcb_io/altium/altium_parser_pcb.cpp b/pcbnew/pcb_io/altium/altium_parser_pcb.cpp index d40a233f78..010db13f30 100644 --- a/pcbnew/pcb_io/altium/altium_parser_pcb.cpp +++ b/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() ) diff --git a/pcbnew/pcb_io/altium/altium_parser_pcb.h b/pcbnew/pcb_io/altium/altium_parser_pcb.h index 1d21f39396..74123225c5 100644 --- a/pcbnew/pcb_io/altium/altium_parser_pcb.h +++ b/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 diff --git a/pcbnew/pcb_io/altium/altium_pcb.cpp b/pcbnew/pcb_io/altium/altium_pcb.cpp index 9728c3ec9f..5ca42c25c3 100644 --- a/pcbnew/pcb_io/altium/altium_pcb.cpp +++ b/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() ) diff --git a/pcbnew/pcb_io/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/pcb_io/cadstar/cadstar_pcb_archive_loader.cpp index 448529a929..d83da4dcdd 100644 --- a/pcbnew/pcb_io/cadstar/cadstar_pcb_archive_loader.cpp +++ b/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: diff --git a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp b/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp index eb518a6b6c..eeaf566669 100644 --- a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp +++ b/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; } diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp index 6aabfa43b9..aeaf219912 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp +++ b/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 diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index d46d0aeae6..3d6798863d 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -2576,14 +2576,11 @@ void PCB_PAINTER::draw( const PCB_TABLE* aTable, int aLayer ) { setupStroke( aTable->GetBorderStroke() ); - std::vector topLeft = aTable->GetCell( 0, 0 )->GetCornersInSequence(); - std::vector bottomLeft = - aTable->GetCell( aTable->GetRowCount() - 1, 0 )->GetCornersInSequence(); - std::vector topRight = - aTable->GetCell( 0, aTable->GetColCount() - 1 )->GetCornersInSequence(); - std::vector bottomRight = - aTable->GetCell( aTable->GetRowCount() - 1, aTable->GetColCount() - 1 ) - ->GetCornersInSequence(); + std::vector topLeft = aTable->GetCell( 0, 0 )->GetCornersInSequence(); + std::vector bottomLeft = aTable->GetCell( aTable->GetRowCount() - 1, 0 )->GetCornersInSequence(); + std::vector topRight = aTable->GetCell( 0, aTable->GetColCount() - 1 )->GetCornersInSequence(); + std::vector 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] ); diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index a0d8418e30..702b17327d 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/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: diff --git a/pcbnew/pcb_plotter.cpp b/pcbnew/pcb_plotter.cpp index d4f5fdcb66..26463d8814 100644 --- a/pcbnew/pcb_plotter.cpp +++ b/pcbnew/pcb_plotter.cpp @@ -348,9 +348,9 @@ void PCB_PLOTTER::PlotJobToPlotOpts( PCB_PLOT_PARAMS& aOpts, JOB_EXPORT_PCB_PLOT if( aJob->m_plotFormat == JOB_EXPORT_PCB_PLOT::PLOT_FORMAT::DXF ) { JOB_EXPORT_PCB_DXF* dxfJob = static_cast( aJob ); - aOpts.SetDXFPlotUnits( dxfJob->m_dxfUnits == JOB_EXPORT_PCB_DXF::DXF_UNITS::INCHES - ? DXF_UNITS::INCHES - : DXF_UNITS::MILLIMETERS ); + aOpts.SetDXFPlotUnits( dxfJob->m_dxfUnits == JOB_EXPORT_PCB_DXF::DXF_UNITS::IN + ? DXF_UNITS::IN + : DXF_UNITS::MM ); aOpts.SetPlotMode( dxfJob->m_plotGraphicItemsUsingContours ? OUTLINE_MODE::SKETCH : OUTLINE_MODE::FILLED ); diff --git a/pcbnew/pcbexpr_evaluator.cpp b/pcbnew/pcbexpr_evaluator.cpp index 18baa1bbfe..bcf15d5d97 100644 --- a/pcbnew/pcbexpr_evaluator.cpp +++ b/pcbnew/pcbexpr_evaluator.cpp @@ -570,8 +570,8 @@ double PCBEXPR_UNIT_RESOLVER::Convert( const wxString& aString, int unitId ) con switch( unitId ) { case 0: return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::MILS, aString ); - case 1: return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::MILLIMETRES, aString ); - case 2: return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::INCHES, aString ); + case 1: return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::MM, aString ); + case 2: return EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::IN, aString ); default: return v; } }; diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 11b6d347a8..98bfadcb60 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -85,7 +85,7 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER IFACE( const char* aName, KIWAY::FACE_T aType ) : KIFACE_BASE( aName, aType ), - UNITS_PROVIDER( pcbIUScale, EDA_UNITS::MILLIMETRES ) + UNITS_PROVIDER( pcbIUScale, EDA_UNITS::MM ) {} bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway ) override; diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp index 9762ddbda5..09610477a8 100644 --- a/pcbnew/pcbnew_jobs_handler.cpp +++ b/pcbnew/pcbnew_jobs_handler.cpp @@ -390,10 +390,10 @@ int PCBNEW_JOBS_HANDLER::JobExportStep( JOB* aJob ) double scale = 0.0; switch ( aStepJob->m_vrmlUnits ) { - case JOB_EXPORT_PCB_3D::VRML_UNITS::MILLIMETERS: scale = 1.0; break; - case JOB_EXPORT_PCB_3D::VRML_UNITS::METERS: scale = 0.001; break; - case JOB_EXPORT_PCB_3D::VRML_UNITS::TENTHS: scale = 10.0 / 25.4; break; - case JOB_EXPORT_PCB_3D::VRML_UNITS::INCHES: scale = 1.0 / 25.4; break; + case JOB_EXPORT_PCB_3D::VRML_UNITS::MM: scale = 1.0; break; + case JOB_EXPORT_PCB_3D::VRML_UNITS::METERS: scale = 0.001; break; + case JOB_EXPORT_PCB_3D::VRML_UNITS::TENTHS: scale = 10.0 / 25.4; break; + case JOB_EXPORT_PCB_3D::VRML_UNITS::IN: scale = 1.0 / 25.4; break; } EXPORTER_VRML vrmlExporter( brd ); @@ -1324,7 +1324,7 @@ int PCBNEW_JOBS_HANDLER::JobExportDrill( JOB* aJob ) DRILL_PRECISION precision; - if( aDrillJob->m_drillUnits == JOB_EXPORT_PCB_DRILL::DRILL_UNITS::INCHES ) + if( aDrillJob->m_drillUnits == JOB_EXPORT_PCB_DRILL::DRILL_UNITS::IN ) precision = precisionListForInches; else precision = precisionListForMetric; @@ -1334,8 +1334,7 @@ int PCBNEW_JOBS_HANDLER::JobExportDrill( JOB* aJob ) if( excellonWriter == nullptr ) return CLI::EXIT_CODES::ERR_UNKNOWN; - excellonWriter->SetFormat( aDrillJob->m_drillUnits - == JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MILLIMETERS, + excellonWriter->SetFormat( aDrillJob->m_drillUnits == JOB_EXPORT_PCB_DRILL::DRILL_UNITS::MM, zeroFmt, precision.m_Lhs, precision.m_Rhs ); excellonWriter->SetOptions( aDrillJob->m_excellonMirrorY, aDrillJob->m_excellonMinimalHeader, @@ -1424,15 +1423,15 @@ int PCBNEW_JOBS_HANDLER::JobExportPos( JOB* aJob ) wxCHECK( file, false ); PLACE_FILE_EXPORTER exporter( brd, - aPosJob->m_units == JOB_EXPORT_PCB_POS::UNITS::MILLIMETERS, - aPosJob->m_smdOnly, - aPosJob->m_excludeFootprintsWithTh, - aPosJob->m_excludeDNP, - frontSide, - backSide, - aPosJob->m_format == JOB_EXPORT_PCB_POS::FORMAT::CSV, - aPosJob->m_useDrillPlaceFileOrigin, - aPosJob->m_negateBottomX ); + aPosJob->m_units == JOB_EXPORT_PCB_POS::UNITS::MM, + aPosJob->m_smdOnly, + aPosJob->m_excludeFootprintsWithTh, + aPosJob->m_excludeDNP, + frontSide, + backSide, + aPosJob->m_format == JOB_EXPORT_PCB_POS::FORMAT::CSV, + aPosJob->m_useDrillPlaceFileOrigin, + aPosJob->m_negateBottomX ); std::string data = exporter.GenPositionData(); fputs( data.c_str(), file ); @@ -1814,10 +1813,10 @@ int PCBNEW_JOBS_HANDLER::JobExportDrc( JOB* aJob ) switch( drcJob->m_units ) { - case JOB_PCB_DRC::UNITS::INCHES: units = EDA_UNITS::INCHES; break; - case JOB_PCB_DRC::UNITS::MILS: units = EDA_UNITS::MILS; break; - case JOB_PCB_DRC::UNITS::MILLIMETERS: units = EDA_UNITS::MILLIMETRES; break; - default: units = EDA_UNITS::MILLIMETRES; break; + case JOB_PCB_DRC::UNITS::IN: units = EDA_UNITS::IN; break; + case JOB_PCB_DRC::UNITS::MILS: units = EDA_UNITS::MILS; break; + case JOB_PCB_DRC::UNITS::MM: units = EDA_UNITS::MM; break; + default: units = EDA_UNITS::MM; break; } std::shared_ptr drcEngine = brd->GetDesignSettings().m_DRCEngine; @@ -2007,8 +2006,7 @@ int PCBNEW_JOBS_HANDLER::JobExportIpc2581( JOB* aJob ) } std::map props; - props["units"] = job->m_units == JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MILLIMETERS ? "mm" - : "inch"; + props["units"] = job->m_units == JOB_EXPORT_PCB_IPC2581::IPC2581_UNITS::MM ? "mm" : "inch"; props["sigfig"] = wxString::Format( "%d", job->m_precision ); props["version"] = job->m_version == JOB_EXPORT_PCB_IPC2581::IPC2581_VERSION::C ? "C" : "B"; props["OEMRef"] = job->m_colInternalId; diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index e422c40342..c0c1f9eb26 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -991,7 +991,7 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) if( aCfg->Read( f + "PcbUserGrid_X", &x ) && aCfg->Read( f + "PcbUserGrid_Y", &y ) ) { EDA_UNITS u = static_cast( aCfg->ReadLong( f + "PcbUserGrid_Unit", - static_cast( EDA_UNITS::INCHES ) ) ); + static_cast( EDA_UNITS::IN ) ) ); // Convert to internal units x = EDA_UNIT_UTILS::UI::FromUserUnit( pcbIUScale, u, x ); diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index 37ebbcbde8..14f6c257f9 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -95,7 +95,7 @@ public: BOARD* GetBoard() const { return m_board; } - virtual EDA_UNITS GetUnits() const { return EDA_UNITS::MILLIMETRES; }; + virtual EDA_UNITS GetUnits() const { return EDA_UNITS::MM; }; PNS::RULE_RESOLVER* GetRuleResolver() override; PNS::DEBUG_DECORATOR* GetDebugDecorator() override; diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index fd5f3b0522..4c06bac437 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -1703,9 +1703,8 @@ SHOVE::SHOVE_STATUS SHOVE::shoveIteration( int aIter ) ITEM* ni = nearest->m_item; - UNITS_PROVIDER up( pcbIUScale, EDA_UNITS::MILLIMETRES ); + UNITS_PROVIDER up( pcbIUScale, EDA_UNITS::MM ); PNS_DBG( Dbg(), Message, wxString::Format( wxT( "NI: %s (%s) %p %d" ), - ni->Format(), ni->Parent() ? ni->Parent()->GetItemDescription( &up, false ) : wxString( wxT( "null" ) ), diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 129b6bd558..0b29312846 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -445,10 +445,10 @@ static wxString ComboBoxUnits( EDA_UNITS aUnits, double aValue, bool aIncludeLab default: wxASSERT_MSG( false, wxT( "Invalid unit" ) ); KI_FALLTHROUGH; - case EDA_UNITS::UNSCALED: format = wxT( "%.0f" ); break; - case EDA_UNITS::MILLIMETRES: format = wxT( "%.3f" ); break; - case EDA_UNITS::MILS: format = wxT( "%.2f" ); break; - case EDA_UNITS::INCHES: format = wxT( "%.5f" ); break; + case EDA_UNITS::UNSCALED: format = wxT( "%.0f" ); break; + case EDA_UNITS::MM: format = wxT( "%.3f" ); break; + case EDA_UNITS::MILS: format = wxT( "%.2f" ); break; + case EDA_UNITS::IN: format = wxT( "%.5f" ); break; } text.Printf( format, EDA_UNIT_UTILS::UI::ToUserUnit( pcbIUScale, aUnits, aValue ) ); @@ -509,25 +509,14 @@ void PCB_EDIT_FRAME::UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool a aViaSizeSelectBox->Clear(); - COMMON_TOOLS* cmnTool = m_toolManager->GetTool(); - + COMMON_TOOLS* cmnTool = m_toolManager->GetTool(); EDA_UNITS primaryUnit = GetUserUnits(); EDA_UNITS secondaryUnit = EDA_UNITS::MILS; if( EDA_UNIT_UTILS::IsImperialUnit( primaryUnit ) ) - { - if( cmnTool ) - secondaryUnit = cmnTool->GetLastMetricUnits(); - else - secondaryUnit = EDA_UNITS::MILLIMETRES; - } + secondaryUnit = cmnTool ? cmnTool->GetLastMetricUnits() : EDA_UNITS::MM; else - { - if( cmnTool ) - secondaryUnit = cmnTool->GetLastImperialUnits(); - else - secondaryUnit = EDA_UNITS::MILS; - } + secondaryUnit = cmnTool ? cmnTool->GetLastImperialUnits() : EDA_UNITS::MILS; if( aShowNetclass ) aViaSizeSelectBox->Append( _( "Via: use netclass sizes" ) ); diff --git a/pcbnew/tools/drawing_stackup_table_tool.cpp b/pcbnew/tools/drawing_stackup_table_tool.cpp index d19b1b85e3..e0e9204592 100644 --- a/pcbnew/tools/drawing_stackup_table_tool.cpp +++ b/pcbnew/tools/drawing_stackup_table_tool.cpp @@ -259,10 +259,10 @@ std::vector DRAWING_TOOL::DrawSpecificationStackup( const VECTOR2I& switch( m_frame->GetUserUnits() ) { - case EDA_UNITS::MILLIMETRES: t->SetText( _( "Thickness (mm)" ) ); break; - case EDA_UNITS::INCHES: t->SetText( _( "Thickness (inches)" ) ); break; - case EDA_UNITS::MILS: t->SetText( _( "Thickness (mils)" ) ); break; - default: wxFAIL_MSG( wxT( "Unhandled unit type" ) ); + case EDA_UNITS::MM: t->SetText( _( "Thickness (mm)" ) ); break; + case EDA_UNITS::IN: t->SetText( _( "Thickness (inches)" ) ); break; + case EDA_UNITS::MILS: t->SetText( _( "Thickness (mils)" ) ); break; + default: wxFAIL_MSG( wxT( "Unhandled unit type" ) ); } colThickness.push_back( t ); @@ -400,8 +400,8 @@ std::vector DRAWING_TOOL::DrawBoardCharacteristics( const VECTOR2I& t->SetPosition( cursorPos ); objects.push_back( t ); - cursorPos.y = cursorPos.y + t->GetBoundingBox().GetHeight() - + EDA_UNIT_UTILS::UI::FromUserUnit( pcbIUScale, EDA_UNITS::MILLIMETRES, 1.0 ); + cursorPos.y += t->GetBoundingBox().GetHeight() + + EDA_UNIT_UTILS::UI::FromUserUnit( pcbIUScale, EDA_UNITS::MM, 1.0 ); std::vector> texts; std::vector colLabel1; @@ -533,7 +533,7 @@ std::vector DRAWING_TOOL::DrawBoardCharacteristics( const VECTOR2I& tableSize->x = tableSize2.x; tableSize->y = cursorPos.y + tableSize2.y - + EDA_UNIT_UTILS::UI::FromUserUnit( pcbIUScale, EDA_UNITS::MILLIMETRES, 2.0 ); + + EDA_UNIT_UTILS::UI::FromUserUnit( pcbIUScale, EDA_UNITS::MM, 2.0 ); return objects; } diff --git a/qa/tests/common/libeval/test_numeric_evaluator.cpp b/qa/tests/common/libeval/test_numeric_evaluator.cpp index f9bf1f195a..b7916c515d 100644 --- a/qa/tests/common/libeval/test_numeric_evaluator.cpp +++ b/qa/tests/common/libeval/test_numeric_evaluator.cpp @@ -32,7 +32,8 @@ struct NUM_EVAL_FIXTURE { - NUM_EVAL_FIXTURE() : m_eval( EDA_UNITS::MILLIMETRES ) + NUM_EVAL_FIXTURE() : + m_eval( EDA_UNITS::MM ) { } diff --git a/qa/tests/eeschema/erc/test_erc_four_way.cpp b/qa/tests/eeschema/erc/test_erc_four_way.cpp index 7766edeb83..e4811d50eb 100644 --- a/qa/tests/eeschema/erc/test_erc_four_way.cpp +++ b/qa/tests/eeschema/erc/test_erc_four_way.cpp @@ -64,7 +64,7 @@ BOOST_FIXTURE_TEST_CASE( ERCFourWayJunctions, ERC_REGRESSION_TEST_FIXTURE ) errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() diff --git a/qa/tests/eeschema/erc/test_erc_global_labels.cpp b/qa/tests/eeschema/erc/test_erc_global_labels.cpp index 5ebebc6146..38431cb863 100644 --- a/qa/tests/eeschema/erc/test_erc_global_labels.cpp +++ b/qa/tests/eeschema/erc/test_erc_global_labels.cpp @@ -78,7 +78,7 @@ BOOST_FIXTURE_TEST_CASE( ERCGlobalLabels, ERC_REGRESSION_TEST_FIXTURE ) errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() @@ -125,7 +125,7 @@ BOOST_FIXTURE_TEST_CASE( ERCSingleGlobalLabels, ERC_REGRESSION_TEST_FIXTURE ) errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() diff --git a/qa/tests/eeschema/erc/test_erc_hierarchical_schematics.cpp b/qa/tests/eeschema/erc/test_erc_hierarchical_schematics.cpp index 1fbe6d5dff..c3bc064974 100644 --- a/qa/tests/eeschema/erc/test_erc_hierarchical_schematics.cpp +++ b/qa/tests/eeschema/erc/test_erc_hierarchical_schematics.cpp @@ -76,7 +76,7 @@ BOOST_FIXTURE_TEST_CASE( ERCHierarchicalSchematics, ERC_REGRESSION_TEST_FIXTURE errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() diff --git a/qa/tests/eeschema/erc/test_erc_label_multiple_wires.cpp b/qa/tests/eeschema/erc/test_erc_label_multiple_wires.cpp index b8560739b3..00716a4187 100644 --- a/qa/tests/eeschema/erc/test_erc_label_multiple_wires.cpp +++ b/qa/tests/eeschema/erc/test_erc_label_multiple_wires.cpp @@ -64,7 +64,7 @@ BOOST_FIXTURE_TEST_CASE( ERCLabelMultipleWires, ERC_REGRESSION_TEST_FIXTURE ) errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() diff --git a/qa/tests/eeschema/erc/test_erc_label_names.cpp b/qa/tests/eeschema/erc/test_erc_label_names.cpp index 716f217945..eb064c0f29 100644 --- a/qa/tests/eeschema/erc/test_erc_label_names.cpp +++ b/qa/tests/eeschema/erc/test_erc_label_names.cpp @@ -68,7 +68,7 @@ BOOST_FIXTURE_TEST_CASE( ERCLabelCapitalization, ERC_REGRESSION_TEST_FIXTURE ) errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() @@ -106,7 +106,7 @@ BOOST_FIXTURE_TEST_CASE( ERCSameLocalGlobalLabel, ERC_REGRESSION_TEST_FIXTURE ) errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() diff --git a/qa/tests/eeschema/erc/test_erc_label_not_connected.cpp b/qa/tests/eeschema/erc/test_erc_label_not_connected.cpp index 267e659821..701d64cc80 100644 --- a/qa/tests/eeschema/erc/test_erc_label_not_connected.cpp +++ b/qa/tests/eeschema/erc/test_erc_label_not_connected.cpp @@ -80,7 +80,7 @@ BOOST_FIXTURE_TEST_CASE( ERCLabelNotConnected, ERC_REGRESSION_TEST_FIXTURE ) errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() << " but got " << errors.GetCount() << "\n" diff --git a/qa/tests/eeschema/erc/test_erc_multiple_pin_to_pin.cpp b/qa/tests/eeschema/erc/test_erc_multiple_pin_to_pin.cpp index 5afe2138bc..163b3dfce1 100644 --- a/qa/tests/eeschema/erc/test_erc_multiple_pin_to_pin.cpp +++ b/qa/tests/eeschema/erc/test_erc_multiple_pin_to_pin.cpp @@ -68,7 +68,7 @@ BOOST_FIXTURE_TEST_CASE( ERCMultiplePinToPin, ERC_REGRESSION_TEST_FIXTURE ) errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() diff --git a/qa/tests/eeschema/erc/test_erc_no_connect.cpp b/qa/tests/eeschema/erc/test_erc_no_connect.cpp index 91dbe2b93a..13f433df44 100644 --- a/qa/tests/eeschema/erc/test_erc_no_connect.cpp +++ b/qa/tests/eeschema/erc/test_erc_no_connect.cpp @@ -81,7 +81,7 @@ BOOST_FIXTURE_TEST_CASE( ERCNoConnect, ERC_REGRESSION_TEST_FIXTURE ) errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() << " but got " << errors.GetCount() << "\n" diff --git a/qa/tests/eeschema/erc/test_erc_stacking_pins.cpp b/qa/tests/eeschema/erc/test_erc_stacking_pins.cpp index 8940869974..468df05358 100644 --- a/qa/tests/eeschema/erc/test_erc_stacking_pins.cpp +++ b/qa/tests/eeschema/erc/test_erc_stacking_pins.cpp @@ -72,7 +72,7 @@ BOOST_FIXTURE_TEST_CASE( ERCStackingPins, ERC_REGRESSION_TEST_FIXTURE ) errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() << " but got " << errors.GetCount() << "\n" diff --git a/qa/tests/eeschema/erc/test_erc_unconnected_wire_endpoints.cpp b/qa/tests/eeschema/erc/test_erc_unconnected_wire_endpoints.cpp index e79f270d18..7d98901560 100644 --- a/qa/tests/eeschema/erc/test_erc_unconnected_wire_endpoints.cpp +++ b/qa/tests/eeschema/erc/test_erc_unconnected_wire_endpoints.cpp @@ -64,7 +64,7 @@ BOOST_FIXTURE_TEST_CASE( ERCUnconnectedWireEndpoints, ERC_REGRESSION_TEST_FIXTUR errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() diff --git a/qa/tests/eeschema/erc/test_erc_wire_bus_entry.cpp b/qa/tests/eeschema/erc/test_erc_wire_bus_entry.cpp index a79a2f1ced..354c03ef99 100644 --- a/qa/tests/eeschema/erc/test_erc_wire_bus_entry.cpp +++ b/qa/tests/eeschema/erc/test_erc_wire_bus_entry.cpp @@ -67,7 +67,7 @@ BOOST_FIXTURE_TEST_CASE( ERCWireBusEntry, ERC_REGRESSION_TEST_FIXTURE ) errors.SetSeverities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ); - ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MILLIMETRES ); + ERC_REPORT reportWriter( m_schematic.get(), EDA_UNITS::MM ); BOOST_CHECK_MESSAGE( errors.GetCount() == test.second, "Expected " << test.second << " errors in " << test.first.ToStdString() diff --git a/qa/tests/pcbnew/drc/test_custom_rule_severities.cpp b/qa/tests/pcbnew/drc/test_custom_rule_severities.cpp index 1443d2d819..8db3cb335f 100644 --- a/qa/tests/pcbnew/drc/test_custom_rule_severities.cpp +++ b/qa/tests/pcbnew/drc/test_custom_rule_severities.cpp @@ -72,7 +72,7 @@ BOOST_FIXTURE_TEST_CASE( DRCCustomRuleSeverityTest, DRC_REGRESSION_TEST_FIXTURE violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.size() == 8 ) { @@ -83,7 +83,7 @@ BOOST_FIXTURE_TEST_CASE( DRCCustomRuleSeverityTest, DRC_REGRESSION_TEST_FIXTURE { BOOST_CHECK_EQUAL( violations.size(), 8 ); - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); diff --git a/qa/tests/pcbnew/drc/test_drc_component_classes.cpp b/qa/tests/pcbnew/drc/test_drc_component_classes.cpp index 956e467ee7..aa7ee396c6 100644 --- a/qa/tests/pcbnew/drc/test_drc_component_classes.cpp +++ b/qa/tests/pcbnew/drc/test_drc_component_classes.cpp @@ -81,7 +81,7 @@ BOOST_FIXTURE_TEST_CASE( DRCComponentClasses, DRC_REGRESSION_TEST_FIXTURE ) violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.size() == test.second ) { @@ -90,7 +90,7 @@ BOOST_FIXTURE_TEST_CASE( DRCComponentClasses, DRC_REGRESSION_TEST_FIXTURE ) } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); @@ -101,8 +101,11 @@ BOOST_FIXTURE_TEST_CASE( DRCComponentClasses, DRC_REGRESSION_TEST_FIXTURE ) itemMap ) ); } - BOOST_ERROR( wxString::Format( "DRC component classes: %s, failed (violations found %d expected %d)", - test.first, (int)violations.size(), test.second ) ); + BOOST_ERROR( wxString::Format( "DRC component classes: %s, failed (violations found %d " + "expected %d)", + test.first, + (int) violations.size(), + test.second ) ); } } } diff --git a/qa/tests/pcbnew/drc/test_drc_copper_conn.cpp b/qa/tests/pcbnew/drc/test_drc_copper_conn.cpp index 366a515dd7..5b7f1bf5b0 100644 --- a/qa/tests/pcbnew/drc/test_drc_copper_conn.cpp +++ b/qa/tests/pcbnew/drc/test_drc_copper_conn.cpp @@ -87,7 +87,7 @@ BOOST_FIXTURE_TEST_CASE( DRCCopperConn, DRC_REGRESSION_TEST_FIXTURE ) violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.size() == test.second ) { @@ -96,7 +96,7 @@ BOOST_FIXTURE_TEST_CASE( DRCCopperConn, DRC_REGRESSION_TEST_FIXTURE ) } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); diff --git a/qa/tests/pcbnew/drc/test_drc_copper_graphics.cpp b/qa/tests/pcbnew/drc/test_drc_copper_graphics.cpp index 0ef228da5c..574b2ca181 100644 --- a/qa/tests/pcbnew/drc/test_drc_copper_graphics.cpp +++ b/qa/tests/pcbnew/drc/test_drc_copper_graphics.cpp @@ -72,7 +72,7 @@ BOOST_FIXTURE_TEST_CASE( DRCCopperGraphicsTest, DRC_COPPER_GRAPHICS_TEST_FIXTURE violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); const int expected_err_cnt = 4; // "What" copper text shorting zone // Copper knockout text shorting two zones twice (but not @@ -88,7 +88,7 @@ BOOST_FIXTURE_TEST_CASE( DRCCopperGraphicsTest, DRC_COPPER_GRAPHICS_TEST_FIXTURE { BOOST_CHECK_EQUAL( violations.size(), expected_err_cnt ); - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); diff --git a/qa/tests/pcbnew/drc/test_drc_copper_sliver.cpp b/qa/tests/pcbnew/drc/test_drc_copper_sliver.cpp index c4b7b1479d..bafaa7babb 100644 --- a/qa/tests/pcbnew/drc/test_drc_copper_sliver.cpp +++ b/qa/tests/pcbnew/drc/test_drc_copper_sliver.cpp @@ -85,7 +85,7 @@ BOOST_DATA_TEST_CASE_F( DRC_REGRESSION_TEST_FIXTURE, DRCCopperSliver, violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.size() == test.second ) { @@ -94,18 +94,18 @@ BOOST_DATA_TEST_CASE_F( DRC_REGRESSION_TEST_FIXTURE, DRCCopperSliver, } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); for( const DRC_ITEM& item : violations ) - { BOOST_TEST_MESSAGE( item.ShowReport( &unitsProvider, RPT_SEVERITY_ERROR, itemMap ) ); - } - BOOST_ERROR( - wxString::Format( "DRC copper sliver: %s, failed (violations found %d expected %d)", - test.first, (int) violations.size(), test.second ) ); + BOOST_ERROR( wxString::Format( "DRC copper sliver: %s, failed (violations found %d " + "expected %d)", + test.first, + (int) violations.size(), + test.second ) ); } } diff --git a/qa/tests/pcbnew/drc/test_drc_courtyard_invalid.cpp b/qa/tests/pcbnew/drc/test_drc_courtyard_invalid.cpp index 8e45913b86..72b3ca42dc 100644 --- a/qa/tests/pcbnew/drc/test_drc_courtyard_invalid.cpp +++ b/qa/tests/pcbnew/drc/test_drc_courtyard_invalid.cpp @@ -315,7 +315,7 @@ void DoCourtyardInvalidTest( const COURTYARD_INVALID_CASE& aCase, } } ); - drcEngine.RunTests( EDA_UNITS::MILLIMETRES, true, false ); + drcEngine.RunTests( EDA_UNITS::MM, true, false ); CheckInvalidsMatchExpected( *board, markers, aCase.m_exp_errors ); } diff --git a/qa/tests/pcbnew/drc/test_drc_courtyard_overlap.cpp b/qa/tests/pcbnew/drc/test_drc_courtyard_overlap.cpp index 924543d15b..66ed872813 100644 --- a/qa/tests/pcbnew/drc/test_drc_courtyard_overlap.cpp +++ b/qa/tests/pcbnew/drc/test_drc_courtyard_overlap.cpp @@ -471,7 +471,7 @@ static void DoCourtyardOverlapTest( const COURTYARD_OVERLAP_TEST_CASE& aCase, } } ); - drcEngine.RunTests( EDA_UNITS::MILLIMETRES, true, false ); + drcEngine.RunTests( EDA_UNITS::MM, true, false ); CheckCollisionsMatchExpected( *board, markers, aCase.m_collisions ); } diff --git a/qa/tests/pcbnew/drc/test_drc_incorrect_text_mirror.cpp b/qa/tests/pcbnew/drc/test_drc_incorrect_text_mirror.cpp index 05208e905b..e64cd8bb16 100644 --- a/qa/tests/pcbnew/drc/test_drc_incorrect_text_mirror.cpp +++ b/qa/tests/pcbnew/drc/test_drc_incorrect_text_mirror.cpp @@ -69,7 +69,7 @@ BOOST_FIXTURE_TEST_CASE( DRCIncorrectTextMirror, DRC_INCORRECT_TEXT_MIRROR_TEST_ violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.size() == test.second ) { @@ -78,14 +78,15 @@ BOOST_FIXTURE_TEST_CASE( DRCIncorrectTextMirror, DRC_INCORRECT_TEXT_MIRROR_TEST_ } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); for( const DRC_ITEM& item : violations ) { - BOOST_TEST_MESSAGE( item.ShowReport( &unitsProvider, RPT_SEVERITY_ERROR, itemMap ) ); + BOOST_TEST_MESSAGE( item.ShowReport( &unitsProvider, RPT_SEVERITY_ERROR, + itemMap ) ); } BOOST_ERROR( wxString::Format( "DRC incorrect text mirror test: %s, failed (violations found %d expected %d)", diff --git a/qa/tests/pcbnew/drc/test_drc_multi_netclasses.cpp b/qa/tests/pcbnew/drc/test_drc_multi_netclasses.cpp index 57dfc4995e..6d5c22a316 100644 --- a/qa/tests/pcbnew/drc/test_drc_multi_netclasses.cpp +++ b/qa/tests/pcbnew/drc/test_drc_multi_netclasses.cpp @@ -84,7 +84,7 @@ BOOST_FIXTURE_TEST_CASE( DRCMultiNetclasses, DRC_REGRESSION_TEST_FIXTURE ) violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.size() == test.second ) { @@ -93,7 +93,7 @@ BOOST_FIXTURE_TEST_CASE( DRCMultiNetclasses, DRC_REGRESSION_TEST_FIXTURE ) } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); diff --git a/qa/tests/pcbnew/drc/test_drc_regressions.cpp b/qa/tests/pcbnew/drc/test_drc_regressions.cpp index 8d46d56be8..3602d6962f 100644 --- a/qa/tests/pcbnew/drc/test_drc_regressions.cpp +++ b/qa/tests/pcbnew/drc/test_drc_regressions.cpp @@ -96,7 +96,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalsePositiveRegressions, DRC_REGRESSION_TEST_FIXTUR violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.empty() ) { @@ -105,7 +105,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalsePositiveRegressions, DRC_REGRESSION_TEST_FIXTUR } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); @@ -187,7 +187,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR } } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.size() == expectedErrors ) { @@ -196,15 +196,15 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); for( const DRC_ITEM& item : violations ) { - BOOST_TEST_MESSAGE( - item.ShowReport( &unitsProvider, RPT_SEVERITY_ERROR, itemMap ) ); + BOOST_TEST_MESSAGE( item.ShowReport( &unitsProvider, RPT_SEVERITY_ERROR, + itemMap ) ); } BOOST_CHECK_EQUAL( violations.size(), expectedErrors ); diff --git a/qa/tests/pcbnew/drc/test_drc_skew.cpp b/qa/tests/pcbnew/drc/test_drc_skew.cpp index 766f6a1d72..0da414f24b 100644 --- a/qa/tests/pcbnew/drc/test_drc_skew.cpp +++ b/qa/tests/pcbnew/drc/test_drc_skew.cpp @@ -85,7 +85,7 @@ BOOST_FIXTURE_TEST_CASE( DRCSkew, DRC_REGRESSION_TEST_FIXTURE ) violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.size() == test.second ) { @@ -94,7 +94,7 @@ BOOST_FIXTURE_TEST_CASE( DRCSkew, DRC_REGRESSION_TEST_FIXTURE ) } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); diff --git a/qa/tests/pcbnew/drc/test_drc_starved_thermal.cpp b/qa/tests/pcbnew/drc/test_drc_starved_thermal.cpp index 2dbf36eca8..5f88a97768 100644 --- a/qa/tests/pcbnew/drc/test_drc_starved_thermal.cpp +++ b/qa/tests/pcbnew/drc/test_drc_starved_thermal.cpp @@ -73,7 +73,7 @@ BOOST_FIXTURE_TEST_CASE( DRCStarvedThermal, DRC_REGRESSION_TEST_FIXTURE ) violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.size() == test.second ) { @@ -82,7 +82,7 @@ BOOST_FIXTURE_TEST_CASE( DRCStarvedThermal, DRC_REGRESSION_TEST_FIXTURE ) } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); diff --git a/qa/tests/pcbnew/drc/test_solder_mask_bridging.cpp b/qa/tests/pcbnew/drc/test_solder_mask_bridging.cpp index 2a4d43eb9a..40633abebb 100644 --- a/qa/tests/pcbnew/drc/test_solder_mask_bridging.cpp +++ b/qa/tests/pcbnew/drc/test_solder_mask_bridging.cpp @@ -67,7 +67,7 @@ BOOST_FIXTURE_TEST_CASE( DRCSolderMaskBridgingTest, DRC_SOLDER_MASK_BRIDGING_TES violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); const int expected_err_cnt = 5; @@ -80,7 +80,7 @@ BOOST_FIXTURE_TEST_CASE( DRCSolderMaskBridgingTest, DRC_SOLDER_MASK_BRIDGING_TES { BOOST_CHECK_EQUAL( violations.size(), expected_err_cnt ); - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); diff --git a/qa/tests/pcbnew/test_tracks_cleaner.cpp b/qa/tests/pcbnew/test_tracks_cleaner.cpp index cff426b02e..e122b9fa79 100644 --- a/qa/tests/pcbnew/test_tracks_cleaner.cpp +++ b/qa/tests/pcbnew/test_tracks_cleaner.cpp @@ -104,18 +104,18 @@ BOOST_DATA_TEST_CASE_F( TRACK_CLEANER_TEST_FIXTURE, FailedToCleanRegressionTests std::vector< std::shared_ptr > realRunItems; cleaner.CleanupBoard( true, &dryRunItems, entry.m_Shorts, - entry.m_RedundantVias, - entry.m_RedundantTracks, - entry.m_DanglingTracks, - entry.m_TracksInPads, - entry.m_DanglingVias ); + entry.m_RedundantVias, + entry.m_RedundantTracks, + entry.m_DanglingTracks, + entry.m_TracksInPads, + entry.m_DanglingVias ); cleaner.CleanupBoard( true, &realRunItems, entry.m_Shorts, - entry.m_RedundantVias, - entry.m_RedundantTracks, - entry.m_DanglingTracks, - entry.m_TracksInPads, - entry.m_DanglingVias ); + entry.m_RedundantVias, + entry.m_RedundantTracks, + entry.m_DanglingTracks, + entry.m_TracksInPads, + entry.m_DanglingVias ); if( dryRunItems.size() == entry.m_Expected && realRunItems.size() == entry.m_Expected ) { @@ -128,7 +128,7 @@ BOOST_DATA_TEST_CASE_F( TRACK_CLEANER_TEST_FIXTURE, FailedToCleanRegressionTests BOOST_CHECK_EQUAL( dryRunItems.size(), entry.m_Expected ); BOOST_CHECK_EQUAL( realRunItems.size(), entry.m_Expected ); - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); @@ -179,18 +179,18 @@ BOOST_DATA_TEST_CASE_F( TRACK_CLEANER_TEST_FIXTURE, TrackCleanerRegressionTests, std::vector< std::shared_ptr > realRunItems; cleaner.CleanupBoard( true, &dryRunItems, true, // short circuits - true, // redundant vias - true, // redundant tracks - true, // dangling tracks - true, // tracks in pads - true ); // dangling vias + true, // redundant vias + true, // redundant tracks + true, // dangling tracks + true, // tracks in pads + true ); // dangling vias cleaner.CleanupBoard( true, &realRunItems, true, // short circuits - true, // redundant vias - true, // redundant tracks - true, // dangling tracks - true, // tracks in pads - true ); // dangling vias + true, // redundant vias + true, // redundant tracks + true, // dangling tracks + true, // tracks in pads + true ); // dangling vias BOOST_CHECK_EQUAL( dryRunItems.size(), realRunItems.size() ); @@ -208,33 +208,28 @@ BOOST_DATA_TEST_CASE_F( TRACK_CLEANER_TEST_FIXTURE, TrackCleanerRegressionTests, bds.m_DRCEngine->SetViolationHandler( [&]( const std::shared_ptr& aItem, VECTOR2I aPos, int aLayer, - DRC_CUSTOM_MARKER_HANDLER* aCustomHandler ) + DRC_CUSTOM_MARKER_HANDLER* aCustomHandler ) { if( aItem->GetErrorCode() == DRCE_UNCONNECTED_ITEMS ) violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.empty() ) { - BOOST_TEST_MESSAGE( wxString::Format( "Track cleaner regression: %s, passed", - relPath ) ); + BOOST_TEST_MESSAGE( wxString::Format( "Track cleaner regression: %s, passed", relPath ) ); } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); for( const DRC_ITEM& item : violations ) - { - BOOST_TEST_MESSAGE( item.ShowReport( &unitsProvider, RPT_SEVERITY_ERROR, - itemMap ) ); - } + BOOST_TEST_MESSAGE( item.ShowReport( &unitsProvider, RPT_SEVERITY_ERROR, itemMap ) ); - BOOST_ERROR( wxString::Format( "Track cleaner regression: %s, failed", - relPath ) ); + BOOST_ERROR( wxString::Format( "Track cleaner regression: %s, failed", relPath ) ); } } diff --git a/qa/tests/pcbnew/test_zone_filler.cpp b/qa/tests/pcbnew/test_zone_filler.cpp index e4064c5e15..753f0a1081 100644 --- a/qa/tests/pcbnew/test_zone_filler.cpp +++ b/qa/tests/pcbnew/test_zone_filler.cpp @@ -131,7 +131,7 @@ BOOST_FIXTURE_TEST_CASE( BasicZoneFills, ZONE_FILL_TEST_FIXTURE ) } } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); BOOST_CHECK_EQUAL( foundPad2Error, true ); BOOST_CHECK_EQUAL( foundPad4Error, true ); @@ -199,13 +199,13 @@ BOOST_DATA_TEST_CASE_F( ZONE_FILL_TEST_FIXTURE, RegressionZoneFillTests, bds.m_DRCEngine->SetViolationHandler( [&]( const std::shared_ptr& aItem, VECTOR2I aPos, int aLayer, - DRC_CUSTOM_MARKER_HANDLER* aCustomHandler ) + DRC_CUSTOM_MARKER_HANDLER* aCustomHandler ) { if( aItem->GetErrorCode() == DRCE_CLEARANCE ) violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.empty() ) { @@ -214,16 +214,13 @@ BOOST_DATA_TEST_CASE_F( ZONE_FILL_TEST_FIXTURE, RegressionZoneFillTests, } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); for( const DRC_ITEM& item : violations ) - { - BOOST_TEST_MESSAGE( item.ShowReport( &unitsProvider, RPT_SEVERITY_ERROR, - itemMap ) ); - } + BOOST_TEST_MESSAGE( item.ShowReport( &unitsProvider, RPT_SEVERITY_ERROR, itemMap ) ); BOOST_ERROR( (const char*)(wxString::Format( "Zone fill regression: %s failed", relPath ).utf8_str()) ); } @@ -236,7 +233,8 @@ static const std::vector RegressionSliverZoneFillTests_tests = { BOOST_DATA_TEST_CASE_F( ZONE_FILL_TEST_FIXTURE, RegressionSliverZoneFillTests, - boost::unit_test::data::make( RegressionSliverZoneFillTests_tests ), relPath ) + boost::unit_test::data::make( RegressionSliverZoneFillTests_tests ), + relPath ) { KI_TEST::LoadBoard( m_settingsManager, relPath, m_board ); @@ -248,13 +246,13 @@ BOOST_DATA_TEST_CASE_F( ZONE_FILL_TEST_FIXTURE, RegressionSliverZoneFillTests, bds.m_DRCEngine->SetViolationHandler( [&]( const std::shared_ptr& aItem, VECTOR2I aPos, int aLayer, - DRC_CUSTOM_MARKER_HANDLER* aCustomHandler ) + DRC_CUSTOM_MARKER_HANDLER* aCustomHandler ) { if( aItem->GetErrorCode() == DRCE_COPPER_SLIVER ) violations.push_back( *aItem ); } ); - bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + bds.m_DRCEngine->RunTests( EDA_UNITS::MM, true, false ); if( violations.empty() ) { @@ -263,16 +261,13 @@ BOOST_DATA_TEST_CASE_F( ZONE_FILL_TEST_FIXTURE, RegressionSliverZoneFillTests, } else { - UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::INCHES ); + UNITS_PROVIDER unitsProvider( pcbIUScale, EDA_UNITS::IN ); std::map itemMap; m_board->FillItemMap( itemMap ); for( const DRC_ITEM& item : violations ) - { - BOOST_TEST_MESSAGE( item.ShowReport( &unitsProvider, RPT_SEVERITY_ERROR, - itemMap ) ); - } + BOOST_TEST_MESSAGE( item.ShowReport( &unitsProvider, RPT_SEVERITY_ERROR, itemMap ) ); BOOST_ERROR( (const char*)(wxString::Format( "Zone fill copper sliver regression: %s failed", relPath ).utf8_str()) ); } diff --git a/qa/tools/drc_proto/drc_proto.cpp b/qa/tools/drc_proto/drc_proto.cpp index 66dd8b7cb5..092b30b320 100644 --- a/qa/tools/drc_proto/drc_proto.cpp +++ b/qa/tools/drc_proto/drc_proto.cpp @@ -134,7 +134,7 @@ int runDRCProto( PROJECT_CONTEXT project, std::shared_ptr a try { - drcEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); + drcEngine->RunTests( EDA_UNITS::MM, true, false ); } catch( const Clipper2Lib::Clipper2Exception& e ) {