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 )
|
void BASE_SCREEN::setCrossHairPosition( const wxPoint& aPosition, const wxPoint& aGridOrigin, bool aSnapToGrid )
|
||||||
{
|
{
|
||||||
if( aSnapToGrid )
|
if( aSnapToGrid )
|
||||||
m_crossHairPosition = getNearestGridPosition( aPosition, aGridOrigin );
|
m_crossHairPosition = getNearestGridPosition( aPosition, aGridOrigin, NULL );
|
||||||
else
|
else
|
||||||
m_crossHairPosition = aPosition;
|
m_crossHairPosition = aPosition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,8 +209,28 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb
|
||||||
StripTrailingZeros( stringValue, 3 );
|
StripTrailingZeros( stringValue, 3 );
|
||||||
|
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ private:
|
||||||
* @param aInvertY Inverts the Y axis position.
|
* @param aInvertY Inverts the Y axis position.
|
||||||
* @return The cross hair position in drawing coordinates.
|
* @return The cross hair position in drawing coordinates.
|
||||||
*/
|
*/
|
||||||
wxPoint getCrossHairPosition( bool aInvertY = false ) const
|
wxPoint getCrossHairPosition( bool aInvertY ) const
|
||||||
{
|
{
|
||||||
if( aInvertY )
|
if( aInvertY )
|
||||||
return wxPoint( m_crossHairPosition.x, -m_crossHairPosition.y );
|
return wxPoint( m_crossHairPosition.x, -m_crossHairPosition.y );
|
||||||
|
@ -119,7 +119,7 @@ private:
|
||||||
* \a aPosition.
|
* \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
|
* Function getCursorScreenPosition
|
||||||
|
@ -138,7 +138,7 @@ private:
|
||||||
* @return The nearst grid position.
|
* @return The nearst grid position.
|
||||||
*/
|
*/
|
||||||
wxPoint getNearestGridPosition( const wxPoint& aPosition, const wxPoint& aGridOrigin,
|
wxPoint getNearestGridPosition( const wxPoint& aPosition, const wxPoint& aGridOrigin,
|
||||||
wxRealPoint* aGridSize = NULL ) const;
|
wxRealPoint* aGridSize ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function getCursorPosition
|
* Function getCursorPosition
|
||||||
|
@ -149,7 +149,7 @@ private:
|
||||||
* if \a aOnGrid is true.
|
* if \a aOnGrid is true.
|
||||||
* @return The current cursor position.
|
* @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; }
|
void setMousePosition( const wxPoint& aPosition ) { m_MousePosition = aPosition; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue