diff --git a/common/base_units.cpp b/common/base_units.cpp index 9bb4d7b268..8ac2c44427 100644 --- a/common/base_units.cpp +++ b/common/base_units.cpp @@ -40,6 +40,7 @@ #include #include +// We need this function even in routines that do not define internal units #if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR ) #define IU_TO_MM( x ) ( x / IU_PER_MM ) @@ -52,7 +53,6 @@ #error "Cannot resolve internal units due to no definition of EESCHEMA, CVPCB or PCBNEW." #endif - // Helper function to print a float number without using scientific notation // and no trailing 0 // So we cannot always just use the %g or the %f format to print a fp number @@ -89,18 +89,18 @@ std::string Double2Str( double aValue ) } -double To_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils ) +double To_User_Unit( EDA_UNITS aUnit, double aValue ) { switch( aUnit ) { case EDA_UNITS::MILLIMETRES: return IU_TO_MM( aValue ); + case EDA_UNITS::MILS: + return IU_TO_MILS( aValue ); + case EDA_UNITS::INCHES: - if( aUseMils ) - return IU_TO_MILS( aValue ); - else - return IU_TO_IN( aValue ); + return IU_TO_IN( aValue ); case EDA_UNITS::DEGREES: return aValue / 10.0f; @@ -121,22 +121,21 @@ double To_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils ) */ // A lower-precision (for readability) version of StringFromValue() -wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aUseMils, EDA_DATA_TYPE aType ) +wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, EDA_DATA_TYPE aType ) { - return MessageTextFromValue( aUnits, double( aValue ), aUseMils ); + return MessageTextFromValue( aUnits, double( aValue ), aType ); } // A lower-precision (for readability) version of StringFromValue() -wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, - bool aUseMils, EDA_DATA_TYPE aType ) +wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, EDA_DATA_TYPE aType ) { - return MessageTextFromValue( aUnits, double( aValue ), aUseMils ); + return MessageTextFromValue( aUnits, double( aValue ), aType ); } // A lower-precision (for readability) version of StringFromValue() -wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aUseMils, EDA_DATA_TYPE aType ) +wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, EDA_DATA_TYPE aType ) { wxString text; const wxChar* format; @@ -145,51 +144,51 @@ wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aUseMils, E switch( aType ) { case EDA_DATA_TYPE::VOLUME: - value = To_User_Unit( aUnits, value, aUseMils ); + value = To_User_Unit( aUnits, value ); // Fall through to continue computation KI_FALLTHROUGH; case EDA_DATA_TYPE::AREA: - value = To_User_Unit( aUnits, value, aUseMils ); + value = To_User_Unit( aUnits, value ); // Fall through to continue computation KI_FALLTHROUGH; case EDA_DATA_TYPE::DISTANCE: - value = To_User_Unit( aUnits, value, aUseMils ); + value = To_User_Unit( aUnits, value ); } - if( aUnits == EDA_UNITS::INCHES ) - { - if( aUseMils ) - { -#if defined( EESCHEMA ) - format = wxT( "%.0f" ); -#else - format = wxT( "%.1f" ); -#endif - } - else - { -#if defined( EESCHEMA ) - format = wxT( "%.3f" ); -#else - format = wxT( "%.4f" ); -#endif - } - } - else + switch( aUnits ) { + default: + case EDA_UNITS::MILLIMETRES: #if defined( EESCHEMA ) format = wxT( "%.4f" ); #else format = wxT( "%.3f" ); #endif + break; + + case EDA_UNITS::MILS: +#if defined( EESCHEMA ) + format = wxT( "%.0f" ); +#else + format = wxT( "%.1f" ); +#endif + break; + + case EDA_UNITS::INCHES: +#if defined( EESCHEMA ) + format = wxT( "%.4f" ); +#else + format = wxT( "%.3f" ); +#endif + break; } text.Printf( format, value ); text += " "; - text += GetAbbreviatedUnitsLabel( aUnits, aUseMils, aType ); + text += GetAbbreviatedUnitsLabel( aUnits, aType ); return text; } @@ -230,23 +229,22 @@ 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 aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils, - EDA_DATA_TYPE aType ) +wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType ) { double value_to_print = aValue; switch( aType ) { case EDA_DATA_TYPE::VOLUME: - value_to_print = To_User_Unit( aUnits, value_to_print, aUseMils ); + value_to_print = To_User_Unit( aUnits, value_to_print ); KI_FALLTHROUGH; case EDA_DATA_TYPE::AREA: - value_to_print = To_User_Unit( aUnits, value_to_print, aUseMils ); + value_to_print = To_User_Unit( aUnits, value_to_print ); KI_FALLTHROUGH; case EDA_DATA_TYPE::DISTANCE: - value_to_print = To_User_Unit( aUnits, value_to_print, aUseMils ); + value_to_print = To_User_Unit( aUnits, value_to_print ); } @@ -276,7 +274,7 @@ wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, } else { - if( aUnits == EDA_UNITS::INCHES && aUseMils ) + if( aUnits == EDA_UNITS::MILS ) len = sprintf( buf, "%.7g", value_to_print ); else len = sprintf( buf, "%.10g", value_to_print ); @@ -290,13 +288,6 @@ wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, { switch( aUnits ) { - case EDA_UNITS::INCHES: - if( aUseMils ) - stringValue += wxT( " mils" ); - else - stringValue += wxT( " in" ); - break; - case EDA_UNITS::MILLIMETRES: stringValue += wxT( " mm" ); break; @@ -305,6 +296,14 @@ wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, stringValue += wxT( " deg" ); break; + case EDA_UNITS::MILS: + stringValue += wxT( " mils" ); + break; + + case EDA_UNITS::INCHES: + stringValue += wxT( " in" ); + break; + case EDA_UNITS::PERCENT: stringValue += wxT( "%" ); break; @@ -318,18 +317,18 @@ wxString StringFromValue( EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, } -double From_User_Unit( EDA_UNITS aUnits, double aValue, bool aUseMils ) +double From_User_Unit( EDA_UNITS aUnits, double aValue ) { switch( aUnits ) { case EDA_UNITS::MILLIMETRES: return MM_TO_IU( aValue ); + case EDA_UNITS::MILS: + return MILS_TO_IU( aValue ); + case EDA_UNITS::INCHES: - if( aUseMils ) - return MILS_TO_IU( aValue ); - else - return IN_TO_IU( aValue ); + return IN_TO_IU( aValue ); case EDA_UNITS::DEGREES: // Convert to "decidegrees" @@ -343,8 +342,7 @@ double From_User_Unit( EDA_UNITS aUnits, double aValue, bool aUseMils ) } -double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils, - EDA_DATA_TYPE aType ) +double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, EDA_DATA_TYPE aType ) { double dtmp = 0; @@ -380,26 +378,23 @@ double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool // Check the optional unit designator (2 ch significant) wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() ); - if( aUnits == EDA_UNITS::INCHES || aUnits == EDA_UNITS::MILLIMETRES ) + if( aUnits == EDA_UNITS::MILLIMETRES || aUnits == EDA_UNITS::MILS || aUnits == EDA_UNITS::INCHES ) { - if( unit == wxT( "in" ) || unit == wxT( "\"" ) ) - { - aUnits = EDA_UNITS::INCHES; - aUseMils = false; - } - else if( unit == wxT( "mm" ) ) + if( unit == wxT( "mm" ) ) { aUnits = EDA_UNITS::MILLIMETRES; } - else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou" + else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) { - aUnits = EDA_UNITS::INCHES; - aUseMils = true; + aUnits = EDA_UNITS::MILS; } - else if( unit == "oz" ) // 1 oz = 1.37 mils + else if( unit == wxT( "in" ) || unit == wxT( "\"" ) ) { aUnits = EDA_UNITS::INCHES; - aUseMils = true; + } + else if( unit == "oz" ) // 1 oz = 1.37 mils + { + aUnits = EDA_UNITS::MILS; dtmp *= 1.37; } } @@ -414,22 +409,22 @@ double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool switch( aType ) { case EDA_DATA_TYPE::VOLUME: - dtmp = From_User_Unit( aUnits, dtmp, aUseMils ); + dtmp = From_User_Unit( aUnits, dtmp ); KI_FALLTHROUGH; case EDA_DATA_TYPE::AREA: - dtmp = From_User_Unit( aUnits, dtmp, aUseMils ); + dtmp = From_User_Unit( aUnits, dtmp ); KI_FALLTHROUGH; case EDA_DATA_TYPE::DISTANCE: - dtmp = From_User_Unit( aUnits, dtmp, aUseMils ); + dtmp = From_User_Unit( aUnits, dtmp ); } return dtmp; } -void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits, bool& aUseMils ) +void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits ) { wxString buf( aTextValue.Strip( wxString::both ) ); unsigned brk_point = 0; @@ -447,31 +442,20 @@ void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits, bool& // Check the unit designator (2 ch significant) wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() ); - if( unit == wxT( "in" ) || unit == wxT( "\"" ) ) - { - aUnits = EDA_UNITS::INCHES; - aUseMils = false; - } - else if( unit == wxT( "mm" ) ) - { + if( unit == wxT( "mm" ) ) aUnits = EDA_UNITS::MILLIMETRES; - } - else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou" - { + else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // "mils" or "thou" + aUnits = EDA_UNITS::MILS; + else if( unit == wxT( "in" ) || unit == wxT( "\"" ) ) aUnits = EDA_UNITS::INCHES; - aUseMils = true; - } - else if( unit == wxT( "de" ) || unit == wxT( "ra" ) ) // "deg" or "rad" - { + else if( unit == wxT( "de" ) || unit == wxT( "ra" ) ) // "deg" or "rad" aUnits = EDA_UNITS::DEGREES; - } } -long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils, - EDA_DATA_TYPE aType ) +long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, EDA_DATA_TYPE aType ) { - double value = DoubleValueFromString( aUnits, aTextValue, aUseMils, aType ); + double value = DoubleValueFromString( aUnits, aTextValue, aType ); return KiROUND( value ); } @@ -492,42 +476,10 @@ wxString AngleToStringDegrees( double aAngle ) } -wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, bool aUseMils, EDA_DATA_TYPE aType ) +wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, EDA_DATA_TYPE aType ) { switch( aUnit ) { - case EDA_UNITS::INCHES: - if( aUseMils ) - { - switch( aType ) - { - default: - wxASSERT( 0 ); - KI_FALLTHROUGH; - case EDA_DATA_TYPE::DISTANCE: - return _( "mils" ); - case EDA_DATA_TYPE::AREA: - return _( "sq. mils" ); - case EDA_DATA_TYPE::VOLUME: - return _( "cu. mils" ); - } - } - else - { - switch( aType ) - { - default: - wxASSERT( 0 ); - KI_FALLTHROUGH; - case EDA_DATA_TYPE::DISTANCE: - return _( "in" ); - case EDA_DATA_TYPE::AREA: - return _( "sq. in" ); - case EDA_DATA_TYPE::VOLUME: - return _( "cu. in" ); - } - } - case EDA_UNITS::MILLIMETRES: switch( aType ) { @@ -542,6 +494,34 @@ wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, bool aUseMils, EDA_DATA_TYPE return _( "cu. mm" ); } + case EDA_UNITS::MILS: + switch( aType ) + { + default: + wxASSERT( 0 ); + KI_FALLTHROUGH; + case EDA_DATA_TYPE::DISTANCE: + return _( "mils" ); + case EDA_DATA_TYPE::AREA: + return _( "sq. mils" ); + case EDA_DATA_TYPE::VOLUME: + return _( "cu. mils" ); + } + + case EDA_UNITS::INCHES: + switch( aType ) + { + default: + wxASSERT( 0 ); + KI_FALLTHROUGH; + case EDA_DATA_TYPE::DISTANCE: + return _( "in" ); + case EDA_DATA_TYPE::AREA: + return _( "sq. in" ); + case EDA_DATA_TYPE::VOLUME: + return _( "cu. in" ); + } + case EDA_UNITS::PERCENT: return _( "%" ); @@ -613,4 +593,3 @@ std::string FormatInternalUnits( const wxSize& aSize ) { return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() ); } - diff --git a/common/dialogs/dialog_grid_settings.cpp b/common/dialogs/dialog_grid_settings.cpp index 262e001657..a40cdb3406 100644 --- a/common/dialogs/dialog_grid_settings.cpp +++ b/common/dialogs/dialog_grid_settings.cpp @@ -86,8 +86,8 @@ bool DIALOG_GRID_SETTINGS::TransferDataFromWindow() gridCfg.last_size_idx = m_currentGridCtrl->GetSelection(); m_parent->SetGridOrigin( wxPoint( m_gridOriginX.GetValue(), m_gridOriginY.GetValue() ) ); - gridCfg.user_grid_x = StringFromValue( GetUserUnits(), m_userGridX.GetValue(), true, true ); - gridCfg.user_grid_y = StringFromValue( GetUserUnits(), m_userGridY.GetValue(), true, true ); + gridCfg.user_grid_x = StringFromValue( GetUserUnits(), m_userGridX.GetValue(), true ); + gridCfg.user_grid_y = StringFromValue( GetUserUnits(), m_userGridY.GetValue(), true ); gridCfg.fast_grid_1 = m_grid1Ctrl->GetSelection(); gridCfg.fast_grid_2 = m_grid2Ctrl->GetSelection(); @@ -111,8 +111,8 @@ bool DIALOG_GRID_SETTINGS::TransferDataToWindow() m_currentGridCtrl->SetSelection( m_parent->config()->m_Window.grid.last_size_idx ); - m_userGridX.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_x, true ) ); - m_userGridY.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_y, true ) ); + m_userGridX.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_x ) ); + m_userGridY.SetValue( ValueFromString( GetUserUnits(), gridCfg.user_grid_y ) ); m_gridOriginX.SetValue( m_parent->GetGridOrigin().x ); m_gridOriginY.SetValue( m_parent->GetGridOrigin().y ); diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 2176e44bf3..522b95cb2f 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -255,10 +255,10 @@ void DIALOG_PAGES_SETTINGS::initDialog() void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event ) { - if( !m_customSizeX.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.x, EDA_UNITS::INCHES, true ) ) + if( !m_customSizeX.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.x, EDA_UNITS::INCHES ) ) return; - if( !m_customSizeY.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.y, EDA_UNITS::INCHES, true ) ) + if( !m_customSizeY.Validate( MIN_PAGE_SIZE_MILS, m_maxPageSizeMils.y, EDA_UNITS::INCHES ) ) return; if( SavePageSettings() ) diff --git a/common/dialogs/panel_setup_netclasses.cpp b/common/dialogs/panel_setup_netclasses.cpp index bc9f4fedda..02c9a50b6c 100644 --- a/common/dialogs/panel_setup_netclasses.cpp +++ b/common/dialogs/panel_setup_netclasses.cpp @@ -199,7 +199,7 @@ static void netclassToGridRow( EDA_UNITS aUnits, wxGrid* aGrid, int aRow, const aGrid->SetCellValue( aRow, GRID_NAME, nc->GetName() ); #define SET_MILS_CELL( col, val ) \ - aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true, true ) ) + aGrid->SetCellValue( aRow, col, StringFromValue( aUnits, val, true ) ) SET_MILS_CELL( GRID_CLEARANCE, nc->GetClearance() ); SET_MILS_CELL( GRID_TRACKSIZE, nc->GetTrackWidth() ); @@ -327,7 +327,7 @@ static void gridRowToNetclass( EDA_UNITS aUnits, wxGrid* grid, int row, const NE nc->SetName( grid->GetCellValue( row, GRID_NAME ) ); #define MYCELL( col ) \ - ValueFromString( aUnits, grid->GetCellValue( row, col ), true ) + ValueFromString( aUnits, grid->GetCellValue( row, col ) ) nc->SetClearance( MYCELL( GRID_CLEARANCE ) ); nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) ); diff --git a/common/eda_size_ctrl.cpp b/common/eda_size_ctrl.cpp index 37e6aa59f1..cc39a08527 100644 --- a/common/eda_size_ctrl.cpp +++ b/common/eda_size_ctrl.cpp @@ -78,8 +78,8 @@ void EDA_POSITION_CTRL::Enable( bool x_win_on, bool y_win_on ) void EDA_POSITION_CTRL::SetValue( int x_value, int y_value ) { - m_FramePosX->SetValue( StringFromValue( m_UserUnit, x_value, true ) ); - m_FramePosY->SetValue( StringFromValue( m_UserUnit, y_value, true ) ); + m_FramePosX->SetValue( StringFromValue( m_UserUnit, x_value ) ); + m_FramePosY->SetValue( StringFromValue( m_UserUnit, y_value ) ); } diff --git a/common/preview_items/preview_utils.cpp b/common/preview_items/preview_utils.cpp index 5a6d811d16..45aa29b5fe 100644 --- a/common/preview_items/preview_utils.cpp +++ b/common/preview_items/preview_utils.cpp @@ -45,6 +45,7 @@ wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal, ED switch( aUnits ) { case EDA_UNITS::MILLIMETRES: fmtStr = wxT( "%.3f" ); break; // 1um + case EDA_UNITS::MILS: fmtStr = wxT( "%.1f" ); break; // 0.1mil case EDA_UNITS::INCHES: fmtStr = wxT( "%.4f" ); break; // 0.1mil case EDA_UNITS::DEGREES: fmtStr = wxT( "%.1f" ); break; // 0.1deg case EDA_UNITS::PERCENT: fmtStr = wxT( "%.1f" ); break; // 0.1% @@ -54,7 +55,7 @@ wxString KIGFX::PREVIEW::DimensionLabel( const wxString& prefix, double aVal, ED str << wxString::Format( fmtStr, To_User_Unit( aUnits, aVal ) ); if( aIncludeUnits ) - str << " " << GetAbbreviatedUnitsLabel( aUnits, false ); + str << " " << GetAbbreviatedUnitsLabel( aUnits ); return str; } diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index 3429eedfc7..8ba0a4b381 100644 --- a/common/tool/common_tools.cpp +++ b/common/tool/common_tools.cpp @@ -51,12 +51,12 @@ void COMMON_TOOLS::Reset( RESET_REASON aReason ) for( const wxString& gridDef : settings.sizes ) { - int gridSize = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridDef, true ); + int gridSize = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridDef ); m_grids.emplace_back( gridSize, gridSize ); } - m_grids.emplace_back( ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_x, true ), - ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_y, true ) ); + m_grids.emplace_back( ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_x ), + ValueFromString( EDA_UNITS::MILLIMETRES, settings.user_grid_y ) ); OnGridChanged(); } diff --git a/common/tool/grid_menu.cpp b/common/tool/grid_menu.cpp index 293d00252f..1ab3f7bd39 100644 --- a/common/tool/grid_menu.cpp +++ b/common/tool/grid_menu.cpp @@ -83,7 +83,7 @@ void GRID_MENU::BuildChoiceList( wxArrayString* aGridsList, APP_SETTINGS_BASE* a for( const wxString& gridSize : aCfg->m_Window.grid.sizes ) { - int val = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridSize, true ); + int val = (int) ValueFromString( EDA_UNITS::MILLIMETRES, gridSize ); double gridValueMils = To_User_Unit( EDA_UNITS::INCHES, val ) * 1000; double gridValue_mm = To_User_Unit( EDA_UNITS::MILLIMETRES, val ); @@ -98,7 +98,7 @@ void GRID_MENU::BuildChoiceList( wxArrayString* aGridsList, APP_SETTINGS_BASE* a if( !aCfg->m_Window.grid.user_grid_x.empty() ) { - int val = (int) ValueFromString( EDA_UNITS::INCHES, aCfg->m_Window.grid.user_grid_x, true ); + int val = (int) ValueFromString( EDA_UNITS::INCHES, aCfg->m_Window.grid.user_grid_x ); double gridValueMils = To_User_Unit( EDA_UNITS::INCHES, val ) * 1000; double gridValue_mm = To_User_Unit( EDA_UNITS::MILLIMETRES, val ); diff --git a/common/widgets/unit_binder.cpp b/common/widgets/unit_binder.cpp index 9ec5d9ed3f..94da76c1a0 100644 --- a/common/widgets/unit_binder.cpp +++ b/common/widgets/unit_binder.cpp @@ -37,17 +37,16 @@ wxDEFINE_EVENT( DELAY_FOCUS, wxCommandEvent ); UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent, wxStaticText* aLabel, wxWindow* aValue, wxStaticText* aUnitLabel, - bool aUseMils, bool allowEval ) : + bool allowEval ) : m_frame( aParent ), m_label( aLabel ), m_value( aValue ), m_unitLabel( aUnitLabel ), - m_eval( aParent->GetUserUnits(), aUseMils ), + m_eval( aParent->GetUserUnits() ), m_originTransforms( aParent->GetOriginTransforms() ), m_coordType( ORIGIN_TRANSFORMS::NOT_A_COORD ) { m_units = aParent->GetUserUnits(); - m_useMils = aUseMils; m_dataType = EDA_DATA_TYPE::DISTANCE; m_allowEval = allowEval && dynamic_cast( m_value ); m_needsEval = false; @@ -62,7 +61,7 @@ UNIT_BINDER::UNIT_BINDER( EDA_DRAW_FRAME* aParent, textEntry->ChangeValue( wxT( "0" ) ); } - m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_useMils, m_dataType ) ); + m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_dataType ) ); m_value->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( UNIT_BINDER::onSetFocus ), NULL, this ); m_value->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( UNIT_BINDER::onKillFocus ), NULL, this ); @@ -78,18 +77,17 @@ UNIT_BINDER::~UNIT_BINDER() } -void UNIT_BINDER::SetUnits( EDA_UNITS aUnits, bool aUseMils ) +void UNIT_BINDER::SetUnits( EDA_UNITS aUnits ) { m_units = aUnits; - m_useMils = aUseMils; - m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_useMils, m_dataType ) ); + m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_dataType ) ); } void UNIT_BINDER::SetDataType( EDA_DATA_TYPE aDataType ) { m_dataType = aDataType; - m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_useMils, m_dataType ) ); + m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_dataType ) ); } @@ -97,7 +95,7 @@ void UNIT_BINDER::onUnitsChanged( wxCommandEvent& aEvent ) { int temp = (int) GetValue(); - SetUnits( m_frame->GetUserUnits(), m_useMils ); + SetUnits( m_frame->GetUserUnits() ); SetValue( temp ); @@ -178,7 +176,7 @@ void UNIT_BINDER::delayedFocusHandler( wxCommandEvent& ) } -bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits, bool aUseMils ) +bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits ) { wxTextEntry* textEntry = dynamic_cast( m_value ); @@ -191,12 +189,12 @@ bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits, bool aUs // TODO: Validate() does not currently support m_dataType being anything other than DISTANCE // Note: aMin and aMax are not always given in internal units - if( GetValue() < From_User_Unit( aUnits, aMin, aUseMils ) ) + if( GetValue() < From_User_Unit( aUnits, aMin ) ) { - double val_min_iu = From_User_Unit( aUnits, aMin, aUseMils ); + double val_min_iu = From_User_Unit( aUnits, aMin ); m_errorMessage = wxString::Format( _( "%s must be at least %s." ), valueDescriptionFromLabel( m_label ), - StringFromValue( m_units, val_min_iu, true, m_useMils ) ); + StringFromValue( m_units, val_min_iu, true ) ); textEntry->SelectAll(); // Don't focus directly; we might be inside a KillFocus event handler @@ -205,12 +203,12 @@ bool UNIT_BINDER::Validate( double aMin, double aMax, EDA_UNITS aUnits, bool aUs return false; } - if( GetValue() > From_User_Unit( aUnits, aMax, aUseMils ) ) + if( GetValue() > From_User_Unit( aUnits, aMax ) ) { - double val_max_iu = From_User_Unit( aUnits, aMax, aUseMils ); + double val_max_iu = From_User_Unit( aUnits, aMax ); m_errorMessage = wxString::Format( _( "%s must be less than %s." ), valueDescriptionFromLabel( m_label ), - StringFromValue( m_units, val_max_iu, true, m_useMils ) ); + StringFromValue( m_units, val_max_iu, true ) ); textEntry->SelectAll(); // Don't focus directly; we might be inside a KillFocus event handler @@ -227,14 +225,14 @@ void UNIT_BINDER::SetValue( int aValue ) { double value = aValue; double displayValue = m_originTransforms.ToDisplay( value, m_coordType ); - SetValue( StringFromValue( m_units, displayValue, false, m_useMils, m_dataType ) ); + SetValue( StringFromValue( m_units, displayValue, false, m_dataType ) ); } void UNIT_BINDER::SetDoubleValue( double aValue ) { double displayValue = m_originTransforms.ToDisplay( aValue, m_coordType ); - SetValue( StringFromValue( m_units, displayValue, false, m_useMils, m_dataType ) ); + SetValue( StringFromValue( m_units, displayValue, false, m_dataType ) ); } @@ -251,7 +249,7 @@ void UNIT_BINDER::SetValue( wxString aValue ) if( m_allowEval ) m_eval.Clear(); - m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_useMils, m_dataType ) ); + m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_dataType ) ); } @@ -259,7 +257,7 @@ void UNIT_BINDER::ChangeValue( int aValue ) { double value = aValue; double displayValue = m_originTransforms.ToDisplay( value, m_coordType ); - ChangeValue( StringFromValue( m_units, displayValue, false, m_useMils ) ); + ChangeValue( StringFromValue( m_units, displayValue, false ) ); } @@ -276,7 +274,7 @@ void UNIT_BINDER::ChangeValue( const wxString& aValue ) if( m_allowEval ) m_eval.Clear(); - m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_useMils, m_dataType ) ); + m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units, m_dataType ) ); } @@ -298,7 +296,7 @@ long long int UNIT_BINDER::GetValue() else return 0; - long long int displayValue = ValueFromString( m_units, value, m_useMils, m_dataType ); + long long int displayValue = ValueFromString( m_units, value, m_dataType ); return m_originTransforms.FromDisplay( displayValue, m_coordType ); } @@ -321,7 +319,7 @@ double UNIT_BINDER::GetDoubleValue() else return 0.0; - double displayValue = DoubleValueFromString( m_units, value, m_useMils, m_dataType ); + double displayValue = DoubleValueFromString( m_units, value, m_dataType ); return m_originTransforms.FromDisplay( displayValue, m_coordType ); } diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp index 8f92454900..d3ced22d70 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -435,7 +435,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow() { - if( !m_textSize.Validate( 1.0, 10000.0, EDA_UNITS::INCHES, true ) ) // 1 mil .. 10 inches + if( !m_textSize.Validate( 1.0, 10000.0, EDA_UNITS::INCHES ) ) // 1 mil .. 10 inches return false; SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet(); diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp index 7335cd5901..628e41fc5b 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp @@ -112,19 +112,19 @@ public: val = PinOrientationNames()[ PinOrientationIndex( pin->GetOrientation() ) ]; break; case COL_NUMBER_SIZE: - val = StringFromValue( aUserUnits, pin->GetNumberTextSize(), true, true ); + val = StringFromValue( aUserUnits, pin->GetNumberTextSize(), true ); break; case COL_NAME_SIZE: - val = StringFromValue( aUserUnits, pin->GetNameTextSize(), true, true ); + val = StringFromValue( aUserUnits, pin->GetNameTextSize(), true ); break; case COL_LENGTH: - val = StringFromValue( aUserUnits, pin->GetLength(), true ); + val = StringFromValue( aUserUnits, pin->GetLength() ); break; case COL_POSX: - val = StringFromValue( aUserUnits, pin->GetPosition().x, true ); + val = StringFromValue( aUserUnits, pin->GetPosition().x ); break; case COL_POSY: - val = StringFromValue( aUserUnits, pin->GetPosition().y, true ); + val = StringFromValue( aUserUnits, pin->GetPosition().y ); break; default: wxFAIL; @@ -186,11 +186,11 @@ public: break; case COL_NUMBER_SIZE: - pin->SetNumberTextSize( ValueFromString( m_userUnits, aValue, true ) ); + pin->SetNumberTextSize( ValueFromString( m_userUnits, aValue ) ); break; case COL_NAME_SIZE: - pin->SetNameTextSize( ValueFromString( m_userUnits, aValue, true ) ); + pin->SetNameTextSize( ValueFromString( m_userUnits, aValue ) ); break; case COL_LENGTH: @@ -261,8 +261,8 @@ public: break; case COL_NUMBER_SIZE: case COL_NAME_SIZE: - res = cmp( ValueFromString( units, lhStr, true ), - ValueFromString( units, rhStr, true ) ); + res = cmp( ValueFromString( units, lhStr ), + ValueFromString( units, rhStr ) ); break; case COL_LENGTH: case COL_POSX: diff --git a/eeschema/dialogs/panel_setup_formatting.cpp b/eeschema/dialogs/panel_setup_formatting.cpp index f46ff2f4f6..8ef397118f 100644 --- a/eeschema/dialogs/panel_setup_formatting.cpp +++ b/eeschema/dialogs/panel_setup_formatting.cpp @@ -59,10 +59,10 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow() m_choiceSeparatorRefId->SetSelection( refStyleSelection ); - m_textSize.SetUnits( EDA_UNITS::INCHES, true ); - m_lineWidth.SetUnits( EDA_UNITS::INCHES, true ); - m_pinSymbolSize.SetUnits( EDA_UNITS::INCHES, true ); - m_junctionSize.SetUnits( EDA_UNITS::INCHES, true ); + m_textSize.SetUnits( EDA_UNITS::INCHES ); + m_lineWidth.SetUnits( EDA_UNITS::INCHES ); + m_pinSymbolSize.SetUnits( EDA_UNITS::INCHES ); + m_junctionSize.SetUnits( EDA_UNITS::INCHES ); m_textSize.SetValue( settings.m_DefaultTextSize ); m_lineWidth.SetValue( settings.m_DefaultLineWidth ); diff --git a/eeschema/fields_grid_table.cpp b/eeschema/fields_grid_table.cpp index 84e683bd44..107bd07209 100644 --- a/eeschema/fields_grid_table.cpp +++ b/eeschema/fields_grid_table.cpp @@ -410,7 +410,7 @@ wxString FIELDS_GRID_TABLE::GetValue( int aRow, int aCol ) return StringFromBool( field.IsBold() ); case FDC_TEXT_SIZE: - return StringFromValue( m_userUnits, field.GetTextSize().GetHeight(), true, true ); + return StringFromValue( m_userUnits, field.GetTextSize().GetHeight() ); case FDC_ORIENTATION: switch ( (int) field.GetTextAngle() ) @@ -422,10 +422,10 @@ wxString FIELDS_GRID_TABLE::GetValue( int aRow, int aCol ) break; case FDC_POSX: - return StringFromValue( m_userUnits, field.GetTextPos().x, true ); + return StringFromValue( m_userUnits, field.GetTextPos().x ); case FDC_POSY: - return StringFromValue( m_userUnits, field.GetTextPos().y, true ); + return StringFromValue( m_userUnits, field.GetTextPos().y ); default: // we can't assert here because wxWidgets sometimes calls this without checking @@ -507,8 +507,8 @@ void FIELDS_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue break; case FDC_TEXT_SIZE: - field.SetTextSize( wxSize( ValueFromString( m_userUnits, aValue, true ), - ValueFromString( m_userUnits, aValue, true ) ) ); + field.SetTextSize( wxSize( ValueFromString( m_userUnits, aValue ), + ValueFromString( m_userUnits, aValue ) ) ); break; case FDC_ORIENTATION: diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index fb4b67998e..31c9672338 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -396,7 +396,7 @@ void LIB_ARC::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorGetUserUnits(), m_Width, true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width ); aList.emplace_back( _( "Line Width" ), msg, BLUE ); diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index 4241886a5a..7590840a80 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -335,7 +335,7 @@ void LIB_BEZIER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorGetUserUnits(), m_Width, true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width ); aList.emplace_back( _( "Line Width" ), msg, BLUE ); diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index 22219de5c8..94150168bf 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -244,11 +244,11 @@ void LIB_CIRCLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList LIB_ITEM::GetMsgPanelInfo( aFrame, aList ); - msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) ); - msg = MessageTextFromValue( aFrame->GetUserUnits(), GetRadius(), true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), GetRadius() ); aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) ); msg.Printf( wxT( "(%d, %d, %d, %d)" ), diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index bf77767aef..1b522f7974 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -431,10 +431,10 @@ void LIB_FIELD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList msg = GetTextStyleName(); aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, MAGENTA ) ); - msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth(), true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) ); - msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight(), true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() ); aList.push_back( MSG_PANEL_ITEM( _( "Height" ), msg, BLUE ) ); // Display field name (ref, value ...) diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 3251263d4a..2ea25c7dd2 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -1010,7 +1010,7 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) ); // Display pin length - text = StringFromValue( aFrame->GetUserUnits(), m_length, true ); + text = StringFromValue( aFrame->GetUserUnits(), m_length ); aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) ); text = PinOrientationName( (unsigned) PinOrientationIndex( m_orientation ) ); @@ -1020,10 +1020,10 @@ void LIB_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) pinpos.y = -pinpos.y; // Display coord are top to bottom // lib items coord are bottom to top - text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.x, true ); + text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.x ); aList.push_back( MSG_PANEL_ITEM( _( "Pos X" ), text, DARKMAGENTA ) ); - text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.y, true ); + text = MessageTextFromValue( aFrame->GetUserUnits(), pinpos.y ); aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) ); } diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 67cb5b723a..2dcbf75af6 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -335,7 +335,7 @@ void LIB_POLYLINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aLi LIB_ITEM::GetMsgPanelInfo( aFrame, aList ); - msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) ); diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index f4f5859f09..aca48f39db 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -192,7 +192,7 @@ void LIB_RECTANGLE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aL { LIB_ITEM::GetMsgPanelInfo( aFrame, aList ); - wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true ); + wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) ); } diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 306a526c2d..63d59970df 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -349,7 +349,7 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) { LIB_ITEM::GetMsgPanelInfo( aFrame, aList ); - wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness(), true ); + wxString msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() ); aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) ); } diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp index 2e6eabaae9..6ca282cfbf 100644 --- a/eeschema/sch_pin.cpp +++ b/eeschema/sch_pin.cpp @@ -171,16 +171,16 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), msg, DARKGREEN ) ); // Display pin length - msg = StringFromValue( aFrame->GetUserUnits(), GetLength(), true ); + msg = StringFromValue( aFrame->GetUserUnits(), GetLength() ); aList.push_back( MSG_PANEL_ITEM( _( "Length" ), msg, MAGENTA ) ); msg = PinOrientationName( (unsigned) PinOrientationIndex( GetOrientation() ) ); aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg, DARKMAGENTA ) ); - msg = MessageTextFromValue( aFrame->GetUserUnits(), m_position.x, true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), m_position.x ); aList.emplace_back( _( "Pos X" ), msg, DARKMAGENTA ); - msg = MessageTextFromValue( aFrame->GetUserUnits(), m_position.y, true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), m_position.y ); aList.emplace_back( _( "Pos Y" ), msg, DARKMAGENTA ); SCH_EDIT_FRAME* schframe = dynamic_cast( aFrame ); diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index d9df9214f2..c74e2aebfd 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -663,7 +663,7 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) } // Display text size (X or Y value, with are the same value in Eeschema) - msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth(), true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() ); aList.push_back( MSG_PANEL_ITEM( _( "Size" ), msg, RED ) ); SCH_EDIT_FRAME* frame = dynamic_cast( aFrame ); diff --git a/include/base_units.h b/include/base_units.h index 2fa7002f4c..33b880a3a0 100644 --- a/include/base_units.h +++ b/include/base_units.h @@ -90,9 +90,8 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed = * @return The converted value, in double * @param aUnit The units to convert \a aValue to. * @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 aUnit, double aValue, bool aUseMils = false ); +double To_User_Unit( EDA_UNITS aUnit, double aValue ); /** * Function AngleToStringDegrees @@ -116,18 +115,14 @@ wxString AngleToStringDegrees( double aAngle ); * @param aUnits The units to show the value in. The unit string is added to the * message text. * @param aValue The double value to convert. - * @param aUseMils Convert inch values to mils if true. * @param aType Type of the unit being used (e.g. distance, area, etc.) * @return The converted string for display in user interface elements. */ -wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, bool aUseMils = false, - EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); +wxString MessageTextFromValue( EDA_UNITS aUnits, double aValue, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); -wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, bool aUseMils = false, - EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); +wxString MessageTextFromValue( EDA_UNITS aUnits, int aValue, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); -wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aUseMils = false, - EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); +wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); /** * Function StringFromValue @@ -146,17 +141,16 @@ wxString MessageTextFromValue( EDA_UNITS aUnits, long long int aValue, bool aUse * @param aUnit = display units (INCHES, MILLIMETRE ..) * @param aValue = value in Internal_Unit * @param aAddUnitSymbol = true to add symbol unit to the string value - * @param aUseMils Indicates mils should be used for imperial units (inches). * @return A wxString object containing value and optionally the symbol unit (like 2.000 mm) */ wxString StringFromValue( EDA_UNITS aUnit, double aValue, bool aAddUnitSymbol = false, - bool aUseMils = false, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); + EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); /** * Return in internal units the value "val" given in a real unit * such as "in", "mm" or "deg" */ -double From_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils = false ); +double From_User_Unit( EDA_UNITS aUnit, double aValue ); /** @@ -166,10 +160,9 @@ double From_User_Unit( EDA_UNITS aUnit, double aValue, bool aUseMils = false ); * * @param aUnits The units of \a aTextValue. * @param aTextValue A reference to a wxString object containing the string to convert. - * @param aUseMils Indicates mils should be used for imperial units (inches). * @return A double representing that value in internal units */ -double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils = false, +double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); /** @@ -179,28 +172,25 @@ double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool * * @param aUnits The units of \a aTextValue. * @param aTextValue A reference to a wxString object containing the string to convert. - * @param aUseMils Indicates mils should be used for imperial units (inches). * @return The string from Value, according to units (inch, mm ...) for display, */ -long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, bool aUseMils = false, +long long int ValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); /** * Function FetchUnitsFromString - * writes any unit info found in the string to aUnits and aUseMils. + * writes any unit info found in the string to aUnits. */ -void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits, bool& aUseMils ); +void FetchUnitsFromString( const wxString& aTextValue, EDA_UNITS& aUnits ); /** * Get the units string for a given units type. * * @param aUnits - The units requested. - * @param aUseMils - Use mils for the unit * @param aType - The data type of the unit (e.g. distance, area, etc.) * @return The human readable units string. */ -wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, bool aUseMils = false, - EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); +wxString GetAbbreviatedUnitsLabel( EDA_UNITS aUnit, EDA_DATA_TYPE aType = EDA_DATA_TYPE::DISTANCE ); /** * Function FormatInternalUnits diff --git a/include/common.h b/include/common.h index d7aec28e06..141c72fa2b 100644 --- a/include/common.h +++ b/include/common.h @@ -204,6 +204,7 @@ enum class EDA_UNITS UNSCALED = 2, DEGREES = 3, PERCENT = 4, + MILS = 5, }; diff --git a/include/widgets/unit_binder.h b/include/widgets/unit_binder.h index 61e202bd8d..f8ede349c3 100644 --- a/include/widgets/unit_binder.h +++ b/include/widgets/unit_binder.h @@ -50,12 +50,11 @@ public: * @param aValue is the control used to edit or display the given value (wxTextCtrl, * wxComboBox, wxStaticText, etc.). * @param aUnitLabel is the units label displayed after the text input widget - * @param aUseMils specifies the use of mils for imperial units (instead of inches) * @param aAllowEval indicates \a aTextInput's content should be eval'ed before storing */ UNIT_BINDER( EDA_DRAW_FRAME* aParent, wxStaticText* aLabel, wxWindow* aValue, wxStaticText* aUnitLabel, - bool aUseMils = false, bool aAllowEval = true ); + bool aAllowEval = true ); ~UNIT_BINDER() override; @@ -64,7 +63,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 aUnits, bool aUseMils = false ); + virtual void SetUnits( EDA_UNITS aUnits ); /** * Used to override the datatype of the displayed property (default is DISTANCE) @@ -131,11 +130,9 @@ public: * @param aMin a minimum value for validation * @param aMax a maximum value for validation * @param aUnits the units of the min/max parameters (use UNSCALED for internal units) - * @param aUseMils if \a aUnits is EDA_UNITS::INCHES, interpret as mils * @return false on error. */ - virtual bool Validate( double aMin, double aMax, EDA_UNITS aUnits = EDA_UNITS::UNSCALED, - bool aUseMils = false ); + virtual bool Validate( double aMin, double aMax, EDA_UNITS aUnits = EDA_UNITS::UNSCALED ); void SetLabel( const wxString& aLabel ); @@ -190,7 +187,6 @@ protected: ///> Currently used units. EDA_UNITS m_units; - bool m_useMils; EDA_DATA_TYPE m_dataType; ///> Validation support. diff --git a/pcbnew/board_stackup_manager/board_stackup_reporter.cpp b/pcbnew/board_stackup_manager/board_stackup_reporter.cpp index c30f8d9610..6f34fe0653 100644 --- a/pcbnew/board_stackup_manager/board_stackup_reporter.cpp +++ b/pcbnew/board_stackup_manager/board_stackup_reporter.cpp @@ -84,7 +84,7 @@ wxString BuildStackupReport( BOARD_STACKUP& aStackup, EDA_UNITS aUnits ) if( item->IsThicknessEditable() ) { txt.Printf( " Thickness %s", - StringFromValue( aUnits, item->GetThickness( idx ), true, true ) ); + StringFromValue( aUnits, item->GetThickness( idx ), true ) ); report << txt; if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC && item->IsThicknessLocked( idx ) ) diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.cpp b/pcbnew/board_stackup_manager/panel_board_stackup.cpp index 99186beccd..1faa45edae 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/panel_board_stackup.cpp @@ -317,17 +317,17 @@ void PANEL_SETUP_BOARD_STACKUP::onUpdateThicknessValue( wxUpdateUIEvent& event ) wxTextCtrl* textCtrl = static_cast( ui_item.m_ThicknessCtrl ); wxString txt = textCtrl->GetValue(); - int item_thickness = ValueFromString( m_frame->GetUserUnits(), txt, true ); + int item_thickness = ValueFromString( m_frame->GetUserUnits(), txt ); thickness += item_thickness; } - m_tcCTValue->SetValue( StringFromValue( m_units, thickness, true, true ) ); + m_tcCTValue->SetValue( StringFromValue( m_units, thickness, true ) ); } int PANEL_SETUP_BOARD_STACKUP::GetPcbThickness() { - return ValueFromString( m_units, m_thicknessCtrl->GetValue(), true ); + return ValueFromString( m_units, m_thicknessCtrl->GetValue() ); } @@ -338,7 +338,7 @@ void PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard( bool aFullSync ) if( aFullSync ) { int thickness = m_brdSettings->GetBoardThickness(); - m_thicknessCtrl->SetValue( StringFromValue( m_units, thickness, true, true ) ); + m_thicknessCtrl->SetValue( StringFromValue( m_units, thickness, true ) ); m_rbDielectricConstraint->SetSelection( brd_stackup.m_HasDielectricConstrains ? 1 : 0 ); m_choiceEdgeConn->SetSelection( brd_stackup.m_EdgeConnectorConstraints ); @@ -396,7 +396,7 @@ void PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard( bool aFullSync ) if( textCtrl ) textCtrl->SetValue( StringFromValue( m_units, - item->GetThickness( sub_item ), true, true ) ); + item->GetThickness( sub_item ), true ) ); if( item->GetType() == BS_ITEM_TYPE_DIELECTRIC ) { @@ -637,8 +637,7 @@ BOARD_STACKUP_ROW_UI_ITEM PANEL_SETUP_BOARD_STACKUP::createRowData( int aRow, { wxTextCtrl* textCtrl = new wxTextCtrl( m_scGridWin, ID_ITEM_THICKNESS+row ); textCtrl->SetMinSize( m_numericTextCtrlSize ); - textCtrl->SetValue( StringFromValue( m_units, item->GetThickness( aSublayerIdx ), - true, true ) ); + textCtrl->SetValue( StringFromValue( m_units, item->GetThickness( aSublayerIdx ), true ) ); m_fgGridSizer->Add( textCtrl, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 ); m_controlItemsList.push_back( textCtrl ); textCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, @@ -989,7 +988,7 @@ bool PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup() wxTextCtrl* textCtrl = static_cast( ui_item.m_ThicknessCtrl ); txt = textCtrl->GetValue(); - int new_thickness = ValueFromString( m_frame->GetUserUnits(), txt, true ); + int new_thickness = ValueFromString( m_frame->GetUserUnits(), txt ); item->SetThickness( new_thickness, sub_item ); stackup_thickness += new_thickness; @@ -1046,10 +1045,9 @@ bool PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup() wxString msg; msg.Printf( _( "Board thickness %s differs from stackup thickness %s\n" "Allowed max error %s" ), - StringFromValue( m_units, pcbThickness, true, true ), - StringFromValue( m_units, stackup_thickness, true, true ), - StringFromValue( m_units, KiROUND( relative_error_max * pcbThickness), - true, true ) ); + StringFromValue( m_units, pcbThickness ), + StringFromValue( m_units, stackup_thickness ), + StringFromValue( m_units, KiROUND( relative_error_max * pcbThickness) ) ); if( !error_msg.IsEmpty() ) error_msg << "\n"; @@ -1223,8 +1221,7 @@ void PANEL_SETUP_BOARD_STACKUP::onCalculateDielectricThickness( wxCommandEvent& { item->SetThickness( dielectric_thickness, sublayer_idx ); wxTextCtrl* textCtrl = static_cast( ui_item.m_ThicknessCtrl ); - textCtrl->SetValue( StringFromValue( m_units, item->GetThickness( sublayer_idx ), - true, true ) ); + textCtrl->SetValue( StringFromValue( m_units, item->GetThickness( sublayer_idx ) ) ); } } } @@ -1376,7 +1373,7 @@ void PANEL_SETUP_BOARD_STACKUP::onThicknessChange( wxCommandEvent& event ) BOARD_STACKUP_ITEM* item = GetStackupItem( row ); int idx = GetSublayerId( row ); - item->SetThickness( ValueFromString( m_frame->GetUserUnits(), value, true ), idx ); + item->SetThickness( ValueFromString( m_frame->GetUserUnits(), value ), idx ); } diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index a23d2030ff..5e86fafc2c 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -41,7 +41,6 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent, KICAD_T aType ) : BOARD_ITEM( aParent, aType ), m_overrideTextEnabled( false ), m_units( EDA_UNITS::INCHES ), - m_useMils( false ), m_autoUnits( false ), m_unitsFormat( DIM_UNITS_FORMAT::BARE_SUFFIX ), m_precision( 4 ), @@ -88,12 +87,12 @@ void DIMENSION::updateText() case DIM_UNITS_FORMAT::BARE_SUFFIX: // normal text += " "; - text += GetAbbreviatedUnitsLabel( m_units, m_useMils ); + text += GetAbbreviatedUnitsLabel( m_units ); break; case DIM_UNITS_FORMAT::PAREN_SUFFIX: // parenthetical text += " ("; - text += GetAbbreviatedUnitsLabel( m_units, m_useMils ); + text += GetAbbreviatedUnitsLabel( m_units ); text += ")"; break; } @@ -121,7 +120,7 @@ wxString DIMENSION::GetValueText() const wxString text; wxString format = wxT( "%." ) + wxString::Format( "%i", m_precision ) + wxT( "f" ); - text.Printf( format, To_User_Unit( m_units, val, m_useMils ) ); + text.Printf( format, To_User_Unit( m_units, val ) ); if( m_suppressZeroes ) { @@ -153,30 +152,39 @@ void DIMENSION::SetSuffix( const wxString& aSuffix ) } -void DIMENSION::SetUnits( EDA_UNITS aUnits, bool aUseMils ) +void DIMENSION::SetUnits( EDA_UNITS aUnits ) { m_units = aUnits; - m_useMils = aUseMils; } DIM_UNITS_MODE DIMENSION::GetUnitsMode() const { if( m_autoUnits ) + { return DIM_UNITS_MODE::AUTOMATIC; - else if( m_units == EDA_UNITS::MILLIMETRES ) - return DIM_UNITS_MODE::MILLIMETRES; - else if( m_useMils ) - return DIM_UNITS_MODE::MILS; + } else - return DIM_UNITS_MODE::INCHES; + { + switch( m_units ) + { + case EDA_UNITS::MILLIMETRES: + return DIM_UNITS_MODE::MILLIMETRES; + + case EDA_UNITS::MILS: + return DIM_UNITS_MODE::MILS; + + default: + case EDA_UNITS::INCHES: + return DIM_UNITS_MODE::INCHES; + } + } } void DIMENSION::SetUnitsMode( DIM_UNITS_MODE aMode ) { m_autoUnits = false; - m_useMils = false; switch( aMode ) { @@ -186,7 +194,6 @@ void DIMENSION::SetUnitsMode( DIM_UNITS_MODE aMode ) case DIM_UNITS_MODE::MILS: m_units = EDA_UNITS::INCHES; - m_useMils = true; break; case DIM_UNITS_MODE::MILLIMETRES: @@ -329,10 +336,9 @@ void DIMENSION::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorGetOriginTransforms(); units = aFrame->GetUserUnits(); diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index e2cb29de77..218b0caf4c 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -162,13 +162,12 @@ public: wxString GetSuffix() const { return m_suffix; } void SetSuffix( const wxString& aSuffix ); - void GetUnits( EDA_UNITS& aUnits, bool& aUseMils ) const + void GetUnits( EDA_UNITS& aUnits ) const { aUnits = m_units; - aUseMils = m_useMils; } - void SetUnits( EDA_UNITS aUnits, bool aUseMils ); + void SetUnits( EDA_UNITS aUnits ); DIM_UNITS_MODE GetUnitsMode() const; void SetUnitsMode( DIM_UNITS_MODE aMode ); diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 385ceeed1b..d66a5dcb84 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -548,7 +548,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector if( (GetShape() == PAD_SHAPE_CIRCLE || GetShape() == PAD_SHAPE_OVAL ) && m_size.x == m_size.y ) { - msg = MessageTextFromValue( units, m_size.x, true ); + msg = MessageTextFromValue( units, m_size.x ); aList.emplace_back( _( "Diameter" ), msg, RED ); } else { - msg = MessageTextFromValue( units, m_size.x, true ); + msg = MessageTextFromValue( units, m_size.x ); aList.emplace_back( _( "Width" ), msg, RED ); - msg = MessageTextFromValue( units, m_size.y, true ); + msg = MessageTextFromValue( units, m_size.y ); aList.emplace_back( _( "Height" ), msg, RED ); } @@ -875,11 +875,11 @@ void D_PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector if( GetPadToDieLength() ) { - msg = MessageTextFromValue(units, GetPadToDieLength(), true ); + msg = MessageTextFromValue(units, GetPadToDieLength() ); aList.emplace_back( _( "Length in Package" ), msg, CYAN ); } - msg = MessageTextFromValue( units, m_drill.x, true ); + msg = MessageTextFromValue( units, m_drill.x ); if( GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ) { @@ -887,16 +887,16 @@ void D_PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector } else { - msg = MessageTextFromValue( units, m_drill.x, true ) + msg = MessageTextFromValue( units, m_drill.x ) + wxT( "/" ) - + MessageTextFromValue( units, m_drill.y, true ); + + MessageTextFromValue( units, m_drill.y ); aList.emplace_back( _( "Drill X / Y" ), msg, RED ); } wxString source; int clearance = GetClearance( GetLayer(), nullptr, &source ); - msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) ); + msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) ); msg2.Printf( _( "(from %s)" ), source ); aList.emplace_back( msg, msg2, BLACK ); } diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 4fe1260d8c..9198026bd7 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -313,13 +313,13 @@ void TEXTE_MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorGetUserUnits(), GetTextThickness(), true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextThickness() ); aList.emplace_back( _( "Thickness" ), msg, DARKGREEN ); - msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth(), true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextWidth() ); aList.emplace_back( _( "Width" ), msg, RED ); - msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight(), true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), GetTextHeight() ); aList.emplace_back( _( "Height" ), msg, RED ); } diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index d36a02ada3..e89ccea3a1 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -623,7 +623,7 @@ void TRACK::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector aList.emplace_back( _( "Layer" ), LayerMaskDescribe(), DARKGREEN ); // Display width - msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width ); aList.emplace_back( _( "Width" ), msg, DARKCYAN ); @@ -641,7 +641,7 @@ void TRACK::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector if( lenPadToDie != 0 ) { - msg = MessageTextFromValue( aFrame->GetUserUnits(), lenPadToDie, true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), lenPadToDie ); aList.emplace_back( _( "Pad To Die Length" ), msg, DARKCYAN ); msg = MessageTextFromValue( aFrame->GetUserUnits(), trackLen + lenPadToDie ); @@ -651,14 +651,14 @@ void TRACK::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector int clearance = GetClearance( GetLayer(), nullptr, &source ); - msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) ); + msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) ); msg2.Printf( _( "(from %s)" ), source ); aList.emplace_back( msg, msg2, BLACK ); int minWidth, maxWidth; GetWidthConstraints( &minWidth, &maxWidth, &source ); - msg.Printf( _( "Min Width: %s" ), MessageTextFromValue( units, minWidth, true ) ); + msg.Printf( _( "Min Width: %s" ), MessageTextFromValue( units, minWidth ) ); msg2.Printf( _( "(from %s)" ), source ); aList.emplace_back( msg, msg2, BLACK ); } @@ -688,7 +688,7 @@ void VIA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList.emplace_back( _( "Layer" ), LayerMaskDescribe(), DARKGREEN ); // Display width - msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width, true ); + msg = MessageTextFromValue( aFrame->GetUserUnits(), m_Width ); // Display diameter value: aList.emplace_back( _( "Diameter" ), msg, DARKCYAN ); @@ -700,13 +700,13 @@ void VIA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& int clearance = GetClearance( GetLayer(), nullptr, &source ); - msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) ); + msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance ) ); msg2.Printf( _( "(from %s)" ), source ); aList.emplace_back( msg, msg2, BLACK ); int minAnnulus = GetMinAnnulus( GetLayer(), &source ); - msg.Printf( _( "Min Annular Width: %s" ), MessageTextFromValue( units, minAnnulus, true ) ); + msg.Printf( _( "Min Annular Width: %s" ), MessageTextFromValue( units, minAnnulus ) ); msg2.Printf( _( "(from %s)" ), source ); aList.emplace_back( msg, msg2, BLACK ); } diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 041c9518fe..faef0e0220 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -618,13 +618,13 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aSegList, SHAPE_POLY_SE if( aErrorText ) { msg.Printf( _( "Unable to find edge with an endpoint of (%s, %s)." ), - StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.x, true ), - StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.y, true ) ); + StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.x ), + StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.y ) ); *aErrorText << msg << "\n"; } @@ -711,8 +711,8 @@ bool ConvertOutlineToPolygon( std::vector& aSegList, SHAPE_POLY_SE if( aErrorText ) { msg.Printf( _( "Unable to find edge with an endpoint of (%s, %s)." ), - StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.x, true ), - StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.y, true ) ); + StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.x ), + StringFromValue( EDA_UNITS::MILLIMETRES, prevPt.y ) ); *aErrorText << msg << "\n"; } diff --git a/pcbnew/dialogs/dialog_board_reannotate.cpp b/pcbnew/dialogs/dialog_board_reannotate.cpp index ab18fdd011..69d1089861 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.cpp +++ b/pcbnew/dialogs/dialog_board_reannotate.cpp @@ -363,8 +363,8 @@ void DIALOG_BOARD_REANNOTATE::MakeSampleText( wxString& aMessage ) "rounded to a %s, %s grid. " ), moduleLocation ? _( "footprint location" ) : _( "reference designator location" ), - MessageTextFromValue( m_Units, m_SortGridx, false ), - MessageTextFromValue( m_Units, m_SortGridy, false ) ); + MessageTextFromValue( m_Units, m_SortGridx ), + MessageTextFromValue( m_Units, m_SortGridy ) ); if( m_UpdateSchematic->GetValue() ) aMessage += _( "\nThe schematic will be updated." ); @@ -399,14 +399,14 @@ void DIALOG_BOARD_REANNOTATE::GetParameters() if( m_GridIndex >= ( int ) m_Settings->m_Window.grid.sizes.size() ) { m_SortGridx = DoubleValueFromString( EDA_UNITS::INCHES, - m_Settings->m_Window.grid.user_grid_x, true ); + m_Settings->m_Window.grid.user_grid_x ); m_SortGridy = DoubleValueFromString( EDA_UNITS::INCHES, - m_Settings->m_Window.grid.user_grid_y, true ); + m_Settings->m_Window.grid.user_grid_y ); } else { m_SortGridx = DoubleValueFromString( EDA_UNITS::INCHES, - m_Settings->m_Window.grid.sizes[ m_GridIndex ], true ); + m_Settings->m_Window.grid.sizes[ m_GridIndex ] ); m_SortGridy = m_SortGridx; } @@ -491,8 +491,8 @@ static bool ModuleCompare( const RefDesInfo& aA, const RefDesInfo& aB ) /// @return the string wxString DIALOG_BOARD_REANNOTATE::CoordTowxString( int aX, int aY ) { - return wxString::Format( "%s, %s", MessageTextFromValue( m_Units, aX, false ), - MessageTextFromValue( m_Units, aY, false ) ); + return wxString::Format( "%s, %s", MessageTextFromValue( m_Units, aX ), + MessageTextFromValue( m_Units, aY ) ); } diff --git a/pcbnew/dialogs/dialog_dimension_properties.cpp b/pcbnew/dialogs/dialog_dimension_properties.cpp index 8b62d5b737..da58873381 100644 --- a/pcbnew/dialogs/dialog_dimension_properties.cpp +++ b/pcbnew/dialogs/dialog_dimension_properties.cpp @@ -183,10 +183,9 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow() m_cbOverrideValue->SetValue( m_dimension->GetOverrideTextEnabled() ); EDA_UNITS units; - bool useMils; - m_dimension->GetUnits( units, useMils ); + m_dimension->GetUnits( units ); - m_cbUnits->SetSelection( units == EDA_UNITS::MILLIMETRES ? 2 : useMils ? 1 : 0 ); + m_cbUnits->SetSelection( units == EDA_UNITS::MILLIMETRES ? 2 : units == EDA_UNITS::MILS ? 1 : 0 ); m_cbUnitsFormat->SetSelection( static_cast( m_dimension->GetUnitsFormat() ) ); m_cbPrecision->SetSelection( static_cast( m_dimension->GetPrecision() ) ); @@ -300,7 +299,7 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( DIMENSION* aTarget aTarget->SetSuffix( board->ConvertCrossReferencesToKIIDs( m_txtSuffix->GetValue() ) ); aTarget->SetLayer( static_cast( m_cbLayerActual->GetLayerSelection() ) ); - aTarget->SetUnits( m_frame->GetUserUnits(), false ); + aTarget->SetUnits( m_frame->GetUserUnits() ); aTarget->SetUnitsMode( static_cast( m_cbUnits->GetSelection() ) ); aTarget->SetUnitsFormat( static_cast( m_cbUnitsFormat->GetSelection() ) ); aTarget->SetPrecision( m_cbPrecision->GetSelection() ); diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp index 7980833b58..071bc9ab51 100644 --- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -186,7 +186,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow() m_LayerCtrl->SetLayerSelection( UNDEFINED_LAYER ); #define SET_INT_VALUE( aRow, aCol, aValue ) \ - m_grid->SetCellValue( aRow, aCol, StringFromValue( GetUserUnits(), aValue, true, true ) ) + m_grid->SetCellValue( aRow, aCol, StringFromValue( GetUserUnits(), aValue, true ) ) #define SET_BOOL_VALUE( aRow, aCol, aValue ) \ attr = new wxGridCellAttr; \ diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp index 1470202a13..c44a889b34 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp @@ -185,7 +185,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists() void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid() { #define SET_NETCLASS_VALUE( row, col, val ) \ - m_netclassGrid->SetCellValue( row, col, StringFromValue( GetUserUnits(), val, true, true ) ) + m_netclassGrid->SetCellValue( row, col, StringFromValue( GetUserUnits(), val, true ) ) m_netclassGrid->SetCellValue( 0, GRID_TRACKSIZE, _( "Track Width" ) ); m_netclassGrid->SetCellValue( 0, GRID_VIASIZE, _( "Via Size" ) ); diff --git a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp index 3caeca47c4..ebd4fa485a 100644 --- a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp @@ -279,10 +279,10 @@ bool DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataToWindow() msg.Printf( "Corner %d", row+1 ); m_gridCornersList->SetRowLabelValue( row, msg ); - msg = StringFromValue( GetUserUnits(), m_currPoints[row].x, true, true ); + msg = StringFromValue( GetUserUnits(), m_currPoints[row].x ); m_gridCornersList->SetCellValue( row, 0, msg ); - msg = StringFromValue( GetUserUnits(), m_currPoints[row].y, true, true ); + msg = StringFromValue( GetUserUnits(), m_currPoints[row].y ); m_gridCornersList->SetCellValue( row, 1, msg ); } @@ -512,9 +512,9 @@ void DIALOG_PAD_PRIMITIVE_POLY_PROPS::onCellChanging( wxGridEvent& event ) return; if( col == 0 ) // Set the X value - m_currPoints[row].x = ValueFromString( GetUserUnits(), msg, true ); + m_currPoints[row].x = ValueFromString( GetUserUnits(), msg ); else // Set the Y value - m_currPoints[row].y = ValueFromString( GetUserUnits(), msg, true ); + m_currPoints[row].y = ValueFromString( GetUserUnits(), msg ); Validate(); diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 294f7e2bc2..c033be1c14 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -676,8 +676,8 @@ void DIALOG_PAD_PROPERTIES::initValues() static wxString formatCoord( EDA_UNITS aUnits, wxPoint aCoord ) { return wxString::Format( "(X:%s Y:%s)", - MessageTextFromValue( aUnits, aCoord.x, true ), - MessageTextFromValue( aUnits, aCoord.y, true ) ); + MessageTextFromValue( aUnits, aCoord.x ), + MessageTextFromValue( aUnits, aCoord.y ) ); } void DIALOG_PAD_PROPERTIES::displayPrimitivesList() @@ -699,7 +699,7 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList() for( wxString& s : bs_info ) s.Empty(); - bs_info[4] = _( "width " ) + MessageTextFromValue( m_units, primitive->GetWidth(), true ); + bs_info[4] = _( "width " ) + MessageTextFromValue( m_units, primitive->GetWidth() ); switch( primitive->GetShape() ) { @@ -729,7 +729,7 @@ void DIALOG_PAD_PROPERTIES::displayPrimitivesList() bs_info[0] = _( "circle" ); bs_info[1] = formatCoord( m_units, primitive->GetStart() ); - bs_info[2] = _( "radius " ) + MessageTextFromValue( m_units, primitive->GetRadius(), true ); + bs_info[2] = _( "radius " ) + MessageTextFromValue( m_units, primitive->GetRadius() ); break; case S_POLYGON: // polygon @@ -1200,7 +1200,7 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK() { error_msgs.Add( wxString::Format( _( "Pad local solder mask clearance must be greater than %s" ), - StringFromValue( GetUserUnits(), min_smClearance, true, true ) ) ); + StringFromValue( GetUserUnits(), min_smClearance ) ) ); } } } diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 023a61edee..77c02e8f81 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -709,9 +709,9 @@ void DIALOG_PLOT::applyPlotSettings() msg.Printf( _( "Width correction constrained. " "The reasonable width correction value must be in a range of " " [%s; %s] (%s) for current design rules." ), - StringFromValue( GetUserUnits(), m_widthAdjustMinValue, false, true ), - StringFromValue( GetUserUnits(), m_widthAdjustMaxValue, false, true ), - GetAbbreviatedUnitsLabel( GetUserUnits(), true ) ); + StringFromValue( GetUserUnits(), m_widthAdjustMinValue, false ), + StringFromValue( GetUserUnits(), m_widthAdjustMaxValue, false ), + GetAbbreviatedUnitsLabel( GetUserUnits() ) ); reporter.Report( msg, RPT_SEVERITY_WARNING ); } diff --git a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp index 187567b04f..b9917b2648 100644 --- a/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp +++ b/pcbnew/dialogs/dialog_pns_length_tuning_settings.cpp @@ -37,7 +37,7 @@ DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( EDA_DRAW_F m_maxAmpl( aParent, m_maxAmplLabel, m_maxAmplText, m_maxAmplUnit, true ), m_spacing( aParent, m_spacingLabel, m_spacingText, m_spacingUnit, true ), m_targetLength( aParent, m_targetLengthLabel, m_targetLengthText, m_targetLengthUnit ), - m_radius( aParent, m_radiusLabel, m_radiusText, m_radiusUnit, false, false ), + m_radius( aParent, m_radiusLabel, m_radiusText, m_radiusUnit ), m_settings( aSettings ), m_mode( aMode ) { diff --git a/pcbnew/dialogs/dialog_track_via_properties.cpp b/pcbnew/dialogs/dialog_track_via_properties.cpp index cf5345496f..5e6a01a5e5 100644 --- a/pcbnew/dialogs/dialog_track_via_properties.cpp +++ b/pcbnew/dialogs/dialog_track_via_properties.cpp @@ -44,11 +44,11 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen m_trackStartY( aParent, m_TrackStartYLabel, m_TrackStartYCtrl, m_TrackStartYUnit ), m_trackEndX( aParent, m_TrackEndXLabel, m_TrackEndXCtrl, m_TrackEndXUnit ), m_trackEndY( aParent, m_TrackEndYLabel, m_TrackEndYCtrl, m_TrackEndYUnit ), - m_trackWidth( aParent, m_TrackWidthLabel, m_TrackWidthCtrl, m_TrackWidthUnit, true, false ), + m_trackWidth( aParent, m_TrackWidthLabel, m_TrackWidthCtrl, m_TrackWidthUnit, false ), m_viaX( aParent, m_ViaXLabel, m_ViaXCtrl, m_ViaXUnit ), m_viaY( aParent, m_ViaYLabel, m_ViaYCtrl, m_ViaYUnit ), - m_viaDiameter( aParent, m_ViaDiameterLabel, m_ViaDiameterCtrl, m_ViaDiameterUnit, true, false ), - m_viaDrill( aParent, m_ViaDrillLabel, m_ViaDrillCtrl, m_ViaDrillUnit, true, false ), + m_viaDiameter( aParent, m_ViaDiameterLabel, m_ViaDiameterCtrl, m_ViaDiameterUnit, false ), + m_viaDrill( aParent, m_ViaDrillLabel, m_ViaDrillCtrl, m_ViaDrillUnit, false ), m_tracks( false ), m_vias( false ) { @@ -227,15 +227,15 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen if( m_vias ) { - m_DesignRuleViasUnit->SetLabel( GetAbbreviatedUnitsLabel( m_units, true ) ); + m_DesignRuleViasUnit->SetLabel( GetAbbreviatedUnitsLabel( m_units ) ); int viaSelection = wxNOT_FOUND; for( unsigned ii = 0; ii < aParent->GetDesignSettings().m_ViasDimensionsList.size(); ii++ ) { VIA_DIMENSION* viaDimension = &aParent->GetDesignSettings().m_ViasDimensionsList[ii]; - wxString msg = StringFromValue( m_units, viaDimension->m_Diameter, false, true ) - + " / " + StringFromValue( m_units, viaDimension->m_Drill, false, true ); + wxString msg = StringFromValue( m_units, viaDimension->m_Diameter, false ) + + " / " + StringFromValue( m_units, viaDimension->m_Drill, false ); m_DesignRuleViasCtrl->Append( msg, viaDimension ); if( viaSelection == wxNOT_FOUND @@ -278,14 +278,14 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen if( m_tracks ) { - m_DesignRuleWidthsUnits->SetLabel( GetAbbreviatedUnitsLabel( m_units, true ) ); + m_DesignRuleWidthsUnits->SetLabel( GetAbbreviatedUnitsLabel( m_units ) ); int widthSelection = wxNOT_FOUND; for( unsigned ii = 0; ii < aParent->GetDesignSettings().m_TrackWidthList.size(); ii++ ) { int width = aParent->GetDesignSettings().m_TrackWidthList[ii]; - wxString msg = StringFromValue( m_units, width, false, true ); + wxString msg = StringFromValue( m_units, width, false ); m_DesignRuleWidthsCtrl->Append( msg ); if( widthSelection == wxNOT_FOUND && m_trackWidth.GetValue() == width ) diff --git a/pcbnew/dialogs/dialog_track_via_size.cpp b/pcbnew/dialogs/dialog_track_via_size.cpp index fef6af158b..5a525df516 100644 --- a/pcbnew/dialogs/dialog_track_via_size.cpp +++ b/pcbnew/dialogs/dialog_track_via_size.cpp @@ -36,9 +36,9 @@ const int minSize = (int)( 0.01 * IU_PER_MM ); DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( EDA_DRAW_FRAME* aParent, BOARD_DESIGN_SETTINGS& aSettings ) : DIALOG_TRACK_VIA_SIZE_BASE( aParent ), - m_trackWidth( aParent, m_trackWidthLabel, m_trackWidthText, m_trackWidthUnits, false, minSize ), - m_viaDiameter( aParent, m_viaDiameterLabel, m_viaDiameterText, m_viaDiameterUnits, false, minSize ), - m_viaDrill( aParent, m_viaDrillLabel, m_viaDrillText, m_viaDrillUnits, false, minSize ), + m_trackWidth( aParent, m_trackWidthLabel, m_trackWidthText, m_trackWidthUnits, minSize ), + m_viaDiameter( aParent, m_viaDiameterLabel, m_viaDiameterText, m_viaDiameterUnits, minSize ), + m_viaDrill( aParent, m_viaDrillLabel, m_viaDrillText, m_viaDrillUnits, minSize ), m_settings( aSettings ) { m_stdButtonsOK->SetDefault(); diff --git a/pcbnew/dialogs/panel_modedit_defaults.cpp b/pcbnew/dialogs/panel_modedit_defaults.cpp index 2f1176e50a..68218bacd7 100644 --- a/pcbnew/dialogs/panel_modedit_defaults.cpp +++ b/pcbnew/dialogs/panel_modedit_defaults.cpp @@ -213,7 +213,7 @@ bool PANEL_MODEDIT_DEFAULTS::TransferDataToWindow() wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND ); #define SET_MILS_CELL( row, col, val ) \ - m_layerClassesGrid->SetCellValue( row, col, StringFromValue( m_frame->GetUserUnits(), val, true, true ) ) + m_layerClassesGrid->SetCellValue( row, col, StringFromValue( m_frame->GetUserUnits(), val, true ) ) #define DISABLE_CELL( row, col ) \ m_layerClassesGrid->SetReadOnly( row, col ); m_layerClassesGrid->SetCellBackgroundColour( row, col, disabledColour ); @@ -300,7 +300,7 @@ bool PANEL_MODEDIT_DEFAULTS::Show( bool aShow ) int PANEL_MODEDIT_DEFAULTS::getGridValue( int aRow, int aCol ) { return ValueFromString( m_frame->GetUserUnits(), - m_layerClassesGrid->GetCellValue( aRow, aCol ), true ); + m_layerClassesGrid->GetCellValue( aRow, aCol ) ); } diff --git a/pcbnew/dialogs/panel_setup_feature_constraints.cpp b/pcbnew/dialogs/panel_setup_feature_constraints.cpp index e556c469f5..dee7c7221b 100644 --- a/pcbnew/dialogs/panel_setup_feature_constraints.cpp +++ b/pcbnew/dialogs/panel_setup_feature_constraints.cpp @@ -57,7 +57,7 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataToWindow() wxString fmt = m_stCircleToPolyWarning->GetLabel(); m_stCircleToPolyWarning->SetLabel( wxString::Format( fmt, StringFromValue( m_Frame->GetUserUnits(), - ARC_HIGH_DEF, true, true ) ) ); + ARC_HIGH_DEF, true ) ) ); m_OptAllowBlindBuriedVias->SetValue( m_BrdSettings->m_BlindBuriedViaAllowed ); m_OptAllowMicroVias->SetValue( m_BrdSettings->m_MicroViasAllowed ); @@ -101,7 +101,7 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow() if( !m_edgeClearance.Validate( 0, 10, EDA_UNITS::INCHES ) ) return false; - if( !m_throughHoleMin.Validate( 2, 1000, EDA_UNITS::INCHES, true ) ) // #107 to 1 inch + if( !m_throughHoleMin.Validate( 2, 1000, EDA_UNITS::INCHES ) ) // #107 to 1 inch return false; if( !m_holeToHoleMin.Validate( 0, 10, EDA_UNITS::INCHES ) ) diff --git a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp index 5e26c17e7d..84a6a486fe 100644 --- a/pcbnew/dialogs/panel_setup_text_and_graphics.cpp +++ b/pcbnew/dialogs/panel_setup_text_and_graphics.cpp @@ -87,7 +87,7 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataToWindow() wxColour disabledColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND ); #define SET_MILS_CELL( row, col, val ) \ - m_grid->SetCellValue( row, col, StringFromValue( m_Frame->GetUserUnits(), val, true, true ) ) + m_grid->SetCellValue( row, col, StringFromValue( m_Frame->GetUserUnits(), val, true ) ) #define DISABLE_CELL( row, col ) \ m_grid->SetReadOnly( row, col ); m_grid->SetCellBackgroundColour( row, col, disabledColour ); @@ -158,7 +158,7 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataToWindow() int PANEL_SETUP_TEXT_AND_GRAPHICS::getGridValue( int aRow, int aCol ) { - return ValueFromString( m_Frame->GetUserUnits(), m_grid->GetCellValue( aRow, aCol ), true ); + return ValueFromString( m_Frame->GetUserUnits(), m_grid->GetCellValue( aRow, aCol ) ); } diff --git a/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp index 0b17220a5f..ad931e7fce 100644 --- a/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp +++ b/pcbnew/dialogs/panel_setup_tracks_and_vias.cpp @@ -150,7 +150,7 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow() msg = m_trackWidthsGrid->GetCellValue( row, TR_WIDTH_COL ); if( !msg.IsEmpty() ) - trackWidths.push_back( ValueFromString( m_Frame->GetUserUnits(), msg, true ) ); + trackWidths.push_back( ValueFromString( m_Frame->GetUserUnits(), msg ) ); } for( int row = 0; row < m_viaSizesGrid->GetNumberRows(); ++row ) @@ -160,12 +160,12 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow() if( !msg.IsEmpty() ) { VIA_DIMENSION via_dim; - via_dim.m_Diameter = ValueFromString( m_Frame->GetUserUnits(), msg, true ); + via_dim.m_Diameter = ValueFromString( m_Frame->GetUserUnits(), msg ); msg = m_viaSizesGrid->GetCellValue( row, VIA_DRILL_COL ); if( !msg.IsEmpty() ) - via_dim.m_Drill = ValueFromString( m_Frame->GetUserUnits(), msg, true ); + via_dim.m_Drill = ValueFromString( m_Frame->GetUserUnits(), msg ); vias.push_back( via_dim ); } @@ -178,15 +178,15 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow() if( !msg.IsEmpty() ) { DIFF_PAIR_DIMENSION diffPair_dim; - diffPair_dim.m_Width = ValueFromString( m_Frame->GetUserUnits(), msg, true ); + diffPair_dim.m_Width = ValueFromString( m_Frame->GetUserUnits(), msg ); msg = m_diffPairsGrid->GetCellValue( row, DP_GAP_COL ); - diffPair_dim.m_Gap = ValueFromString( m_Frame->GetUserUnits(), msg, true ); + diffPair_dim.m_Gap = ValueFromString( m_Frame->GetUserUnits(), msg ); msg = m_diffPairsGrid->GetCellValue( row, DP_VIA_GAP_COL ); if( !msg.IsEmpty() ) - diffPair_dim.m_ViaGap = ValueFromString( m_Frame->GetUserUnits(), msg, true ); + diffPair_dim.m_ViaGap = ValueFromString( m_Frame->GetUserUnits(), msg ); diffPairs.push_back( diffPair_dim ); } @@ -237,7 +237,7 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::validateData() if( ValueFromString( m_Frame->GetUserUnits(), tvalue ) < minTrackWidth ) { msg.Printf( _( "Track width less than minimum track width (%s)." ), - StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) ); + StringFromValue( m_Frame->GetUserUnits(), minTrackWidth ) ); m_Parent->SetError( msg, this, m_trackWidthsGrid, row, TR_WIDTH_COL ); return false; } @@ -254,7 +254,7 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::validateData() if( ValueFromString( m_Frame->GetUserUnits(), viaDia ) < minViaDia ) { msg.Printf( _( "Via diameter less than minimum via diameter (%s)." ), - StringFromValue( m_Frame->GetUserUnits(), minViaDia, true, true ) ); + StringFromValue( m_Frame->GetUserUnits(), minViaDia ) ); m_Parent->SetError( msg, this, m_viaSizesGrid, row, VIA_SIZE_COL ); return false; } @@ -271,7 +271,7 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::validateData() if( ValueFromString( m_Frame->GetUserUnits(), viaDrill ) < minThroughHole ) { msg.Printf( _( "Via drill less than minimum through hole (%s)." ), - StringFromValue( m_Frame->GetUserUnits(), minThroughHole, true, true ) ); + StringFromValue( m_Frame->GetUserUnits(), minThroughHole ) ); m_Parent->SetError( msg, this, m_viaSizesGrid, row, VIA_DRILL_COL ); return false; } @@ -288,7 +288,7 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::validateData() - ValueFromString( m_Frame->GetUserUnits(), viaDrill ) ) / 2 < minViaAnnulus ) { msg.Printf( _( "Diameter and drill leave via annulus less than minimum (%s)." ), - StringFromValue( m_Frame->GetUserUnits(), minViaAnnulus, true, true ) ); + StringFromValue( m_Frame->GetUserUnits(), minViaAnnulus ) ); m_Parent->SetError( msg, this, m_viaSizesGrid, row, VIA_SIZE_COL ); return false; } @@ -305,7 +305,7 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::validateData() if( ValueFromString( m_Frame->GetUserUnits(), tvalue ) < minTrackWidth ) { msg.Printf( _( "Differential pair track width less than minimum track width (%s)." ), - StringFromValue( m_Frame->GetUserUnits(), minTrackWidth, true, true ) ); + StringFromValue( m_Frame->GetUserUnits(), minTrackWidth ) ); m_Parent->SetError( msg, this, m_diffPairsGrid, row, 0 ); return false; } @@ -322,7 +322,7 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::validateData() if( ValueFromString( m_Frame->GetUserUnits(), gap ) < minClearance ) { msg.Printf( _( "Differential pair gap less than minimum clearance (%s)." ), - StringFromValue( m_Frame->GetUserUnits(), minClearance, true, true ) ); + StringFromValue( m_Frame->GetUserUnits(), minClearance ) ); m_Parent->SetError( msg, this, m_diffPairsGrid, row, 1 ); return false; } @@ -335,7 +335,7 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::validateData() if( ValueFromString( m_Frame->GetUserUnits(), viaGap ) < minClearance ) { msg.Printf( _( "Differential pair via gap less than minimum clearance (%s)." ), - StringFromValue( m_Frame->GetUserUnits(), minClearance, true, true ) ); + StringFromValue( m_Frame->GetUserUnits(), minClearance ) ); m_Parent->SetError( msg, this, m_diffPairsGrid, row, 2 ); return false; } @@ -351,7 +351,7 @@ void PANEL_SETUP_TRACKS_AND_VIAS::AppendTrackWidth( const int aWidth ) m_trackWidthsGrid->AppendRows( 1 ); - wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth, true, true ); + wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth ); m_trackWidthsGrid->SetCellValue( i, TR_WIDTH_COL, val ); } @@ -362,12 +362,12 @@ void PANEL_SETUP_TRACKS_AND_VIAS::AppendViaSize( const int aSize, const int aDri m_viaSizesGrid->AppendRows( 1 ); - wxString val = StringFromValue( m_Frame->GetUserUnits(), aSize, true, true ); + wxString val = StringFromValue( m_Frame->GetUserUnits(), aSize ); m_viaSizesGrid->SetCellValue( i, VIA_SIZE_COL, val ); if( aDrill > 0 ) { - val = StringFromValue( m_Frame->GetUserUnits(), aDrill, true, true ); + val = StringFromValue( m_Frame->GetUserUnits(), aDrill ); m_viaSizesGrid->SetCellValue( i, VIA_DRILL_COL, val ); } } @@ -380,18 +380,18 @@ void PANEL_SETUP_TRACKS_AND_VIAS::AppendDiffPairs( const int aWidth, const int a m_diffPairsGrid->AppendRows( 1 ); - wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth, true, true ); + wxString val = StringFromValue( m_Frame->GetUserUnits(), aWidth ); m_diffPairsGrid->SetCellValue( i, DP_WIDTH_COL, val ); if( aGap > 0 ) { - val = StringFromValue( m_Frame->GetUserUnits(), aGap, true, true ); + val = StringFromValue( m_Frame->GetUserUnits(), aGap ); m_diffPairsGrid->SetCellValue( i, DP_GAP_COL, val ); } if( aViaGap > 0 ) { - val = StringFromValue( m_Frame->GetUserUnits(), aViaGap, true, true ); + val = StringFromValue( m_Frame->GetUserUnits(), aViaGap ); m_diffPairsGrid->SetCellValue( i, DP_VIA_GAP_COL, val ); } } diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index 61476dad28..6d769a5dad 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -474,7 +474,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRulesForItems( DRC_CONSTRAINT_TYPE_T aConstraintI REPORT( "" ) REPORT( wxString::Format( _( "Local override on %s; clearance: %s." ), a->GetSelectMenuText( UNITS ), - MessageTextFromValue( UNITS, overrideA, true ) ) ) + MessageTextFromValue( UNITS, overrideA ) ) ) } if( connectedB && connectedB->GetLocalClearanceOverrides( nullptr ) > 0 ) @@ -484,7 +484,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRulesForItems( DRC_CONSTRAINT_TYPE_T aConstraintI REPORT( "" ) REPORT( wxString::Format( _( "Local override on %s; clearance: %s." ), b->GetSelectMenuText( UNITS ), - MessageTextFromValue( UNITS, overrideB, true ) ) ) + MessageTextFromValue( UNITS, overrideB ) ) ) } if( overrideA || overrideB ) @@ -513,7 +513,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRulesForItems( DRC_CONSTRAINT_TYPE_T aConstraintI REPORT( wxString::Format( implicit ? _( "Checking %s; clearance: %s." ) : _( "Checking rule %s; clearance: %s."), rcons->constraint.GetName(), - MessageTextFromValue( UNITS, clearance, true ) ) ) + MessageTextFromValue( UNITS, clearance ) ) ) } else { @@ -583,7 +583,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRulesForItems( DRC_CONSTRAINT_TYPE_T aConstraintI REPORT( "" ) REPORT( wxString::Format( _( "Local clearance on %s; clearance: %s." ), a->GetSelectMenuText( UNITS ), - MessageTextFromValue( UNITS, localA, true ) ) ) + MessageTextFromValue( UNITS, localA ) ) ) if( localA > clearance ) clearance = connectedA->GetLocalClearance( &m_msg ); @@ -594,7 +594,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRulesForItems( DRC_CONSTRAINT_TYPE_T aConstraintI REPORT( "" ) REPORT( wxString::Format( _( "Local clearance on %s; clearance: %s." ), b->GetSelectMenuText( UNITS ), - MessageTextFromValue( UNITS, localB, true ) ) ) + MessageTextFromValue( UNITS, localB ) ) ) if( localB > clearance ) clearance = connectedB->GetLocalClearance( &m_msg ); diff --git a/pcbnew/drc/drc_test_provider_annulus.cpp b/pcbnew/drc/drc_test_provider_annulus.cpp index 0f865e6a4d..b4c6571a40 100644 --- a/pcbnew/drc/drc_test_provider_annulus.cpp +++ b/pcbnew/drc/drc_test_provider_annulus.cpp @@ -120,14 +120,14 @@ bool DRC_TEST_PROVIDER_ANNULUS::Run() if( fail_min ) m_msg.Printf( drcItem->GetErrorText() + _( " (%s min annular width %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), v_min, true ), - MessageTextFromValue( userUnits(), annulus, true ) ); + MessageTextFromValue( userUnits(), v_min ), + MessageTextFromValue( userUnits(), annulus ) ); if( fail_max ) m_msg.Printf( drcItem->GetErrorText() + _( " (%s max annular width %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), v_max, true ), - MessageTextFromValue( userUnits(), annulus, true ) ); + MessageTextFromValue( userUnits(), v_max ), + MessageTextFromValue( userUnits(), annulus ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( item ); diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index d01778fef1..3b72d0e148 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -236,8 +236,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem( BOARD_ITEM* aItem ) m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), std::max( 0, actual ), true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), std::max( 0, actual ) ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( track, aItem ); @@ -299,8 +299,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testCopperDrawItem( BOARD_ITEM* aItem ) m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( pad, aItem ); @@ -408,8 +408,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc( TRACK* aRefSeg, PCB_LAYER_I m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( aRefSeg, pad ); @@ -484,8 +484,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc( TRACK* aRefSeg, PCB_LAYER_I m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( aRefSeg, track ); @@ -555,8 +555,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::doTrackDrc( TRACK* aRefSeg, PCB_LAYER_I m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( aRefSeg, zone ); @@ -739,8 +739,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::doPadToPadsDrc( int aRefPadIdx, m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( refPad, pad ); @@ -919,8 +919,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testZones() m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), zone2zoneClearance, true ), - MessageTextFromValue( userUnits(), conflict.second, true ) ); + MessageTextFromValue( userUnits(), zone2zoneClearance ), + MessageTextFromValue( userUnits(), conflict.second ) ); drcItem->SetErrorMessage( m_msg ); } diff --git a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp index 245556d807..fb2a3058e3 100644 --- a/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp +++ b/pcbnew/drc/drc_test_provider_diff_pair_coupling.cpp @@ -457,8 +457,8 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run() int totalLen = std::max( it.second.totalLengthN, it.second.totalLengthP ); reportAux( wxString::Format( " - coupled length: %s, total length: %s", - MessageTextFromValue( userUnits(), it.second.totalCoupled, false), - MessageTextFromValue( userUnits(), totalLen, false ) ) ); + MessageTextFromValue( userUnits(), it.second.totalCoupled ), + MessageTextFromValue( userUnits(), totalLen ) ) ); int totalUncoupled = totalLen - it.second.totalCoupled; @@ -475,8 +475,8 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run() drcItem->GetErrorText() + " (" + maxUncoupledConstraint->GetParentRule()->m_Name + " "; msg += wxString::Format( _( "maximum uncoupled length: %s; actual: %s)" ), - MessageTextFromValue( userUnits(), val.Max(), true ), - MessageTextFromValue( userUnits(), totalUncoupled, true ) ); + MessageTextFromValue( userUnits(), val.Max() ), + MessageTextFromValue( userUnits(), totalUncoupled ) ); drcItem->SetErrorMessage( msg ); @@ -507,15 +507,15 @@ bool test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run() if( val.HasMin() ) msg += wxString::Format( _( "minimum gap: %s; " ), - MessageTextFromValue( userUnits(), val.Min(), true ) ); + MessageTextFromValue( userUnits(), val.Min() ) ); if( val.HasMax() ) msg += wxString::Format( _( "maximum gap: %s; " ), - MessageTextFromValue( userUnits(), val.Max(), true ) ); + MessageTextFromValue( userUnits(), val.Max() ) ); msg += wxString::Format( _( "actual: %s)" ), - MessageTextFromValue( userUnits(), cpair.computedGap, true ) ); + MessageTextFromValue( userUnits(), cpair.computedGap ) ); drcItem->SetErrorMessage( msg ); @@ -545,4 +545,4 @@ std::set test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::GetC namespace detail { static DRC_REGISTER_TEST_PROVIDER dummy; -} \ No newline at end of file +} diff --git a/pcbnew/drc/drc_test_provider_edge_clearance.cpp b/pcbnew/drc/drc_test_provider_edge_clearance.cpp index 3a2f7a482a..fb2b07667d 100644 --- a/pcbnew/drc/drc_test_provider_edge_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_edge_clearance.cpp @@ -153,8 +153,8 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run() m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( outlineItem, boardItem ); @@ -186,4 +186,4 @@ std::set DRC_TEST_PROVIDER_EDGE_CLEARANCE::GetConstraintT namespace detail { static DRC_REGISTER_TEST_PROVIDER dummy; -} \ No newline at end of file +} diff --git a/pcbnew/drc/drc_test_provider_hole_clearance.cpp b/pcbnew/drc/drc_test_provider_hole_clearance.cpp index 4845342d14..9e1f1112c2 100644 --- a/pcbnew/drc/drc_test_provider_hole_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_hole_clearance.cpp @@ -268,8 +268,8 @@ bool DRC_TEST_PROVIDER_HOLE_CLEARANCE::doPadToPadHoleDrc( int aRefPadIdx, m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( pad, refPad ); @@ -300,8 +300,8 @@ bool DRC_TEST_PROVIDER_HOLE_CLEARANCE::doPadToPadHoleDrc( int aRefPadIdx, m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( refPad, pad ); @@ -390,8 +390,8 @@ void DRC_TEST_PROVIDER_HOLE_CLEARANCE::testHoles2Holes() m_msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( refHole.m_owner, checkHole.m_owner ); diff --git a/pcbnew/drc/drc_test_provider_hole_size.cpp b/pcbnew/drc/drc_test_provider_hole_size.cpp index 532a473167..73db8af1be 100644 --- a/pcbnew/drc/drc_test_provider_hole_size.cpp +++ b/pcbnew/drc/drc_test_provider_hole_size.cpp @@ -142,8 +142,8 @@ void DRC_TEST_PROVIDER_HOLE_SIZE::checkPad( D_PAD* aPad ) m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minHole, true ), - MessageTextFromValue( userUnits(), holeSize, true ) ); + MessageTextFromValue( userUnits(), minHole ), + MessageTextFromValue( userUnits(), holeSize ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( aPad ); @@ -184,8 +184,8 @@ void DRC_TEST_PROVIDER_HOLE_SIZE::checkVia( VIA* via, bool aExceedMicro, bool aE m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ), constraint.GetName(), - MessageTextFromValue( userUnits(), minHole, true ), - MessageTextFromValue( userUnits(), via->GetDrillValue(), true ) ); + MessageTextFromValue( userUnits(), minHole ), + MessageTextFromValue( userUnits(), via->GetDrillValue() ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( via ); diff --git a/pcbnew/drc/drc_test_provider_matched_length.cpp b/pcbnew/drc/drc_test_provider_matched_length.cpp index 76619ea044..4114f56f89 100644 --- a/pcbnew/drc/drc_test_provider_matched_length.cpp +++ b/pcbnew/drc/drc_test_provider_matched_length.cpp @@ -132,14 +132,14 @@ void test::DRC_TEST_PROVIDER_MATCHED_LENGTH::checkLengthViolations( if( minViolation ) { msg += wxString::Format( _( "minimum length: %s; actual: %s)" ), - MessageTextFromValue( userUnits(), minLen, true ), - MessageTextFromValue( userUnits(), ent.total, true ) ); + MessageTextFromValue( userUnits(), minLen ), + MessageTextFromValue( userUnits(), ent.total ) ); } else if( maxViolation ) { msg += wxString::Format( _( "maximum length: %s; actual: %s)" ), - MessageTextFromValue( userUnits(), maxLen, true ), - MessageTextFromValue( userUnits(), ent.total, true ) ); + MessageTextFromValue( userUnits(), maxLen ), + MessageTextFromValue( userUnits(), ent.total ) ); } drcItem->SetErrorMessage( msg ); @@ -176,10 +176,10 @@ void test::DRC_TEST_PROVIDER_MATCHED_LENGTH::checkSkewViolations( drcItem->GetErrorText() + " (" + aConstraint.GetParentRule()->m_Name + " "; msg += wxString::Format( _( "maximum skew: %s; actual skew: %s; average net length: %s; actual net length: %s)" ), - MessageTextFromValue( userUnits(), aConstraint.GetValue().Max(), true ), - MessageTextFromValue( userUnits(), skew, true ), - MessageTextFromValue( userUnits(), avgLength, true ), - MessageTextFromValue( userUnits(), ent.total, true ) + MessageTextFromValue( userUnits(), aConstraint.GetValue().Max() ), + MessageTextFromValue( userUnits(), skew ), + MessageTextFromValue( userUnits(), avgLength ), + MessageTextFromValue( userUnits(), ent.total ) ); drcItem->SetErrorMessage( msg ); @@ -357,10 +357,10 @@ bool test::DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal( bool aDelayReportMode ent.from, ent.to, (int) ent.items.size(), - MessageTextFromValue( userUnits(), ent.total, true ), - MessageTextFromValue( userUnits(), ent.totalRoute, true ), - MessageTextFromValue( userUnits(), ent.totalVia, true ), - MessageTextFromValue( userUnits(), ent.totalPadToDie, true ), + MessageTextFromValue( userUnits(), ent.total ), + MessageTextFromValue( userUnits(), ent.totalRoute ), + MessageTextFromValue( userUnits(), ent.totalVia ), + MessageTextFromValue( userUnits(), ent.totalPadToDie ), ent.viaCount ) ); } @@ -401,4 +401,4 @@ std::set test::DRC_TEST_PROVIDER_MATCHED_LENGTH::GetConst namespace detail { static DRC_REGISTER_TEST_PROVIDER dummy; -} \ No newline at end of file +} diff --git a/pcbnew/drc/drc_test_provider_silk_to_silk.cpp b/pcbnew/drc/drc_test_provider_silk_to_silk.cpp index 52951b8260..6170dcb154 100644 --- a/pcbnew/drc/drc_test_provider_silk_to_silk.cpp +++ b/pcbnew/drc/drc_test_provider_silk_to_silk.cpp @@ -171,8 +171,8 @@ bool DRC_TEST_PROVIDER_SILK_TO_SILK::Run() msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), constraint.GetParentRule()->m_Name, - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( msg ); drcItem->SetItems( aRefItem->parent, aTestItem->parent ); diff --git a/pcbnew/drc/drc_test_provider_track_width.cpp b/pcbnew/drc/drc_test_provider_track_width.cpp index 141d789982..07bf38d05e 100644 --- a/pcbnew/drc/drc_test_provider_track_width.cpp +++ b/pcbnew/drc/drc_test_provider_track_width.cpp @@ -126,8 +126,8 @@ bool DRC_TEST_PROVIDER_TRACK_WIDTH::Run() m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s width %s; actual %s)" ), constraint.GetName(), fail_min ? _( "min" ) : _( "max" ), - MessageTextFromValue( userUnits(), constraintWidth, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), constraintWidth ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( item ); @@ -171,4 +171,4 @@ std::set DRC_TEST_PROVIDER_TRACK_WIDTH::GetConstraintType namespace detail { static DRC_REGISTER_TEST_PROVIDER dummy; -} \ No newline at end of file +} diff --git a/pcbnew/drc/drc_test_provider_via_diameter.cpp b/pcbnew/drc/drc_test_provider_via_diameter.cpp index a89018fcef..61bb8daf77 100644 --- a/pcbnew/drc/drc_test_provider_via_diameter.cpp +++ b/pcbnew/drc/drc_test_provider_via_diameter.cpp @@ -113,8 +113,8 @@ bool DRC_TEST_PROVIDER_VIA_DIAMETER::Run() m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s diameter %s; actual %s)" ), constraint.GetName(), fail_min ? _( "min" ) : _( "max" ), - MessageTextFromValue( userUnits(), constraintDiameter, true ) ); - MessageTextFromValue( userUnits(), actual, true ), + MessageTextFromValue( userUnits(), constraintDiameter ) ); + MessageTextFromValue( userUnits(), actual ), drcItem->SetErrorMessage( m_msg ); drcItem->SetItems( item ); @@ -158,4 +158,4 @@ std::set DRC_TEST_PROVIDER_VIA_DIAMETER::GetConstraintTyp namespace detail { static DRC_REGISTER_TEST_PROVIDER dummy; -} \ No newline at end of file +} diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 3cccf30b13..0ec045c0f0 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -885,7 +885,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) dimension->Text().SetTextSize( designSettings.GetTextSize( layer ) ); dimension->Text().SetTextThickness( designSettings.GetTextThickness( layer ) ); dimension->SetLineThickness( designSettings.GetLineThickness( layer ) ); - dimension->SetUnits( EDA_UNITS::MILLIMETRES, false ); + dimension->SetUnits( EDA_UNITS::MILLIMETRES ); // check which axis the dimension runs in // because the "height" of the dimension is perpendicular to that axis diff --git a/pcbnew/footprint_editor_settings.cpp b/pcbnew/footprint_editor_settings.cpp index c84f80d30c..c9260fb987 100644 --- a/pcbnew/footprint_editor_settings.cpp +++ b/pcbnew/footprint_editor_settings.cpp @@ -386,8 +386,8 @@ bool FOOTPRINT_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) x = From_User_Unit( u, x ); y = From_User_Unit( u, y ); - ( *this )[PointerFromString( "window.grid.user_grid_x" )] = StringFromValue( u, x, true, true ); - ( *this )[PointerFromString( "window.grid.user_grid_y" )] = StringFromValue( u, y, true, true ); + ( *this )[PointerFromString( "window.grid.user_grid_x" )] = StringFromValue( u, x ); + ( *this )[PointerFromString( "window.grid.user_grid_y" )] = StringFromValue( u, y ); } return ret; diff --git a/pcbnew/footprint_preview_panel.cpp b/pcbnew/footprint_preview_panel.cpp index 6d56c6d342..0be16a9f5e 100644 --- a/pcbnew/footprint_preview_panel.cpp +++ b/pcbnew/footprint_preview_panel.cpp @@ -483,7 +483,7 @@ FOOTPRINT_PREVIEW_PANEL* FOOTPRINT_PREVIEW_PANEL::New( KIWAY* aKiway, wxWindow* //Bounds checking cannot include number of elements as an index! int gridIdx = std::max( 0, std::min( gridCfg.last_size_idx, (int) gridCfg.sizes.size() - 1 ) ); - int gridSize = (int) ValueFromString( EDA_UNITS::INCHES, gridCfg.sizes[ gridIdx ], true ); + int gridSize = (int) ValueFromString( EDA_UNITS::INCHES, gridCfg.sizes[ gridIdx ] ); panel->GetGAL()->SetGridSize( VECTOR2D( gridSize, gridSize ) ); return panel; diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp index eda0b8ad95..012aff1659 100644 --- a/pcbnew/microwave/microwave_inductor.cpp +++ b/pcbnew/microwave/microwave_inductor.cpp @@ -370,7 +370,7 @@ MODULE* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& aIn aInductorPattern.m_length = min_len; // Enter the desired length. - msg = StringFromValue( editFrame.GetUserUnits(), aInductorPattern.m_length, true ); + msg = StringFromValue( editFrame.GetUserUnits(), aInductorPattern.m_length ); WX_TEXT_ENTRY_DIALOG dlg( &editFrame, _( "Length of Trace:" ), wxEmptyString, msg ); if( dlg.ShowModal() != wxID_OK ) diff --git a/pcbnew/netinfo_item.cpp b/pcbnew/netinfo_item.cpp index dd9a8af87e..5a47f60212 100644 --- a/pcbnew/netinfo_item.cpp +++ b/pcbnew/netinfo_item.cpp @@ -132,6 +132,6 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorGetUserUnits(), lengthPadToDie, true ); + txt = MessageTextFromValue( aFrame->GetUserUnits(), lengthPadToDie ); aList.emplace_back( _( "In Package" ), txt, RED ); } diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index 5d92ad6cc7..a65fdda3fb 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -180,7 +180,7 @@ void PCB_BASE_EDIT_FRAME::unitsChangeRefresh() if( dimension->GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC ) { - dimension->SetUnits( units, false ); + dimension->SetUnits( units ); dimension->Update(); view->Update( dimension ); } diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index e636a60bb7..3863b89493 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -533,9 +533,9 @@ public: switch( unitId ) { - case 0: return DoubleValueFromString( EDA_UNITS::INCHES, aString, true ); + case 0: return DoubleValueFromString( EDA_UNITS::INCHES, aString ); case 1: return DoubleValueFromString( EDA_UNITS::MILLIMETRES, aString ); - case 2: return DoubleValueFromString( EDA_UNITS::INCHES, aString, false ); + case 2: return DoubleValueFromString( EDA_UNITS::INCHES, aString ); default: return v; } }; diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 51147add80..fcacf045e2 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -2445,9 +2445,8 @@ DIMENSION* PCB_PARSER::parseDIMENSION() if( isLegacyDimension ) { EDA_UNITS units = EDA_UNITS::INCHES; - bool useMils = false; - FetchUnitsFromString( text->GetText(), units, useMils ); - dimension->SetUnits( units, useMils ); + FetchUnitsFromString( text->GetText(), units ); + dimension->SetUnits( units ); } delete text; diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index 93a501b883..5993f67904 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -748,8 +748,8 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) x = From_User_Unit( u, x ); y = From_User_Unit( u, y ); - ( *this )[PointerFromString( "window.grid.user_grid_x" )] = StringFromValue( u, x, true, true ); - ( *this )[PointerFromString( "window.grid.user_grid_y" )] = StringFromValue( u, y, true, true ); + ( *this )[PointerFromString( "window.grid.user_grid_x" )] = StringFromValue( u, x ); + ( *this )[PointerFromString( "window.grid.user_grid_y" )] = StringFromValue( u, y ); } // Footprint editor settings were stored in pcbnew config file. Migrate them here. diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index cfab2aacc6..c92e9cb0aa 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -962,14 +962,14 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem ) switch( aElem.textunit ) { case ALTIUM_UNIT::INCHES: - dimension->SetUnits( EDA_UNITS::INCHES, false ); + dimension->SetUnits( EDA_UNITS::INCHES ); break; case ALTIUM_UNIT::MILS: - dimension->SetUnits( EDA_UNITS::INCHES, true ); + dimension->SetUnits( EDA_UNITS::INCHES ); break; case ALTIUM_UNIT::MILLIMETERS: case ALTIUM_UNIT::CENTIMETER: - dimension->SetUnits( EDA_UNITS::MILLIMETRES, false ); + dimension->SetUnits( EDA_UNITS::MILLIMETRES ); break; default: break; diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index 35f8836d65..5596fdae9f 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -938,15 +938,15 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions() case UNITS::CENTIMETER: case UNITS::MM: case UNITS::MICROMETRE: - dimension->SetUnits( EDA_UNITS::MILLIMETRES, false ); + dimension->SetUnits( EDA_UNITS::MILLIMETRES ); break; case UNITS::INCH: - dimension->SetUnits( EDA_UNITS::INCHES, false ); + dimension->SetUnits( EDA_UNITS::INCHES ); break; case UNITS::THOU: - dimension->SetUnits( EDA_UNITS::INCHES, true ); + dimension->SetUnits( EDA_UNITS::INCHES ); break; } } diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp index abb43b141c..e0bf2bad5e 100644 --- a/pcbnew/router/pns_dp_meander_placer.cpp +++ b/pcbnew/router/pns_dp_meander_placer.cpp @@ -408,11 +408,11 @@ const wxString DP_MEANDER_PLACER::TuningInfo( EDA_UNITS aUnits ) const return _( "?" ); } - status += ::MessageTextFromValue( aUnits, m_lastLength, false ); + status += ::MessageTextFromValue( aUnits, m_lastLength ); status += "/"; - status += ::MessageTextFromValue( aUnits, m_settings.m_targetLength, false ); + status += ::MessageTextFromValue( aUnits, m_settings.m_targetLength ); status += " (gap: "; - status += ::MessageTextFromValue( aUnits, m_originPair.Gap(), false ); + status += ::MessageTextFromValue( aUnits, m_originPair.Gap() ); status += ")"; return status; diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp index fd78623475..ad41acc125 100644 --- a/pcbnew/router/pns_meander_placer.cpp +++ b/pcbnew/router/pns_meander_placer.cpp @@ -278,9 +278,9 @@ const wxString MEANDER_PLACER::TuningInfo( EDA_UNITS aUnits ) const return _( "?" ); } - status += ::MessageTextFromValue( aUnits, m_lastLength, false ); + status += ::MessageTextFromValue( aUnits, m_lastLength ); status += "/"; - status += ::MessageTextFromValue( aUnits, m_settings.m_targetLength, false ); + status += ::MessageTextFromValue( aUnits, m_settings.m_targetLength ); return status; } diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp index ca485e0ff6..ca58f94f12 100644 --- a/pcbnew/router/pns_meander_skew_placer.cpp +++ b/pcbnew/router/pns_meander_skew_placer.cpp @@ -173,9 +173,9 @@ const wxString MEANDER_SKEW_PLACER::TuningInfo( EDA_UNITS aUnits ) const return _( "?" ); } - status += ::MessageTextFromValue( aUnits, m_lastLength - m_coupledLength, false ); + status += ::MessageTextFromValue( aUnits, m_lastLength - m_coupledLength ); status += "/"; - status += ::MessageTextFromValue( aUnits, m_settings.m_targetSkew, false ); + status += ::MessageTextFromValue( aUnits, m_settings.m_targetSkew ); return status; } diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 96d22afbfd..bdbac9a46a 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -213,7 +213,7 @@ protected: if( i == 0 ) msg = _( "Track netclass width" ); else - msg.Printf( _( "Track %s" ), MessageTextFromValue( units, width, true ) ); + msg.Printf( _( "Track %s" ), MessageTextFromValue( units, width ) ); int menuIdx = ID_POPUP_PCB_SELECT_WIDTH1 + i; Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK ); @@ -232,10 +232,10 @@ protected: { if( via.m_Drill > 0 ) msg.Printf( _("Via %s, drill %s" ), - MessageTextFromValue( units, via.m_Diameter, true ), - MessageTextFromValue( units, via.m_Drill, true ) ); + MessageTextFromValue( units, via.m_Diameter ), + MessageTextFromValue( units, via.m_Drill ) ); else - msg.Printf( _( "Via %s" ), MessageTextFromValue( units, via.m_Diameter, true ) ); + msg.Printf( _( "Via %s" ), MessageTextFromValue( units, via.m_Diameter ) ); } int menuIdx = ID_POPUP_PCB_SELECT_VIASIZE1 + i; @@ -334,13 +334,13 @@ protected: DIFF_PAIR_DIMENSION diffPair = bds.m_DiffPairDimensionsList[i]; wxString msg; - msg << _( "Width " ) << MessageTextFromValue( units, diffPair.m_Width, true ); + msg << _( "Width " ) << MessageTextFromValue( units, diffPair.m_Width ); if( diffPair.m_Gap > 0 ) - msg << _( ", gap " ) << MessageTextFromValue( units, diffPair.m_Gap, true ); + msg << _( ", gap " ) << MessageTextFromValue( units, diffPair.m_Gap ); if( diffPair.m_ViaGap > 0 ) - msg << _( ", via gap " ) << MessageTextFromValue( units, diffPair.m_ViaGap, true ); + msg << _( ", via gap " ) << MessageTextFromValue( units, diffPair.m_ViaGap ); int menuIdx = ID_POPUP_PCB_SELECT_DIFFPAIR1 + i - 1; Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK ); diff --git a/pcbnew/text_mod_grid_table.cpp b/pcbnew/text_mod_grid_table.cpp index c6ed0ed419..7501e25e3b 100644 --- a/pcbnew/text_mod_grid_table.cpp +++ b/pcbnew/text_mod_grid_table.cpp @@ -189,13 +189,13 @@ wxString TEXT_MOD_GRID_TABLE::GetValue( int aRow, int aCol ) return text.GetText(); case TMC_WIDTH: - return StringFromValue( m_userUnits, text.GetTextWidth(), true, true ); + return StringFromValue( m_userUnits, text.GetTextWidth() ); case TMC_HEIGHT: - return StringFromValue( m_userUnits, text.GetTextHeight(), true, true ); + return StringFromValue( m_userUnits, text.GetTextHeight() ); case TMC_THICKNESS: - return StringFromValue( m_userUnits, text.GetTextThickness(), true, true ); + return StringFromValue( m_userUnits, text.GetTextThickness() ); case TMC_LAYER: return text.GetLayerName(); @@ -205,10 +205,10 @@ wxString TEXT_MOD_GRID_TABLE::GetValue( int aRow, int aCol ) true ); case TMC_XOFFSET: - return StringFromValue( m_userUnits, text.GetPos0().x, true ); + return StringFromValue( m_userUnits, text.GetPos0().x ); case TMC_YOFFSET: - return StringFromValue( m_userUnits, text.GetPos0().y, true ); + return StringFromValue( m_userUnits, text.GetPos0().y ); default: // we can't assert here because wxWidgets sometimes calls this without checking @@ -260,14 +260,14 @@ void TEXT_MOD_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue ) break; case TMC_WIDTH: - text.SetTextWidth( ValueFromString( m_userUnits, aValue, true ) ); + text.SetTextWidth( ValueFromString( m_userUnits, aValue ) ); break; case TMC_HEIGHT: - text.SetTextHeight( ValueFromString( m_userUnits, aValue, true ) ); + text.SetTextHeight( ValueFromString( m_userUnits, aValue ) ); break; - case TMC_THICKNESS:text.SetTextThickness( ValueFromString( m_userUnits, aValue, true )); + case TMC_THICKNESS:text.SetTextThickness( ValueFromString( m_userUnits, aValue )); break; case TMC_ORIENTATION: diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index d4e47015ee..8844591d7e 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -100,10 +100,10 @@ protected: if( via.m_Drill > 0 ) msg.Printf( _("Via %s, drill %s" ), - MessageTextFromValue( units, via.m_Diameter, true ), - MessageTextFromValue( units, via.m_Drill, true ) ); + MessageTextFromValue( units, via.m_Diameter ), + MessageTextFromValue( units, via.m_Drill ) ); else - msg.Printf( _( "Via %s" ), MessageTextFromValue( units, via.m_Diameter, true ) ); + msg.Printf( _( "Via %s" ), MessageTextFromValue( units, via.m_Diameter ) ); int menuIdx = ID_POPUP_PCB_SELECT_VIASIZE1 + i; Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK ); @@ -742,7 +742,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) aDim->SetKeepTextAligned( boardSettings.m_DimensionKeepTextAligned ); if( boardSettings.m_DimensionUnitsMode == DIM_UNITS_MODE::AUTOMATIC ) - aDim->SetUnits( m_frame->GetUserUnits(), false ); + aDim->SetUnits( m_frame->GetUserUnits() ); }; if( originalEvent.IsAction( &PCB_ACTIONS::drawAlignedDimension ) ) diff --git a/pcbnew/tools/pcb_inspection_tool.cpp b/pcbnew/tools/pcb_inspection_tool.cpp index a1e343bb22..91b4165795 100644 --- a/pcbnew/tools/pcb_inspection_tool.cpp +++ b/pcbnew/tools/pcb_inspection_tool.cpp @@ -144,7 +144,7 @@ void PCB_INSPECTION_TOOL::reportZoneConnection( ZONE_CONTAINER* aZone, D_PAD* aP int gap = aZone->GetThermalReliefGap(); r->Report( wxString::Format( _( "Zone thermal relief: %s." ), - StringFromValue( r->GetUnits(), gap, true ) ) ); + StringFromValue( r->GetUnits(), gap ) ) ); gap = aZone->GetThermalReliefGap( aPad, &source ); @@ -152,7 +152,7 @@ void PCB_INSPECTION_TOOL::reportZoneConnection( ZONE_CONTAINER* aZone, D_PAD* aP { r->Report( wxString::Format( _( "Overridden by %s; thermal relief: %s." ), source, - StringFromValue( r->GetUnits(), gap, true ) ) ); + StringFromValue( r->GetUnits(), gap ) ) ); } } else if( connection == ZONE_CONNECTION::NONE ) @@ -160,7 +160,7 @@ void PCB_INSPECTION_TOOL::reportZoneConnection( ZONE_CONTAINER* aZone, D_PAD* aP int clearance = aZone->GetLocalClearance(); r->Report( wxString::Format( _( "Zone clearance: %s." ), - StringFromValue( r->GetUnits(), clearance, true ) ) ); + StringFromValue( r->GetUnits(), clearance ) ) ); if( aZone->GetThermalReliefGap( aPad ) > clearance ) { @@ -171,7 +171,7 @@ void PCB_INSPECTION_TOOL::reportZoneConnection( ZONE_CONTAINER* aZone, D_PAD* aP r->Report( wxString::Format( _( "Overridden by larger thermal relief from %s;" "clearance: %s." ), source, - StringFromValue( r->GetUnits(), clearance, true ) ) ); + StringFromValue( r->GetUnits(), clearance ) ) ); } } } @@ -205,7 +205,7 @@ void PCB_INSPECTION_TOOL::reportCopperClearance( PCB_LAYER_ID aLayer, BOARD_CONN if( r ) { - wxString clearance = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true ); + wxString clearance = StringFromValue( r->GetUnits(), constraint.m_Value.Min() ); r->Report( "" ); r->Report( wxString::Format( _( "Clearance: %s." ), clearance ) ); @@ -362,10 +362,10 @@ int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent ) wxString max = _( "undefined" ); if( constraint.m_Value.HasMin() ) - min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true ); + min = StringFromValue( r->GetUnits(), constraint.m_Value.Min() ); if( constraint.m_Value.HasMax() ) - max = StringFromValue( r->GetUnits(), constraint.m_Value.Max(), true ); + max = StringFromValue( r->GetUnits(), constraint.m_Value.Max() ); r->Report( "" ); r->Report( wxString::Format( _( "Width constraints: min %s max %s." ), @@ -390,10 +390,10 @@ int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent ) wxString max = _( "undefined" ); if( constraint.m_Value.HasMin() ) - min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true ); + min = StringFromValue( r->GetUnits(), constraint.m_Value.Min() ); if( constraint.m_Value.HasMax() ) - max = StringFromValue( r->GetUnits(), constraint.m_Value.Max(), true ); + max = StringFromValue( r->GetUnits(), constraint.m_Value.Max() ); r->Report( "" ); r->Report( wxString::Format( _( "Diameter constraints: min %s max %s." ), @@ -416,10 +416,10 @@ int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent ) max = _( "undefined" ); if( constraint.m_Value.HasMin() ) - min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true ); + min = StringFromValue( r->GetUnits(), constraint.m_Value.Min() ); if( constraint.m_Value.HasMax() ) - max = StringFromValue( r->GetUnits(), constraint.m_Value.Max(), true ); + max = StringFromValue( r->GetUnits(), constraint.m_Value.Max() ); r->Report( "" ); r->Report( wxString::Format( _( "Annular width constraints: min %s max %s." ), @@ -444,7 +444,7 @@ int PCB_INSPECTION_TOOL::InspectConstraints( const TOOL_EVENT& aEvent ) wxString min = _( "undefined" ); if( constraint.m_Value.HasMin() ) - min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true ); + min = StringFromValue( r->GetUnits(), constraint.m_Value.Min() ); r->Report( "" ); r->Report( wxString::Format( _( "Hole constraint: min %s." ), min ) ); diff --git a/qa/drc_proto/drc_test_provider_silk_to_pad.cpp b/qa/drc_proto/drc_test_provider_silk_to_pad.cpp index 982ab0914c..36618d3ad6 100644 --- a/qa/drc_proto/drc_test_provider_silk_to_pad.cpp +++ b/qa/drc_proto/drc_test_provider_silk_to_pad.cpp @@ -142,8 +142,8 @@ bool test::DRC_TEST_PROVIDER_SILK_TO_PAD::Run() msg.Printf( drcItem->GetErrorText() + _( " (%s clearance %s; actual %s)" ), rule->GetName(), - MessageTextFromValue( userUnits(), minClearance, true ), - MessageTextFromValue( userUnits(), actual, true ) ); + MessageTextFromValue( userUnits(), minClearance ), + MessageTextFromValue( userUnits(), actual ) ); drcItem->SetErrorMessage( msg ); drcItem->SetItems( outlineItem, boardItem ); @@ -167,4 +167,4 @@ std::set test::DRC_TEST_PROVIDER_SILK_TO_PAD::GetConstrai namespace detail { static DRC_REGISTER_TEST_PROVIDER dummy; -} \ No newline at end of file +}