ReturnStringFromValue() refinements
This commit is contained in:
parent
1b5a1b74fa
commit
790e0ef36c
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue