From 11ff16be4e249118f545e1643ffc2110b0d4aaf5 Mon Sep 17 00:00:00 2001 From: Mark Roszko Date: Fri, 20 Dec 2019 14:11:39 +0000 Subject: [PATCH] Switch to scoped enums --- .../3d_cache/dialogs/panel_prev_model.cpp | 24 +++--- 3d-viewer/3d_cache/dialogs/panel_prev_model.h | 2 +- bitmap2component/bitmap2cmp_gui.cpp | 38 ++++----- bitmap2component/bitmap2cmp_gui.h | 14 ++-- common/base_screen.cpp | 6 +- common/base_struct.cpp | 2 +- common/base_units.cpp | 80 +++++++++---------- common/dialog_shim.cpp | 19 +++-- common/eda_draw_frame.cpp | 18 +++-- common/eda_size_ctrl.cpp | 6 +- common/libeval/numeric_evaluator.cpp | 7 +- common/marker_base.cpp | 11 ++- common/page_layout/ws_draw_item.cpp | 18 ++--- common/plotters/DXF_plotter.cpp | 4 +- common/preview_items/arc_assistant.cpp | 15 ++-- common/preview_items/preview_utils.cpp | 15 ++-- common/preview_items/ruler_item.cpp | 26 +++--- common/tool/common_tools.cpp | 8 +- common/tool/grid_menu.cpp | 4 +- common/widgets/text_ctrl_eval.cpp | 20 +++-- common/widgets/unit_binder.cpp | 2 +- cvpcb/display_footprints_frame.cpp | 4 +- eeschema/connection_graph.cpp | 4 +- eeschema/dialog_erc_listbox.h | 2 +- eeschema/dialogs/dialog_annotate.cpp | 2 +- .../dialogs/dialog_lib_edit_pin_table.cpp | 16 ++-- .../panel_eeschema_display_options.cpp | 6 +- eeschema/dialogs/panel_eeschema_settings.cpp | 21 +++-- eeschema/dialogs/panel_libedit_settings.cpp | 35 +++++--- eeschema/drc_erc_item.cpp | 6 +- eeschema/eeschema_config.cpp | 4 +- eeschema/erc.cpp | 2 +- eeschema/erc.h | 2 +- eeschema/fields_grid_table.h | 6 +- eeschema/lib_arc.cpp | 4 +- eeschema/lib_arc.h | 4 +- eeschema/lib_bezier.cpp | 2 +- eeschema/lib_bezier.h | 2 +- eeschema/lib_circle.cpp | 4 +- eeschema/lib_circle.h | 4 +- eeschema/lib_field.cpp | 4 +- eeschema/lib_field.h | 4 +- eeschema/lib_item.cpp | 2 +- eeschema/lib_item.h | 2 +- eeschema/lib_pin.cpp | 15 ++-- eeschema/lib_pin.h | 10 +-- eeschema/lib_polyline.cpp | 4 +- eeschema/lib_polyline.h | 4 +- eeschema/lib_rectangle.cpp | 4 +- eeschema/lib_rectangle.h | 4 +- eeschema/lib_text.cpp | 4 +- eeschema/lib_text.h | 4 +- eeschema/libedit/menubar_libedit.cpp | 8 +- eeschema/libedit/toolbars_libedit.cpp | 4 +- eeschema/menubar.cpp | 8 +- eeschema/sch_base_frame.cpp | 10 +-- eeschema/sch_bitmap.cpp | 8 +- eeschema/sch_bitmap.h | 4 +- eeschema/sch_bus_entry.cpp | 6 +- eeschema/sch_bus_entry.h | 6 +- eeschema/sch_component.cpp | 6 +- eeschema/sch_component.h | 4 +- eeschema/sch_connection.cpp | 2 +- eeschema/sch_field.cpp | 5 +- eeschema/sch_field.h | 2 +- eeschema/sch_junction.h | 2 +- eeschema/sch_line.cpp | 4 +- eeschema/sch_line.h | 4 +- eeschema/sch_marker.cpp | 2 +- eeschema/sch_marker.h | 4 +- eeschema/sch_no_connect.h | 2 +- eeschema/sch_pin.cpp | 4 +- eeschema/sch_pin.h | 4 +- eeschema/sch_sheet.cpp | 6 +- eeschema/sch_sheet.h | 6 +- eeschema/sch_sheet_pin.cpp | 2 +- eeschema/sch_text.cpp | 10 +-- eeschema/sch_text.h | 10 +-- eeschema/toolbars_sch_editor.cpp | 4 +- gerbview/dialogs/panel_gerbview_settings.cpp | 5 +- gerbview/gerber_draw_item.cpp | 4 +- gerbview/gerber_draw_item.h | 4 +- gerbview/gerber_file_image.cpp | 2 +- gerbview/gerbview_draw_panel_gal.cpp | 4 +- gerbview/gerbview_draw_panel_gal.h | 2 +- gerbview/gerbview_frame.cpp | 30 ++++--- gerbview/menubar.cpp | 8 +- gerbview/toolbars_gerber.cpp | 8 +- include/base_screen.h | 2 +- include/base_struct.h | 4 +- include/base_units.h | 21 +++-- include/class_draw_panel_gal.h | 2 +- include/common.h | 5 +- include/dialog_helpers.h | 12 +-- include/dialog_shim.h | 9 ++- include/drc_item.h | 16 ++-- include/eda_base_frame.h | 15 +++- include/libeval/numeric_evaluator.h | 2 +- include/marker_base.h | 10 +-- include/plotter.h | 8 +- include/preview_items/arc_assistant.h | 5 +- include/preview_items/preview_utils.h | 3 +- include/preview_items/ruler_item.h | 11 ++- include/widgets/unit_binder.h | 4 +- include/ws_draw_item.h | 14 ++-- pagelayout_editor/pl_draw_panel_gal.cpp | 2 +- pagelayout_editor/pl_draw_panel_gal.h | 2 +- pagelayout_editor/pl_editor_frame.cpp | 22 +++-- pagelayout_editor/properties_frame.cpp | 42 +++++----- .../board_stackup_reporter.cpp | 2 +- .../board_stackup_reporter.h | 4 +- .../panel_board_stackup.h | 2 +- pcbnew/class_board.cpp | 62 +++++++------- pcbnew/class_board.h | 12 +-- pcbnew/class_dimension.cpp | 22 ++--- pcbnew/class_dimension.h | 10 +-- pcbnew/class_drawsegment.cpp | 4 +- pcbnew/class_drawsegment.h | 4 +- pcbnew/class_edge_mod.cpp | 5 +- pcbnew/class_edge_mod.h | 4 +- pcbnew/class_marker_pcb.cpp | 14 ++-- pcbnew/class_marker_pcb.h | 15 ++-- pcbnew/class_module.cpp | 4 +- pcbnew/class_module.h | 4 +- pcbnew/class_pad.cpp | 4 +- pcbnew/class_pad.h | 4 +- pcbnew/class_pcb_target.cpp | 2 +- pcbnew/class_pcb_target.h | 2 +- pcbnew/class_pcb_text.cpp | 4 +- pcbnew/class_pcb_text.h | 4 +- pcbnew/class_text_mod.cpp | 4 +- pcbnew/class_text_mod.h | 4 +- pcbnew/class_track.cpp | 16 ++-- pcbnew/class_track.h | 12 +-- pcbnew/class_zone.cpp | 23 +++--- pcbnew/class_zone.h | 19 ++--- .../convert_drawsegment_list_to_polygon.cpp | 8 +- pcbnew/dialogs/dialog_board_statistics.cpp | 2 +- pcbnew/dialogs/dialog_copper_zones.cpp | 34 +++++--- pcbnew/dialogs/dialog_create_array.cpp | 5 +- pcbnew/dialogs/dialog_drc.cpp | 2 +- pcbnew/dialogs/dialog_drclistbox.h | 6 +- pcbnew/dialogs/dialog_export_idf.cpp | 4 +- pcbnew/dialogs/dialog_export_step.cpp | 4 +- pcbnew/dialogs/dialog_export_vrml.cpp | 4 +- .../dialog_graphic_item_properties.cpp | 2 +- .../dialog_keepout_area_properties.cpp | 24 ++++-- pcbnew/dialogs/dialog_move_exact.cpp | 4 +- .../dialog_non_copper_zones_properties.cpp | 34 +++++--- .../dialog_pad_basicshapes_properties.cpp | 6 +- pcbnew/dialogs/dialog_pad_properties.cpp | 4 +- pcbnew/dialogs/dialog_plot.cpp | 4 +- .../dialog_pns_length_tuning_settings.cpp | 2 +- pcbnew/dialogs/dialog_position_relative.cpp | 2 +- pcbnew/dialogs/dialog_set_grid.cpp | 2 +- pcbnew/dialogs/dialog_text_properties.cpp | 41 +++++++--- pcbnew/dialogs/panel_modedit_settings.cpp | 5 +- pcbnew/dialogs/panel_pcbnew_settings.cpp | 5 +- pcbnew/dialogs/panel_setup_netclasses.cpp | 4 +- pcbnew/drc/drc_marker_factory.cpp | 4 +- pcbnew/drc/drc_marker_factory.h | 8 +- pcbnew/drc_item.cpp | 6 +- pcbnew/eagle_plugin.cpp | 8 +- pcbnew/exporters/export_vrml.cpp | 2 +- pcbnew/exporters/gen_drill_report_files.cpp | 4 +- pcbnew/exporters/gen_footprints_placefile.cpp | 2 +- pcbnew/footprint_edit_frame.cpp | 2 +- pcbnew/import_gfx/dialog_import_gfx.cpp | 9 ++- pcbnew/kicad_plugin.cpp | 20 +++-- pcbnew/legacy_plugin.cpp | 25 +++--- pcbnew/menubar_footprint_editor.cpp | 8 +- pcbnew/menubar_pcb_editor.cpp | 10 +-- pcbnew/netinfo.h | 2 +- pcbnew/netinfo_item.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp | 4 +- pcbnew/pcb_base_frame.cpp | 30 ++++--- pcbnew/pcb_draw_panel_gal.cpp | 2 +- pcbnew/pcb_draw_panel_gal.h | 2 +- pcbnew/pcb_edit_frame.cpp | 2 +- pcbnew/pcb_parser.cpp | 23 +++--- pcbnew/pcb_plot_params.cpp | 2 +- pcbnew/router/pns_dp_meander_placer.cpp | 2 +- pcbnew/router/pns_dp_meander_placer.h | 2 +- pcbnew/router/pns_kicad_iface.cpp | 6 +- pcbnew/router/pns_meander_placer.cpp | 2 +- pcbnew/router/pns_meander_placer.h | 2 +- pcbnew/router/pns_meander_placer_base.h | 2 +- pcbnew/router/pns_meander_skew_placer.cpp | 2 +- pcbnew/router/pns_meander_skew_placer.h | 2 +- pcbnew/router/router_tool.cpp | 6 +- pcbnew/text_mod_grid_table.cpp | 22 ++--- pcbnew/text_mod_grid_table.h | 14 ++-- pcbnew/toolbars_footprint_editor.cpp | 4 +- pcbnew/toolbars_pcb_editor.cpp | 20 ++--- pcbnew/tools/drawing_tool.cpp | 5 +- pcbnew/tools/drc.cpp | 3 +- pcbnew/tools/drc.h | 4 +- pcbnew/tools/edit_tool.cpp | 2 +- pcbnew/tracks_cleaner.cpp | 12 +-- pcbnew/tracks_cleaner.h | 4 +- pcbnew/zone_filler.cpp | 4 +- pcbnew/zone_filler.h | 2 +- pcbnew/zone_settings.cpp | 26 +++--- pcbnew/zone_settings.h | 17 +++- qa/common/libeval/test_numeric_evaluator.cpp | 2 +- qa/pcbnew_tools/tools/drc_tool/drc_tool.cpp | 2 +- 206 files changed, 951 insertions(+), 814 deletions(-) diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp index b1acf74ce9..0b169d5036 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp +++ b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp @@ -131,7 +131,7 @@ void PANEL_PREV_3D::loadCommonSettings() */ static double rotationFromString( const wxString& aValue ) { - double rotation = DoubleValueFromString( DEGREES, aValue ) / 10.0; + double rotation = DoubleValueFromString( EDA_UNITS::DEGREES, aValue ) / 10.0; if( rotation > MAX_ROTATION ) { @@ -156,14 +156,14 @@ wxString PANEL_PREV_3D::formatScaleValue( double aValue ) wxString PANEL_PREV_3D::formatRotationValue( double aValue ) { - return wxString::Format( "%.2f %s", aValue, GetAbbreviatedUnitsLabel( DEGREES ) ); + return wxString::Format( "%.2f %s", aValue, GetAbbreviatedUnitsLabel( EDA_UNITS::DEGREES ) ); } wxString PANEL_PREV_3D::formatOffsetValue( double aValue ) { // Convert from internal units (mm) to user units - if( m_userUnits == INCHES ) + if( m_userUnits == EDA_UNITS::INCHES ) aValue /= 25.4f; return wxString::Format( "%.4f %s", aValue, GetAbbreviatedUnitsLabel( m_userUnits ) ); @@ -218,9 +218,9 @@ void PANEL_PREV_3D::updateOrientation( wxCommandEvent &event ) // Write settings back to the parent MODULE_3D_SETTINGS* modelInfo = &m_parentModelList->at( (unsigned) m_selected ); - modelInfo->m_Scale.x = DoubleValueFromString( UNSCALED_UNITS, xscale->GetValue() ); - modelInfo->m_Scale.y = DoubleValueFromString( UNSCALED_UNITS, yscale->GetValue() ); - modelInfo->m_Scale.z = DoubleValueFromString( UNSCALED_UNITS, zscale->GetValue() ); + modelInfo->m_Scale.x = DoubleValueFromString( EDA_UNITS::UNSCALED, xscale->GetValue() ); + modelInfo->m_Scale.y = DoubleValueFromString( EDA_UNITS::UNSCALED, yscale->GetValue() ); + modelInfo->m_Scale.z = DoubleValueFromString( EDA_UNITS::UNSCALED, zscale->GetValue() ); modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() ); modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() ); @@ -247,7 +247,7 @@ void PANEL_PREV_3D::doIncrementScale( wxSpinEvent& event, double aSign ) else if( spinCtrl == m_spinZscale ) textCtrl = zscale; - double curr_value = DoubleValueFromString( UNSCALED_UNITS, textCtrl->GetValue() ); + double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() ); curr_value += ( SCALE_INCREMENT * aSign ); curr_value = std::max( 1/MAX_SCALE, curr_value ); @@ -267,7 +267,7 @@ void PANEL_PREV_3D::doIncrementRotation( wxSpinEvent& aEvent, double aSign ) else if( spinCtrl == m_spinZrot ) textCtrl = zrot; - double curr_value = DoubleValueFromString( DEGREES, textCtrl->GetValue() ) / 10.0; + double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0; curr_value += ( ROTATION_INCREMENT * aSign ); curr_value = std::max( -MAX_ROTATION, curr_value ); @@ -290,7 +290,7 @@ void PANEL_PREV_3D::doIncrementOffset( wxSpinEvent& event, double aSign ) double step = OFFSET_INCREMENT_MM; - if( m_userUnits == INCHES ) + if( m_userUnits == EDA_UNITS::INCHES ) step = OFFSET_INCREMENT_MIL/1000.0; double curr_value = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM; @@ -315,7 +315,7 @@ void PANEL_PREV_3D::onMouseWheelScale( wxMouseEvent& event ) if( event.GetWheelRotation() >= 0 ) step = -step; - double curr_value = DoubleValueFromString( UNSCALED_UNITS, textCtrl->GetValue() ); + double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() ); curr_value += step; curr_value = std::max( 1/MAX_SCALE, curr_value ); @@ -337,7 +337,7 @@ void PANEL_PREV_3D::onMouseWheelRot( wxMouseEvent& event ) if( event.GetWheelRotation() >= 0 ) step = -step; - double curr_value = DoubleValueFromString( DEGREES, textCtrl->GetValue() ) / 10.0; + double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0; curr_value += step; curr_value = std::max( -MAX_ROTATION, curr_value ); @@ -356,7 +356,7 @@ void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event ) if( event.ShiftDown( ) ) step = OFFSET_INCREMENT_MM_FINE; - if( m_userUnits == INCHES ) + if( m_userUnits == EDA_UNITS::INCHES ) { step = OFFSET_INCREMENT_MIL/1000.0; if( event.ShiftDown( ) ) diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_model.h b/3d-viewer/3d_cache/dialogs/panel_prev_model.h index 6787beaa6a..619e3de127 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_model.h +++ b/3d-viewer/3d_cache/dialogs/panel_prev_model.h @@ -87,7 +87,7 @@ private: std::vector* m_parentModelList; int m_selected; /// Index into m_parentInfoList - EDA_UNITS_T m_userUnits; + EDA_UNITS m_userUnits; // Methods of the class private: diff --git a/bitmap2component/bitmap2cmp_gui.cpp b/bitmap2component/bitmap2cmp_gui.cpp index 134905902e..1c2429c123 100644 --- a/bitmap2component/bitmap2cmp_gui.cpp +++ b/bitmap2component/bitmap2cmp_gui.cpp @@ -61,18 +61,18 @@ IMAGE_SIZE::IMAGE_SIZE() m_outputSize = 0.0; m_originalDPI = DEFAULT_DPI; m_originalSizePixels = 0; - m_unit = MILLIMETRES; + m_unit = EDA_UNITS::MILLIMETRES; } void IMAGE_SIZE::SetOutputSizeFromInitialImageSize() { // Set the m_outputSize value from the m_originalSizePixels and the selected unit - if( m_unit == MILLIMETRES ) + if( m_unit == EDA_UNITS::MILLIMETRES ) { m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI * 25.4; } - else if( m_unit == INCHES ) + else if( m_unit == EDA_UNITS::INCHES ) { m_outputSize = (double)GetOriginalSizePixels() / m_originalDPI; } @@ -88,11 +88,11 @@ int IMAGE_SIZE::GetOutputDPI() { int outputDPI; - if( m_unit == MILLIMETRES ) + if( m_unit == EDA_UNITS::MILLIMETRES ) { outputDPI = GetOriginalSizePixels() / ( m_outputSize / 25.4 ); } - else if( m_unit == INCHES ) + else if( m_unit == EDA_UNITS::INCHES ) { outputDPI = GetOriginalSizePixels() / m_outputSize; } @@ -105,7 +105,7 @@ int IMAGE_SIZE::GetOutputDPI() } -void IMAGE_SIZE::SetUnit( EDA_UNITS_T aUnit ) +void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit ) { // Set the unit used for m_outputSize, and convert the old m_outputSize value // to the value in new unit @@ -115,11 +115,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS_T aUnit ) // Convert m_outputSize to mm: double size_mm; - if( m_unit == MILLIMETRES ) + if( m_unit == EDA_UNITS::MILLIMETRES ) { size_mm = m_outputSize; } - else if( m_unit == INCHES ) + else if( m_unit == EDA_UNITS::INCHES ) { size_mm = m_outputSize * 25.4; } @@ -134,11 +134,11 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS_T aUnit ) } // Convert m_outputSize to new value: - if( aUnit == MILLIMETRES ) + if( aUnit == EDA_UNITS::MILLIMETRES ) { m_outputSize = size_mm; } - else if( aUnit == INCHES ) + else if( aUnit == EDA_UNITS::INCHES ) { m_outputSize = size_mm / 25.4; } @@ -471,11 +471,11 @@ wxString BM2CMP_FRAME::FormatOutputSize( double aSize ) { wxString text; - if( getUnitFromSelection() == MILLIMETRES ) + if( getUnitFromSelection() == EDA_UNITS::MILLIMETRES ) { text.Printf( "%.1f", aSize ); } - else if( getUnitFromSelection() == INCHES ) + else if( getUnitFromSelection() == EDA_UNITS::INCHES ) { text.Printf( "%.2f", aSize ); } @@ -506,23 +506,23 @@ void BM2CMP_FRAME::updateImageInfo() } -EDA_UNITS_T BM2CMP_FRAME::getUnitFromSelection() +EDA_UNITS BM2CMP_FRAME::getUnitFromSelection() { - // return the EDA_UNITS_T from the m_PixelUnit choice + // return the EDA_UNITS from the m_PixelUnit choice switch( m_PixelUnit->GetSelection() ) { case 1: - return INCHES; + return EDA_UNITS::INCHES; case 2: - return UNSCALED_UNITS; + return EDA_UNITS::UNSCALED; case 0: default: break; } - return MILLIMETRES; + return EDA_UNITS::MILLIMETRES; } @@ -536,7 +536,7 @@ void BM2CMP_FRAME::OnSizeChangeX( wxCommandEvent& event ) { double calculatedY = new_size / m_AspectRatio; - if( getUnitFromSelection() == UNSCALED_UNITS ) + if( getUnitFromSelection() == EDA_UNITS::UNSCALED ) { // for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked. // just rescale the other dpi @@ -565,7 +565,7 @@ void BM2CMP_FRAME::OnSizeChangeY( wxCommandEvent& event ) { double calculatedX = new_size * m_AspectRatio; - if( getUnitFromSelection() == UNSCALED_UNITS ) + if( getUnitFromSelection() == EDA_UNITS::UNSCALED ) { // for units in DPI, keeping aspect ratio cannot use m_AspectRatioLocked. // just rescale the other dpi diff --git a/bitmap2component/bitmap2cmp_gui.h b/bitmap2component/bitmap2cmp_gui.h index ec042b56e0..5225296998 100644 --- a/bitmap2component/bitmap2cmp_gui.h +++ b/bitmap2component/bitmap2cmp_gui.h @@ -26,8 +26,8 @@ #include "bitmap2component.h" #include "bitmap2cmp_gui_base.h" +#include // for EDA_UNITS #include -#include // for EDA_UNITS_T class IMAGE_SIZE @@ -37,7 +37,7 @@ public: // Set the unit used for m_outputSize, and convert the old m_outputSize value // to the value in new unit - void SetUnit( EDA_UNITS_T aUnit ); + void SetUnit( EDA_UNITS aUnit ); // Accessors: void SetOriginalDPI( int aDPI ) @@ -55,7 +55,7 @@ public: return m_outputSize; } - void SetOutputSize( double aSize, EDA_UNITS_T aUnit ) + void SetOutputSize( double aSize, EDA_UNITS aUnit ) { m_unit = aUnit; m_outputSize = aSize; @@ -75,8 +75,8 @@ public: int GetOutputDPI(); private: - EDA_UNITS_T m_unit; // The units for m_outputSize (mm, inch, dpi) - double m_outputSize; // The size in m_unit of the output image, depending on + EDA_UNITS m_unit; // The units for m_outputSize (mm, inch, dpi) + double m_outputSize; // The size in m_unit of the output image, depending on // the user settings. Set to the initial image size int m_originalDPI; // The image DPI if specified in file, or 0 if unknown int m_originalSizePixels; // The original image size read from file, in pixels @@ -101,8 +101,8 @@ private: void OnExportToFile( wxCommandEvent& event ) override; void OnExportToClipboard( wxCommandEvent& event ) override; - ///> @return the EDA_UNITS_T from the m_PixelUnit choice - EDA_UNITS_T getUnitFromSelection(); + ///> @return the EDA_UNITS from the m_PixelUnit choice + EDA_UNITS getUnitFromSelection(); // return a string giving the output size, according to the selected unit wxString FormatOutputSize( double aSize ); diff --git a/common/base_screen.cpp b/common/base_screen.cpp index 287c69bb8a..99087be3ae 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -112,8 +112,8 @@ int BASE_SCREEN::BuildGridsChoiceList( wxArrayString& aGridsList, bool aMmFirst) for( size_t i = 0; i < GetGridCount(); i++ ) { const GRID_TYPE& grid = m_grids[i]; - double gridValueMils = To_User_Unit( INCHES, grid.m_Size.x ) * 1000; - double gridValue_mm = To_User_Unit( MILLIMETRES, grid.m_Size.x ); + double gridValueMils = To_User_Unit( EDA_UNITS::INCHES, grid.m_Size.x ) * 1000; + double gridValue_mm = To_User_Unit( EDA_UNITS::MILLIMETRES, grid.m_Size.x ); if( grid.m_CmdId == ID_POPUP_GRID_USER ) { @@ -220,7 +220,7 @@ void BASE_SCREEN::AddGrid( const GRID_TYPE& aGrid ) } -void BASE_SCREEN::AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id ) +void BASE_SCREEN::AddGrid( const wxRealPoint& size, EDA_UNITS aUnit, int id ) { wxRealPoint new_size; GRID_TYPE new_grid; diff --git a/common/base_struct.cpp b/common/base_struct.cpp index a121781ab7..d088f8d367 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -144,7 +144,7 @@ SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData, const KICAD_ } -wxString EDA_ITEM::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString EDA_ITEM::GetSelectMenuText( EDA_UNITS aUnits ) const { wxFAIL_MSG( wxT( "GetSelectMenuText() was not overridden for schematic item type " ) + GetClass() ); diff --git a/common/base_units.cpp b/common/base_units.cpp index b09d5f8f56..56f9388fe0 100644 --- a/common/base_units.cpp +++ b/common/base_units.cpp @@ -90,20 +90,20 @@ std::string Double2Str( double aValue ) } -double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils ) +double To_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils ) { switch( aUnit ) { - case MILLIMETRES: + case EDA_UNITS::MILLIMETRES: return IU_TO_MM( aValue ); - case INCHES: + case EDA_UNITS::INCHES: if( aUseMils ) return IU_TO_MILS( aValue ); else return IU_TO_IN( aValue ); - case DEGREES: + case EDA_UNITS::DEGREES: return aValue / 10.0f; default: @@ -122,27 +122,27 @@ double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils ) */ // A lower-precision (for readability) version of StringFromValue() -wxString MessageTextFromValue( EDA_UNITS_T aUnits, int aValue, bool aUseMils ) +wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aUseMils ) { return MessageTextFromValue( aUnits, double( aValue ), aUseMils ); } // A lower-precision (for readability) version of StringFromValue() -wxString MessageTextFromValue( EDA_UNITS_T aUnits, long long int aValue, bool aUseMils ) +wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aUseMils ) { return MessageTextFromValue( aUnits, double( aValue ), aUseMils ); } // A lower-precision (for readability) version of StringFromValue() -wxString MessageTextFromValue( EDA_UNITS_T aUnits, double aValue, bool aUseMils ) +wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aUseMils ) { wxString text; const wxChar* format; double value = To_User_Unit( aUnits, aValue, aUseMils ); - if( aUnits == INCHES ) + if( aUnits == EDA_UNITS::INCHES ) { if( aUseMils ) { @@ -214,7 +214,7 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed ) * otherwise the actual value is rounded when read from dialog and converted * in internal units, and therefore modified. */ -wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils ) +wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils ) { double value_to_print = To_User_Unit( aUnits, aValue, aUseMils ); @@ -244,7 +244,7 @@ wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol } else { - if( aUnits == INCHES && aUseMils ) + if( aUnits == EDA_UNITS::INCHES && aUseMils ) len = sprintf( buf, "%.7g", value_to_print ); else len = sprintf( buf, "%.10g", value_to_print ); @@ -258,26 +258,26 @@ wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol { switch( aUnits ) { - case INCHES: + case EDA_UNITS::INCHES: if( aUseMils ) stringValue += wxT( " mils" ); else stringValue += wxT( " in" ); break; - case MILLIMETRES: + case EDA_UNITS::MILLIMETRES: stringValue += wxT( " mm" ); break; - case DEGREES: + case EDA_UNITS::DEGREES: stringValue += wxT( " deg" ); break; - case PERCENT: + case EDA_UNITS::PERCENT: stringValue += wxT( "%" ); break; - case UNSCALED_UNITS: + case EDA_UNITS::UNSCALED: break; } } @@ -286,32 +286,32 @@ wxString StringFromValue( EDA_UNITS_T aUnits, double aValue, bool aAddUnitSymbol } -double From_User_Unit( EDA_UNITS_T aUnits, double aValue, bool aUseMils ) +double From_User_Unit( EDA_UNITS aUnits, double aValue, bool aUseMils ) { switch( aUnits ) { - case MILLIMETRES: + case EDA_UNITS::MILLIMETRES: return MM_TO_IU( aValue ); - case INCHES: + case EDA_UNITS::INCHES: if( aUseMils ) return MILS_TO_IU( aValue ); else return IN_TO_IU( aValue ); - case DEGREES: + case EDA_UNITS::DEGREES: // Convert to "decidegrees" return aValue * 10; default: - case UNSCALED_UNITS: - case PERCENT: + case EDA_UNITS::UNSCALED: + case EDA_UNITS::PERCENT: return aValue; } } -double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils ) +double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils ) { double value; double dtmp = 0; @@ -348,30 +348,30 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bo // Check the optional unit designator (2 ch significant) wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() ); - if( aUnits == INCHES || aUnits == MILLIMETRES ) + if( aUnits == EDA_UNITS::INCHES || aUnits == EDA_UNITS::MILLIMETRES ) { if( unit == wxT( "in" ) || unit == wxT( "\"" ) ) { - aUnits = INCHES; + aUnits = EDA_UNITS::INCHES; aUseMils = false; } else if( unit == wxT( "mm" ) ) { - aUnits = MILLIMETRES; + aUnits = EDA_UNITS::MILLIMETRES; } else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou" { - aUnits = INCHES; + aUnits = EDA_UNITS::INCHES; aUseMils = true; } else if( unit == "oz" ) // 1 oz = 1.37 mils { - aUnits = INCHES; + aUnits = EDA_UNITS::INCHES; aUseMils = true; dtmp *= 1.37; } } - else if( aUnits == DEGREES ) + else if( aUnits == EDA_UNITS::DEGREES ) { if( unit == wxT( "ra" ) ) // Radians { @@ -385,7 +385,7 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bo } -void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS_T& aUnits, bool& aUseMils ) +void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits, bool& aUseMils ) { wxString buf( aTextValue.Strip( wxString::both ) ); unsigned brk_point = 0; @@ -405,26 +405,26 @@ void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS_T& aUnits, bool if( unit == wxT( "in" ) || unit == wxT( "\"" ) ) { - aUnits = INCHES; + aUnits = EDA_UNITS::INCHES; aUseMils = false; } else if( unit == wxT( "mm" ) ) { - aUnits = MILLIMETRES; + aUnits = EDA_UNITS::MILLIMETRES; } else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou" { - aUnits = INCHES; + aUnits = EDA_UNITS::INCHES; aUseMils = true; } else if( unit == wxT( "de" ) || unit == wxT( "ra" ) ) // "deg" or "rad" { - aUnits = DEGREES; + aUnits = EDA_UNITS::DEGREES; } } -long long int ValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils ) +long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils ) { double value = DoubleValueFromString( aUnits, aTextValue, aUseMils ); return KiROUND( value ); @@ -447,26 +447,26 @@ wxString AngleToStringDegrees( double aAngle ) } -wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit, bool aUseMils ) +wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, bool aUseMils ) { switch( aUnit ) { - case INCHES: + case EDA_UNITS::INCHES: if( aUseMils ) return _( "mils" ); else return _( "in" ); - case MILLIMETRES: + case EDA_UNITS::MILLIMETRES: return _( "mm" ); - case PERCENT: + case EDA_UNITS::PERCENT: return _( "%" ); - case UNSCALED_UNITS: + case EDA_UNITS::UNSCALED: return wxEmptyString; - case DEGREES: + case EDA_UNITS::DEGREES: return _( "deg" ); default: diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index 08f2aa901b..71b6078599 100644 --- a/common/dialog_shim.cpp +++ b/common/dialog_shim.cpp @@ -66,16 +66,15 @@ 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( MILLIMETRES ), - m_firstPaintEvent( true ), - m_initialFocusTarget( nullptr ), - m_qmodal_loop( nullptr ), - m_qmodal_showing( false ), - m_qmodal_parent_disabler( nullptr ) + 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_firstPaintEvent( true ), + m_initialFocusTarget( nullptr ), + m_qmodal_loop( nullptr ), + m_qmodal_showing( false ), + m_qmodal_parent_disabler( nullptr ) { KIWAY_HOLDER* kiwayHolder = nullptr; diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 12dd6f83df..19b2653d03 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -111,7 +111,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame // BLACK for Pcbnew, BLACK or WHITE for eeschema m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight(); m_zoomLevelCoeff = 1.0; - m_userUnits = MILLIMETRES; + m_userUnits = EDA_UNITS::MILLIMETRES; m_PolarCoords = false; m_findReplaceData = new wxFindReplaceData( wxFR_DOWN ); @@ -389,11 +389,11 @@ void EDA_DRAW_FRAME::DisplayGridMsg() switch( m_userUnits ) { - case INCHES: + case EDA_UNITS::INCHES: gridformatter = "grid %.3f"; break; - case MILLIMETRES: + case EDA_UNITS::MILLIMETRES: gridformatter = "grid %.4f"; break; @@ -416,8 +416,12 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg() switch( m_userUnits ) { - case INCHES: msg = _( "Inches" ); break; - case MILLIMETRES: msg = _( "mm" ); break; + case EDA_UNITS::INCHES: + msg = _( "Inches" ); + break; + case EDA_UNITS::MILLIMETRES: + msg = _( "mm" ); + break; default: msg = _( "Units" ); break; } @@ -461,12 +465,12 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg ) wxConfigBase* cmnCfg = Pgm().CommonSettings(); // Read units used in dialogs and toolbars - EDA_UNITS_T unitsTmp; + EDA_UNITS unitsTmp; if( aCfg->Read( baseCfgName + UserUnitsEntryKeyword, (int*) &unitsTmp ) ) SetUserUnits( unitsTmp ); else - SetUserUnits( MILLIMETRES ); + SetUserUnits( EDA_UNITS::MILLIMETRES ); // Read show/hide grid entry bool btmp; diff --git a/common/eda_size_ctrl.cpp b/common/eda_size_ctrl.cpp index 89abc49732..670dea294e 100644 --- a/common/eda_size_ctrl.cpp +++ b/common/eda_size_ctrl.cpp @@ -32,7 +32,7 @@ /* Class to display and edit a coordinated INCHES or MM */ /********************************************************/ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent, const wxString& title, const wxPoint& aPos, - EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer ) + EDA_UNITS user_unit, wxBoxSizer* BoxSizer ) { m_UserUnit = user_unit; @@ -88,8 +88,8 @@ void EDA_POSITION_CTRL::SetValue( int x_value, int y_value ) /* EDA_SIZE_CTRL */ /*******************/ EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, const wxSize& aSize, - EDA_UNITS_T aUnit, wxBoxSizer* aBoxSizer ) : - EDA_POSITION_CTRL( parent, title, wxPoint( aSize.x, aSize.y ), aUnit, aBoxSizer ) + EDA_UNITS aUnit, wxBoxSizer* aBoxSizer ) + : EDA_POSITION_CTRL( parent, title, wxPoint( aSize.x, aSize.y ), aUnit, aBoxSizer ) { } diff --git a/common/libeval/numeric_evaluator.cpp b/common/libeval/numeric_evaluator.cpp index a70bf915d1..bb58cb6095 100644 --- a/common/libeval/numeric_evaluator.cpp +++ b/common/libeval/numeric_evaluator.cpp @@ -43,7 +43,7 @@ namespace numEval } /* namespace numEval */ -NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS_T aUnits, bool aUseMils ) +NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS aUnits, bool aUseMils ) { struct lconv* lc = localeconv(); m_localeDecimalSeparator = *lc->decimal_point; @@ -55,13 +55,14 @@ NUMERIC_EVALUATOR::NUMERIC_EVALUATOR( EDA_UNITS_T aUnits, bool aUseMils ) switch( aUnits ) { - case INCHES: + case EDA_UNITS::INCHES: if( aUseMils ) m_defaultUnits = Unit::Mil; else m_defaultUnits = Unit::Inch; break; - case MILLIMETRES:m_defaultUnits = Unit::Metric; + case EDA_UNITS::MILLIMETRES: + m_defaultUnits = Unit::Metric; break; default:m_defaultUnits = Unit::Metric; break; diff --git a/common/marker_base.cpp b/common/marker_base.cpp index 1d1112417f..430e6d40bc 100644 --- a/common/marker_base.cpp +++ b/common/marker_base.cpp @@ -103,9 +103,9 @@ MARKER_BASE::MARKER_BASE( int aScalingFactor ) } -MARKER_BASE::MARKER_BASE( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos, - EDA_ITEM* aItem, const wxPoint& aPos, - EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor ) +MARKER_BASE::MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, + EDA_ITEM* aItem, const wxPoint& aPos, EDA_ITEM* bItem, const wxPoint& bPos, + int aScalingFactor ) { m_ScalingFactor = aScalingFactor; init(); @@ -140,9 +140,8 @@ MARKER_BASE::~MARKER_BASE() } -void MARKER_BASE::SetData( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos, - EDA_ITEM* aItem, const wxPoint& aPos, - EDA_ITEM* bItem, const wxPoint& bPos ) +void MARKER_BASE::SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, + EDA_ITEM* aItem, const wxPoint& aPos, EDA_ITEM* bItem, const wxPoint& bPos ) { m_Pos = aMarkerPos; m_drc.SetData( aUnits, aErrorCode, aItem, aPos, bItem, bPos ); diff --git a/common/page_layout/ws_draw_item.cpp b/common/page_layout/ws_draw_item.cpp index 4ab2ef2c51..a739e11c65 100644 --- a/common/page_layout/ws_draw_item.cpp +++ b/common/page_layout/ws_draw_item.cpp @@ -95,7 +95,7 @@ bool WS_DRAW_ITEM_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAc } -void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { wxString msg; WS_DATA_ITEM* dataItem = GetPeer(); @@ -137,10 +137,10 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aL aList.push_back( MSG_PANEL_ITEM( _( "First Page Option" ), msg, BROWN ) ); - msg = MessageTextFromValue( UNSCALED_UNITS, dataItem->m_RepeatCount ); + msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_RepeatCount ); aList.push_back( MSG_PANEL_ITEM( _( "Repeat Count" ), msg, BLUE ) ); - msg = MessageTextFromValue( UNSCALED_UNITS, dataItem->m_IncrementLabel ); + msg = MessageTextFromValue( EDA_UNITS::UNSCALED, dataItem->m_IncrementLabel ); aList.push_back( MSG_PANEL_ITEM( _( "Repeat Label Increment" ), msg, DARKGRAY ) ); msg.Printf( wxT( "(%s, %s)" ), @@ -179,7 +179,7 @@ bool WS_DRAW_ITEM_TEXT::HitTest( const EDA_RECT& aRect, bool aContains, int aAcc } -wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Text %s at (%s, %s)" ), GetShownText(), @@ -279,7 +279,7 @@ bool WS_DRAW_ITEM_POLYPOLYGONS::HitTest( const EDA_RECT& aRect, bool aContained, } -wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Imported shape at (%s, %s)" ), MessageTextFromValue( aUnits, GetPosition().x ), @@ -336,7 +336,7 @@ bool WS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const } -wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Rectangle from (%s, %s) to (%s, %s)" ), MessageTextFromValue( aUnits, GetStart().x ), @@ -367,7 +367,7 @@ bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const } -wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Line from (%s, %s) to (%s, %s)" ), MessageTextFromValue( aUnits, GetStart().x ), @@ -420,7 +420,7 @@ bool WS_DRAW_ITEM_BITMAP::HitTest( const EDA_RECT& aRect, bool aContains, int aA } -wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Image at (%s, %s)" ), MessageTextFromValue( aUnits, GetPosition().x ), @@ -428,7 +428,7 @@ wxString WS_DRAW_ITEM_BITMAP::GetSelectMenuText( EDA_UNITS_T aUnits ) const } -wxString WS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString WS_DRAW_ITEM_PAGE::GetSelectMenuText( EDA_UNITS aUnits ) const { wxString txt( "Page limits" ); return txt; diff --git a/common/plotters/DXF_plotter.cpp b/common/plotters/DXF_plotter.cpp index d9f721c466..76aa38e2d4 100644 --- a/common/plotters/DXF_plotter.cpp +++ b/common/plotters/DXF_plotter.cpp @@ -128,12 +128,12 @@ void DXF_PLOTTER::SetUnits( DXF_UNITS aUnit ) switch( aUnit ) { - case DXF_UNIT_MILLIMETERS: + case DXF_UNITS::MILLIMETERS: m_unitScalingFactor = 0.00254; m_measurementDirective = 1; break; - case DXF_UNIT_INCHES: + case DXF_UNITS::INCHES: default: m_unitScalingFactor = 0.0001; m_measurementDirective = 0; diff --git a/common/preview_items/arc_assistant.cpp b/common/preview_items/arc_assistant.cpp index 98016a6435..64e6e10d35 100644 --- a/common/preview_items/arc_assistant.cpp +++ b/common/preview_items/arc_assistant.cpp @@ -34,10 +34,8 @@ using namespace KIGFX::PREVIEW; -ARC_ASSISTANT::ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS_T aUnits ) : - EDA_ITEM( NOT_USED ), - m_constructMan( aManager ), - m_units( aUnits ) +ARC_ASSISTANT::ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS aUnits ) + : EDA_ITEM( NOT_USED ), m_constructMan( aManager ), m_units( aUnits ) { } @@ -131,7 +129,8 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const double degs = getNormDeciDegFromRad( initAngle ); cursorStrings.push_back( DimensionLabel( "r", m_constructMan.GetRadius(), m_units ) ); - cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), degs, DEGREES ) ); + cursorStrings.push_back( + DimensionLabel( wxString::FromUTF8( "θ" ), degs, EDA_UNITS::DEGREES ) ); } else { @@ -148,8 +147,10 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const // draw dimmed extender line to cursor preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetLastPoint(), true ); - cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "Δθ" ), subtendedDeg, DEGREES ) ); - cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), endAngleDeg, DEGREES ) ); + cursorStrings.push_back( + DimensionLabel( wxString::FromUTF8( "Δθ" ), subtendedDeg, EDA_UNITS::DEGREES ) ); + cursorStrings.push_back( + DimensionLabel( wxString::FromUTF8( "θ" ), endAngleDeg, EDA_UNITS::DEGREES ) ); } // place the text next to cursor, on opposite side from radius diff --git a/common/preview_items/preview_utils.cpp b/common/preview_items/preview_utils.cpp index 323a93eef5..798820bab6 100644 --- a/common/preview_items/preview_utils.cpp +++ b/common/preview_items/preview_utils.cpp @@ -29,7 +29,7 @@ double KIGFX::PREVIEW::PreviewOverlayDeemphAlpha( bool aDeemph ) } -static wxString formatPreviewDimension( double aVal, EDA_UNITS_T aUnits ) +static wxString formatPreviewDimension( double aVal, EDA_UNITS aUnits ) { int precision = 4; @@ -37,23 +37,23 @@ static wxString formatPreviewDimension( double aVal, EDA_UNITS_T aUnits ) // be accurate down to the nanometre switch( aUnits ) { - case MILLIMETRES: + case EDA_UNITS::MILLIMETRES: precision = 3; // 1um break; - case INCHES: + case EDA_UNITS::INCHES: precision = 4; // 0.1mil break; - case DEGREES: + case EDA_UNITS::DEGREES: precision = 1; // 0.1deg break; - case PERCENT: + case EDA_UNITS::PERCENT: precision = 1; // 0.1% break; - case UNSCALED_UNITS: + case EDA_UNITS::UNSCALED: break; } @@ -70,8 +70,7 @@ static wxString formatPreviewDimension( double aVal, EDA_UNITS_T aUnits ) } -wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, - double aVal, EDA_UNITS_T aUnits ) +wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal, EDA_UNITS aUnits ) { wxString str; diff --git a/common/preview_items/ruler_item.cpp b/common/preview_items/ruler_item.cpp index 638483a860..adcb22877a 100644 --- a/common/preview_items/ruler_item.cpp +++ b/common/preview_items/ruler_item.cpp @@ -39,8 +39,8 @@ static const double midTickLengthFactor = 1.5; static const double majorTickLengthFactor = 2.5; -static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor, - const VECTOR2D& aRulerVec, EDA_UNITS_T aUnits ) +static void drawCursorStrings( + KIGFX::VIEW* aView, const VECTOR2D& aCursor, const VECTOR2D& aRulerVec, EDA_UNITS aUnits ) { // draw the cursor labels std::vector cursorStrings; @@ -51,7 +51,8 @@ static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor, cursorStrings.push_back( DimensionLabel( "r", aRulerVec.EuclideanNorm(), aUnits ) ); double degs = RAD2DECIDEG( -aRulerVec.Angle() ); - cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), degs, DEGREES ) ); + cursorStrings.push_back( + DimensionLabel( wxString::FromUTF8( "θ" ), degs, EDA_UNITS::DEGREES ) ); auto temp = aRulerVec; DrawTextNextToCursor( aView, aCursor, -temp, cursorStrings ); @@ -70,7 +71,7 @@ struct TICK_FORMAT }; -static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA_UNITS_T aUnits ) +static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA_UNITS aUnits ) { // simple 1/2/5 scales per decade static std::vector tickFormats = @@ -84,7 +85,7 @@ static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA aTickSpace = 1; // convert to a round (mod-10) number of mils - if( aUnits == INCHES ) + if( aUnits == EDA_UNITS::INCHES ) { aTickSpace *= 2.54; } @@ -115,8 +116,8 @@ static TICK_FORMAT getTickFormatForScale( double aScale, double& aTickSpace, EDA * @param aLine line vector * @param aMinorTickLen length of minor ticks in IU */ -void drawTicksAlongLine( KIGFX::VIEW *aView, const VECTOR2D& aOrigin, - const VECTOR2D& aLine, double aMinorTickLen, EDA_UNITS_T aUnits ) +void drawTicksAlongLine( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECTOR2D& aLine, + double aMinorTickLen, EDA_UNITS aUnits ) { VECTOR2D tickLine = aLine.Rotate( -M_PI_2 ); auto gal = aView->GetGAL(); @@ -198,11 +199,12 @@ void drawBacksideTicks( KIGFX::GAL& aGal, const VECTOR2D& aOrigin, } -RULER_ITEM::RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, EDA_UNITS_T userUnits ): - EDA_ITEM( NOT_USED ), // Never added to anything - just a preview - m_geomMgr( aGeomMgr ), - m_userUnits( userUnits ) -{} +RULER_ITEM::RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, EDA_UNITS userUnits ) + : EDA_ITEM( NOT_USED ), // Never added to anything - just a preview + m_geomMgr( aGeomMgr ), + m_userUnits( userUnits ) +{ +} const BOX2I RULER_ITEM::ViewBBox() const diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index 3096408445..f379be24f7 100644 --- a/common/tool/common_tools.cpp +++ b/common/tool/common_tools.cpp @@ -447,21 +447,23 @@ int COMMON_TOOLS::GridProperties( const TOOL_EVENT& aEvent ) int COMMON_TOOLS::MetricUnits( const TOOL_EVENT& aEvent ) { - m_frame->ChangeUserUnits( MILLIMETRES ); + m_frame->ChangeUserUnits( EDA_UNITS::MILLIMETRES ); return 0; } int COMMON_TOOLS::ImperialUnits( const TOOL_EVENT& aEvent ) { - m_frame->ChangeUserUnits( INCHES ); + m_frame->ChangeUserUnits( EDA_UNITS::INCHES ); return 0; } int COMMON_TOOLS::ToggleUnits( const TOOL_EVENT& aEvent ) { - m_frame->ChangeUserUnits( m_frame->GetUserUnits() == INCHES ? MILLIMETRES : INCHES ); + m_frame->ChangeUserUnits( m_frame->GetUserUnits() == EDA_UNITS::INCHES ? + EDA_UNITS::MILLIMETRES : + EDA_UNITS::INCHES ); return 0; } diff --git a/common/tool/grid_menu.cpp b/common/tool/grid_menu.cpp index daabb0f5bc..047dcdebf7 100644 --- a/common/tool/grid_menu.cpp +++ b/common/tool/grid_menu.cpp @@ -43,7 +43,7 @@ GRID_MENU::GRID_MENU( EDA_DRAW_FRAME* aParent ) : SetIcon( grid_select_xpm ); wxArrayString gridsList; - screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != INCHES ); + screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != EDA_UNITS::INCHES ); for( unsigned int i = 0; i < gridsList.GetCount(); ++i ) { @@ -69,7 +69,7 @@ void GRID_MENU::update() int currentId = screen->GetGridCmdId(); wxArrayString gridsList; - screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != INCHES ); + screen->BuildGridsChoiceList( gridsList, m_parent->GetUserUnits() != EDA_UNITS::INCHES ); for( unsigned int i = 0; i < GetMenuItemCount(); ++i ) { diff --git a/common/widgets/text_ctrl_eval.cpp b/common/widgets/text_ctrl_eval.cpp index df22b5203d..cf19917dda 100644 --- a/common/widgets/text_ctrl_eval.cpp +++ b/common/widgets/text_ctrl_eval.cpp @@ -24,18 +24,16 @@ #include -TEXT_CTRL_EVAL::TEXT_CTRL_EVAL( wxWindow* aParent, wxWindowID aId, const - wxString& aValue, const wxPoint& aPos, const wxSize& aSize, long aStyle, - const wxValidator& aValidator, const wxString& aName ) - : wxTextCtrl( aParent, aId, aValue, aPos, aSize, aStyle | wxTE_PROCESS_ENTER, aValidator, aName ), - m_eval( UNSCALED_UNITS ) +TEXT_CTRL_EVAL::TEXT_CTRL_EVAL( wxWindow* aParent, wxWindowID aId, const wxString& aValue, + const wxPoint& aPos, const wxSize& aSize, long aStyle, const wxValidator& aValidator, + const wxString& aName ) + : wxTextCtrl( aParent, aId, aValue, aPos, aSize, aStyle | wxTE_PROCESS_ENTER, aValidator, + aName ), + m_eval( EDA_UNITS::UNSCALED ) { - Connect( wxEVT_SET_FOCUS, - wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusGet ), NULL, this ); - Connect( wxEVT_KILL_FOCUS, - wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusLost ), NULL, this ); - Connect( wxEVT_TEXT_ENTER, - wxCommandEventHandler( TEXT_CTRL_EVAL::onTextEnter ), NULL, this ); + Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusGet ), NULL, this ); + Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( TEXT_CTRL_EVAL::onTextFocusLost ), NULL, this ); + Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( TEXT_CTRL_EVAL::onTextEnter ), NULL, this ); } diff --git a/common/widgets/unit_binder.cpp b/common/widgets/unit_binder.cpp index d6a8b0e72d..355f40bfde 100644 --- a/common/widgets/unit_binder.cpp +++ b/common/widgets/unit_binder.cpp @@ -65,7 +65,7 @@ UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent, } -void UNIT_BINDER::SetUnits( EDA_UNITS_T aUnits, bool aUseMils ) +void UNIT_BINDER::SetUnits( EDA_UNITS aUnits, bool aUseMils ) { m_units = aUnits; m_useMils = aUseMils; diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp index 3ec3f71971..538a604e35 100644 --- a/cvpcb/display_footprints_frame.cpp +++ b/cvpcb/display_footprints_frame.cpp @@ -435,8 +435,8 @@ void DISPLAY_FOOTPRINTS_FRAME::SyncToolbars() m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); m_optionsToolBar->Toggle( ACTIONS::selectionTool, IsCurrentTool( ACTIONS::selectionTool ) ); m_optionsToolBar->Toggle( ACTIONS::measureTool, IsCurrentTool( ACTIONS::measureTool ) ); - m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); - m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); + m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES ); + m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES ); m_optionsToolBar->Refresh(); } diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 5a31b06994..c1684fc2fc 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -821,7 +821,7 @@ void CONNECTION_GRAPH::buildConnectionGraph() } default: wxLogTrace( "CONN", "Driver type unsupported: %s", - driver->GetSelectMenuText( MILLIMETRES ) ); + driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ); break; } @@ -893,7 +893,7 @@ void CONNECTION_GRAPH::buildConnectionGraph() } default: wxLogTrace( "CONN", "Unexpected strong driver %s", - driver->GetSelectMenuText( MILLIMETRES ) ); + driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ); break; } } diff --git a/eeschema/dialog_erc_listbox.h b/eeschema/dialog_erc_listbox.h index 4e10704aa8..2dfc61fe0b 100644 --- a/eeschema/dialog_erc_listbox.h +++ b/eeschema/dialog_erc_listbox.h @@ -68,7 +68,7 @@ public: * Function DisplayList(); * Build the Html marker list and show it */ - void DisplayList( EDA_UNITS_T aUnits ) + void DisplayList( EDA_UNITS aUnits ) { wxString htmlpage; wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ); diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index a3f8f5140f..b4f0576ddd 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -311,7 +311,7 @@ int DIALOG_ANNOTATE::GetAnnotateAlgo() int DIALOG_ANNOTATE::GetStartNumber() { - return ValueFromString( EDA_UNITS_T::UNSCALED_UNITS, m_textNumberAfter->GetValue() ); + return ValueFromString( EDA_UNITS::UNSCALED, m_textNumberAfter->GetValue() ); } diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp index f1d55fc540..ed8b004719 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp @@ -58,13 +58,13 @@ private: // contains only a single pin. std::vector m_rows; - EDA_UNITS_T m_userUnits; - bool m_edited; + EDA_UNITS m_userUnits; + bool m_edited; public: - PIN_TABLE_DATA_MODEL( EDA_UNITS_T aUserUnits ) : - m_userUnits( aUserUnits ), m_edited( false ) - {} + PIN_TABLE_DATA_MODEL( EDA_UNITS aUserUnits ) : m_userUnits( aUserUnits ), m_edited( false ) + { + } int GetNumberRows() override { return (int) m_rows.size(); } int GetNumberCols() override { return COL_COUNT; } @@ -97,7 +97,7 @@ public: return GetValue( m_rows[ aRow ], aCol, m_userUnits ); } - static wxString GetValue( const LIB_PINS& pins, int aCol, EDA_UNITS_T aUserUnits ) + static wxString GetValue( const LIB_PINS& pins, int aCol, EDA_UNITS aUserUnits ) { wxString fieldValue; @@ -232,8 +232,8 @@ public: return -1; } - static bool compare( const LIB_PINS& lhs, const LIB_PINS& rhs, - int sortCol, bool ascending, EDA_UNITS_T units ) + static bool compare( + const LIB_PINS& lhs, const LIB_PINS& rhs, int sortCol, bool ascending, EDA_UNITS units ) { wxString lhStr = GetValue( lhs, sortCol, units ); wxString rhStr = GetValue( rhs, sortCol, units ); diff --git a/eeschema/dialogs/panel_eeschema_display_options.cpp b/eeschema/dialogs/panel_eeschema_display_options.cpp index d38b61c7af..3aa8c32f80 100644 --- a/eeschema/dialogs/panel_eeschema_display_options.cpp +++ b/eeschema/dialogs/panel_eeschema_display_options.cpp @@ -67,9 +67,9 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow() m_choiceSeparatorRefId->SetSelection( refStyleSelection ); - m_busWidth.SetUnits( INCHES, true ); - m_wireWidth.SetUnits( INCHES, true ); - m_junctionSize.SetUnits( INCHES, true ); + m_busWidth.SetUnits( EDA_UNITS::INCHES, true ); + m_wireWidth.SetUnits( EDA_UNITS::INCHES, true ); + m_junctionSize.SetUnits( EDA_UNITS::INCHES, true ); m_busWidth.SetValue( GetDefaultBusThickness() ); m_wireWidth.SetValue( GetDefaultWireThickness() ); diff --git a/eeschema/dialogs/panel_eeschema_settings.cpp b/eeschema/dialogs/panel_eeschema_settings.cpp index efd597415b..4266aa4bab 100644 --- a/eeschema/dialogs/panel_eeschema_settings.cpp +++ b/eeschema/dialogs/panel_eeschema_settings.cpp @@ -37,11 +37,14 @@ PANEL_EESCHEMA_SETTINGS::PANEL_EESCHEMA_SETTINGS( SCH_EDIT_FRAME* aFrame, wxWind bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow() { - m_choiceUnits->SetSelection( m_frame->GetUserUnits() == INCHES ? 0 : 1 ); + m_choiceUnits->SetSelection( m_frame->GetUserUnits() == EDA_UNITS::INCHES ? 0 : 1 ); - m_textSizeCtrl->SetValue( StringFromValue( INCHES, GetDefaultTextSize(), false, true ) ); - m_hPitchCtrl->SetValue( StringFromValue( INCHES, m_frame->GetRepeatStep().x, false, true ) ); - m_vPitchCtrl->SetValue( StringFromValue( INCHES, m_frame->GetRepeatStep().y, false, true ) ); + m_textSizeCtrl->SetValue( + StringFromValue( EDA_UNITS::INCHES, GetDefaultTextSize(), false, true ) ); + m_hPitchCtrl->SetValue( + StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().x, false, true ) ); + m_vPitchCtrl->SetValue( + StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().y, false, true ) ); m_spinRepeatLabel->SetValue( m_frame->GetRepeatDeltaLabel() ); m_checkHVOrientation->SetValue( m_frame->GetForceHVLines() ); @@ -61,9 +64,10 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow() bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow() { - m_frame->SetUserUnits( m_choiceUnits->GetSelection() == 0 ? INCHES : MILLIMETRES ); + m_frame->SetUserUnits( + m_choiceUnits->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES ); - int textSize = ValueFromString( INCHES, m_textSizeCtrl->GetValue(), true ); + int textSize = ValueFromString( EDA_UNITS::INCHES, m_textSizeCtrl->GetValue(), true ); if( textSize != GetDefaultTextSize() ) { @@ -71,8 +75,9 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow() m_frame->SaveProjectSettings( false ); } - m_frame->SetRepeatStep( wxPoint( ValueFromString( INCHES, m_hPitchCtrl->GetValue(), true ), - ValueFromString( INCHES, m_vPitchCtrl->GetValue(), true ) ) ); + m_frame->SetRepeatStep( + wxPoint( ValueFromString( EDA_UNITS::INCHES, m_hPitchCtrl->GetValue(), true ), + ValueFromString( EDA_UNITS::INCHES, m_vPitchCtrl->GetValue(), true ) ) ); m_frame->SetRepeatDeltaLabel( m_spinRepeatLabel->GetValue() ); m_frame->SetForceHVLines( m_checkHVOrientation->GetValue() ); diff --git a/eeschema/dialogs/panel_libedit_settings.cpp b/eeschema/dialogs/panel_libedit_settings.cpp index a6d989abfa..901638fa56 100644 --- a/eeschema/dialogs/panel_libedit_settings.cpp +++ b/eeschema/dialogs/panel_libedit_settings.cpp @@ -39,12 +39,18 @@ PANEL_LIBEDIT_SETTINGS::PANEL_LIBEDIT_SETTINGS( LIB_EDIT_FRAME* aFrame, wxWindow bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow() { - m_lineWidthCtrl->SetValue( StringFromValue( INCHES, GetDefaultLineThickness(), false, true ) ); - m_pinLengthCtrl->SetValue( StringFromValue( INCHES, m_frame->GetDefaultPinLength(), false, true ) ); - m_pinNumSizeCtrl->SetValue( StringFromValue( INCHES, m_frame->GetPinNumDefaultSize(), false, true ) ); - m_pinNameSizeCtrl->SetValue( StringFromValue( INCHES, m_frame->GetPinNameDefaultSize(), false, true ) ); - m_hPitchCtrl->SetValue( StringFromValue( INCHES, m_frame->GetRepeatStep().x, false, true ) ); - m_vPitchCtrl->SetValue( StringFromValue( INCHES, m_frame->GetRepeatStep().y, false, true ) ); + m_lineWidthCtrl->SetValue( + StringFromValue( EDA_UNITS::INCHES, GetDefaultLineThickness(), false, true ) ); + m_pinLengthCtrl->SetValue( + StringFromValue( EDA_UNITS::INCHES, m_frame->GetDefaultPinLength(), false, true ) ); + m_pinNumSizeCtrl->SetValue( + StringFromValue( EDA_UNITS::INCHES, m_frame->GetPinNumDefaultSize(), false, true ) ); + m_pinNameSizeCtrl->SetValue( + StringFromValue( EDA_UNITS::INCHES, m_frame->GetPinNameDefaultSize(), false, true ) ); + m_hPitchCtrl->SetValue( + StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().x, false, true ) ); + m_vPitchCtrl->SetValue( + StringFromValue( EDA_UNITS::INCHES, m_frame->GetRepeatStep().y, false, true ) ); m_choicePinDisplacement->SetSelection( m_frame->GetRepeatPinStep() == 50 ? 1 : 0 ); m_spinRepeatLabel->SetValue( m_frame->GetRepeatDeltaLabel() ); @@ -56,12 +62,17 @@ bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow() bool PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow() { - SetDefaultLineThickness( ValueFromString( INCHES, m_lineWidthCtrl->GetValue(), true ) ); - m_frame->SetDefaultPinLength( ValueFromString( INCHES, m_pinLengthCtrl->GetValue(), true ) ); - m_frame->SetPinNumDefaultSize( ValueFromString( INCHES, m_pinNumSizeCtrl->GetValue(), true ) ); - m_frame->SetPinNameDefaultSize( ValueFromString( INCHES, m_pinNameSizeCtrl->GetValue(), true ) ); - m_frame->SetRepeatStep( wxPoint( ValueFromString( INCHES, m_hPitchCtrl->GetValue(), true ), - ValueFromString( INCHES, m_vPitchCtrl->GetValue(), true ) ) ); + SetDefaultLineThickness( + ValueFromString( EDA_UNITS::INCHES, m_lineWidthCtrl->GetValue(), true ) ); + m_frame->SetDefaultPinLength( + ValueFromString( EDA_UNITS::INCHES, m_pinLengthCtrl->GetValue(), true ) ); + m_frame->SetPinNumDefaultSize( + ValueFromString( EDA_UNITS::INCHES, m_pinNumSizeCtrl->GetValue(), true ) ); + m_frame->SetPinNameDefaultSize( + ValueFromString( EDA_UNITS::INCHES, m_pinNameSizeCtrl->GetValue(), true ) ); + m_frame->SetRepeatStep( + wxPoint( ValueFromString( EDA_UNITS::INCHES, m_hPitchCtrl->GetValue(), true ), + ValueFromString( EDA_UNITS::INCHES, m_vPitchCtrl->GetValue(), true ) ) ); m_frame->SetRepeatPinStep( m_choicePinDisplacement->GetSelection() == 1 ? 50 : 100 ); m_frame->SetRepeatDeltaLabel( m_spinRepeatLabel->GetValue() ); diff --git a/eeschema/drc_erc_item.cpp b/eeschema/drc_erc_item.cpp index ea7698926d..65f5763a17 100644 --- a/eeschema/drc_erc_item.cpp +++ b/eeschema/drc_erc_item.cpp @@ -84,7 +84,7 @@ wxString DRC_ITEM::GetErrorText() const } } -wxString DRC_ITEM::ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos ) +wxString DRC_ITEM::ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos ) { return wxString::Format( "@(%s, %s)", MessageTextFromValue( aUnits, aPos.x ), @@ -92,7 +92,7 @@ wxString DRC_ITEM::ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos ) } -wxString DRC_ITEM::ShowHtml( EDA_UNITS_T aUnits ) const +wxString DRC_ITEM::ShowHtml( EDA_UNITS aUnits ) const { wxString mainText = m_MainText; // a wxHtmlWindows does not like < and > in the text to display @@ -138,7 +138,7 @@ wxString DRC_ITEM::ShowHtml( EDA_UNITS_T aUnits ) const } -wxString DRC_ITEM::ShowReport( EDA_UNITS_T aUnits ) const +wxString DRC_ITEM::ShowReport( EDA_UNITS aUnits ) const { if( m_hasSecondItem ) { diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 9255396803..863ac31533 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -349,8 +349,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings() m_configSettings.push_back( new PARAM_CFG_BOOL( true, ShowPageLimitsEntry, &m_showPageLimits, true ) ); - m_configSettings.push_back( new PARAM_CFG_INT( true, UnitsEntry, - (int*)&m_userUnits, MILLIMETRES ) ); + m_configSettings.push_back( new PARAM_CFG_INT( + true, UnitsEntry, (int*) &m_userUnits, (int) EDA_UNITS::MILLIMETRES ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, PrintMonochromeEntry, &m_printMonochrome, true ) ); diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index e7b01998ad..438119e705 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -566,7 +566,7 @@ int NETLIST_OBJECT_LIST::CountPinsInNet( unsigned aNetStart ) return count; } -bool WriteDiagnosticERC( EDA_UNITS_T aUnits, const wxString& aFullFileName ) +bool WriteDiagnosticERC( EDA_UNITS aUnits, const wxString& aFullFileName ) { wxFFile file( aFullFileName, wxT( "wt" ) ); diff --git a/eeschema/erc.h b/eeschema/erc.h index d7e96acdf2..0e09a9ef50 100644 --- a/eeschema/erc.h +++ b/eeschema/erc.h @@ -88,7 +88,7 @@ enum ERCE_T * * @param aFullFileName A wxString object containing the file name and path. */ -bool WriteDiagnosticERC( EDA_UNITS_T aUnits, const wxString& aFullFileName ); +bool WriteDiagnosticERC( EDA_UNITS aUnits, const wxString& aFullFileName ); /** * Performs ERC testing and creates an ERC marker to show the ERC problem for aNetItemRef diff --git a/eeschema/fields_grid_table.h b/eeschema/fields_grid_table.h index 7cacbc31d2..2b71d6a037 100644 --- a/eeschema/fields_grid_table.h +++ b/eeschema/fields_grid_table.h @@ -99,9 +99,9 @@ public: bool BoolFromString( wxString aValue ); private: - SCH_BASE_FRAME* m_frame; - EDA_UNITS_T m_userUnits; - LIB_PART* m_part; + SCH_BASE_FRAME* m_frame; + EDA_UNITS m_userUnits; + LIB_PART* m_part; SCH_FIELD_VALIDATOR m_fieldNameValidator; SCH_FIELD_VALIDATOR m_referenceValidator; diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 896f2031f7..2dfc9cd932 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -388,7 +388,7 @@ const EDA_RECT LIB_ARC::GetBoundingBox() const } -void LIB_ARC::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void LIB_ARC::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; EDA_RECT bBox = GetBoundingBox(); @@ -406,7 +406,7 @@ void LIB_ARC::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > } -wxString LIB_ARC::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString LIB_ARC::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Arc center (%s, %s), radius %s" ), MessageTextFromValue( aUnits, m_Pos.x ), diff --git a/eeschema/lib_arc.h b/eeschema/lib_arc.h index 7ff71ffabb..10ce460536 100644 --- a/eeschema/lib_arc.h +++ b/eeschema/lib_arc.h @@ -75,7 +75,7 @@ public: const EDA_RECT GetBoundingBox() const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; int GetPenSize() const override; @@ -122,7 +122,7 @@ public: void CalcRadiusAngles(); - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index 93d1c2532e..01424c0374 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -332,7 +332,7 @@ const EDA_RECT LIB_BEZIER::GetBoundingBox() const } -void LIB_BEZIER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void LIB_BEZIER::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; EDA_RECT bBox = GetBoundingBox(); diff --git a/eeschema/lib_bezier.h b/eeschema/lib_bezier.h index 121b360bbe..3de4fe092a 100644 --- a/eeschema/lib_bezier.h +++ b/eeschema/lib_bezier.h @@ -94,7 +94,7 @@ public: int GetPenSize( ) const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; EDA_ITEM* Clone() const override; diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index f40abc8223..c84ada5460 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -228,7 +228,7 @@ const EDA_RECT LIB_CIRCLE::GetBoundingBox() const } -void LIB_CIRCLE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void LIB_CIRCLE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { wxString msg; EDA_RECT bBox = GetBoundingBox(); @@ -252,7 +252,7 @@ void LIB_CIRCLE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) } -wxString LIB_CIRCLE::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString LIB_CIRCLE::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Circle center (%s, %s), radius %s" ), MessageTextFromValue( aUnits, m_Pos.x ), diff --git a/eeschema/lib_circle.h b/eeschema/lib_circle.h index cfe57e61e9..aeb25ca53c 100644 --- a/eeschema/lib_circle.h +++ b/eeschema/lib_circle.h @@ -61,7 +61,7 @@ public: const EDA_RECT GetBoundingBox() const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; void BeginEdit( const wxPoint aStartPoint ) override; void CalcEdit( const wxPoint& aPosition ) override; @@ -90,7 +90,7 @@ public: void SetRadius( int aRadius ) { m_EndPos = wxPoint( m_Pos.x + aRadius, m_Pos.y ); } int GetRadius() const { return KiROUND( GetLineLength( m_EndPos, m_Pos ) ); } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 2e983186e2..1fd275d37c 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -408,7 +408,7 @@ void LIB_FIELD::SetName( const wxString& aName ) } -wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Field %s \"%s\"" ), GetName(), ShortenedShownText() ); } @@ -426,7 +426,7 @@ void LIB_FIELD::CalcEdit( const wxPoint& aPosition ) } -void LIB_FIELD::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void LIB_FIELD::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { wxString msg; diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index 52d48aea4d..e6a7492ccf 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -148,7 +148,7 @@ public: const EDA_RECT GetBoundingBox() const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; @@ -188,7 +188,7 @@ public: int GetWidth() const override { return GetThickness(); } void SetWidth( int aWidth ) override { SetThickness( aWidth ); } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/eeschema/lib_item.cpp b/eeschema/lib_item.cpp index 33ffbe9f6e..ee0297c4c3 100644 --- a/eeschema/lib_item.cpp +++ b/eeschema/lib_item.cpp @@ -49,7 +49,7 @@ LIB_ITEM::LIB_ITEM( KICAD_T aType, } -void LIB_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void LIB_ITEM::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { wxString msg; diff --git a/eeschema/lib_item.h b/eeschema/lib_item.h index 53efe505ca..83230e00a5 100644 --- a/eeschema/lib_item.h +++ b/eeschema/lib_item.h @@ -204,7 +204,7 @@ public: *

* @param aList is the list to populate. */ - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; /** * Test LIB_ITEM objects for equivalence. diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index cf565f0cb8..9c0769be4c 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -1373,7 +1373,7 @@ void LIB_PIN::SetWidth( int aWidth ) } -void LIB_PIN::getMsgPanelInfoBase( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void LIB_PIN::getMsgPanelInfoBase( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { wxString text = m_number.IsEmpty() ? wxT( "?" ) : m_number; @@ -1397,7 +1397,7 @@ void LIB_PIN::getMsgPanelInfoBase( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) ); } -void LIB_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void LIB_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { getMsgPanelInfoBase( aUnits, aList ); @@ -1413,8 +1413,8 @@ void LIB_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) ); } -void LIB_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList, - SCH_COMPONENT* aComponent ) +void LIB_PIN::GetMsgPanelInfo( + EDA_UNITS aUnits, std::vector& aList, SCH_COMPONENT* aComponent ) { getMsgPanelInfoBase( aUnits, aList ); @@ -1603,7 +1603,7 @@ BITMAP_DEF LIB_PIN::GetMenuImage() const } -wxString LIB_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString LIB_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Pin %s, %s, %s" ), m_number, @@ -1614,7 +1614,7 @@ wxString LIB_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) { - wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) ); + wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ); // Note: this will have to be modified if we add find and replace capability to the // compoment library editor. Otherwise, you wont be able to replace pin text. @@ -1622,7 +1622,8 @@ bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) || ( aSearchData.GetFlags() & FR_SEARCH_REPLACE ) ) return false; - wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) ); + wxLogTrace( + traceFindItem, wxT( " child item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ); return EDA_ITEM::Matches( GetName(), aSearchData ) || EDA_ITEM::Matches( m_number, aSearchData ); diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h index c7321f34e1..6adc3fdb71 100644 --- a/eeschema/lib_pin.h +++ b/eeschema/lib_pin.h @@ -111,7 +111,7 @@ public: bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; /** * Display pin info (given by GetMsgPanelInfo) and add some info related to aComponent @@ -119,8 +119,8 @@ public: * @param aList is the message list to fill * @param aComponent is the component which "owns" the pin */ - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList, - SCH_COMPONENT* aComponent ); + void GetMsgPanelInfo( + EDA_UNITS aUnits, std::vector& aList, SCH_COMPONENT* aComponent ); bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override; @@ -446,7 +446,7 @@ public: BITMAP_DEF GetMenuImage() const override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; EDA_ITEM* Clone() const override; @@ -458,7 +458,7 @@ private: * they are pin info without the actual pin position, which * is not known in schematic without knowing the parent component */ - void getMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ); + void getMsgPanelInfoBase( EDA_UNITS aUnits, std::vector& aList ); /** diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 6eee79945f..4daac8489e 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -327,7 +327,7 @@ void LIB_POLYLINE::DeleteSegment( const wxPoint aPosition ) } -void LIB_POLYLINE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void LIB_POLYLINE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { wxString msg; EDA_RECT bBox = GetBoundingBox(); @@ -345,7 +345,7 @@ void LIB_POLYLINE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) } -wxString LIB_POLYLINE::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString LIB_POLYLINE::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Polyline at (%s, %s) with %d points" ), MessageTextFromValue( aUnits, m_PolyPoints[0].x ), diff --git a/eeschema/lib_polyline.h b/eeschema/lib_polyline.h index 1d63ed7002..ed6e45555b 100644 --- a/eeschema/lib_polyline.h +++ b/eeschema/lib_polyline.h @@ -79,7 +79,7 @@ public: int GetPenSize( ) const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; void BeginEdit( const wxPoint aStartPoint ) override; void CalcEdit( const wxPoint& aPosition ) override; @@ -104,7 +104,7 @@ public: int GetWidth() const override { return m_Width; } void SetWidth( int aWidth ) override { m_Width = aWidth; } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 00dd21af25..4bf6a1af2c 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -182,7 +182,7 @@ void LIB_RECTANGLE::print( wxDC* aDC, const wxPoint& aOffset, void* aData, } -void LIB_RECTANGLE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void LIB_RECTANGLE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { LIB_ITEM::GetMsgPanelInfo( aUnits, aList ); @@ -248,7 +248,7 @@ bool LIB_RECTANGLE::HitTest( const wxPoint& aPosition, int aAccuracy ) const } -wxString LIB_RECTANGLE::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString LIB_RECTANGLE::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Rectangle from (%s, %s) to (%s, %s)" ), MessageTextFromValue( aUnits, m_Pos.x ), diff --git a/eeschema/lib_rectangle.h b/eeschema/lib_rectangle.h index e072f2a0e7..93c8156b19 100644 --- a/eeschema/lib_rectangle.h +++ b/eeschema/lib_rectangle.h @@ -62,7 +62,7 @@ public: const EDA_RECT GetBoundingBox() const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; void BeginEdit( const wxPoint aStartPoint ) override; void CalcEdit( const wxPoint& aPosition ) override; @@ -88,7 +88,7 @@ public: void SetEnd( const wxPoint& aEnd ) { m_End = aEnd; } wxPoint GetEnd() const { return m_End; } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 6d19edc78b..5dc3183b76 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -259,7 +259,7 @@ void LIB_TEXT::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRAN } -void LIB_TEXT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void LIB_TEXT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { LIB_ITEM::GetMsgPanelInfo( aUnits, aList ); @@ -293,7 +293,7 @@ const EDA_RECT LIB_TEXT::GetBoundingBox() const } -wxString LIB_TEXT::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString LIB_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Graphic Text \"%s\"" ), ShortenedShownText() ); } diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h index 000116d0bd..a5fdee670d 100644 --- a/eeschema/lib_text.h +++ b/eeschema/lib_text.h @@ -70,7 +70,7 @@ public: int GetPenSize( ) const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; const EDA_RECT GetBoundingBox() const override; @@ -95,7 +95,7 @@ public: int GetWidth() const override { return GetThickness(); } void SetWidth( int aWidth ) override { SetThickness( aWidth ); } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/eeschema/libedit/menubar_libedit.cpp b/eeschema/libedit/menubar_libedit.cpp index bf957119d4..436eb89a43 100644 --- a/eeschema/libedit/menubar_libedit.cpp +++ b/eeschema/libedit/menubar_libedit.cpp @@ -123,11 +123,11 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() auto gridShownCondition = [ this ] ( const SELECTION& aSel ) { return IsGridVisible(); }; - auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) { - return GetUserUnits() == INCHES; + auto imperialUnitsCondition = [this]( const SELECTION& aSel ) { + return GetUserUnits() == EDA_UNITS::INCHES; }; - auto metricUnitsCondition = [ this ] ( const SELECTION& aSel ) { - return GetUserUnits() == MILLIMETRES; + auto metricUnitsCondition = [this]( const SELECTION& aSel ) { + return GetUserUnits() == EDA_UNITS::MILLIMETRES; }; auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) { return GetGalDisplayOptions().m_fullscreenCursor; diff --git a/eeschema/libedit/toolbars_libedit.cpp b/eeschema/libedit/toolbars_libedit.cpp index adc24f8497..199b542dce 100644 --- a/eeschema/libedit/toolbars_libedit.cpp +++ b/eeschema/libedit/toolbars_libedit.cpp @@ -173,8 +173,8 @@ void LIB_EDIT_FRAME::SyncToolbars() m_mainToolBar->Refresh(); m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); - m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); - m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); + m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES ); + m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES ); m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor ); m_optionsToolBar->Toggle( EE_ACTIONS::showElectricalTypes, GetShowElectricalType() ); m_optionsToolBar->Toggle( EE_ACTIONS::showComponentTree, IsSearchTreeShown() ); diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 971e3afa6a..a6bdd85cd7 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -162,11 +162,11 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() auto gridShownCondition = [ this ] ( const SELECTION& aSel ) { return IsGridVisible(); }; - auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) { - return GetUserUnits() == INCHES; + auto imperialUnitsCondition = [this]( const SELECTION& aSel ) { + return GetUserUnits() == EDA_UNITS::INCHES; }; - auto metricUnitsCondition = [ this ] ( const SELECTION& aSel ) { - return GetUserUnits() == MILLIMETRES; + auto metricUnitsCondition = [this]( const SELECTION& aSel ) { + return GetUserUnits() == EDA_UNITS::MILLIMETRES; }; auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) { return GetGalDisplayOptions().m_fullscreenCursor; diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 619d94e95a..c2dcdd2ef8 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -185,7 +185,7 @@ void SCH_BASE_FRAME::UpdateStatusBar() double dXpos = To_User_Unit( GetUserUnits(), cursorPos.x ); double dYpos = To_User_Unit( GetUserUnits(), cursorPos.y ); - if ( GetUserUnits() == MILLIMETRES ) + if( GetUserUnits() == EDA_UNITS::MILLIMETRES ) { dXpos = RoundTo0( dXpos, 100.0 ); dYpos = RoundTo0( dYpos, 100.0 ); @@ -196,17 +196,17 @@ void SCH_BASE_FRAME::UpdateStatusBar() switch( GetUserUnits() ) { - case INCHES: + case EDA_UNITS::INCHES: absformatter = "X %.3f Y %.3f"; locformatter = "dx %.3f dy %.3f dist %.3f"; break; - case MILLIMETRES: + case EDA_UNITS::MILLIMETRES: absformatter = "X %.2f Y %.2f"; locformatter = "dx %.2f dy %.2f dist %.2f"; break; - case UNSCALED_UNITS: + case EDA_UNITS::UNSCALED: absformatter = "X %f Y %f"; locformatter = "dx %f dy %f dist %f"; break; @@ -226,7 +226,7 @@ void SCH_BASE_FRAME::UpdateStatusBar() dXpos = To_User_Unit( GetUserUnits(), dx ); dYpos = To_User_Unit( GetUserUnits(), dy ); - if( GetUserUnits() == MILLIMETRES ) + if( GetUserUnits() == EDA_UNITS::MILLIMETRES ) { dXpos = RoundTo0( dXpos, 100.0 ); dYpos = RoundTo0( dYpos, 100.0 ); diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp index cf46c63cb3..ebfade20cd 100644 --- a/eeschema/sch_bitmap.cpp +++ b/eeschema/sch_bitmap.cpp @@ -193,12 +193,14 @@ BITMAP_DEF SCH_BITMAP::GetMenuImage() const } -void SCH_BITMAP::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void SCH_BITMAP::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { aList.push_back( MSG_PANEL_ITEM( _( "Bitmap" ), wxEmptyString, RED ) ); - aList.push_back( MSG_PANEL_ITEM( _( "Width" ), MessageTextFromValue( aUnits, GetSize().x ), RED ) ); - aList.push_back( MSG_PANEL_ITEM( _( "Height" ), MessageTextFromValue( aUnits, GetSize().y ), RED ) ); + aList.push_back( + MSG_PANEL_ITEM( _( "Width" ), MessageTextFromValue( aUnits, GetSize().x ), RED ) ); + aList.push_back( + MSG_PANEL_ITEM( _( "Height" ), MessageTextFromValue( aUnits, GetSize().y ), RED ) ); } diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h index f7fa54cbd8..9aa1a8fe1d 100644 --- a/eeschema/sch_bitmap.h +++ b/eeschema/sch_bitmap.h @@ -128,14 +128,14 @@ public: void MirrorX( int aXaxis_position ) override; void Rotate( wxPoint aPosition ) override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override { return wxString( _( "Image" ) ); } BITMAP_DEF GetMenuImage() const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; wxPoint GetPosition() const override { return m_pos; } void SetPosition( const wxPoint& aPosition ) override { m_pos = aPosition; } diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index d72b562324..3911be9b6a 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -299,13 +299,13 @@ void SCH_BUS_ENTRY_BASE::GetConnectionPoints( std::vector< wxPoint >& aPoints ) } -wxString SCH_BUS_WIRE_ENTRY::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_BUS_WIRE_ENTRY::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString( _( "Bus to Wire Entry" ) ); } -wxString SCH_BUS_BUS_ENTRY::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_BUS_BUS_ENTRY::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString( _( "Bus to Bus Entry" ) ); } @@ -381,7 +381,7 @@ char SCH_BUS_ENTRY_BASE::GetBusEntryShape() const } -void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { wxString msg; diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h index 59c9a91d07..6de4d29c55 100644 --- a/eeschema/sch_bus_entry.h +++ b/eeschema/sch_bus_entry.h @@ -112,7 +112,7 @@ public: void Plot( PLOTTER* aPlotter ) override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } @@ -152,7 +152,7 @@ public: ( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS ); } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; EDA_ITEM* Clone() const override; @@ -198,7 +198,7 @@ public: return aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS; } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; EDA_ITEM* Clone() const override; diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 421c48d398..3c526a06a1 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -1344,7 +1344,7 @@ const EDA_RECT SCH_COMPONENT::GetBoundingBox() const } -void SCH_COMPONENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void SCH_COMPONENT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { wxString msg; @@ -1487,7 +1487,7 @@ void SCH_COMPONENT::Rotate( wxPoint aPosition ) bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) { - wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) ); + wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ); // Components are searchable via the child field and pin item text. return false; @@ -1597,7 +1597,7 @@ LIB_ITEM* SCH_COMPONENT::GetDrawItem( const wxPoint& aPosition, KICAD_T aType ) } -wxString SCH_COMPONENT::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_COMPONENT::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Symbol %s, %s" ), GetLibId().GetLibItemName().wx_str(), diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index 6f97752e3e..f328b14a43 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -291,7 +291,7 @@ public: */ int GetOrientation(); - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; /** * Clear exiting component annotation. @@ -603,7 +603,7 @@ public: */ LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT ); - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/eeschema/sch_connection.cpp b/eeschema/sch_connection.cpp index 7309aed5ad..0bf02dcebb 100644 --- a/eeschema/sch_connection.cpp +++ b/eeschema/sch_connection.cpp @@ -371,7 +371,7 @@ void SCH_CONNECTION::AppendDebugInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const if( auto driver = Driver() ) { - msg.Printf( "%s at %p", driver->GetSelectMenuText( MILLIMETRES ), driver ); + msg.Printf( "%s at %p", driver->GetSelectMenuText( EDA_UNITS::MILLIMETRES ), driver ); aList.push_back( MSG_PANEL_ITEM( "Connection Source", msg, RED ) ); } } diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index f13a869351..fdf1e85af0 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -284,7 +284,8 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) if( ( flags & FR_SEARCH_REPLACE ) && m_id == REFERENCE && !( flags & FR_REPLACE_REFERENCES ) ) return false; - wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) ); + wxLogTrace( + traceFindItem, wxT( " child item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ); // Take sheet path into account which effects the reference field and the unit for // components with multiple parts. @@ -361,7 +362,7 @@ void SCH_FIELD::Rotate( wxPoint aPosition ) } -wxString SCH_FIELD::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Field %s" ), GetName() ); } diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index b516257c55..3784688a11 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -183,7 +183,7 @@ public: bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h index 967480ea40..86631ad707 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -88,7 +88,7 @@ public: aItem->Type() == SCH_COMPONENT_T; } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override { return wxString( _( "Junction" ) ); } diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index a7bb2f5afb..75416a7e08 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -622,7 +622,7 @@ void SCH_LINE::GetSelectedPoints( std::vector< wxPoint >& aPoints ) const } -wxString SCH_LINE::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const { wxString txtfmt, orient; @@ -787,7 +787,7 @@ void SCH_LINE::SetPosition( const wxPoint& aPosition ) } -void SCH_LINE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void SCH_LINE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { wxString msg; diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 8d9be0b67f..c762afe991 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -193,7 +193,7 @@ public: bool CanConnect( const SCH_ITEM* aItem ) const override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; @@ -213,7 +213,7 @@ public: void SwapData( SCH_ITEM* aItem ) override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override; diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index ea6ba063b0..a25f0530c2 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -107,7 +107,7 @@ const EDA_RECT SCH_MARKER::GetBoundingBox() const } -void SCH_MARKER::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void SCH_MARKER::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { aList.push_back( MSG_PANEL_ITEM( _( "Electronics Rule Check Error" ), GetReporter().GetErrorText(), DARKRED ) ); diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h index 853e4ef0dc..8c694c842f 100644 --- a/eeschema/sch_marker.h +++ b/eeschema/sch_marker.h @@ -86,9 +86,9 @@ public: */ bool Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override { return wxString( _( "ERC Marker" ) ); } diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h index 3b6bde80c9..c623983877 100644 --- a/eeschema/sch_no_connect.h +++ b/eeschema/sch_no_connect.h @@ -94,7 +94,7 @@ public: void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override { return wxString( _( "No Connect" ) ); } diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp index 9427e85d4d..0e0b1bd331 100644 --- a/eeschema/sch_pin.cpp +++ b/eeschema/sch_pin.cpp @@ -67,7 +67,7 @@ SCH_COMPONENT* SCH_PIN::GetParentComponent() const } -wxString SCH_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( "%s %s", GetParentComponent()->GetSelectMenuText( aUnits ), @@ -75,7 +75,7 @@ wxString SCH_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const } -void SCH_PIN::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void SCH_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { m_libPin->GetMsgPanelInfo( aUnits, aList, GetParentComponent() ); } diff --git a/eeschema/sch_pin.h b/eeschema/sch_pin.h index 221e9dfd9a..876aa3a08c 100644 --- a/eeschema/sch_pin.h +++ b/eeschema/sch_pin.h @@ -65,8 +65,8 @@ public: wxString GetDefaultNetName( const SCH_SHEET_PATH aPath ); - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; + void GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) override; void Print( wxDC* aDC, const wxPoint& aOffset ) override {} diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 6f125af515..c457f1c072 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -664,7 +664,7 @@ wxString SCH_SHEET::GetFileName( void ) const } -void SCH_SHEET::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void SCH_SHEET::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { aList.push_back( MSG_PANEL_ITEM( _( "Sheet Name" ), m_name, CYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) ); @@ -750,7 +750,7 @@ void SCH_SHEET::Resize( const wxSize& aSize ) bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) { - wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) ); + wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ); // Ignore the sheet file name if searching to replace. if( !(aSearchData.GetFlags() & FR_SEARCH_REPLACE) @@ -846,7 +846,7 @@ SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR aInspector, void* testData, const KICA } -wxString SCH_SHEET::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_SHEET::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Hierarchical Sheet %s" ), m_name ); } diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 95a15be945..3ba27cf7a1 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -188,7 +188,7 @@ public: bool IsConnectable() const override { return true; } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; @@ -314,7 +314,7 @@ public: */ int GetScreenCount() const; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; /* there is no member for orientation in sch_sheet, to preserve file * format, we detect orientation based on pin edges @@ -529,7 +529,7 @@ public: SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp index f1a9aed9bb..24351b2257 100644 --- a/eeschema/sch_sheet_pin.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -269,7 +269,7 @@ void SCH_SHEET_PIN::GetEndPoints( std::vector & aItemList ) } -wxString SCH_SHEET_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_SHEET_PIN::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Hierarchical Sheet Pin %s" ), ShortenedShownText() ); } diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 4fc700c8f7..7710f2544c 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -446,7 +446,7 @@ const EDA_RECT SCH_TEXT::GetBoundingBox() const } -wxString SCH_TEXT::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Graphic Text \"%s\"" ), GetChars( ShortenedShownText() ) ); } @@ -556,7 +556,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) } -void SCH_TEXT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) +void SCH_TEXT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) { wxString msg; @@ -715,7 +715,7 @@ const EDA_RECT SCH_LABEL::GetBoundingBox() const } -wxString SCH_LABEL::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_LABEL::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Label %s" ), ShortenedShownText() ); } @@ -987,7 +987,7 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const } -wxString SCH_GLOBALLABEL::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_GLOBALLABEL::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Global Label %s" ), ShortenedShownText() ); } @@ -1170,7 +1170,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const } -wxString SCH_HIERLABEL::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString SCH_HIERLABEL::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Hierarchical Label %s" ), ShortenedShownText() ); } diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 9baf17ddd3..00644ceb8c 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -189,7 +189,7 @@ public: bool CanIncrementLabel() const override { return true; } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; @@ -205,7 +205,7 @@ public: EDA_ITEM* Clone() const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override; @@ -244,7 +244,7 @@ public: ( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS ); } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; @@ -294,7 +294,7 @@ public: ( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS ); } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; @@ -344,7 +344,7 @@ public: ( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS ); } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/eeschema/toolbars_sch_editor.cpp b/eeschema/toolbars_sch_editor.cpp index caca7a6a3d..016cf3077a 100644 --- a/eeschema/toolbars_sch_editor.cpp +++ b/eeschema/toolbars_sch_editor.cpp @@ -178,8 +178,8 @@ void SCH_EDIT_FRAME::SyncToolbars() m_mainToolBar->Refresh(); m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); - m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); - m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); + m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES ); + m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES ); m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor ); m_optionsToolBar->Toggle( EE_ACTIONS::toggleHiddenPins, GetShowAllPins() ); m_optionsToolBar->Toggle( EE_ACTIONS::toggleForceHV, GetForceHVLines() ); diff --git a/gerbview/dialogs/panel_gerbview_settings.cpp b/gerbview/dialogs/panel_gerbview_settings.cpp index 8b5f6555ea..3061ec77a2 100644 --- a/gerbview/dialogs/panel_gerbview_settings.cpp +++ b/gerbview/dialogs/panel_gerbview_settings.cpp @@ -37,7 +37,7 @@ PANEL_GERBVIEW_SETTINGS::PANEL_GERBVIEW_SETTINGS( GERBVIEW_FRAME *aFrame, wxWind bool PANEL_GERBVIEW_SETTINGS::TransferDataToWindow( ) { m_PolarDisplay->SetSelection( m_Parent->GetShowPolarCoords() ? 1 : 0 ); - m_BoxUnits->SetSelection( m_Parent->GetUserUnits() ? 1 : 0 ); + m_BoxUnits->SetSelection( ( m_Parent->GetUserUnits() == EDA_UNITS::MILLIMETRES ) ? 1 : 0 ); m_ShowPageLimitsOpt->SetValue( m_Parent->GetDisplayOptions().m_DisplayPageLimits ); for( unsigned i = 0; i < arrayDim( g_GerberPageSizeList ); ++i ) @@ -56,7 +56,8 @@ bool PANEL_GERBVIEW_SETTINGS::TransferDataToWindow( ) bool PANEL_GERBVIEW_SETTINGS::TransferDataFromWindow() { m_Parent->SetShowPolarCoords( m_PolarDisplay->GetSelection() != 0 ); - m_Parent->SetUserUnits( m_BoxUnits->GetSelection() == 0 ? INCHES : MILLIMETRES ); + m_Parent->SetUserUnits( + m_BoxUnits->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES ); auto opts = m_Parent->GetDisplayOptions(); opts.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue(); diff --git a/gerbview/gerber_draw_item.cpp b/gerbview/gerber_draw_item.cpp index b3ad616778..6599f26ec7 100644 --- a/gerbview/gerber_draw_item.cpp +++ b/gerbview/gerber_draw_item.cpp @@ -643,7 +643,7 @@ void GERBER_DRAW_ITEM::PrintGerberPoly( wxDC* aDC, COLOR4D aColor, const wxPoint } -void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; wxString text; @@ -955,7 +955,7 @@ SEARCH_RESULT GERBER_DRAW_ITEM::Visit( INSPECTOR inspector, void* testData, cons } -wxString GERBER_DRAW_ITEM::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString GERBER_DRAW_ITEM::GetSelectMenuText( EDA_UNITS aUnits ) const { wxString layerName; diff --git a/gerbview/gerber_draw_item.h b/gerbview/gerber_draw_item.h index 2a6a4c59fd..7e471ea056 100644 --- a/gerbview/gerber_draw_item.h +++ b/gerbview/gerber_draw_item.h @@ -256,7 +256,7 @@ public: /* divers */ int Shape() const { return m_Shape; } - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; wxString ShowGBRShape() const; @@ -326,7 +326,7 @@ public: SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; ///> @copydoc EDA_ITEM::GetSelectMenuText() - virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + virtual wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; ///> @copydoc EDA_ITEM::GetMenuImage() BITMAP_DEF GetMenuImage() const override; diff --git a/gerbview/gerber_file_image.cpp b/gerbview/gerber_file_image.cpp index 5e81d1acc2..62f7a0f3ba 100644 --- a/gerbview/gerber_file_image.cpp +++ b/gerbview/gerber_file_image.cpp @@ -363,7 +363,7 @@ void GERBER_FILE_IMAGE::DisplayImageInfo( GERBVIEW_FRAME* aMainFrame ) msg = m_ImageJustifyYCenter ? _("Center") : _("Normal"); aMainFrame->AppendMsgPanel( _( "Y Justify" ), msg, DARKRED ); - if( aMainFrame->GetUserUnits() == INCHES ) + if( aMainFrame->GetUserUnits() == EDA_UNITS::INCHES ) msg.Printf( wxT( "X=%f Y=%f" ), Iu2Mils( m_ImageJustifyOffset.x ) / 1000.0, Iu2Mils( m_ImageJustifyOffset.y ) / 1000.0 ); else diff --git a/gerbview/gerbview_draw_panel_gal.cpp b/gerbview/gerbview_draw_panel_gal.cpp index aef6f24f9b..7e90ba3b00 100644 --- a/gerbview/gerbview_draw_panel_gal.cpp +++ b/gerbview/gerbview_draw_panel_gal.cpp @@ -94,8 +94,8 @@ void GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer( int aLayer ) } -void GERBVIEW_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_UNITS_T aUnits, - std::vector& aList ) +void GERBVIEW_DRAW_PANEL_GAL::GetMsgPanelInfo( + EDA_UNITS aUnits, std::vector& aList ) { } diff --git a/gerbview/gerbview_draw_panel_gal.h b/gerbview/gerbview_draw_panel_gal.h index e37933d1d3..1b8c43444f 100644 --- a/gerbview/gerbview_draw_panel_gal.h +++ b/gerbview/gerbview_draw_panel_gal.h @@ -51,7 +51,7 @@ public: virtual void SetHighContrastLayer( int aLayer ) override; ///> @copydoc EDA_DRAW_PANEL_GAL::GetMsgPanelInfo() - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; ///> @copydoc EDA_DRAW_PANEL_GAL::OnShow() void OnShow() override; diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 282d529283..19c8537354 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -530,7 +530,7 @@ void GERBVIEW_FRAME::Liste_D_Codes() int ii, jj; wxString Line; wxArrayString list; - double scale = GetUserUnits() == INCHES ? IU_PER_MILS * 1000 : IU_PER_MM; + double scale = GetUserUnits() == EDA_UNITS::INCHES ? IU_PER_MILS * 1000 : IU_PER_MM; int curr_layer = GetActiveLayer(); for( int layer = 0; layer < (int)ImagesMaxCount(); ++layer ) @@ -550,7 +550,7 @@ void GERBVIEW_FRAME::Liste_D_Codes() list.Add( Line ); - const char* units = GetUserUnits() == INCHES ? "\"" : "mm"; + const char* units = GetUserUnits() == EDA_UNITS::INCHES ? "\"" : "mm"; for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ ) { @@ -980,11 +980,11 @@ void GERBVIEW_FRAME::DisplayGridMsg() switch( m_userUnits ) { - case INCHES: + case EDA_UNITS::INCHES: gridformatter = "grid X %.6f Y %.6f"; break; - case MILLIMETRES: + case EDA_UNITS::MILLIMETRES: gridformatter = "grid X %.6f Y %.6f"; break; @@ -996,7 +996,7 @@ void GERBVIEW_FRAME::DisplayGridMsg() BASE_SCREEN* screen = GetScreen(); wxArrayString gridsList; - int icurr = screen->BuildGridsChoiceList( gridsList, m_userUnits != INCHES ); + int icurr = screen->BuildGridsChoiceList( gridsList, m_userUnits != EDA_UNITS::INCHES ); GRID_TYPE& grid = screen->GetGrid( icurr ); double grid_x = To_User_Unit( m_userUnits, grid.m_Size.x ); double grid_y = To_User_Unit( m_userUnits, grid.m_Size.y ); @@ -1028,9 +1028,15 @@ void GERBVIEW_FRAME::UpdateStatusBar() switch( GetUserUnits() ) { - case INCHES: formatter = wxT( "r %.6f theta %.1f" ); break; - case MILLIMETRES: formatter = wxT( "r %.5f theta %.1f" ); break; - case UNSCALED_UNITS: formatter = wxT( "r %f theta %f" ); break; + case EDA_UNITS::INCHES: + formatter = wxT( "r %.6f theta %.1f" ); + break; + case EDA_UNITS::MILLIMETRES: + formatter = wxT( "r %.5f theta %.1f" ); + break; + case EDA_UNITS::UNSCALED: + formatter = wxT( "r %f theta %f" ); + break; default: wxASSERT( false ); break; } @@ -1048,17 +1054,17 @@ void GERBVIEW_FRAME::UpdateStatusBar() switch( GetUserUnits() ) { - case INCHES: + case EDA_UNITS::INCHES: absformatter = wxT( "X %.6f Y %.6f" ); relformatter = wxT( "dx %.6f dy %.6f dist %.4f" ); break; - case MILLIMETRES: + case EDA_UNITS::MILLIMETRES: absformatter = wxT( "X %.5f Y %.5f" ); relformatter = wxT( "dx %.5f dy %.5f dist %.3f" ); break; - case UNSCALED_UNITS: + case EDA_UNITS::UNSCALED: absformatter = wxT( "X %f Y %f" ); relformatter = wxT( "dx %f dy %f dist %f" ); break; @@ -1178,7 +1184,7 @@ void GERBVIEW_FRAME::updateGridSelectBox() // Update grid values with the current units setting. m_gridSelectBox->Clear(); wxArrayString gridsList; - int icurr = GetScreen()->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES ); + int icurr = GetScreen()->BuildGridsChoiceList( gridsList, GetUserUnits() != EDA_UNITS::INCHES ); for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ ) { diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index 3ee60e232f..b8927af951 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -153,11 +153,11 @@ void GERBVIEW_FRAME::ReCreateMenuBar() auto layersManagerShownCondition = [ this ] ( const SELECTION& aSel ) { return m_show_layer_manager_tools; }; - auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) { - return GetUserUnits() == INCHES; + auto imperialUnitsCondition = [this]( const SELECTION& aSel ) { + return GetUserUnits() == EDA_UNITS::INCHES; }; - auto metricUnitsCondition = [ this ] ( const SELECTION& aSel ) { - return GetUserUnits() == MILLIMETRES; + auto metricUnitsCondition = [this]( const SELECTION& aSel ) { + return GetUserUnits() == EDA_UNITS::MILLIMETRES; }; auto sketchFlashedCondition = [ this ] ( const SELECTION& aSel ) { return !m_DisplayOptions.m_DisplayFlashedItemsFill; diff --git a/gerbview/toolbars_gerber.cpp b/gerbview/toolbars_gerber.cpp index e6d8cca675..18ce07b59c 100644 --- a/gerbview/toolbars_gerber.cpp +++ b/gerbview/toolbars_gerber.cpp @@ -274,8 +274,8 @@ void GERBVIEW_FRAME::updateDCodeSelectBox() // Build the aperture list of the current layer, and add it to the combo box: wxArrayString dcode_list; wxString msg; - const char* units = GetUserUnits() == INCHES ? "mils" : "mm"; - double scale = GetUserUnits() == INCHES ? IU_PER_MILS : IU_PER_MM; + const char* units = GetUserUnits() == EDA_UNITS::INCHES ? "mils" : "mm"; + double scale = GetUserUnits() == EDA_UNITS::INCHES ? IU_PER_MILS : IU_PER_MM; for( int ii = 0; ii < TOOLS_MAX_COUNT; ii++ ) { @@ -474,8 +474,8 @@ void GERBVIEW_FRAME::SyncToolbars() TOGGLE_TOOL( m_optionsToolBar, ACTIONS::selectionTool ); m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); - m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); - m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); + m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES ); + m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES ); m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, !galOpts.m_fullscreenCursor ); m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::flashedDisplayOutlines, !m_DisplayOptions.m_DisplayFlashedItemsFill ); diff --git a/include/base_screen.h b/include/base_screen.h index 6c589a1f5d..e5ea3a718a 100644 --- a/include/base_screen.h +++ b/include/base_screen.h @@ -305,7 +305,7 @@ public: int SetGrid( int aCommandId ); void AddGrid( const GRID_TYPE& aGrid ); - void AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id ); + void AddGrid( const wxRealPoint& size, EDA_UNITS aUnit, int id ); /** * Function GridExists diff --git a/include/base_struct.h b/include/base_struct.h index 5f219abf22..e0aa691c25 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -325,7 +325,7 @@ public: * * @param aList is the list to populate. */ - virtual void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) + virtual void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { } @@ -485,7 +485,7 @@ public: * * @return The menu text string. */ - virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const; + virtual wxString GetSelectMenuText( EDA_UNITS aUnits ) const; /** * Function GetMenuImage diff --git a/include/base_units.h b/include/base_units.h index 0dd935f1bb..282c893b45 100644 --- a/include/base_units.h +++ b/include/base_units.h @@ -81,7 +81,7 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed = * @param aValue The value in internal units to convert. * @param aUseMils Indicates mils should be used for imperial units (inches). */ -double To_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils = false ); +double To_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils = false ); /** * Function AngleToStringDegrees @@ -108,11 +108,11 @@ wxString AngleToStringDegrees( double aAngle ); * @param aUseMils Convert inch values to mils if true. * @return The converted string for display in user interface elements. */ -wxString MessageTextFromValue( EDA_UNITS_T aUnits, double aValue, bool aUseMils = false ); +wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aUseMils = false ); -wxString MessageTextFromValue( EDA_UNITS_T aUnits, int aValue, bool aUseMils = false ); +wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aUseMils = false ); -wxString MessageTextFromValue( EDA_UNITS_T aUnits, long long int aValue, bool aUseMils = false ); +wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aUseMils = false ); /** * Function StringFromValue @@ -135,13 +135,13 @@ wxString MessageTextFromValue( EDA_UNITS_T aUnits, long long int aValue, bool aU * @return A wxString object containing value and optionally the symbol unit (like 2.000 mm) */ wxString StringFromValue( - EDA_UNITS_T aUnit, double aValue, bool aAddUnitSymbol = false, bool aUseMils = false ); + EDA_UNITS aUnit, double aValue, bool aAddUnitSymbol = false, bool aUseMils = false ); /** * Return in internal units the value "val" given in a real unit * such as "in", "mm" or "deg" */ -double From_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils = false ); +double From_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils = false ); /** @@ -152,8 +152,7 @@ double From_User_Unit( EDA_UNITS_T aUnit, double aValue, bool aUseMils = false ) * @param aUseMils Indicates mils should be used for imperial units (inches). * @return A double representing that value in internal units */ -double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, - bool aUseMils = false ); +double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils = false ); /** * Function ValueFromString @@ -165,13 +164,13 @@ double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue, * @return The string from Value, according to units (inch, mm ...) for display, */ long long int ValueFromString( - EDA_UNITS_T aUnits, const wxString& aTextValue, bool aUseMils = false ); + EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils = false ); /** * Function FetchUnitsFromString * writes any unit info found in the string to aUnits and aUseMils. */ -void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS_T& aUnits, bool& aUseMils ); +void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits, bool& aUseMils ); /** * Get the units string for a given units type. @@ -179,7 +178,7 @@ void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS_T& aUnits, bool * @param aUnits - The units requested. * @return The human readable units string. */ -wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit, bool aUseMils = false ); +wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, bool aUseMils = false ); /** * Function FormatInternalUnits diff --git a/include/class_draw_panel_gal.h b/include/class_draw_panel_gal.h index 8d70b82516..7dc9e3f5bc 100644 --- a/include/class_draw_panel_gal.h +++ b/include/class_draw_panel_gal.h @@ -147,7 +147,7 @@ public: */ virtual void SetTopLayer( int aLayer ); - virtual void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector& aList ) + virtual void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxASSERT( false ); } diff --git a/include/common.h b/include/common.h index 2e8706445a..1703000835 100644 --- a/include/common.h +++ b/include/common.h @@ -130,10 +130,11 @@ constexpr ret_type KiROUND( fp_type v ) //---------------------------------------------------------------- -enum EDA_UNITS_T { +enum class EDA_UNITS +{ INCHES = 0, MILLIMETRES = 1, - UNSCALED_UNITS = 2, + UNSCALED = 2, DEGREES = 3, PERCENT = 4, }; diff --git a/include/dialog_helpers.h b/include/dialog_helpers.h index 63d77802cc..74918a6f03 100644 --- a/include/dialog_helpers.h +++ b/include/dialog_helpers.h @@ -32,8 +32,8 @@ #define DIALOG_HELPERS_H_ -#include // EDA_UNITS_T #include <../common/dialogs/dialog_list_selector_base.h> +#include // EDA_UNITS void ConvertMarkdown2Html( const wxString& aMarkdownInput, wxString& aHtmlOutput ); @@ -107,7 +107,7 @@ private: class EDA_POSITION_CTRL { public: - EDA_UNITS_T m_UserUnit; + EDA_UNITS m_UserUnit; wxTextCtrl* m_FramePosX; wxTextCtrl* m_FramePosY; @@ -116,8 +116,8 @@ private: wxStaticText* m_TextX, * m_TextY; public: - EDA_POSITION_CTRL( wxWindow* parent, const wxString& title, - const wxPoint& pos_to_edit, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer ); + EDA_POSITION_CTRL( wxWindow* parent, const wxString& title, const wxPoint& pos_to_edit, + EDA_UNITS user_unit, wxBoxSizer* BoxSizer ); ~EDA_POSITION_CTRL(); @@ -134,8 +134,8 @@ public: class EDA_SIZE_CTRL : public EDA_POSITION_CTRL { public: - EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, - const wxSize& size_to_edit, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer ); + EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, const wxSize& size_to_edit, + EDA_UNITS user_unit, wxBoxSizer* BoxSizer ); ~EDA_SIZE_CTRL() { } wxSize GetValue(); diff --git a/include/dialog_shim.h b/include/dialog_shim.h index ab02181682..300ab6f275 100644 --- a/include/dialog_shim.h +++ b/include/dialog_shim.h @@ -129,7 +129,10 @@ public: void OnPaint( wxPaintEvent &event ); - EDA_UNITS_T GetUserUnits() const { return m_units; } + EDA_UNITS GetUserUnits() const + { + return m_units; + } static bool IsCtrl( int aChar, const wxKeyEvent& e ) { @@ -190,8 +193,8 @@ protected: */ void ResetSize(); - EDA_UNITS_T m_units; // userUnits for display and parsing - std::string m_hash_key; // alternate for class_map when classname re-used + EDA_UNITS m_units; // userUnits for display and parsing + std::string m_hash_key; // alternate for class_map when classname re-used // On MacOS (at least) SetFocus() calls made in the constructor will fail because a // window that isn't yet visible will return false to AcceptsFocus(). So we must delay diff --git a/include/drc_item.h b/include/drc_item.h index 67eb129900..857c7eb086 100644 --- a/include/drc_item.h +++ b/include/drc_item.h @@ -72,13 +72,13 @@ public: m_auxItemWeakRef = nullptr; } - DRC_ITEM( EDA_UNITS_T aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos, - EDA_ITEM* bAuxiliaryItem, const wxPoint& bAuxiliaryPos ) + DRC_ITEM( EDA_UNITS aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos, + EDA_ITEM* bAuxiliaryItem, const wxPoint& bAuxiliaryPos ) { SetData( aUnits, aErrorCode, aMainItem, aMainPos, bAuxiliaryItem, bAuxiliaryPos ); } - DRC_ITEM( EDA_UNITS_T aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos ) + DRC_ITEM( EDA_UNITS aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos ) { SetData( aUnits, aErrorCode, aMainItem, aMainPos ); } @@ -100,8 +100,8 @@ public: * @param aMainPos = position the first item and therefore of this issue * @param bAuxiliaryPos = position the second item */ - void SetData( EDA_UNITS_T aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos, - EDA_ITEM* bAuxiliaryItem = nullptr, const wxPoint& bAuxiliaryPos = wxPoint() ) + void SetData( EDA_UNITS aUnits, int aErrorCode, EDA_ITEM* aMainItem, const wxPoint& aMainPos, + EDA_ITEM* bAuxiliaryItem = nullptr, const wxPoint& bAuxiliaryPos = wxPoint() ) { m_ErrorCode = aErrorCode; m_MainText = aMainItem->GetSelectMenuText( aUnits ); @@ -186,7 +186,7 @@ public: * wxWidget's wxHtmlListBox class. * @return wxString - the html text. */ - wxString ShowHtml( EDA_UNITS_T aUnits ) const; + wxString ShowHtml( EDA_UNITS aUnits ) const; /** * Function ShowReport @@ -194,7 +194,7 @@ public: * to disk in a report. * @return wxString - the simple multi-line report text. */ - wxString ShowReport( EDA_UNITS_T aUnits ) const; + wxString ShowReport( EDA_UNITS aUnits ) const; /** * Function GetErrorCode @@ -241,7 +241,7 @@ public: * @param aPos The position to format * @return wxString - The formated string */ - static wxString ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos ); + static wxString ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos ); }; diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index 6c022ef3a8..5ea45d113b 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -148,7 +148,7 @@ protected: wxString m_mruPath; // Most recently used path. - EDA_UNITS_T m_userUnits; + EDA_UNITS m_userUnits; ///> Default style flags used for wxAUI toolbars static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND; @@ -208,10 +208,17 @@ public: /** * Return the user units currently in use. */ - EDA_UNITS_T GetUserUnits() const { return m_userUnits; } - void SetUserUnits( EDA_UNITS_T aUnits ) { m_userUnits = aUnits; } + EDA_UNITS GetUserUnits() const + { + return m_userUnits; + } - void ChangeUserUnits( EDA_UNITS_T aUnits ) + void SetUserUnits( EDA_UNITS aUnits ) + { + m_userUnits = aUnits; + } + + void ChangeUserUnits( EDA_UNITS aUnits ) { SetUserUnits( aUnits ); unitsChangeRefresh(); diff --git a/include/libeval/numeric_evaluator.h b/include/libeval/numeric_evaluator.h index 0b46dba244..1b2a065ae9 100644 --- a/include/libeval/numeric_evaluator.h +++ b/include/libeval/numeric_evaluator.h @@ -96,7 +96,7 @@ class NUMERIC_EVALUATOR enum class Unit { Invalid, Metric, Inch, Mil }; public: - NUMERIC_EVALUATOR( EDA_UNITS_T aUnits, bool aUseMils = false ); + NUMERIC_EVALUATOR( EDA_UNITS aUnits, bool aUseMils = false ); ~NUMERIC_EVALUATOR(); /* clear() should be invoked by the client if a new input string is to be processed. It diff --git a/include/marker_base.h b/include/marker_base.h index a1ff9e3eca..b401e7bbfc 100644 --- a/include/marker_base.h +++ b/include/marker_base.h @@ -79,9 +79,8 @@ public: * @param bPos The position of the second of two objects * @param aScalingFactor the scaling factor to convert the shape coordinates to IU coordinates */ - MARKER_BASE( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos, - EDA_ITEM* aItem, const wxPoint& aPos, - EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor ); + MARKER_BASE( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, EDA_ITEM* aItem, + const wxPoint& aPos, EDA_ITEM* bItem, const wxPoint& bPos, int aScalingFactor ); /** * Constructor @@ -199,9 +198,8 @@ public: * @param bItem The second of the two conflicting objects * @param bPos The position of the second of two objects */ - void SetData( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos, - EDA_ITEM* aItem, const wxPoint& aPos, - EDA_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() ); + void SetData( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, EDA_ITEM* aItem, + const wxPoint& aPos, EDA_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() ); /** * Function SetData diff --git a/include/plotter.h b/include/plotter.h index ed060e2e10..bfe4a92eb4 100644 --- a/include/plotter.h +++ b/include/plotter.h @@ -1390,7 +1390,7 @@ public: textAsLines = true; m_currentColor = COLOR4D::BLACK; m_currentLineType = 0; - SetUnits( DXF_PLOTTER::DXF_UNIT_INCHES ); + SetUnits( DXF_UNITS::INCHES ); } virtual PlotFormat GetPlotterType() const override @@ -1477,10 +1477,10 @@ public: // Must be in the same order as the drop-down list in the plot dialog inside pcbnew - enum DXF_UNITS + enum class DXF_UNITS { - DXF_UNIT_INCHES = 0, - DXF_UNIT_MILLIMETERS = 1 + INCHES = 0, + MILLIMETERS = 1 }; /** diff --git a/include/preview_items/arc_assistant.h b/include/preview_items/arc_assistant.h index 7dbf7fd174..76397a5a28 100644 --- a/include/preview_items/arc_assistant.h +++ b/include/preview_items/arc_assistant.h @@ -38,8 +38,7 @@ namespace PREVIEW { class ARC_ASSISTANT : public EDA_ITEM { public: - - ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS_T aUnits ); + ARC_ASSISTANT( const ARC_GEOM_MANAGER& aManager, EDA_UNITS aUnits ); const BOX2I ViewBBox() const override; @@ -66,7 +65,7 @@ public: private: const ARC_GEOM_MANAGER& m_constructMan; - EDA_UNITS_T m_units; + EDA_UNITS m_units; }; } // PREVIEW } // KIGFX diff --git a/include/preview_items/preview_utils.h b/include/preview_items/preview_utils.h index d16414170c..0f9fe9e8d3 100644 --- a/include/preview_items/preview_utils.h +++ b/include/preview_items/preview_utils.h @@ -47,8 +47,7 @@ double PreviewOverlayDeemphAlpha( bool aDeemph = true ); * Get a formatted string showing a dimension to a sane precision * with an optional prefix and unit suffix. */ -wxString DimensionLabel( const wxString& prefix, double aVal, - EDA_UNITS_T aUnits ); +wxString DimensionLabel( const wxString& prefix, double aVal, EDA_UNITS aUnits ); /** * Set the GAL glyph height to a constant scaled value, so that it diff --git a/include/preview_items/ruler_item.h b/include/preview_items/ruler_item.h index 2f5474d692..e29c8429fc 100644 --- a/include/preview_items/ruler_item.h +++ b/include/preview_items/ruler_item.h @@ -43,8 +43,7 @@ class TWO_POINT_GEOMETRY_MANAGER; class RULER_ITEM : public EDA_ITEM { public: - - RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr, EDA_UNITS_T userUnits ); + RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr, EDA_UNITS userUnits ); ///> @copydoc EDA_ITEM::ViewBBox() const BOX2I ViewBBox() const override; @@ -73,15 +72,15 @@ public: void SwitchUnits() { - if( m_userUnits == INCHES ) - m_userUnits = MILLIMETRES; + if( m_userUnits == EDA_UNITS::INCHES ) + m_userUnits = EDA_UNITS::MILLIMETRES; else - m_userUnits = INCHES; + m_userUnits = EDA_UNITS::INCHES; } private: const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr; - EDA_UNITS_T m_userUnits; + EDA_UNITS m_userUnits; }; } // PREVIEW diff --git a/include/widgets/unit_binder.h b/include/widgets/unit_binder.h index 3eea2eaa16..028d767d30 100644 --- a/include/widgets/unit_binder.h +++ b/include/widgets/unit_binder.h @@ -60,7 +60,7 @@ public: * Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be * used to set to DEGREES for angular controls. */ - virtual void SetUnits( EDA_UNITS_T aUnits, bool aUseMils = false ); + virtual void SetUnits( EDA_UNITS aUnits, bool aUseMils = false ); /** * Function SetValue @@ -133,7 +133,7 @@ protected: wxStaticText* m_unitLabel; ///> Currently used units. - EDA_UNITS_T m_units; + EDA_UNITS m_units; bool m_useMils; ///> Validation support. diff --git a/include/ws_draw_item.h b/include/ws_draw_item.h index 080747cd5e..b199544f72 100644 --- a/include/ws_draw_item.h +++ b/include/ws_draw_item.h @@ -94,7 +94,7 @@ public: bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) override; }; @@ -132,7 +132,7 @@ public: void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } @@ -175,7 +175,7 @@ public: void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } @@ -216,7 +216,7 @@ public: const EDA_RECT GetBoundingBox() const override; bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } @@ -260,7 +260,7 @@ public: const EDA_RECT GetBoundingBox() const override; bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override { return false; } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } @@ -304,7 +304,7 @@ public: bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } @@ -336,7 +336,7 @@ public: bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; const EDA_RECT GetBoundingBox() const override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } diff --git a/pagelayout_editor/pl_draw_panel_gal.cpp b/pagelayout_editor/pl_draw_panel_gal.cpp index 13acc1eddb..bda0019387 100644 --- a/pagelayout_editor/pl_draw_panel_gal.cpp +++ b/pagelayout_editor/pl_draw_panel_gal.cpp @@ -65,7 +65,7 @@ PL_DRAW_PANEL_GAL::~PL_DRAW_PANEL_GAL() } -void PL_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector& aList ) +void PL_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { } diff --git a/pagelayout_editor/pl_draw_panel_gal.h b/pagelayout_editor/pl_draw_panel_gal.h index d2e4935f88..f7cae89c3a 100644 --- a/pagelayout_editor/pl_draw_panel_gal.h +++ b/pagelayout_editor/pl_draw_panel_gal.h @@ -35,7 +35,7 @@ public: virtual ~PL_DRAW_PANEL_GAL(); ///> @copydoc EDA_DRAW_PANEL_GAL::GetMsgPanelInfo() - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; /** * Build and update the list of WS_DRAW_ITEM_xxx showing the frame layout diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index 3ddc26745e..ced48ab7d7 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -80,7 +80,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME ) { - m_userUnits = MILLIMETRES; + m_userUnits = EDA_UNITS::MILLIMETRES; m_zoomLevelCoeff = 290.0; // Adjusted to roughly displays zoom level = 1 // when the screen shows a 1:1 image // obviously depends on the monitor, @@ -570,8 +570,12 @@ void PL_EDITOR_FRAME::DisplayGridMsg() switch( m_userUnits ) { - case INCHES: gridformatter = "grid %.3f"; break; - case MILLIMETRES: gridformatter = "grid %.4f"; break; + case EDA_UNITS::INCHES: + gridformatter = "grid %.3f"; + break; + case EDA_UNITS::MILLIMETRES: + gridformatter = "grid %.4f"; + break; default: gridformatter = "grid %f"; break; } @@ -636,9 +640,15 @@ void PL_EDITOR_FRAME::UpdateStatusBar() switch( GetUserUnits() ) { - case INCHES: SetStatusText( _("inches"), 6 ); break; - case MILLIMETRES: SetStatusText( _("mm"), 6 ); break; - case UNSCALED_UNITS: SetStatusText( wxEmptyString, 6 ); break; + case EDA_UNITS::INCHES: + SetStatusText( _( "inches" ), 6 ); + break; + case EDA_UNITS::MILLIMETRES: + SetStatusText( _( "mm" ), 6 ); + break; + case EDA_UNITS::UNSCALED: + SetStatusText( wxEmptyString, 6 ); + break; default: wxASSERT( false ); break; } diff --git a/pagelayout_editor/properties_frame.cpp b/pagelayout_editor/properties_frame.cpp index 0aaee4acc6..4b003a803b 100644 --- a/pagelayout_editor/properties_frame.cpp +++ b/pagelayout_editor/properties_frame.cpp @@ -106,27 +106,27 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToGeneral() // Import default parameters from widgets msg = m_textCtrlDefaultLineWidth->GetValue(); - model.m_DefaultLineWidth = DoubleValueFromString( UNSCALED_UNITS, msg ); + model.m_DefaultLineWidth = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); msg = m_textCtrlDefaultTextSizeX->GetValue(); - model.m_DefaultTextSize.x = DoubleValueFromString( UNSCALED_UNITS, msg ); + model.m_DefaultTextSize.x = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); msg = m_textCtrlDefaultTextSizeY->GetValue(); - model.m_DefaultTextSize.y = DoubleValueFromString( UNSCALED_UNITS, msg ); + model.m_DefaultTextSize.y = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); msg = m_textCtrlDefaultTextThickness->GetValue(); - model.m_DefaultTextThickness = DoubleValueFromString( UNSCALED_UNITS, msg ); + model.m_DefaultTextThickness = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); // Get page margins values msg = m_textCtrlRightMargin->GetValue(); - model.SetRightMargin( DoubleValueFromString( UNSCALED_UNITS, msg ) ); + model.SetRightMargin( DoubleValueFromString( EDA_UNITS::UNSCALED, msg ) ); msg = m_textCtrlDefaultBottomMargin->GetValue(); - model.SetBottomMargin( DoubleValueFromString( UNSCALED_UNITS, msg ) ); + model.SetBottomMargin( DoubleValueFromString( EDA_UNITS::UNSCALED, msg ) ); // cordinates of the left top corner are the left and top margins msg = m_textCtrlLeftMargin->GetValue(); - model.SetLeftMargin( DoubleValueFromString( UNSCALED_UNITS, msg ) ); + model.SetLeftMargin( DoubleValueFromString( EDA_UNITS::UNSCALED, msg ) ); msg = m_textCtrlTopMargin->GetValue(); - model.SetTopMargin( DoubleValueFromString( UNSCALED_UNITS, msg ) ); + model.SetTopMargin( DoubleValueFromString( EDA_UNITS::UNSCALED, msg ) ); return true; } @@ -354,14 +354,14 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem ) // Import thickness msg = m_textCtrlThickness->GetValue(); - aItem->m_LineWidth = DoubleValueFromString( UNSCALED_UNITS, msg ); + aItem->m_LineWidth = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); // Import Start point msg = m_textCtrlPosX->GetValue(); - aItem->m_Pos.m_Pos.x = DoubleValueFromString( UNSCALED_UNITS, msg ); + aItem->m_Pos.m_Pos.x = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); msg = m_textCtrlPosY->GetValue(); - aItem->m_Pos.m_Pos.y = DoubleValueFromString( UNSCALED_UNITS, msg ); + aItem->m_Pos.m_Pos.y = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); switch( m_comboBoxCornerPos->GetSelection() ) { @@ -373,10 +373,10 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem ) // Import End point msg = m_textCtrlEndX->GetValue(); - aItem->m_End.m_Pos.x = DoubleValueFromString( UNSCALED_UNITS, msg ); + aItem->m_End.m_Pos.x = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); msg = m_textCtrlEndY->GetValue(); - aItem->m_End.m_Pos.y = DoubleValueFromString( UNSCALED_UNITS, msg ); + aItem->m_End.m_Pos.y = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); switch( m_comboBoxCornerEnd->GetSelection() ) { @@ -393,10 +393,10 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem ) aItem->m_RepeatCount = itmp; msg = m_textCtrlStepX->GetValue(); - aItem->m_IncrementVector.x = DoubleValueFromString( UNSCALED_UNITS, msg ); + aItem->m_IncrementVector.x = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); msg = m_textCtrlStepY->GetValue(); - aItem->m_IncrementVector.y = DoubleValueFromString( UNSCALED_UNITS, msg ); + aItem->m_IncrementVector.y = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); if( aItem->GetType() == WS_DATA_ITEM::WS_TEXT ) { @@ -426,21 +426,21 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem ) } msg = m_textCtrlRotation->GetValue(); - item->m_Orient = DoubleValueFromString( UNSCALED_UNITS, msg ); + item->m_Orient = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); // Import text size msg = m_textCtrlTextSizeX->GetValue(); - item->m_TextSize.x = DoubleValueFromString( UNSCALED_UNITS, msg ); + item->m_TextSize.x = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); msg = m_textCtrlTextSizeY->GetValue(); - item->m_TextSize.y = DoubleValueFromString( UNSCALED_UNITS, msg ); + item->m_TextSize.y = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); // Import constraints: msg = m_textCtrlConstraintX->GetValue(); - item->m_BoundingBoxSize.x = DoubleValueFromString( UNSCALED_UNITS, msg ); + item->m_BoundingBoxSize.x = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); msg = m_textCtrlConstraintY->GetValue(); - item->m_BoundingBoxSize.y = DoubleValueFromString( UNSCALED_UNITS, msg ); + item->m_BoundingBoxSize.y = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); } if( aItem->GetType() == WS_DATA_ITEM::WS_POLYPOLYGON ) @@ -448,7 +448,7 @@ bool PROPERTIES_FRAME::CopyPrmsFromPanelToItem( WS_DATA_ITEM* aItem ) WS_DATA_ITEM_POLYGONS* item = (WS_DATA_ITEM_POLYGONS*) aItem; msg = m_textCtrlRotation->GetValue(); - item->m_Orient = DoubleValueFromString( UNSCALED_UNITS, msg ); + item->m_Orient = DoubleValueFromString( EDA_UNITS::UNSCALED, msg ); } if( aItem->GetType() == WS_DATA_ITEM::WS_BITMAP ) diff --git a/pcbnew/board_stackup_manager/board_stackup_reporter.cpp b/pcbnew/board_stackup_manager/board_stackup_reporter.cpp index db46364870..c30f8d9610 100644 --- a/pcbnew/board_stackup_manager/board_stackup_reporter.cpp +++ b/pcbnew/board_stackup_manager/board_stackup_reporter.cpp @@ -36,7 +36,7 @@ #include "board_stackup_reporter.h" -wxString BuildStackupReport( BOARD_STACKUP& aStackup, EDA_UNITS_T aUnits ) +wxString BuildStackupReport( BOARD_STACKUP& aStackup, EDA_UNITS aUnits ) { // Build a ascii representation of stackup and copy it in the clipboard wxString report; diff --git a/pcbnew/board_stackup_manager/board_stackup_reporter.h b/pcbnew/board_stackup_manager/board_stackup_reporter.h index 846eb5837d..f1bbaa99cb 100644 --- a/pcbnew/board_stackup_manager/board_stackup_reporter.h +++ b/pcbnew/board_stackup_manager/board_stackup_reporter.h @@ -28,10 +28,10 @@ #ifndef BOARD_STACKUP_REPORTER_H #define BOARD_STACKUP_REPORTER_H -#include // for EDA_UNITS_T +#include // for EDA_UNITS class BOARD_STACKUP; -wxString BuildStackupReport( BOARD_STACKUP& aStackup, EDA_UNITS_T aUnits ); +wxString BuildStackupReport( BOARD_STACKUP& aStackup, EDA_UNITS aUnits ); #endif // #ifndef BOARD_STACKUP_REPORTER_H diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.h b/pcbnew/board_stackup_manager/panel_board_stackup.h index 6b27573931..43b76b726c 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.h +++ b/pcbnew/board_stackup_manager/panel_board_stackup.h @@ -228,7 +228,7 @@ private: std::vector m_rowUiItemsList; BOARD* m_board; BOARD_DESIGN_SETTINGS* m_brdSettings; - EDA_UNITS_T m_units; + EDA_UNITS m_units; PCB_EDIT_FRAME* m_frame; wxSize m_numericTextCtrlSize; // Best size to enter values with units in wxTextCtrl wxSize m_numericFieldsSize; // Best size to enter double values in wxTextCtrl diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 6742f83ea8..495b76312f 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -64,7 +64,7 @@ public: BOARD_ITEM( nullptr, NOT_USED ) {} - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override { return _( "(Deleted Item)" ); } @@ -670,7 +670,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem ) } -wxString BOARD::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString BOARD::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "PCB" ) ); } @@ -815,7 +815,7 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const } -void BOARD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void BOARD::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString txt; int viasCount = 0; @@ -1519,32 +1519,32 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer return NULL; } -std::list BOARD::GetZoneList( bool aIncludeZonesInFootprints ) -{ - std::list zones; - - for( int ii = 0; ii < GetAreaCount(); ii++ ) - { - zones.push_back( GetArea( ii ) ); - } - - if( aIncludeZonesInFootprints ) - { - for( MODULE* mod : m_modules ) - { - for( MODULE_ZONE_CONTAINER* zone : mod->Zones() ) - { - zones.push_back( zone ); - } - } - } - - return zones; -} - +std::list BOARD::GetZoneList( bool aIncludeZonesInFootprints ) +{ + std::list zones; -ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, - PCB_LAYER_ID aLayer, wxPoint aStartPointPosition, int aHatch ) + for( int ii = 0; ii < GetAreaCount(); ii++ ) + { + zones.push_back( GetArea( ii ) ); + } + + if( aIncludeZonesInFootprints ) + { + for( MODULE* mod : m_modules ) + { + for( MODULE_ZONE_CONTAINER* zone : mod->Zones() ) + { + zones.push_back( zone ); + } + } + } + + return zones; +} + + +ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, + wxPoint aStartPointPosition, ZONE_HATCH_STYLE aHatch ) { ZONE_CONTAINER* new_area = InsertArea( aNetcode, m_ZoneDescriptorList.size( ) - 1, @@ -1579,8 +1579,8 @@ void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to } -ZONE_CONTAINER* BOARD::InsertArea( int aNetcode, int aAreaIdx, PCB_LAYER_ID aLayer, - int aCornerX, int aCornerY, int aHatch ) +ZONE_CONTAINER* BOARD::InsertArea( int aNetcode, int aAreaIdx, PCB_LAYER_ID aLayer, int aCornerX, + int aCornerY, ZONE_HATCH_STYLE aHatch ) { ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this ); @@ -1593,7 +1593,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int aNetcode, int aAreaIdx, PCB_LAYER_ID aLay else m_ZoneDescriptorList.push_back( new_area ); - new_area->SetHatchStyle( (ZONE_CONTAINER::HATCH_STYLE) aHatch ); + new_area->SetHatchStyle( (ZONE_HATCH_STYLE) aHatch ); // Add the first corner to the new zone new_area->AppendCorner( wxPoint( aCornerX, aCornerY ), -1 ); diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 34c19a181d..450e4d420c 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -552,7 +552,7 @@ public: TITLE_BLOCK& GetTitleBlock() { return m_titles; } void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; /** * Function GetColorSettings @@ -794,7 +794,7 @@ public: return ComputeBoundingBox( true ); } - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; /** * Function Print. @@ -964,8 +964,8 @@ public: * @param aHatch = hatch option * @return a reference to the new area */ - ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, - PCB_LAYER_ID aLayer, wxPoint aStartPointPosition, int aHatch ); + ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, PCB_LAYER_ID aLayer, + wxPoint aStartPointPosition, ZONE_HATCH_STYLE aHatch ); /** * Add a copper area to net, inserting after m_ZoneDescriptorList[aAreaIdx] @@ -977,8 +977,8 @@ public: * @param aHatch is the hatch option * @return pointer to the new area */ - ZONE_CONTAINER* InsertArea( int aNetcode, int aAreaIdx, PCB_LAYER_ID aLayer, - int aCornerX, int aCornerY, int aHatch ); + ZONE_CONTAINER* InsertArea( int aNetcode, int aAreaIdx, PCB_LAYER_ID aLayer, int aCornerX, + int aCornerY, ZONE_HATCH_STYLE aHatch ); /** * Function NormalizeAreaPolygon diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index b28acdad66..f4f11d5601 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -39,14 +39,14 @@ #include -DIMENSION::DIMENSION( BOARD_ITEM* aParent ) : - BOARD_ITEM( aParent, PCB_DIMENSION_T ), - m_Width( Millimeter2iu( 0.2 ) ), - m_Unit( INCHES ), - m_UseMils( false ), - m_Value( 0 ), - m_Height( 0 ), - m_Text( this ) +DIMENSION::DIMENSION( BOARD_ITEM* aParent ) + : BOARD_ITEM( aParent, PCB_DIMENSION_T ), + m_Width( Millimeter2iu( 0.2 ) ), + m_Unit( EDA_UNITS::INCHES ), + m_UseMils( false ), + m_Value( 0 ), + m_Height( 0 ), + m_Text( this ) { m_Layer = Dwgs_User; m_Shape = 0; @@ -336,7 +336,7 @@ void DIMENSION::AdjustDimensionDetails( int aPrecision ) m_Value = measure; - if( m_Unit == MILLIMETRES ) + if( m_Unit == EDA_UNITS::MILLIMETRES ) aPrecision += 2; else if( !m_UseMils ) aPrecision += 3; @@ -390,7 +390,7 @@ void DIMENSION::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset ) // see class_cotation.h -void DIMENSION::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void DIMENSION::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { // for now, display only the text within the DIMENSION using class TEXTE_PCB. m_Text.GetMsgPanelInfo( aUnits, aList ); @@ -496,7 +496,7 @@ const EDA_RECT DIMENSION::GetBoundingBox() const } -wxString DIMENSION::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString DIMENSION::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Dimension \"%s\" on %s" ), GetText(), GetLayerName() ); } diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index b496d57d91..1a41073f8c 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -62,7 +62,7 @@ class DIMENSION : public BOARD_ITEM { int m_Width; ///< Line width int m_Shape; ///< Currently always 0. - EDA_UNITS_T m_Unit; ///< 0 = inches, 1 = mm + EDA_UNITS m_Unit; ///< 0 = inches, 1 = mm bool m_UseMils; ///< If inches, use mils. int m_Value; ///< value of PCB dimensions. int m_Height; ///< length of feature lines @@ -185,13 +185,13 @@ public: */ void AdjustDimensionDetails( int aPrecision ); - void GetUnits( EDA_UNITS_T& aUnits, bool& aUseMils ) const + void GetUnits( EDA_UNITS& aUnits, bool& aUseMils ) const { aUnits = m_Unit; aUseMils = m_UseMils; } - void SetUnits( EDA_UNITS_T aUnits, bool aUseMils ) + void SetUnits( EDA_UNITS aUnits, bool aUseMils ) { m_Unit = aUnits; m_UseMils = aUseMils; @@ -222,7 +222,7 @@ public: */ void Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight = false ); - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; @@ -235,7 +235,7 @@ public: // Virtual function const EDA_RECT GetBoundingBox() const override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 615999684d..ccde82f9cf 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -446,7 +446,7 @@ void DRAWSEGMENT::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& aOffse } -void DRAWSEGMENT::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void DRAWSEGMENT::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; @@ -835,7 +835,7 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy } -wxString DRAWSEGMENT::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString DRAWSEGMENT::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Pcb Graphic %s, length %s on %s" ), ShowShape( m_Shape ), diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index 07e2051e65..2a4d8c1ef8 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -214,7 +214,7 @@ public: void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& aOffset = ZeroOffset ) override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; const EDA_RECT GetBoundingBox() const override; @@ -253,7 +253,7 @@ public: void TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue, int aError = ARC_HIGH_DEF, bool ignoreLineWidth = false ) const override; - virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + virtual wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; virtual BITMAP_DEF GetMenuImage() const override; diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 8d940c1562..3f867cd83b 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -238,7 +238,7 @@ void EDGE_MODULE::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset // see class_edge_mod.h -void EDGE_MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void EDGE_MODULE::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; @@ -259,8 +259,7 @@ void EDGE_MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_IT } - -wxString EDGE_MODULE::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString EDGE_MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Graphic %s of %s on %s" ), ShowShape( m_Shape ), diff --git a/pcbnew/class_edge_mod.h b/pcbnew/class_edge_mod.h index a49ddf063b..a427e42cca 100644 --- a/pcbnew/class_edge_mod.h +++ b/pcbnew/class_edge_mod.h @@ -119,14 +119,14 @@ public: void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; wxString GetClass() const override { return wxT( "MGRAPHIC" ); } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/pcbnew/class_marker_pcb.cpp b/pcbnew/class_marker_pcb.cpp index 8e13aa7930..ab7836d190 100644 --- a/pcbnew/class_marker_pcb.cpp +++ b/pcbnew/class_marker_pcb.cpp @@ -50,11 +50,11 @@ MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) : } -MARKER_PCB::MARKER_PCB( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos, - BOARD_ITEM* aItem, const wxPoint& aPos, - BOARD_ITEM* bItem, const wxPoint& bPos ) : - BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add() - MARKER_BASE( aUnits, aErrorCode, aMarkerPos, aItem, aPos, bItem, bPos, SCALING_FACTOR ), m_item( nullptr ) +MARKER_PCB::MARKER_PCB( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, + BOARD_ITEM* aItem, const wxPoint& aPos, BOARD_ITEM* bItem, const wxPoint& bPos ) + : BOARD_ITEM( nullptr, PCB_MARKER_T ), // parent set during BOARD::Add() + MARKER_BASE( aUnits, aErrorCode, aMarkerPos, aItem, aPos, bItem, bPos, SCALING_FACTOR ), + m_item( nullptr ) { m_Color = WHITE; } @@ -87,7 +87,7 @@ bool MARKER_PCB::IsOnLayer( PCB_LAYER_ID aLayer ) const return IsCopperLayer( aLayer ); } -void MARKER_PCB::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void MARKER_PCB::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString errorTxt, txtA, txtB; @@ -121,7 +121,7 @@ void MARKER_PCB::Flip(const wxPoint& aCentre, bool aFlipLeftRight ) } -wxString MARKER_PCB::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString MARKER_PCB::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Marker @(%s, %s)" ), MessageTextFromValue( aUnits, m_Pos.x ), diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h index 0abfe3c39e..0f56e667a8 100644 --- a/pcbnew/class_marker_pcb.h +++ b/pcbnew/class_marker_pcb.h @@ -55,9 +55,8 @@ public: * @param bItem The second of the two conflicting objects * @param bPos The position of the second of two objects */ - MARKER_PCB( EDA_UNITS_T aUnits, int aErrorCode, const wxPoint& aMarkerPos, - BOARD_ITEM* aItem, const wxPoint& aPos, - BOARD_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() ); + MARKER_PCB( EDA_UNITS aUnits, int aErrorCode, const wxPoint& aMarkerPos, BOARD_ITEM* aItem, + const wxPoint& aPos, BOARD_ITEM* bItem = nullptr, const wxPoint& bPos = wxPoint() ); /** * Constructor @@ -103,14 +102,14 @@ public: bool IsOnLayer( PCB_LAYER_ID aLayer ) const override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override - { - return BOARD_ITEM::Matches( m_drc.GetErrorText(), aSearchData ); - } + { + return BOARD_ITEM::Matches( m_drc.GetErrorText(), aSearchData ); + } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 5d44695fdd..433e6b3881 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -556,7 +556,7 @@ SHAPE_POLY_SET MODULE::GetBoundingPoly() const } -void MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void MODULE::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; @@ -879,7 +879,7 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T } -wxString MODULE::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const { wxString reference = GetReference(); diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 91c39ba88c..e04fe8574c 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -408,7 +408,7 @@ public: SHAPE_POLY_SET& aCornerBuffer, int aInflateValue, int aError = ARC_HIGH_DEF ) const; ///> @copydoc EDA_ITEM::GetMsgPanelInfo - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; @@ -575,7 +575,7 @@ public: return wxT( "MODULE" ); } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 534352b6e2..b0d6f4d4c8 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -747,7 +747,7 @@ int D_PAD::GetThermalGap() const } -void D_PAD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM>& aList ) +void D_PAD::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { MODULE* module; wxString msg; @@ -1263,7 +1263,7 @@ wxString D_PAD::ShowPadAttr() const } -wxString D_PAD::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString D_PAD::GetSelectMenuText( EDA_UNITS aUnits ) const { if( GetName().IsEmpty() ) { diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 3125ebed18..03e3c48ff9 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -726,7 +726,7 @@ public: int GetSubRatsnest() const { return m_SubRatsnest; } void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; } - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; bool IsOnLayer( PCB_LAYER_ID aLayer ) const override { @@ -766,7 +766,7 @@ public: void Rotate( const wxPoint& aRotCentre, double aAngle ) override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/pcbnew/class_pcb_target.cpp b/pcbnew/class_pcb_target.cpp index 3fdb3943f8..464e73ef35 100644 --- a/pcbnew/class_pcb_target.cpp +++ b/pcbnew/class_pcb_target.cpp @@ -181,7 +181,7 @@ const EDA_RECT PCB_TARGET::GetBoundingBox() const } -wxString PCB_TARGET::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString PCB_TARGET::GetSelectMenuText( EDA_UNITS aUnits ) const { // Targets are on *every* layer by definition return wxString::Format( _( "Target size %s" ), MessageTextFromValue( aUnits, m_Size ) ); diff --git a/pcbnew/class_pcb_target.h b/pcbnew/class_pcb_target.h index fca9829111..689232e383 100644 --- a/pcbnew/class_pcb_target.h +++ b/pcbnew/class_pcb_target.h @@ -96,7 +96,7 @@ public: // Virtual function const EDA_RECT GetBoundingBox() const override; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index cf4a27eaee..55f0a5e098 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -82,7 +82,7 @@ void TEXTE_PCB::Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset ) } -void TEXTE_PCB::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void TEXTE_PCB::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; @@ -158,7 +158,7 @@ void TEXTE_PCB::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) } -wxString TEXTE_PCB::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString TEXTE_PCB::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Pcb Text \"%s\" on %s"), ShortenedShownText(), GetLayerName() ); } diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index eafb7d3d58..9ddcff1f6c 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -81,7 +81,7 @@ public: void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; bool HitTest( const wxPoint& aPosition, int aAccuracy ) const override { @@ -113,7 +113,7 @@ public: void TransformShapeWithClearanceToPolygonSet( SHAPE_POLY_SET& aCornerBuffer, int aClearanceValue, int aError = ARC_HIGH_DEF ) const; - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 64baf4c30e..44e0a533a0 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -335,7 +335,7 @@ double TEXTE_MODULE::GetDrawRotation() const // see class_text_mod.h -void TEXTE_MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void TEXTE_MODULE::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { MODULE* module = (MODULE*) m_Parent; @@ -389,7 +389,7 @@ void TEXTE_MODULE::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_I } -wxString TEXTE_MODULE::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString TEXTE_MODULE::GetSelectMenuText( EDA_UNITS aUnits ) const { switch( m_Type ) { diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 0775678e6a..a4aaa72830 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -190,7 +190,7 @@ public: */ void Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset = ZeroOffset ) override; - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; bool TextHitTest( const wxPoint& aPoint, int aAccuracy = 0 ) const override; bool TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy = 0 ) const override; @@ -210,7 +210,7 @@ public: return wxT( "MTEXT" ); } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index f9866ae131..943a125cf4 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -86,7 +86,7 @@ EDA_ITEM* VIA::Clone() const } -wxString VIA::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString VIA::GetSelectMenuText( EDA_UNITS aUnits ) const { wxString format; BOARD* board = GetBoard(); @@ -773,7 +773,7 @@ unsigned int VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const // see class_track.h -void TRACK::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void TRACK::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; BOARD* board = GetBoard(); @@ -823,7 +823,7 @@ void TRACK::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& } } -void TRACK::GetMsgPanelInfoBase_Common( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void TRACK::GetMsgPanelInfoBase_Common( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; @@ -883,7 +883,8 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_UNITS_T aUnits, std::vector< MSG_PAN aList.emplace_back( _( "Status" ), msg, MAGENTA ); } -void TRACK::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) + +void TRACK::GetMsgPanelInfoBase( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; BOARD* board = GetBoard(); @@ -910,7 +911,8 @@ void TRACK::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM aList.emplace_back( _( "Segment Length" ), msg, DARKCYAN ); } -void VIA::GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) + +void VIA::GetMsgPanelInfoBase( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; BOARD* board = GetBoard(); @@ -1000,6 +1002,7 @@ bool TRACK::HitTest( const wxPoint& aPosition, int aAccuracy ) const return TestSegmentHit( aPosition, m_Start, m_End, aAccuracy + ( m_Width / 2 ) ); } + bool VIA::HitTest( const wxPoint& aPosition, int aAccuracy ) const { int max_dist = aAccuracy + ( m_Width / 2 ); @@ -1024,6 +1027,7 @@ bool TRACK::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) con return arect.Intersects( GetStart(), GetEnd() ); } + bool VIA::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const { EDA_RECT box; @@ -1044,7 +1048,7 @@ bool VIA::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const } -wxString TRACK::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString TRACK::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _("Track %s %s on %s, length: %s" ), MessageTextFromValue( aUnits, m_Width ), diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index ac71dc078b..09adf52887 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -184,7 +184,7 @@ public: return ( Type() == PCB_VIA_T ) || ( m_Start == m_End ); } - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; @@ -214,7 +214,7 @@ public: */ virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const override; - virtual wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + virtual wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; @@ -254,10 +254,10 @@ protected: * Display info about the track segment only, and does not calculate the full track length * @param aList A list of #MSG_PANEL_ITEM objects to add status information. */ - virtual void GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ); + virtual void GetMsgPanelInfoBase( EDA_UNITS aUnits, std::vector& aList ); - void GetMsgPanelInfoBase_Common( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ); + void GetMsgPanelInfoBase_Common( EDA_UNITS aUnits, std::vector& aList ); int m_Width; ///< Thickness of track, or via diameter @@ -327,7 +327,7 @@ public: return wxT( "VIA" ); } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; @@ -383,7 +383,7 @@ public: virtual void SwapData( BOARD_ITEM* aImage ) override; protected: - void GetMsgPanelInfoBase( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfoBase( EDA_UNITS aUnits, std::vector& aList ) override; private: /// The bottom layer of the via (the top layer is in m_Layer) diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 4c8b6fc3fc..43ad0d9af7 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -47,8 +47,8 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent, bool aInModule ) { m_CornerSelection = nullptr; // no corner is selected m_IsFilled = false; // fill status : true when the zone is filled - m_FillMode = ZFM_POLYGONS; - m_hatchStyle = DIAGONAL_EDGE; + m_FillMode = ZONE_FILL_MODE::POLYGONS; + m_hatchStyle = ZONE_HATCH_STYLE::DIAGONAL_EDGE; m_hatchPitch = GetDefaultHatchPitch(); m_hv45 = false; m_HatchFillTypeThickness = 0; @@ -677,7 +677,7 @@ bool ZONE_CONTAINER::HitTestFilledArea( const wxPoint& aRefPos ) const } -void ZONE_CONTAINER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void ZONE_CONTAINER::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString msg; @@ -742,9 +742,9 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL switch( m_FillMode ) { - case ZFM_POLYGONS: + case ZONE_FILL_MODE::POLYGONS: msg = _( "Solid" ); break; - case ZFM_HATCH_PATTERN: + case ZONE_FILL_MODE::HATCH_PATTERN: msg = _( "Hatched" ); break; default: msg = _( "Unknown" ); break; @@ -931,7 +931,7 @@ bool ZONE_CONTAINER::AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowD } -wxString ZONE_CONTAINER::GetSelectMenuText( EDA_UNITS_T aUnits ) const +wxString ZONE_CONTAINER::GetSelectMenuText( EDA_UNITS aUnits ) const { wxString text; @@ -954,10 +954,10 @@ int ZONE_CONTAINER::GetHatchPitch() const } -void ZONE_CONTAINER::SetHatch( int aHatchStyle, int aHatchPitch, bool aRebuildHatch ) +void ZONE_CONTAINER::SetHatch( ZONE_HATCH_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch ) { SetHatchPitch( aHatchPitch ); - m_hatchStyle = (ZONE_CONTAINER::HATCH_STYLE) aHatchStyle; + m_hatchStyle = aHatchStyle; if( aRebuildHatch ) Hatch(); @@ -988,7 +988,7 @@ void ZONE_CONTAINER::Hatch() { UnHatch(); - if( m_hatchStyle == NO_HATCH || m_hatchPitch == 0 || m_Poly->IsEmpty() ) + if( m_hatchStyle == ZONE_HATCH_STYLE::NO_HATCH || m_hatchPitch == 0 || m_Poly->IsEmpty() ) return; // define range for hatch lines @@ -1015,7 +1015,7 @@ void ZONE_CONTAINER::Hatch() // Calculate spacing between 2 hatch lines int spacing; - if( m_hatchStyle == DIAGONAL_EDGE ) + if( m_hatchStyle == ZONE_HATCH_STYLE::DIAGONAL_EDGE ) spacing = m_hatchPitch; else spacing = m_hatchPitch * 2; @@ -1118,7 +1118,8 @@ void ZONE_CONTAINER::Hatch() // Push only one line for diagonal hatch, // or for small lines < twice the line length // else push 2 small lines - if( m_hatchStyle == DIAGONAL_FULL || std::abs( dx ) < 2 * hatch_line_len ) + if( m_hatchStyle == ZONE_HATCH_STYLE::DIAGONAL_FULL + || std::abs( dx ) < 2 * hatch_line_len ) { m_HatchLines.emplace_back( SEG( pointbuffer[ip], pointbuffer[ip + 1] ) ); } diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 744d396ada..4a0cddc220 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -61,9 +61,6 @@ class ZONE_CONTAINER : public BOARD_CONNECTED_ITEM { public: - /// Zone hatch styles - typedef enum HATCH_STYLE { NO_HATCH, DIAGONAL_FULL, DIAGONAL_EDGE } HATCH_STYLE; - /** * The ctor to build ZONE_CONTAINER, but comaptible with MODULE_ZONE_CONTAINER * requirement. @@ -102,7 +99,7 @@ public: */ unsigned GetPriority() const { return m_priority; } - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; void SetLayerSet( LSET aLayerSet ); @@ -516,12 +513,12 @@ public: */ bool AppendCorner( wxPoint aPosition, int aHoleIdx, bool aAllowDuplication = false ); - HATCH_STYLE GetHatchStyle() const + ZONE_HATCH_STYLE GetHatchStyle() const { return m_hatchStyle; } - void SetHatchStyle( HATCH_STYLE aStyle ) + void SetHatchStyle( ZONE_HATCH_STYLE aStyle ) { m_hatchStyle = aStyle; } @@ -618,7 +615,7 @@ public: return m_RawPolysList; } - wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override; + wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; BITMAP_DEF GetMenuImage() const override; @@ -662,7 +659,7 @@ public: * @param aRebuildHatch is a flag to indicate whether to re-hatch after having set the * previous parameters. */ - void SetHatch( int aHatchStyle, int aHatchPitch, bool aRebuildHatch ); + void SetHatch( ZONE_HATCH_STYLE aHatchStyle, int aHatchPitch, bool aRebuildHatch ); /** * Function SetHatchPitch @@ -761,8 +758,8 @@ protected: /** How to fill areas: - * ZFM_POLYGONS => use solid polygons - * ZFM_HATCH_PATTERN => use a grid pattern as shape + * ZONE_FILL_MODE::POLYGONS => use solid polygons + * ZONE_FILL_MODE::HATCH_PATTERN => use a grid pattern as shape */ ZONE_FILL_MODE m_FillMode; @@ -807,7 +804,7 @@ protected: MD5_HASH m_filledPolysHash; // A hash value used in zone filling calculations // to see if the filled areas are up to date - HATCH_STYLE m_hatchStyle; // hatch style, see enum above + ZONE_HATCH_STYLE m_hatchStyle; // hatch style, see enum above int m_hatchPitch; // for DIAGONAL_EDGE, distance between 2 hatch lines std::vector m_HatchLines; // hatch lines std::vector m_insulatedIslands; diff --git a/pcbnew/convert_drawsegment_list_to_polygon.cpp b/pcbnew/convert_drawsegment_list_to_polygon.cpp index 55083a6d92..a60fa37801 100644 --- a/pcbnew/convert_drawsegment_list_to_polygon.cpp +++ b/pcbnew/convert_drawsegment_list_to_polygon.cpp @@ -481,8 +481,8 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SE if( aErrorText ) { msg.Printf( _( "Unable to find segment with an endpoint of (%s, %s)." ), - StringFromValue( MILLIMETRES, prevPt.x, true ), - StringFromValue( MILLIMETRES, prevPt.y, true ) ); + StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.x, true ), + StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.y, true ) ); *aErrorText << msg << "\n"; } @@ -683,8 +683,8 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SE if( aErrorText ) { msg.Printf( _( "Unable to find segment with an endpoint of (%s, %s)." ), - StringFromValue( MILLIMETRES, prevPt.x, true ), - StringFromValue( MILLIMETRES, prevPt.y, true ) ); + StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.x, true ), + StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.y, true ) ); *aErrorText << msg << "\n"; } diff --git a/pcbnew/dialogs/dialog_board_statistics.cpp b/pcbnew/dialogs/dialog_board_statistics.cpp index 2e4b044278..6bd0eab9d2 100644 --- a/pcbnew/dialogs/dialog_board_statistics.cpp +++ b/pcbnew/dialogs/dialog_board_statistics.cpp @@ -339,7 +339,7 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB() } } - if( GetUserUnits() == INCHES ) + if( GetUserUnits() == EDA_UNITS::INCHES ) m_boardArea /= ( IU_PER_MILS * IU_PER_MILS * 1000000 ); else m_boardArea /= ( IU_PER_MM * IU_PER_MM ); diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 3521359655..e2e2035a90 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -144,9 +144,15 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow() switch( m_settings.m_Zone_HatchingStyle ) { - case ZONE_CONTAINER::NO_HATCH: m_OutlineAppearanceCtrl->SetSelection( 0 ); break; - case ZONE_CONTAINER::DIAGONAL_EDGE: m_OutlineAppearanceCtrl->SetSelection( 1 ); break; - case ZONE_CONTAINER::DIAGONAL_FULL: m_OutlineAppearanceCtrl->SetSelection( 2 ); break; + case ZONE_HATCH_STYLE::NO_HATCH: + m_OutlineAppearanceCtrl->SetSelection( 0 ); + break; + case ZONE_HATCH_STYLE::DIAGONAL_EDGE: + m_OutlineAppearanceCtrl->SetSelection( 1 ); + break; + case ZONE_HATCH_STYLE::DIAGONAL_FULL: + m_OutlineAppearanceCtrl->SetSelection( 2 ); + break; } m_clearance.SetValue( m_settings.m_ZoneClearance ); @@ -190,13 +196,13 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow() switch( m_settings.m_FillMode ) { - case ZFM_HATCH_PATTERN: + case ZONE_FILL_MODE::HATCH_PATTERN: m_GridStyleCtrl->SetSelection( 1 ); break; default: m_GridStyleCtrl->SetSelection( 0 ); break; } - m_gridStyleRotation.SetUnits( DEGREES ); + m_gridStyleRotation.SetUnits( EDA_UNITS::DEGREES ); m_gridStyleRotation.SetValue( m_settings.m_HatchFillTypeOrientation*10 ); // IU is decidegree // Gives a reasonable value to grid style parameters, if currently there are no defined @@ -264,9 +270,9 @@ bool DIALOG_COPPER_ZONE::TransferDataFromWindow() m_netNameShowFilter = m_ShowNetNameFilter->GetValue(); if( m_GridStyleCtrl->GetSelection() > 0 ) - m_settings.m_FillMode = ZFM_HATCH_PATTERN; + m_settings.m_FillMode = ZONE_FILL_MODE::HATCH_PATTERN; else - m_settings.m_FillMode = ZFM_POLYGONS; + m_settings.m_FillMode = ZONE_FILL_MODE::POLYGONS; if( !AcceptOptions() ) return false; @@ -304,7 +310,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly ) m_gridStyleRotation.SetValue( NormalizeAngle180( m_gridStyleRotation.GetValue() ) ); - if( m_settings.m_FillMode == ZFM_HATCH_PATTERN ) + if( m_settings.m_FillMode == ZONE_FILL_MODE::HATCH_PATTERN ) { int minThickness = m_minWidth.GetValue(); @@ -325,9 +331,15 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly ) switch( m_OutlineAppearanceCtrl->GetSelection() ) { - case 0: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH; break; - case 1: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; break; - case 2: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; break; + case 0: + m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::NO_HATCH; + break; + case 1: + m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_EDGE; + break; + case 2: + m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_FULL; + break; } if( m_Config ) diff --git a/pcbnew/dialogs/dialog_create_array.cpp b/pcbnew/dialogs/dialog_create_array.cpp index f157e24255..403ac8c480 100644 --- a/pcbnew/dialogs/dialog_create_array.cpp +++ b/pcbnew/dialogs/dialog_create_array.cpp @@ -167,7 +167,7 @@ DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent, m_choiceSecAxisNumbering->SetSelection( 0 ); m_choiceCircNumbering->SetSelection( 0 ); - m_circAngle.SetUnits( EDA_UNITS_T::DEGREES ); + m_circAngle.SetUnits( EDA_UNITS::DEGREES ); // bind grid options to persister m_cfg_persister.Add( *m_entryNx, saved_array_options.m_gridNx ); @@ -377,7 +377,8 @@ bool DIALOG_CREATE_ARRAY::TransferDataFromWindow() newCirc->m_centre.x = m_hCentre.GetValue(); newCirc->m_centre.y = m_vCentre.GetValue(); - newCirc->m_angle = DoubleValueFromString( DEGREES, m_entryCircAngle->GetValue() ); + newCirc->m_angle = + DoubleValueFromString( EDA_UNITS::DEGREES, m_entryCircAngle->GetValue() ); ok = ok && validateLongEntry(*m_entryCircCount, newCirc->m_nPts, _("point count"), errors); diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 813020ffe0..383264e85d 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -569,7 +569,7 @@ bool DIALOG_DRC_CONTROL::writeReport( const wxString& aFullFileName ) return false; int count; - EDA_UNITS_T units = GetUserUnits(); + EDA_UNITS units = GetUserUnits(); fprintf( fp, "** Drc report for %s **\n", TO_UTF8( m_brdEditor->GetBoard()->GetFileName() ) ); diff --git a/pcbnew/dialogs/dialog_drclistbox.h b/pcbnew/dialogs/dialog_drclistbox.h index 358686fb3d..e87fc645b1 100644 --- a/pcbnew/dialogs/dialog_drclistbox.h +++ b/pcbnew/dialogs/dialog_drclistbox.h @@ -177,7 +177,7 @@ public: class DRCLISTBOX : public wxHtmlListBox { private: - EDA_UNITS_T m_units; + EDA_UNITS m_units; DRC_ITEM_LIST* m_list; ///< wxHtmlListBox does not own the list, I do public: @@ -186,7 +186,7 @@ public: long style = 0, const wxString choices[] = NULL, int unused = 0) : wxHtmlListBox( parent, id, pos, size, style ) { - m_units = MILLIMETRES; + m_units = EDA_UNITS::MILLIMETRES; m_list = 0; } @@ -204,7 +204,7 @@ public: * @param aList The DRC_ITEM_LIST* containing the DRC_ITEMs which will be * displayed in the wxHtmlListBox */ - void SetList( EDA_UNITS_T aUnits, DRC_ITEM_LIST* aList ) + void SetList( EDA_UNITS aUnits, DRC_ITEM_LIST* aList ) { delete m_list; diff --git a/pcbnew/dialogs/dialog_export_idf.cpp b/pcbnew/dialogs/dialog_export_idf.cpp index a9c92ff247..7034446f17 100644 --- a/pcbnew/dialogs/dialog_export_idf.cpp +++ b/pcbnew/dialogs/dialog_export_idf.cpp @@ -120,12 +120,12 @@ public: double GetXRef() { - return DoubleValueFromString( UNSCALED_UNITS, m_IDF_Xref->GetValue() ); + return DoubleValueFromString( EDA_UNITS::UNSCALED, m_IDF_Xref->GetValue() ); } double GetYRef() { - return DoubleValueFromString( UNSCALED_UNITS, m_IDF_Yref->GetValue() ); + return DoubleValueFromString( EDA_UNITS::UNSCALED, m_IDF_Yref->GetValue() ); } bool GetAutoAdjustOffset() diff --git a/pcbnew/dialogs/dialog_export_step.cpp b/pcbnew/dialogs/dialog_export_step.cpp index 3312c35f3a..78d784a846 100644 --- a/pcbnew/dialogs/dialog_export_step.cpp +++ b/pcbnew/dialogs/dialog_export_step.cpp @@ -77,12 +77,12 @@ protected: double GetXOrg() const { - return DoubleValueFromString( UNSCALED_UNITS, m_STEP_Xorg->GetValue() ); + return DoubleValueFromString( EDA_UNITS::UNSCALED, m_STEP_Xorg->GetValue() ); } double GetYOrg() { - return DoubleValueFromString( UNSCALED_UNITS, m_STEP_Yorg->GetValue() ); + return DoubleValueFromString( EDA_UNITS::UNSCALED, m_STEP_Yorg->GetValue() ); } STEP_ORG_OPT GetOriginOption(); diff --git a/pcbnew/dialogs/dialog_export_vrml.cpp b/pcbnew/dialogs/dialog_export_vrml.cpp index e387c41ac8..0a665f6313 100644 --- a/pcbnew/dialogs/dialog_export_vrml.cpp +++ b/pcbnew/dialogs/dialog_export_vrml.cpp @@ -130,12 +130,12 @@ public: double GetXRef() { - return DoubleValueFromString( UNSCALED_UNITS, m_VRML_Xref->GetValue() ); + return DoubleValueFromString( EDA_UNITS::UNSCALED, m_VRML_Xref->GetValue() ); } double GetYRef() { - return DoubleValueFromString( UNSCALED_UNITS, m_VRML_Yref->GetValue() ); + return DoubleValueFromString( EDA_UNITS::UNSCALED, m_VRML_Yref->GetValue() ); } int GetUnits() diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 3f1d82411e..b3fc7172c2 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -101,7 +101,7 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR m_item = dynamic_cast( aItem ); m_moduleItem = dynamic_cast( aItem ); - m_angle.SetUnits( DEGREES ); + m_angle.SetUnits( EDA_UNITS::DEGREES ); m_AngleValidator.SetRange( -360.0, 360.0 ); m_angleCtrl->SetValidator( m_AngleValidator ); m_AngleValidator.SetWindow( m_angleCtrl ); diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp index 1e66b4a082..06f1413320 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp @@ -98,9 +98,15 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataToWindow() switch( m_zonesettings.m_Zone_HatchingStyle ) { - case ZONE_CONTAINER::NO_HATCH: m_OutlineAppearanceCtrl->SetSelection( 0 ); break; - case ZONE_CONTAINER::DIAGONAL_EDGE: m_OutlineAppearanceCtrl->SetSelection( 1 ); break; - case ZONE_CONTAINER::DIAGONAL_FULL: m_OutlineAppearanceCtrl->SetSelection( 2 ); break; + case ZONE_HATCH_STYLE::NO_HATCH: + m_OutlineAppearanceCtrl->SetSelection( 0 ); + break; + case ZONE_HATCH_STYLE::DIAGONAL_EDGE: + m_OutlineAppearanceCtrl->SetSelection( 1 ); + break; + case ZONE_HATCH_STYLE::DIAGONAL_FULL: + m_OutlineAppearanceCtrl->SetSelection( 2 ); + break; } SetInitialFocus( m_OutlineAppearanceCtrl ); @@ -159,9 +165,15 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataFromWindow() switch( m_OutlineAppearanceCtrl->GetSelection() ) { - case 0: m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH; break; - case 1: m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; break; - case 2: m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; break; + case 0: + m_zonesettings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::NO_HATCH; + break; + case 1: + m_zonesettings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_EDGE; + break; + case 2: + m_zonesettings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_FULL; + break; } if( m_config ) diff --git a/pcbnew/dialogs/dialog_move_exact.cpp b/pcbnew/dialogs/dialog_move_exact.cpp index 7b5aa2becb..686df99746 100644 --- a/pcbnew/dialogs/dialog_move_exact.cpp +++ b/pcbnew/dialogs/dialog_move_exact.cpp @@ -68,7 +68,7 @@ DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, wxPoint& aTransla m_moveX.SetValue( m_options.entry1 ); m_moveY.SetValue( m_options.entry2 ); - m_rotate.SetUnits( DEGREES ); + m_rotate.SetUnits( EDA_UNITS::DEGREES ); m_rotate.SetValue( m_options.entryRotation ); m_anchorOptions->SetSelection( std::min( m_options.entryAnchorSelection, m_menuIDs.size() ) ); @@ -175,7 +175,7 @@ void DIALOG_MOVE_EXACT::updateDialogControls( bool aPolar ) { m_moveX.SetLabel( _( "Distance:" ) ); // Polar radius m_moveY.SetLabel( _( "Angle:" ) ); // Polar theta or angle - m_moveY.SetUnits( DEGREES ); + m_moveY.SetUnits( EDA_UNITS::DEGREES ); } else { diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp index 36632bc8a9..efb5b5baf6 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp @@ -121,22 +121,28 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow() switch( m_settings.m_Zone_HatchingStyle ) { - case ZONE_CONTAINER::NO_HATCH: m_OutlineAppearanceCtrl->SetSelection( 0 ); break; - case ZONE_CONTAINER::DIAGONAL_EDGE: m_OutlineAppearanceCtrl->SetSelection( 1 ); break; - case ZONE_CONTAINER::DIAGONAL_FULL: m_OutlineAppearanceCtrl->SetSelection( 2 ); break; + case ZONE_HATCH_STYLE::NO_HATCH: + m_OutlineAppearanceCtrl->SetSelection( 0 ); + break; + case ZONE_HATCH_STYLE::DIAGONAL_EDGE: + m_OutlineAppearanceCtrl->SetSelection( 1 ); + break; + case ZONE_HATCH_STYLE::DIAGONAL_FULL: + m_OutlineAppearanceCtrl->SetSelection( 2 ); + break; } SetInitialFocus( m_OutlineAppearanceCtrl ); switch( m_settings.m_FillMode ) { - case ZFM_HATCH_PATTERN: + case ZONE_FILL_MODE::HATCH_PATTERN: m_GridStyleCtrl->SetSelection( 1 ); break; default: m_GridStyleCtrl->SetSelection( 0 ); break; } - m_gridStyleRotation.SetUnits( DEGREES ); + m_gridStyleRotation.SetUnits( EDA_UNITS::DEGREES ); m_gridStyleRotation.SetValue( m_settings.m_HatchFillTypeOrientation*10 ); // IU is decidegree // Gives a reasonable value to grid style parameters, if currently there are no defined @@ -218,18 +224,24 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow() switch( m_OutlineAppearanceCtrl->GetSelection() ) { - case 0: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH; break; - case 1: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; break; - case 2: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; break; + case 0: + m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::NO_HATCH; + break; + case 1: + m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_EDGE; + break; + case 2: + m_settings.m_Zone_HatchingStyle = ZONE_HATCH_STYLE::DIAGONAL_FULL; + break; } if( m_GridStyleCtrl->GetSelection() > 0 ) - m_settings.m_FillMode = ZFM_HATCH_PATTERN; + m_settings.m_FillMode = ZONE_FILL_MODE::HATCH_PATTERN; else - m_settings.m_FillMode = ZFM_POLYGONS; + m_settings.m_FillMode = ZONE_FILL_MODE::POLYGONS; - if( m_settings.m_FillMode == ZFM_HATCH_PATTERN ) + if( m_settings.m_FillMode == ZONE_FILL_MODE::HATCH_PATTERN ) { int minThickness = m_minWidth.GetValue(); diff --git a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp index b15d9caed6..f6a97ee3fa 100644 --- a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp @@ -120,7 +120,7 @@ bool DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataToWindow() m_endX.SetValue( m_shape->m_Start.x ); // arc center m_endY.SetValue( m_shape->m_Start.y ); m_radiusLabel->SetLabel( _( "Angle:" ) ); - m_radius.SetUnits( DEGREES ); + m_radius.SetUnits( EDA_UNITS::DEGREES ); m_radius.SetValue( m_shape->m_ArcAngle ); m_ctrl1X.Show( false, true ); m_ctrl1Y.Show( false, true ); @@ -566,7 +566,7 @@ DIALOG_PAD_PRIMITIVES_TRANSFORM::DIALOG_PAD_PRIMITIVES_TRANSFORM( wxWindow* aPar m_vectorY( aFrame, m_yLabel, m_yCtrl, m_yUnits, true ), m_rotation( aFrame, m_rotationLabel, m_rotationCtrl, m_rotationUnits ) { - m_rotation.SetUnits( DEGREES ); + m_rotation.SetUnits( EDA_UNITS::DEGREES ); if( !aShowDuplicate ) // means no duplicate transform { @@ -593,7 +593,7 @@ void DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform( std::vector* { wxPoint move_vect( m_vectorX.GetValue(), m_vectorY.GetValue() ); double rotation = m_rotation.GetValue(); - double scale = DoubleValueFromString( UNSCALED_UNITS, m_scaleCtrl->GetValue() ); + double scale = DoubleValueFromString( EDA_UNITS::UNSCALED, m_scaleCtrl->GetValue() ); // Avoid too small / too large scale, which could create issues: if( scale < 0.01 ) diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 1e152631da..a0811c6c68 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -710,7 +710,7 @@ void DIALOG_PAD_PROPERTIES::initValues() // Pad Orient // Note: use ChangeValue() instead of SetValue() so that we don't generate events - m_orientation->ChangeValue( StringFromValue( DEGREES, angle ) ); + m_orientation->ChangeValue( StringFromValue( EDA_UNITS::DEGREES, angle ) ); switch( m_dummyPad->GetShape() ) { @@ -781,7 +781,7 @@ void DIALOG_PAD_PROPERTIES::initValues() } // A small helper function, to display coordinates: -static wxString formatCoord( EDA_UNITS_T aUnits, wxPoint aCoord ) +static wxString formatCoord( EDA_UNITS aUnits, wxPoint aCoord ) { return wxString::Format( "(X:%s Y:%s)", MessageTextFromValue( aUnits, aCoord.x, true ), diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 5f1c97fa74..a13841f6cf 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -111,8 +111,8 @@ void DIALOG_PLOT::init_Dialog() || m_XScaleAdjust > PLOT_MAX_SCALE || m_YScaleAdjust > PLOT_MAX_SCALE ) m_XScaleAdjust = m_YScaleAdjust = 1.0; - m_fineAdjustXCtrl->SetValue( StringFromValue( UNSCALED_UNITS, m_XScaleAdjust ) ); - m_fineAdjustYCtrl->SetValue( StringFromValue( UNSCALED_UNITS, m_YScaleAdjust ) ); + m_fineAdjustXCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, m_XScaleAdjust ) ); + m_fineAdjustYCtrl->SetValue( StringFromValue( EDA_UNITS::UNSCALED, m_YScaleAdjust ) ); // Test for a reasonable PS width correction value. Set to 0 if problem. if( m_PSWidthAdjust < m_widthAdjustMinValue || m_PSWidthAdjust > m_widthAdjustMaxValue ) diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp index 8b467e2188..07584301a2 100644 --- a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp +++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp @@ -44,7 +44,7 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( EDA_DRAW_F m_stdButtonsOK->SetDefault(); m_targetLengthText->SetSelection( -1, -1 ); m_targetLengthText->SetFocus(); - m_radius.SetUnits( PERCENT ); + m_radius.SetUnits( EDA_UNITS::PERCENT ); GetSizer()->SetSizeHints(this); Centre(); diff --git a/pcbnew/dialogs/dialog_position_relative.cpp b/pcbnew/dialogs/dialog_position_relative.cpp index f70ab1795f..cd03a9cf69 100644 --- a/pcbnew/dialogs/dialog_position_relative.cpp +++ b/pcbnew/dialogs/dialog_position_relative.cpp @@ -132,7 +132,7 @@ void DIALOG_POSITION_RELATIVE::updateDialogControls( bool aPolar ) { m_xOffset.SetLabel( _( "Distance:" ) ); // Polar radius m_yOffset.SetLabel( _( "Angle:" ) ); // Polar theta or angle - m_yOffset.SetUnits( DEGREES ); + m_yOffset.SetUnits( EDA_UNITS::DEGREES ); } else { diff --git a/pcbnew/dialogs/dialog_set_grid.cpp b/pcbnew/dialogs/dialog_set_grid.cpp index 122d69fd30..b129c2cb29 100644 --- a/pcbnew/dialogs/dialog_set_grid.cpp +++ b/pcbnew/dialogs/dialog_set_grid.cpp @@ -100,7 +100,7 @@ bool DIALOG_SET_GRID::TransferDataFromWindow() // User grid BASE_SCREEN* screen = m_parent->GetScreen(); - screen->AddGrid( m_parent->m_UserGridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER ); + screen->AddGrid( m_parent->m_UserGridSize, EDA_UNITS::UNSCALED, ID_POPUP_GRID_USER ); // If the user grid is the current option, recall SetGrid() // to force new values put in list as current grid value diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index ef3194ce32..0471f1996e 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -248,20 +248,20 @@ void DIALOG_TEXT_PROPERTIES::OnCharHook( wxKeyEvent& aEvent ) void DIALOG_TEXT_PROPERTIES::OnDimensionTextChange( wxCommandEvent& event ) { - EDA_UNITS_T units = UNSCALED_UNITS; + EDA_UNITS units = EDA_UNITS::UNSCALED; bool useMils; FetchUnitsFromString( m_DimensionText->GetValue(), units, useMils ); - if( units != UNSCALED_UNITS ) - m_DimensionUnitsOpt->SetSelection( units == MILLIMETRES ? 2 : useMils ? 1 : 0 ); + if( units != EDA_UNITS::UNSCALED ) + m_DimensionUnitsOpt->SetSelection( units == EDA_UNITS::MILLIMETRES ? 2 : useMils ? 1 : 0 ); } void DIALOG_TEXT_PROPERTIES::OnDimensionUnitsChange( wxCommandEvent& event ) { DIMENSION* dimension = (DIMENSION*) m_item; - EDA_UNITS_T units; + EDA_UNITS units; bool useMils; // Get default units in case dimension text doesn't contain units. @@ -271,9 +271,18 @@ void DIALOG_TEXT_PROPERTIES::OnDimensionUnitsChange( wxCommandEvent& event ) switch( event.GetSelection() ) { - case 0: units = INCHES; useMils = false; break; - case 1: units = INCHES; useMils = true; break; - case 2: units = MILLIMETRES; useMils = false; break; + case 0: + units = EDA_UNITS::INCHES; + useMils = false; + break; + case 1: + units = EDA_UNITS::INCHES; + useMils = true; + break; + case 2: + units = EDA_UNITS::MILLIMETRES; + useMils = false; + break; default: break; } @@ -303,11 +312,11 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow() m_DimensionText->SetSelection( -1, -1 ); DIMENSION* dimension = (DIMENSION*) m_item; - EDA_UNITS_T units; - bool useMils; + EDA_UNITS units; + bool useMils; dimension->GetUnits( units, useMils ); - m_DimensionUnitsOpt->SetSelection( units == MILLIMETRES ? 2 : useMils ? 1 : 0 ); + m_DimensionUnitsOpt->SetSelection( units == EDA_UNITS::MILLIMETRES ? 2 : useMils ? 1 : 0 ); m_linesThickness.SetValue( dimension->GetWidth() ); } @@ -412,9 +421,15 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow() switch( m_DimensionUnitsOpt->GetSelection() ) { - case 0: dimension->SetUnits( INCHES, false ); break; - case 1: dimension->SetUnits( INCHES, true ); break; - case 2: dimension->SetUnits( MILLIMETRES, false ); break; + case 0: + dimension->SetUnits( EDA_UNITS::INCHES, false ); + break; + case 1: + dimension->SetUnits( EDA_UNITS::INCHES, true ); + break; + case 2: + dimension->SetUnits( EDA_UNITS::MILLIMETRES, false ); + break; default: break; } diff --git a/pcbnew/dialogs/panel_modedit_settings.cpp b/pcbnew/dialogs/panel_modedit_settings.cpp index 754e1cf19c..6693006604 100644 --- a/pcbnew/dialogs/panel_modedit_settings.cpp +++ b/pcbnew/dialogs/panel_modedit_settings.cpp @@ -42,7 +42,7 @@ bool PANEL_MODEDIT_SETTINGS::TransferDataToWindow() { // Display options m_PolarDisplay->SetSelection( m_frame->GetShowPolarCoords() ? 1 : 0 ); - m_UnitsSelection->SetSelection( m_frame->GetUserUnits() == INCHES ? 0 : 1 ); + m_UnitsSelection->SetSelection( m_frame->GetUserUnits() == EDA_UNITS::INCHES ? 0 : 1 ); // Editing options m_Segments_45_Only_Ctrl->SetValue( m_frame->Settings().m_Use45DegreeGraphicSegments ); @@ -56,7 +56,8 @@ bool PANEL_MODEDIT_SETTINGS::TransferDataFromWindow() { // Display options m_frame->SetShowPolarCoords( m_PolarDisplay->GetSelection() != 0 ); - m_frame->SetUserUnits( m_UnitsSelection->GetSelection() == 0 ? INCHES : MILLIMETRES ); + m_frame->SetUserUnits( + m_UnitsSelection->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES ); // Editing options m_frame->Settings().m_Use45DegreeGraphicSegments = m_Segments_45_Only_Ctrl->GetValue(); diff --git a/pcbnew/dialogs/panel_pcbnew_settings.cpp b/pcbnew/dialogs/panel_pcbnew_settings.cpp index f8a6639629..5562661ff6 100644 --- a/pcbnew/dialogs/panel_pcbnew_settings.cpp +++ b/pcbnew/dialogs/panel_pcbnew_settings.cpp @@ -46,7 +46,7 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow() /* Set display options */ m_PolarDisplay->SetSelection( m_Frame->GetShowPolarCoords() ? 1 : 0 ); - m_UnitsSelection->SetSelection( m_Frame->GetUserUnits() == INCHES ? 0 : 1 ); + m_UnitsSelection->SetSelection( m_Frame->GetUserUnits() == EDA_UNITS::INCHES ? 0 : 1 ); m_OptDisplayCurvedRatsnestLines->SetValue( displ_opts.m_DisplayRatsnestLinesCurved ); m_showGlobalRatsnest->SetValue( displ_opts.m_ShowGlobalRatsnest ); m_showSelectedRatsnest->SetValue( displ_opts.m_ShowModuleRatsnest ); @@ -71,7 +71,8 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow() bool PANEL_PCBNEW_SETTINGS::TransferDataFromWindow() { m_Frame->SetShowPolarCoords( m_PolarDisplay->GetSelection() != 0 ); - m_Frame->SetUserUnits( m_UnitsSelection->GetSelection() == 0 ? INCHES : MILLIMETRES ); + m_Frame->SetUserUnits( + m_UnitsSelection->GetSelection() == 0 ? EDA_UNITS::INCHES : EDA_UNITS::MILLIMETRES ); m_Frame->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) ); diff --git a/pcbnew/dialogs/panel_setup_netclasses.cpp b/pcbnew/dialogs/panel_setup_netclasses.cpp index 3e3553cc37..cbb3517978 100644 --- a/pcbnew/dialogs/panel_setup_netclasses.cpp +++ b/pcbnew/dialogs/panel_setup_netclasses.cpp @@ -132,7 +132,7 @@ PANEL_SETUP_NETCLASSES::~PANEL_SETUP_NETCLASSES() } -static void netclassToGridRow( EDA_UNITS_T aUnits, wxGrid* aGrid, int aRow, const NETCLASSPTR& nc ) +static void netclassToGridRow( EDA_UNITS aUnits, wxGrid* aGrid, int aRow, const NETCLASSPTR& nc ) { aGrid->SetCellValue( aRow, GRID_NAME, nc->GetName() ); @@ -227,7 +227,7 @@ void PANEL_SETUP_NETCLASSES::rebuildNetclassDropdowns() } -static void gridRowToNetclass( EDA_UNITS_T aUnits, wxGrid* grid, int row, const NETCLASSPTR& nc ) +static void gridRowToNetclass( EDA_UNITS aUnits, wxGrid* grid, int row, const NETCLASSPTR& nc ) { nc->SetName( grid->GetCellValue( row, GRID_NAME ) ); diff --git a/pcbnew/drc/drc_marker_factory.cpp b/pcbnew/drc/drc_marker_factory.cpp index c569326ee0..fc6c6de5d0 100644 --- a/pcbnew/drc/drc_marker_factory.cpp +++ b/pcbnew/drc/drc_marker_factory.cpp @@ -47,7 +47,7 @@ const int EPSILON = Mils2iu( 5 ); DRC_MARKER_FACTORY::DRC_MARKER_FACTORY() { - SetUnits( EDA_UNITS_T::MILLIMETRES ); + SetUnits( EDA_UNITS::MILLIMETRES ); } @@ -57,7 +57,7 @@ void DRC_MARKER_FACTORY::SetUnitsProvider( UNITS_PROVIDER aUnitsProvider ) } -void DRC_MARKER_FACTORY::SetUnits( EDA_UNITS_T aUnits ) +void DRC_MARKER_FACTORY::SetUnits( EDA_UNITS aUnits ) { m_units_provider = [=]() { return aUnits; }; } diff --git a/pcbnew/drc/drc_marker_factory.h b/pcbnew/drc/drc_marker_factory.h index 8c977bd67b..f3cf5d1aad 100644 --- a/pcbnew/drc/drc_marker_factory.h +++ b/pcbnew/drc/drc_marker_factory.h @@ -27,7 +27,7 @@ #include -#include // for EDA_UNITS_T +#include // for EDA_UNITS class ZONE_CONTAINER; @@ -42,7 +42,7 @@ class SEG; class DRC_MARKER_FACTORY { public: - using UNITS_PROVIDER = std::function; + using UNITS_PROVIDER = std::function; DRC_MARKER_FACTORY(); @@ -57,7 +57,7 @@ public: * Set the units provider to a function returning a constant value. * This is a shorthand for #SetUnitProvider. */ - void SetUnits( EDA_UNITS_T aUnits ); + void SetUnits( EDA_UNITS aUnits ); /** * Creates a marker on a track, via or pad. @@ -93,7 +93,7 @@ public: MARKER_PCB* NewMarker( int aErrorCode, const wxString& aMessage ) const; private: - EDA_UNITS_T getCurrentUnits() const + EDA_UNITS getCurrentUnits() const { return m_units_provider(); } diff --git a/pcbnew/drc_item.cpp b/pcbnew/drc_item.cpp index 6e10864b7b..00a6a37e2f 100644 --- a/pcbnew/drc_item.cpp +++ b/pcbnew/drc_item.cpp @@ -173,7 +173,7 @@ wxString DRC_ITEM::GetErrorText() const } -wxString DRC_ITEM::ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos ) +wxString DRC_ITEM::ShowCoord( EDA_UNITS aUnits, const wxPoint& aPos ) { return wxString::Format( wxT( "@(%s, %s)" ), MessageTextFromValue( aUnits, aPos.x ), @@ -181,7 +181,7 @@ wxString DRC_ITEM::ShowCoord( EDA_UNITS_T aUnits, const wxPoint& aPos ) } -wxString DRC_ITEM::ShowHtml( EDA_UNITS_T aUnits ) const +wxString DRC_ITEM::ShowHtml( EDA_UNITS aUnits ) const { wxString mainText = m_MainText; // a wxHtmlWindows does not like < and > in the text to display @@ -226,7 +226,7 @@ wxString DRC_ITEM::ShowHtml( EDA_UNITS_T aUnits ) const } -wxString DRC_ITEM::ShowReport( EDA_UNITS_T aUnits ) const +wxString DRC_ITEM::ShowReport( EDA_UNITS aUnits ) const { if( m_hasSecondItem ) { diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 18bfa47946..d4a6eb302c 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -685,7 +685,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) zone->SetLayer( layer ); zone->SetNetCode( NETINFO_LIST::UNCONNECTED ); - ZONE_CONTAINER::HATCH_STYLE outline_hatch = ZONE_CONTAINER::DIAGONAL_EDGE; + ZONE_HATCH_STYLE outline_hatch = ZONE_HATCH_STYLE::DIAGONAL_EDGE; const int outlineIdx = -1; // this is the id of the copper zone main outline zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y1 ) ), outlineIdx ); @@ -767,7 +767,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) dimension->Text().SetTextSize( designSettings.GetTextSize( layer ) ); dimension->Text().SetThickness( designSettings.GetTextThickness( layer ) ); dimension->SetWidth( designSettings.GetLineThickness( layer ) ); - dimension->SetUnits( MILLIMETRES, false ); + dimension->SetUnits( EDA_UNITS::MILLIMETRES, false ); // check which axis the dimension runs in // because the "height" of the dimension is perpendicular to that axis @@ -1215,13 +1215,13 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode ) { zone->SetIsKeepout( true ); zone->SetDoNotAllowCopperPour( true ); - zone->SetHatchStyle( ZONE_CONTAINER::NO_HATCH ); + zone->SetHatchStyle( ZONE_HATCH_STYLE::NO_HATCH ); } else if( p.pour == EPOLYGON::HATCH ) { int spacing = p.spacing ? p.spacing->ToPcbUnits() : 50 * IU_PER_MILS; - zone->SetFillMode( ZFM_HATCH_PATTERN ); + zone->SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN ); zone->SetHatchFillTypeThickness( p.width.ToPcbUnits() ); zone->SetHatchFillTypeGap( spacing - p.width.ToPcbUnits() ); zone->SetHatchFillTypeOrientation( 0 ); diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp index dcb980d973..23487e0885 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -995,7 +995,7 @@ static void export_vrml_zones( MODEL_VRML& aModel, BOARD* aPcb ) if( !zone->IsFilled() ) { ZONE_FILLER filler( aPcb ); - zone->SetFillMode( ZFM_POLYGONS ); // use filled polygons + zone->SetFillMode( ZONE_FILL_MODE::POLYGONS ); // use filled polygons filler.Fill( { zone } ); } diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index b815dd8405..4daed82606 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -146,9 +146,9 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER; if( m_unitsMetric ) - dxf_plotter->SetUnits( DXF_PLOTTER::DXF_UNIT_MILLIMETERS ); + dxf_plotter->SetUnits( DXF_PLOTTER::DXF_UNITS::MILLIMETERS ); else - dxf_plotter->SetUnits( DXF_PLOTTER::DXF_UNIT_INCHES ); + dxf_plotter->SetUnits( DXF_PLOTTER::DXF_UNITS::INCHES ); plotter = dxf_plotter; plotter->SetPageSettings( page_info ); diff --git a/pcbnew/exporters/gen_footprints_placefile.cpp b/pcbnew/exporters/gen_footprints_placefile.cpp index 533675843b..1abcc41d39 100644 --- a/pcbnew/exporters/gen_footprints_placefile.cpp +++ b/pcbnew/exporters/gen_footprints_placefile.cpp @@ -527,7 +527,7 @@ void PCB_EDIT_FRAME::GenFootprintsReport( wxCommandEvent& event ) fn.SetPath( dirDialog.GetPath() ); fn.SetExt( wxT( "rpt" ) ); - bool unitMM = GetUserUnits() != INCHES; + bool unitMM = GetUserUnits() != EDA_UNITS::INCHES; bool success = DoGenFootprintsReport( fn.GetFullPath(), unitMM ); wxString msg; diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 3dc4b1b867..f507991cae 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -168,7 +168,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent, SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) ); GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax ); - GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER ); + GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS::UNSCALED, ID_POPUP_GRID_USER ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); // In modedit, set the default paper size to A4: diff --git a/pcbnew/import_gfx/dialog_import_gfx.cpp b/pcbnew/import_gfx/dialog_import_gfx.cpp index 8607a4770b..cb555db7ee 100644 --- a/pcbnew/import_gfx/dialog_import_gfx.cpp +++ b/pcbnew/import_gfx/dialog_import_gfx.cpp @@ -170,7 +170,7 @@ void DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX::onUnitPositionSelection( wxCommandEve double DIALOG_IMPORT_GFX::getPCBdefaultLineWidthMM() { - double value = DoubleValueFromString( UNSCALED_UNITS, m_textCtrlLineWidth->GetValue() ); + double value = DoubleValueFromString( EDA_UNITS::UNSCALED, m_textCtrlLineWidth->GetValue() ); switch( m_lineWidthUnits ) { @@ -302,7 +302,8 @@ bool DIALOG_IMPORT_GFX::TransferDataFromWindow() { // Set coordinates offset for import (offset is given in mm) m_importer->SetImportOffsetMM( m_origin ); - m_scaleImport = DoubleValueFromString( UNSCALED_UNITS, m_textCtrlImportScale->GetValue() ); + m_scaleImport = + DoubleValueFromString( EDA_UNITS::UNSCALED, m_textCtrlImportScale->GetValue() ); // The line width is meant to be in pcbnew units, so we scale the import width before // applying @@ -353,8 +354,8 @@ void DIALOG_IMPORT_GFX::originOptionOnUpdateUI( wxUpdateUIEvent& event ) void DIALOG_IMPORT_GFX::updatePcbImportOffsets_mm() { - m_origin.x = DoubleValueFromString( UNSCALED_UNITS, m_DxfPcbXCoord->GetValue() ); - m_origin.y = DoubleValueFromString( UNSCALED_UNITS, m_DxfPcbYCoord->GetValue() ); + m_origin.x = DoubleValueFromString( EDA_UNITS::UNSCALED, m_DxfPcbXCoord->GetValue() ); + m_origin.y = DoubleValueFromString( EDA_UNITS::UNSCALED, m_DxfPcbYCoord->GetValue() ); if( m_originUnits ) // Units are inches m_origin = m_origin * 25.4; diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index b7c6b2d6ab..844dec97cb 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -1650,8 +1650,8 @@ void PCB_IO::format( TRACK* aTrack, int aNestLevel ) const const VIA* via = static_cast( aTrack ); BOARD* board = (BOARD*) via->GetParent(); - wxCHECK_RET( board != 0, wxT( "Via " ) + via->GetSelectMenuText( MILLIMETRES ) + - wxT( " has no parent." ) ); + wxCHECK_RET( board != 0, wxT( "Via " ) + via->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) + + wxT( " has no parent." ) ); m_out->Print( aNestLevel, "(via" ); @@ -1733,9 +1733,15 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const switch( aZone->GetHatchStyle() ) { default: - case ZONE_CONTAINER::NO_HATCH: hatch = "none"; break; - case ZONE_CONTAINER::DIAGONAL_EDGE: hatch = "edge"; break; - case ZONE_CONTAINER::DIAGONAL_FULL: hatch = "full"; break; + case ZONE_HATCH_STYLE::NO_HATCH: + hatch = "none"; + break; + case ZONE_HATCH_STYLE::DIAGONAL_EDGE: + hatch = "edge"; + break; + case ZONE_HATCH_STYLE::DIAGONAL_FULL: + hatch = "full"; + break; } m_out->Print( 0, " (hatch %s %s)\n", hatch.c_str(), @@ -1793,7 +1799,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const m_out->Print( 0, " yes" ); // Default is polygon filled. - if( aZone->GetFillMode() == ZFM_HATCH_PATTERN ) + if( aZone->GetFillMode() == ZONE_FILL_MODE::HATCH_PATTERN ) m_out->Print( 0, " (mode hatch)" ); m_out->Print( 0, " (thermal_gap %s) (thermal_bridge_width %s)", @@ -1825,7 +1831,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const FormatInternalUnits( aZone->GetCornerRadius() ).c_str() ); } - if( aZone->GetFillMode() == ZFM_HATCH_PATTERN ) + if( aZone->GetFillMode() == ZONE_FILL_MODE::HATCH_PATTERN ) { m_out->Print( 0, "\n" ); m_out->Print( aNestLevel+2, "(hatch_thickness %s) (hatch_gap %s) (hatch_orientation %s)", diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 19feee3a99..c47eb20680 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -2489,7 +2489,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() { unique_ptr zc( new ZONE_CONTAINER( m_board ) ); - ZONE_CONTAINER::HATCH_STYLE outline_hatch = ZONE_CONTAINER::NO_HATCH; + ZONE_HATCH_STYLE outline_hatch = ZONE_HATCH_STYLE::NO_HATCH; bool endContour = false; int holeIndex = -1; // -1 is the main outline; holeIndex >= 0 = hole index char buf[1024]; @@ -2559,14 +2559,21 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() THROW_IO_ERROR( m_error ); } - switch( *hopt ) // upper case required + switch( *hopt ) // upper case required { - case 'N': outline_hatch = ZONE_CONTAINER::NO_HATCH; break; - case 'E': outline_hatch = ZONE_CONTAINER::DIAGONAL_EDGE; break; - case 'F': outline_hatch = ZONE_CONTAINER::DIAGONAL_FULL; break; + case 'N': + outline_hatch = ZONE_HATCH_STYLE::NO_HATCH; + break; + case 'E': + outline_hatch = ZONE_HATCH_STYLE::DIAGONAL_EDGE; + break; + case 'F': + outline_hatch = ZONE_HATCH_STYLE::DIAGONAL_FULL; + break; default: - m_error.Printf( _( "Bad ZAux for CZONE_CONTAINER \"%s\"" ), zc->GetNetname().GetData() ); + m_error.Printf( + _( "Bad ZAux for CZONE_CONTAINER \"%s\"" ), zc->GetNetname().GetData() ); THROW_IO_ERROR( m_error ); } @@ -2648,11 +2655,11 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() } // User OK'd; switch to polygon mode - zc->SetFillMode( ZFM_POLYGONS ); + zc->SetFillMode( ZONE_FILL_MODE::POLYGONS ); m_board->SetModified(); } else - zc->SetFillMode( ZFM_POLYGONS ); + zc->SetFillMode( ZONE_FILL_MODE::POLYGONS ); zc->SetIsFilled( fillstate == 'S' ); zc->SetThermalReliefGap( thermalReliefGap ); @@ -2756,7 +2763,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() { if( !zc->IsOnCopperLayer() ) { - zc->SetFillMode( ZFM_POLYGONS ); + zc->SetFillMode( ZONE_FILL_MODE::POLYGONS ); zc->SetNetCode( NETINFO_LIST::UNCONNECTED ); } diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index eeff759719..a7a82653f8 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -149,11 +149,11 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() auto polarCoordsCondition = [ this ] ( const SELECTION& aSel ) { return GetShowPolarCoords(); }; - auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) { - return GetUserUnits() == INCHES; + auto imperialUnitsCondition = [this]( const SELECTION& aSel ) { + return GetUserUnits() == EDA_UNITS::INCHES; }; - auto metricUnitsCondition = [ this ] ( const SELECTION& aSel ) { - return GetUserUnits() == MILLIMETRES; + auto metricUnitsCondition = [this]( const SELECTION& aSel ) { + return GetUserUnits() == EDA_UNITS::MILLIMETRES; }; auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) { return GetGalDisplayOptions().m_fullscreenCursor; diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 01cb7c1cf2..6c4fc03b09 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -261,13 +261,11 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() { return GetShowPolarCoords(); }; - auto imperialUnitsCondition = [ this ]( const SELECTION &aSel ) - { - return GetUserUnits() == INCHES; + auto imperialUnitsCondition = [this]( const SELECTION& aSel ) { + return GetUserUnits() == EDA_UNITS::INCHES; }; - auto metricUnitsCondition = [ this ]( const SELECTION &aSel ) - { - return GetUserUnits() == MILLIMETRES; + auto metricUnitsCondition = [this]( const SELECTION& aSel ) { + return GetUserUnits() == EDA_UNITS::MILLIMETRES; }; auto fullCrosshairCondition = [ this ]( const SELECTION &aSel ) { diff --git a/pcbnew/netinfo.h b/pcbnew/netinfo.h index 1cbe8b143f..b705b5aa73 100644 --- a/pcbnew/netinfo.h +++ b/pcbnew/netinfo.h @@ -249,7 +249,7 @@ public: * * @param aList is the list in which to place the status information. */ - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; /** * Function Clear diff --git a/pcbnew/netinfo_item.cpp b/pcbnew/netinfo_item.cpp index 84066f7481..65baa116fe 100644 --- a/pcbnew/netinfo_item.cpp +++ b/pcbnew/netinfo_item.cpp @@ -83,7 +83,7 @@ void NETINFO_ITEM::SetClass( const NETCLASSPTR& aNetClass ) } -void NETINFO_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) +void NETINFO_ITEM::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { wxString txt; double lengthnet = 0.0; // This is the length of tracks on pcb diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp index a0787c1959..a9b61c2675 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp @@ -194,8 +194,6 @@ void PCB_POLYGON::AddToBoard() zone->SetNetCode( m_netCode ); // add outline - int outline_hatch = ZONE_CONTAINER::DIAGONAL_EDGE; - for( i = 0; i < (int) m_outline.GetCount(); i++ ) { zone->AppendCorner( wxPoint( KiROUND( m_outline[i]->x ), @@ -206,7 +204,7 @@ void PCB_POLYGON::AddToBoard() zone->SetPriority( m_priority ); - zone->SetHatch( outline_hatch, zone->GetDefaultHatchPitch(), true ); + zone->SetHatch( ZONE_HATCH_STYLE::DIAGONAL_EDGE, zone->GetDefaultHatchPitch(), true ); if ( m_objType == wxT( 'K' ) ) { diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index c5462af23a..79a91c0fdb 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -560,11 +560,11 @@ void PCB_BASE_FRAME::DisplayGridMsg() switch( m_userUnits ) { - case INCHES: + case EDA_UNITS::INCHES: gridformatter = "grid X %.6f Y %.6f"; break; - case MILLIMETRES: + case EDA_UNITS::MILLIMETRES: gridformatter = "grid X %.6f Y %.6f"; break; @@ -576,7 +576,7 @@ void PCB_BASE_FRAME::DisplayGridMsg() BASE_SCREEN* screen = GetScreen(); wxArrayString gridsList; - int icurr = screen->BuildGridsChoiceList( gridsList, m_userUnits != INCHES ); + int icurr = screen->BuildGridsChoiceList( gridsList, m_userUnits != EDA_UNITS::INCHES ); GRID_TYPE& grid = screen->GetGrid( icurr ); double grid_x = To_User_Unit( m_userUnits, grid.m_Size.x ); double grid_y = To_User_Unit( m_userUnits, grid.m_Size.y ); @@ -611,9 +611,15 @@ void PCB_BASE_FRAME::UpdateStatusBar() switch( GetUserUnits() ) { - case INCHES: formatter = wxT( "r %.6f theta %.1f" ); break; - case MILLIMETRES: formatter = wxT( "r %.6f theta %.1f" ); break; - case UNSCALED_UNITS: formatter = wxT( "r %f theta %f" ); break; + case EDA_UNITS::INCHES: + formatter = wxT( "r %.6f theta %.1f" ); + break; + case EDA_UNITS::MILLIMETRES: + formatter = wxT( "r %.6f theta %.1f" ); + break; + case EDA_UNITS::UNSCALED: + formatter = wxT( "r %f theta %f" ); + break; default: wxASSERT( false ); break; } @@ -632,17 +638,17 @@ void PCB_BASE_FRAME::UpdateStatusBar() switch( GetUserUnits() ) { - case INCHES: + case EDA_UNITS::INCHES: absformatter = "X %.6f Y %.6f"; locformatter = "dx %.6f dy %.6f dist %.4f"; break; - case MILLIMETRES: + case EDA_UNITS::MILLIMETRES: absformatter = "X %.6f Y %.6f"; locformatter = "dx %.6f dy %.6f dist %.3f"; break; - case UNSCALED_UNITS: + case EDA_UNITS::UNSCALED: absformatter = "X %f Y %f"; locformatter = "dx %f dy %f dist %f"; break; @@ -689,8 +695,8 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg ) wxString baseCfgName = GetName(); - EDA_UNITS_T userGridUnits; - aCfg->Read( baseCfgName + UserGridUnitsEntry, ( int* )&userGridUnits, ( int )INCHES ); + EDA_UNITS userGridUnits; + aCfg->Read( baseCfgName + UserGridUnitsEntry, (int*) &userGridUnits, (int) EDA_UNITS::INCHES ); double tmp; aCfg->Read( baseCfgName + UserGridSizeXEntry, &tmp, 0.01 ); @@ -774,7 +780,7 @@ void PCB_BASE_FRAME::UpdateGridSelectBox() // Update grid values with the current units setting. m_gridSelectBox->Clear(); wxArrayString gridsList; - int icurr = GetScreen()->BuildGridsChoiceList( gridsList, GetUserUnits() != INCHES ); + int icurr = GetScreen()->BuildGridsChoiceList( gridsList, GetUserUnits() != EDA_UNITS::INCHES ); for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ ) { diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index 036a1ff913..803c984f49 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -336,7 +336,7 @@ void PCB_DRAW_PANEL_GAL::SyncLayersVisibility( const BOARD* aBoard ) } -void PCB_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector& aList ) +void PCB_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) { BOARD* board = static_cast( m_parent )->GetBoard(); wxString txt; diff --git a/pcbnew/pcb_draw_panel_gal.h b/pcbnew/pcb_draw_panel_gal.h index 50276e0e66..0b930a3107 100644 --- a/pcbnew/pcb_draw_panel_gal.h +++ b/pcbnew/pcb_draw_panel_gal.h @@ -94,7 +94,7 @@ public: void SyncLayersVisibility( const BOARD* aBoard ); ///> @copydoc EDA_DRAW_PANEL_GAL::GetMsgPanelInfo() - void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector& aList ) override; + void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector& aList ) override; ///> @copydoc EDA_DRAW_PANEL_GAL::OnShow() void OnShow() override; diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 756fff6e3d..2d3414b49a 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -222,7 +222,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); - GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER ); + GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS::UNSCALED, ID_POPUP_GRID_USER ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); setupTools(); diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index c6a6ea87dc..7a8b56e98a 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -2168,7 +2168,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() dimension->Text().SetTimeStamp( dimension->GetTimeStamp() ); dimension->SetPosition( text->GetTextPos() ); - EDA_UNITS_T units = INCHES; + EDA_UNITS units = EDA_UNITS::INCHES; bool useMils = false; FetchUnitsFromString( text->GetText(), units, useMils ); dimension->SetUnits( units, useMils ); @@ -3432,7 +3432,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent ) wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as ZONE_CONTAINER." ) ); - ZONE_CONTAINER::HATCH_STYLE hatchStyle = ZONE_CONTAINER::NO_HATCH; + ZONE_HATCH_STYLE hatchStyle = ZONE_HATCH_STYLE::NO_HATCH; int hatchPitch = ZONE_CONTAINER::GetDefaultHatchPitch(); wxPoint pt; @@ -3508,9 +3508,14 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent ) switch( token ) { default: - case T_none: hatchStyle = ZONE_CONTAINER::NO_HATCH; break; - case T_edge: hatchStyle = ZONE_CONTAINER::DIAGONAL_EDGE; break; - case T_full: hatchStyle = ZONE_CONTAINER::DIAGONAL_FULL; + case T_none: + hatchStyle = ZONE_HATCH_STYLE::NO_HATCH; + break; + case T_edge: + hatchStyle = ZONE_HATCH_STYLE::DIAGONAL_EDGE; + break; + case T_full: + hatchStyle = ZONE_HATCH_STYLE::DIAGONAL_FULL; } hatchPitch = parseBoardUnits( "hatch pitch" ); @@ -3601,13 +3606,13 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent ) m_showLegacyZoneWarning = false; } - zone->SetFillMode( ZFM_POLYGONS ); + zone->SetFillMode( ZONE_FILL_MODE::POLYGONS ); m_board->SetModified(); } else if( token == T_hatch ) - zone->SetFillMode( ZFM_HATCH_PATTERN ); + zone->SetFillMode( ZONE_FILL_MODE::HATCH_PATTERN ); else - zone->SetFillMode( ZFM_POLYGONS ); + zone->SetFillMode( ZONE_FILL_MODE::POLYGONS ); NeedRIGHT(); break; @@ -3808,7 +3813,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent ) { if( !zone->IsOnCopperLayer() ) { - //zone->SetFillMode( ZFM_POLYGONS ); + //zone->SetFillMode( ZONE_FILL_MODE::POLYGONS ); zone->SetNetCode( NETINFO_LIST::UNCONNECTED ); } diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 9ae9707efd..c41fcf5c02 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -103,7 +103,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() m_plotViaOnMaskLayer = false; m_plotMode = FILLED; m_DXFplotPolygonMode = true; - m_DXFplotUnits = DXF_PLOTTER::DXF_UNIT_INCHES; + m_DXFplotUnits = DXF_PLOTTER::DXF_UNITS::INCHES; m_useAuxOrigin = false; m_HPGLPenNum = 1; m_HPGLPenSpeed = 20; // this param is always in cm/s diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp index e7033fa114..50280fd763 100644 --- a/pcbnew/router/pns_dp_meander_placer.cpp +++ b/pcbnew/router/pns_dp_meander_placer.cpp @@ -362,7 +362,7 @@ int DP_MEANDER_PLACER::CurrentLayer() const } -const wxString DP_MEANDER_PLACER::TuningInfo( EDA_UNITS_T aUnits ) const +const wxString DP_MEANDER_PLACER::TuningInfo( EDA_UNITS aUnits ) const { wxString status; diff --git a/pcbnew/router/pns_dp_meander_placer.h b/pcbnew/router/pns_dp_meander_placer.h index d4cbdd36a2..f939da03ac 100644 --- a/pcbnew/router/pns_dp_meander_placer.h +++ b/pcbnew/router/pns_dp_meander_placer.h @@ -100,7 +100,7 @@ public: long long int totalLength(); - const wxString TuningInfo( EDA_UNITS_T aUnits ) const override; + const wxString TuningInfo( EDA_UNITS aUnits ) const override; TUNING_STATUS TuningStatus() const override; bool CheckFit( MEANDER_SHAPE* aShape ) override; diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index f5754390cb..dde1f6b70b 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -859,9 +859,9 @@ bool PNS_KICAD_IFACE::syncZone( PNS::NODE* aWorld, ZONE_CONTAINER* aZone ) KIDIALOG dlg( nullptr, wxString::Format( _( "Malformed keep-out zone at (%d, %d)" ), aZone->GetPosition().x, aZone->GetPosition().y ), KIDIALOG::KD_WARNING ); dlg.ShowDetailedText( - wxString::Format( _( "%s\nThis zone cannot be handled by the track layout tool.\n" - "Please verify it is not a self-intersecting polygon." ), - aZone->GetSelectMenuText( MILLIMETRES ) ) ); + wxString::Format( _( "%s\nThis zone cannot be handled by the track layout tool.\n" + "Please verify it is not a self-intersecting polygon." ), + aZone->GetSelectMenuText( EDA_UNITS::MILLIMETRES ) ) ); dlg.DoNotShowCheckbox( __FILE__, __LINE__ ); dlg.ShowModal(); diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp index 9472659cce..07cbf88f4c 100644 --- a/pcbnew/router/pns_meander_placer.cpp +++ b/pcbnew/router/pns_meander_placer.cpp @@ -235,7 +235,7 @@ int MEANDER_PLACER::CurrentLayer() const } -const wxString MEANDER_PLACER::TuningInfo( EDA_UNITS_T aUnits ) const +const wxString MEANDER_PLACER::TuningInfo( EDA_UNITS aUnits ) const { wxString status; diff --git a/pcbnew/router/pns_meander_placer.h b/pcbnew/router/pns_meander_placer.h index cb2223d012..e288d21d4c 100644 --- a/pcbnew/router/pns_meander_placer.h +++ b/pcbnew/router/pns_meander_placer.h @@ -80,7 +80,7 @@ public: int CurrentLayer() const override; /// @copydoc MEANDER_PLACER_BASE::TuningInfo() - virtual const wxString TuningInfo( EDA_UNITS_T aUnits ) const override; + virtual const wxString TuningInfo( EDA_UNITS aUnits ) const override; /// @copydoc MEANDER_PLACER_BASE::TuningStatus() virtual TUNING_STATUS TuningStatus() const override; diff --git a/pcbnew/router/pns_meander_placer_base.h b/pcbnew/router/pns_meander_placer_base.h index 1b9f7dcf52..33e482680d 100644 --- a/pcbnew/router/pns_meander_placer_base.h +++ b/pcbnew/router/pns_meander_placer_base.h @@ -64,7 +64,7 @@ public: * Returns a string describing the status and length of the * tuned traces. */ - virtual const wxString TuningInfo( EDA_UNITS_T aUnits ) const = 0; + virtual const wxString TuningInfo( EDA_UNITS aUnits ) const = 0; /** * Function TuningStatus() diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp index b68c0544a9..ca485e0ff6 100644 --- a/pcbnew/router/pns_meander_skew_placer.cpp +++ b/pcbnew/router/pns_meander_skew_placer.cpp @@ -154,7 +154,7 @@ bool MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) } -const wxString MEANDER_SKEW_PLACER::TuningInfo( EDA_UNITS_T aUnits ) const +const wxString MEANDER_SKEW_PLACER::TuningInfo( EDA_UNITS aUnits ) const { wxString status; diff --git a/pcbnew/router/pns_meander_skew_placer.h b/pcbnew/router/pns_meander_skew_placer.h index 3a45321326..580877c479 100644 --- a/pcbnew/router/pns_meander_skew_placer.h +++ b/pcbnew/router/pns_meander_skew_placer.h @@ -49,7 +49,7 @@ public: bool Move( const VECTOR2I& aP, ITEM* aEndItem ) override; /// @copydoc MEANDER_PLACER_BASE::TuningInfo() - const wxString TuningInfo( EDA_UNITS_T aUnits ) const override; + const wxString TuningInfo( EDA_UNITS aUnits ) const override; private: long long int currentSkew() const; diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 83bcf16020..1648ddd9d0 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -165,7 +165,7 @@ protected: void update() override { - EDA_UNITS_T units = m_frame.GetUserUnits(); + EDA_UNITS units = m_frame.GetUserUnits(); BOARD_DESIGN_SETTINGS& bds = m_frame.GetBoard()->GetDesignSettings(); bool useIndex = !bds.m_UseConnectedTrackWidth && !bds.UseCustomTrackViaSize(); @@ -294,8 +294,8 @@ protected: void update() override { - EDA_UNITS_T units = m_frame.GetUserUnits(); - const BOARD_DESIGN_SETTINGS& bds = m_frame.GetBoard()->GetDesignSettings(); + EDA_UNITS units = m_frame.GetUserUnits(); + const BOARD_DESIGN_SETTINGS& bds = m_frame.GetBoard()->GetDesignSettings(); Clear(); diff --git a/pcbnew/text_mod_grid_table.cpp b/pcbnew/text_mod_grid_table.cpp index b93654bec7..35d243523e 100644 --- a/pcbnew/text_mod_grid_table.cpp +++ b/pcbnew/text_mod_grid_table.cpp @@ -38,9 +38,8 @@ enum wxArrayString g_menuOrientations; -TEXT_MOD_GRID_TABLE::TEXT_MOD_GRID_TABLE( EDA_UNITS_T aUserUnits, PCB_BASE_FRAME* aFrame ) : - m_userUnits( aUserUnits ), - m_frame( aFrame ) +TEXT_MOD_GRID_TABLE::TEXT_MOD_GRID_TABLE( EDA_UNITS aUserUnits, PCB_BASE_FRAME* aFrame ) + : m_userUnits( aUserUnits ), m_frame( aFrame ) { // Build the column attributes. @@ -54,10 +53,14 @@ TEXT_MOD_GRID_TABLE::TEXT_MOD_GRID_TABLE( EDA_UNITS_T aUserUnits, PCB_BASE_FRAME if( g_menuOrientations.IsEmpty() ) { - g_menuOrientations.push_back( wxT( "0 " ) + GetAbbreviatedUnitsLabel( DEGREES ) ); - g_menuOrientations.push_back( wxT( "90 " ) + GetAbbreviatedUnitsLabel( DEGREES ) ); - g_menuOrientations.push_back( wxT( "-90 " ) + GetAbbreviatedUnitsLabel( DEGREES ) ); - g_menuOrientations.push_back( wxT( "180 " ) + GetAbbreviatedUnitsLabel( DEGREES ) ); + g_menuOrientations.push_back( + wxT( "0 " ) + GetAbbreviatedUnitsLabel( EDA_UNITS::DEGREES ) ); + g_menuOrientations.push_back( + wxT( "90 " ) + GetAbbreviatedUnitsLabel( EDA_UNITS::DEGREES ) ); + g_menuOrientations.push_back( + wxT( "-90 " ) + GetAbbreviatedUnitsLabel( EDA_UNITS::DEGREES ) ); + g_menuOrientations.push_back( + wxT( "180 " ) + GetAbbreviatedUnitsLabel( EDA_UNITS::DEGREES ) ); } m_orientationColAttr = new wxGridCellAttr; @@ -198,7 +201,8 @@ wxString TEXT_MOD_GRID_TABLE::GetValue( int aRow, int aCol ) return text.GetLayerName(); case TMC_ORIENTATION: - return StringFromValue( DEGREES, (int) NormalizeAnglePos( text.GetTextAngle() ), true ); + return StringFromValue( + EDA_UNITS::DEGREES, (int) NormalizeAnglePos( text.GetTextAngle() ), true ); case TMC_XOFFSET: return StringFromValue( m_userUnits, text.GetPos0().x, true ); @@ -268,7 +272,7 @@ void TEXT_MOD_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue ) break; case TMC_ORIENTATION: - text.SetTextAngle( DoubleValueFromString( DEGREES, aValue ) ); + text.SetTextAngle( DoubleValueFromString( EDA_UNITS::DEGREES, aValue ) ); text.SetDrawCoord(); break; diff --git a/pcbnew/text_mod_grid_table.h b/pcbnew/text_mod_grid_table.h index 420bbf3d35..d149584e07 100644 --- a/pcbnew/text_mod_grid_table.h +++ b/pcbnew/text_mod_grid_table.h @@ -54,7 +54,7 @@ enum TEXT_MOD_COL_ORDER class TEXT_MOD_GRID_TABLE : public wxGridTableBase, public std::vector { public: - TEXT_MOD_GRID_TABLE( EDA_UNITS_T userUnits, PCB_BASE_FRAME* aFrame ); + TEXT_MOD_GRID_TABLE( EDA_UNITS userUnits, PCB_BASE_FRAME* aFrame ); ~TEXT_MOD_GRID_TABLE(); int GetNumberRows() override { return (int) size(); } @@ -81,13 +81,13 @@ public: void SetValueAsLong( int aRow, int aCol, long aValue ) override; private: - EDA_UNITS_T m_userUnits; - PCB_BASE_FRAME* m_frame; + EDA_UNITS m_userUnits; + PCB_BASE_FRAME* m_frame; - wxGridCellAttr* m_readOnlyAttr; - wxGridCellAttr* m_boolColAttr; - wxGridCellAttr* m_orientationColAttr; - wxGridCellAttr* m_layerColAttr; + wxGridCellAttr* m_readOnlyAttr; + wxGridCellAttr* m_boolColAttr; + wxGridCellAttr* m_orientationColAttr; + wxGridCellAttr* m_layerColAttr; }; diff --git a/pcbnew/toolbars_footprint_editor.cpp b/pcbnew/toolbars_footprint_editor.cpp index a823b1f40c..5c5fbbfb31 100644 --- a/pcbnew/toolbars_footprint_editor.cpp +++ b/pcbnew/toolbars_footprint_editor.cpp @@ -236,8 +236,8 @@ void FOOTPRINT_EDIT_FRAME::SyncToolbars() m_mainToolBar->Refresh(); m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); - m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); - m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); + m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES ); + m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES ); m_optionsToolBar->Toggle( ACTIONS::togglePolarCoords, GetShowPolarCoords() ); m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts.m_DisplayPadFill ); m_optionsToolBar->Toggle( PCB_ACTIONS::moduleEdgeOutlines, !opts.m_DisplayModEdgeFill ); diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index ed2ee6145f..d53be04836 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -500,7 +500,7 @@ void PCB_EDIT_FRAME::UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, return; wxString msg; - bool mmFirst = GetUserUnits() != INCHES; + bool mmFirst = GetUserUnits() != EDA_UNITS::INCHES; aTrackWidthSelectBox->Clear(); @@ -508,8 +508,8 @@ void PCB_EDIT_FRAME::UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, { int size = GetDesignSettings().m_TrackWidthList[ii]; - double valueMils = To_User_Unit( INCHES, size ) * 1000; - double value_mm = To_User_Unit( MILLIMETRES, size ); + double valueMils = To_User_Unit( EDA_UNITS::INCHES, size ) * 1000; + double value_mm = To_User_Unit( EDA_UNITS::MILLIMETRES, size ); if( mmFirst ) msg.Printf( _( "Track: %.3f mm (%.2f mils)" ), value_mm, valueMils ); @@ -543,23 +543,23 @@ void PCB_EDIT_FRAME::UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool a aViaSizeSelectBox->Clear(); - bool mmFirst = GetUserUnits() != INCHES; + bool mmFirst = GetUserUnits() != EDA_UNITS::INCHES; for( unsigned ii = 0; ii < GetDesignSettings().m_ViasDimensionsList.size(); ii++ ) { VIA_DIMENSION viaDimension = GetDesignSettings().m_ViasDimensionsList[ii]; wxString msg, mmStr, milsStr; - double diam = To_User_Unit( MILLIMETRES, viaDimension.m_Diameter ); - double hole = To_User_Unit( MILLIMETRES, viaDimension.m_Drill ); + double diam = To_User_Unit( EDA_UNITS::MILLIMETRES, viaDimension.m_Diameter ); + double hole = To_User_Unit( EDA_UNITS::MILLIMETRES, viaDimension.m_Drill ); if( hole > 0 ) mmStr.Printf( _( "%.2f / %.2f mm" ), diam, hole ); else mmStr.Printf( _( "%.2f mm" ), diam ); - diam = To_User_Unit( INCHES, viaDimension.m_Diameter ) * 1000; - hole = To_User_Unit( INCHES, viaDimension.m_Drill ) * 1000; + diam = To_User_Unit( EDA_UNITS::INCHES, viaDimension.m_Diameter ) * 1000; + hole = To_User_Unit( EDA_UNITS::INCHES, viaDimension.m_Drill ) * 1000; if( hole > 0 ) milsStr.Printf( _( "%.1f / %.1f mils" ), diam, hole ); @@ -686,8 +686,8 @@ void PCB_EDIT_FRAME::SyncToolbars() PrepareLayerIndicator(); m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); - m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES ); - m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES ); + m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES ); + m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES ); m_optionsToolBar->Toggle( ACTIONS::togglePolarCoords, GetShowPolarCoords() ); m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor ); m_optionsToolBar->Toggle( PCB_ACTIONS::showRatsnest, opts.m_ShowGlobalRatsnest ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 1f58a807a5..b7c8bad8a3 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -597,8 +597,9 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) dimension->Text().SetThickness( boardSettings.GetTextThickness( layer ) ); dimension->Text().SetItalic( boardSettings.GetTextItalic( layer ) ); dimension->SetWidth( boardSettings.GetLineThickness( layer ) ); - dimension->SetUnits( boardSettings.m_DimensionUnits == 2 ? MILLIMETRES : INCHES, - boardSettings.m_DimensionUnits == 1 ); + dimension->SetUnits( boardSettings.m_DimensionUnits == 2 ? EDA_UNITS::MILLIMETRES : + EDA_UNITS::INCHES, + boardSettings.m_DimensionUnits == 1 ); dimension->AdjustDimensionDetails( boardSettings.m_DimensionPrecision ); preview.Add( dimension ); diff --git a/pcbnew/tools/drc.cpp b/pcbnew/tools/drc.cpp index e8c0d32ea9..a7f55327f3 100644 --- a/pcbnew/tools/drc.cpp +++ b/pcbnew/tools/drc.cpp @@ -1350,8 +1350,7 @@ void DRC::doFootprintOverlappingDrc() } -void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS_T aUnits, - DRC_LIST& aDRCList ) +void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS aUnits, DRC_LIST& aDRCList ) { // Search for duplicate footprints on the board diff --git a/pcbnew/tools/drc.h b/pcbnew/tools/drc.h index de0e4c1e0c..f88a901c08 100644 --- a/pcbnew/tools/drc.h +++ b/pcbnew/tools/drc.h @@ -412,8 +412,8 @@ public: * Test the board footprints against a netlist. Will report DRCE_MISSING_FOOTPRINT, * DRCE_DUPLICATE_FOOTPRINT and DRCE_EXTRA_FOOTPRINT errors in aDRCList. */ - static void TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS_T aUnits, - DRC_LIST& aDRCList ); + static void TestFootprints( + NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS aUnits, DRC_LIST& aDRCList ); /** * Open a dialog and prompts the user, then if a test run button is diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index b082232792..b82deffc2e 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -1151,7 +1151,7 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent ) frame()->PushTool( tool ); Activate(); - EDA_UNITS_T units = frame()->GetUserUnits(); + EDA_UNITS units = frame()->GetUserUnits(); KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr; KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, units ); diff --git a/pcbnew/tracks_cleaner.cpp b/pcbnew/tracks_cleaner.cpp index 0f6d0b70a9..1db0401510 100644 --- a/pcbnew/tracks_cleaner.cpp +++ b/pcbnew/tracks_cleaner.cpp @@ -51,12 +51,12 @@ int GLOBAL_EDIT_TOOL::CleanupTracksAndVias( const TOOL_EVENT& aEvent ) } -TRACKS_CLEANER::TRACKS_CLEANER( EDA_UNITS_T aUnits, BOARD* aPcb, BOARD_COMMIT& aCommit ) : - m_units( aUnits ), - m_brd( aPcb ), - m_commit( aCommit ), - m_dryRun( true ), - m_itemsList( nullptr ) +TRACKS_CLEANER::TRACKS_CLEANER( EDA_UNITS aUnits, BOARD* aPcb, BOARD_COMMIT& aCommit ) + : m_units( aUnits ), + m_brd( aPcb ), + m_commit( aCommit ), + m_dryRun( true ), + m_itemsList( nullptr ) { } diff --git a/pcbnew/tracks_cleaner.h b/pcbnew/tracks_cleaner.h index 02cc27ea51..58ea2f09e9 100644 --- a/pcbnew/tracks_cleaner.h +++ b/pcbnew/tracks_cleaner.h @@ -34,7 +34,7 @@ class BOARD_COMMIT; class TRACKS_CLEANER { public: - TRACKS_CLEANER( EDA_UNITS_T aUnits, BOARD* aPcb, BOARD_COMMIT& aCommit ); + TRACKS_CLEANER( EDA_UNITS aUnits, BOARD* aPcb, BOARD_COMMIT& aCommit ); /** * the cleanup function. @@ -115,7 +115,7 @@ private: */ bool testTrackEndpointIsNode( TRACK* aTrack, bool aTstStart ); - EDA_UNITS_T m_units; + EDA_UNITS m_units; BOARD* m_brd; BOARD_COMMIT& m_commit; bool m_dryRun; diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index f6112896d4..6459a20a81 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -774,7 +774,7 @@ void ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone, dumper->Write( &aRawPolys, "solid-areas-before-hatching" ); // Now remove the non filled areas due to the hatch pattern - if( aZone->GetFillMode() == ZFM_HATCH_PATTERN ) + if( aZone->GetFillMode() == ZONE_FILL_MODE::HATCH_PATTERN ) addHatchFillTypeOnZone( aZone, aRawPolys ); if( s_DumpZonesWhenFilling ) @@ -848,7 +848,7 @@ bool ZONE_FILLER::fillSingleZone( ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aRawPol smoothedPoly.Deflate( half_min_width - epsilon, numSegs ); // Remove the non filled areas due to the hatch pattern - if( aZone->GetFillMode() == ZFM_HATCH_PATTERN ) + if( aZone->GetFillMode() == ZONE_FILL_MODE::HATCH_PATTERN ) addHatchFillTypeOnZone( aZone, smoothedPoly ); // Re-inflate after pruning of areas that don't meet minimum-width criteria diff --git a/pcbnew/zone_filler.h b/pcbnew/zone_filler.h index f843145bff..dacfe8e6b9 100644 --- a/pcbnew/zone_filler.h +++ b/pcbnew/zone_filler.h @@ -95,7 +95,7 @@ private: SHAPE_POLY_SET& aFinalPolys ); /** - * for zones having the ZONE_FILL_MODE::ZFM_HATCH_PATTERN, create a grid pattern + * for zones having the ZONE_FILL_MODE::ZONE_FILL_MODE::HATCH_PATTERN, create a grid pattern * in filled areas of aZone, giving to the filled polygons a fill style like a grid * @param aZone is the zone to modify * @param aRawPolys: A reference to a SHAPE_POLY_SET buffer containing the initial diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index 9437b459a4..1f0be01bd3 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -44,20 +44,22 @@ ZONE_SETTINGS::ZONE_SETTINGS() { m_ZonePriority = 0; - m_FillMode = ZFM_POLYGONS; // Mode for filling zone : 1 use segments, 0 use polygons + m_FillMode = ZONE_FILL_MODE::POLYGONS; // Mode for filling zone // Zone clearance value - m_ZoneClearance = Mils2iu( ZONE_CLEARANCE_MIL ); + m_ZoneClearance = Mils2iu( ZONE_CLEARANCE_MIL ); // Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) : - m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL ); - m_HatchFillTypeThickness = 0; // good value of grid line thickness if m_FillMode = ZFM_GRID_PATTERN - m_HatchFillTypeGap = 0; // good value of grid line gap if m_FillMode = ZFM_GRID_PATTERN - m_HatchFillTypeOrientation = 0.0; // Grid style: orientation of grid lines in degrees - m_HatchFillTypeSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing - m_HatchFillTypeSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value - m_NetcodeSelection = 0; // Net code selection for the current zone - m_CurrentZone_Layer = F_Cu; // Layer used to create the current zone - m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; // Option to show the zone area (outlines only, - //short hatches or full hatches + m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL ); + m_HatchFillTypeThickness = + 0; // good value of grid line thickness if m_FillMode = ZFM_GRID_PATTERN + m_HatchFillTypeGap = 0; // good value of grid line gap if m_FillMode = ZFM_GRID_PATTERN + m_HatchFillTypeOrientation = 0.0; // Grid style: orientation of grid lines in degrees + m_HatchFillTypeSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing + m_HatchFillTypeSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value + m_NetcodeSelection = 0; // Net code selection for the current zone + m_CurrentZone_Layer = F_Cu; // Layer used to create the current zone + m_Zone_HatchingStyle = + ZONE_HATCH_STYLE::DIAGONAL_EDGE; // Option to show the zone area (outlines only, + //short hatches or full hatches // thickness of the gap in thermal reliefs: m_ThermalReliefGap = Mils2iu( ZONE_THERMAL_RELIEF_GAP_MIL ); diff --git a/pcbnew/zone_settings.h b/pcbnew/zone_settings.h index d2e590bac9..a5f4ff5cba 100644 --- a/pcbnew/zone_settings.h +++ b/pcbnew/zone_settings.h @@ -34,10 +34,19 @@ #include #include -enum ZONE_FILL_MODE +enum class ZONE_FILL_MODE { - ZFM_POLYGONS = 0, // fill zone with polygons - ZFM_HATCH_PATTERN = 1 // fill zone using a grid pattern + POLYGONS = 0, // fill zone with polygons + HATCH_PATTERN = 1 // fill zone using a grid pattern +}; + + +/// Zone hatch styles +enum class ZONE_HATCH_STYLE +{ + NO_HATCH, + DIAGONAL_FULL, + DIAGONAL_EDGE }; /** @@ -78,7 +87,7 @@ public: PCB_LAYER_ID m_CurrentZone_Layer; ///< Layer used to create the current zone /// Option to show the zone area (outlines only, short hatches or full hatches - int m_Zone_HatchingStyle; + ZONE_HATCH_STYLE m_Zone_HatchingStyle; long m_ThermalReliefGap; ///< thickness of the gap in thermal reliefs long m_ThermalReliefCopperBridge; ///< thickness of the copper bridge in thermal reliefs diff --git a/qa/common/libeval/test_numeric_evaluator.cpp b/qa/common/libeval/test_numeric_evaluator.cpp index 7dd11a6e97..12426188ff 100644 --- a/qa/common/libeval/test_numeric_evaluator.cpp +++ b/qa/common/libeval/test_numeric_evaluator.cpp @@ -32,7 +32,7 @@ struct NUM_EVAL_FIXTURE { - NUM_EVAL_FIXTURE() : m_eval( EDA_UNITS_T::MILLIMETRES, false ) + NUM_EVAL_FIXTURE() : m_eval( EDA_UNITS::MILLIMETRES, false ) { } diff --git a/qa/pcbnew_tools/tools/drc_tool/drc_tool.cpp b/qa/pcbnew_tools/tools/drc_tool/drc_tool.cpp index d5cf9cb956..fdfb1dfdcc 100644 --- a/qa/pcbnew_tools/tools/drc_tool/drc_tool.cpp +++ b/qa/pcbnew_tools/tools/drc_tool/drc_tool.cpp @@ -127,7 +127,7 @@ private: int index = 0; for( const auto& m : aMarkers ) { - std::cout << index++ << ": " << m->GetReporter().ShowReport( EDA_UNITS_T::MILLIMETRES ); + std::cout << index++ << ": " << m->GetReporter().ShowReport( EDA_UNITS::MILLIMETRES ); } if( index )