diff --git a/common/base_screen.cpp b/common/base_screen.cpp index a47f21386d..717154b2e3 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -337,7 +337,7 @@ wxPoint BASE_SCREEN::getCrossHairScreenPosition() const void BASE_SCREEN::setCrossHairPosition( const wxPoint& aPosition, const wxPoint& aGridOrigin, bool aSnapToGrid ) { if( aSnapToGrid ) - m_crossHairPosition = getNearestGridPosition( aPosition, aGridOrigin ); + m_crossHairPosition = getNearestGridPosition( aPosition, aGridOrigin, NULL ); else m_crossHairPosition = aPosition; } diff --git a/common/base_units.cpp b/common/base_units.cpp index 76dcc5d8c1..09a2ab9bd0 100644 --- a/common/base_units.cpp +++ b/common/base_units.cpp @@ -209,8 +209,28 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb StripTrailingZeros( stringValue, 3 ); #else - std::string s = Double2Str( value_to_print ); - wxString stringValue = FROM_UTF8( s.c_str() ); + + char buf[50]; + int len; + + if( value_to_print != 0.0 && fabs( value_to_print ) <= 0.0001 ) + { + len = sprintf( buf, "%.10f", value_to_print ); + + while( --len > 0 && buf[len] == '0' ) + buf[len] = '\0'; + + if( buf[len]=='.' || buf[len]==',' ) + buf[len] = '\0'; + else + ++len; + } + else + { + len = sprintf( buf, "%.10g", value_to_print ); + } + + wxString stringValue( buf, wxConvUTF8 ); #endif diff --git a/include/class_base_screen.h b/include/class_base_screen.h index 537b277bfe..6d133982a9 100644 --- a/include/class_base_screen.h +++ b/include/class_base_screen.h @@ -102,7 +102,7 @@ private: * @param aInvertY Inverts the Y axis position. * @return The cross hair position in drawing coordinates. */ - wxPoint getCrossHairPosition( bool aInvertY = false ) const + wxPoint getCrossHairPosition( bool aInvertY ) const { if( aInvertY ) return wxPoint( m_crossHairPosition.x, -m_crossHairPosition.y ); @@ -119,7 +119,7 @@ private: * \a aPosition. * */ - void setCrossHairPosition( const wxPoint& aPosition, const wxPoint& aGridOrigin, bool aSnapToGrid = true ); + void setCrossHairPosition( const wxPoint& aPosition, const wxPoint& aGridOrigin, bool aSnapToGrid ); /** * Function getCursorScreenPosition @@ -138,7 +138,7 @@ private: * @return The nearst grid position. */ wxPoint getNearestGridPosition( const wxPoint& aPosition, const wxPoint& aGridOrigin, - wxRealPoint* aGridSize = NULL ) const; + wxRealPoint* aGridSize ) const; /** * Function getCursorPosition @@ -149,7 +149,7 @@ private: * if \a aOnGrid is true. * @return The current cursor position. */ - wxPoint getCursorPosition( bool aOnGrid, const wxPoint& aGridOrigin, wxRealPoint* aGridSize = NULL ) const; + wxPoint getCursorPosition( bool aOnGrid, const wxPoint& aGridOrigin, wxRealPoint* aGridSize ) const; void setMousePosition( const wxPoint& aPosition ) { m_MousePosition = aPosition; }