Commit e96f1aeb authored by jean-pierre charras's avatar jean-pierre charras

Remove valeur_param(), that does not work in Kicad Nanometer

parent 9d6c1d12
......@@ -70,7 +70,7 @@ void S3D_MASTER::Set_Object_Coords( std::vector< S3D_Vertex >& aVertices )
RotatePoint( &aVertices[ii].x, &aVertices[ii].y, (int) (m_MatRotation.z * 10) );
/* adjust offset position (offset is given in UNIT 3D (0.1 inch) */
#define SCALE_3D_CONV (PCB_INTERNAL_UNIT / UNITS3D_TO_UNITSPCB)
#define SCALE_3D_CONV ((IU_PER_MILS * 1000) / UNITS3D_TO_UNITSPCB)
aVertices[ii].x += m_MatPosition.x * SCALE_3D_CONV;
aVertices[ii].y += m_MatPosition.y * SCALE_3D_CONV;
aVertices[ii].z += m_MatPosition.z * SCALE_3D_CONV;
......
......@@ -67,6 +67,11 @@ double To_User_Unit( EDA_UNITS_T aUnit, double aValue )
wxString CoordinateToString( int aValue, bool aConvertToMils )
{
return LengthDoubleToString( (double) aValue, aConvertToMils );
}
wxString LengthDoubleToString( double aValue, bool aConvertToMils )
{
wxString text;
const wxChar* format;
......@@ -249,3 +254,14 @@ int ReturnValueFromTextCtrl( const wxTextCtrl& aTextCtr )
return value;
}
wxString& operator <<( wxString& aString, const wxPoint& aPos )
{
aString << wxT( "@ (" ) << CoordinateToString( aPos.x );
aString << wxT( "," ) << CoordinateToString( aPos.y );
aString << wxT( ")" );
return aString;
}
......@@ -334,39 +334,6 @@ unsigned long GetNewTimeStamp()
}
const wxString& valeur_param( int valeur, wxString& buf_texte )
{
switch( g_UserUnit )
{
case MILLIMETRES:
buf_texte.Printf( _( "%3.3f mm" ), valeur * 0.00254 );
break;
case INCHES:
buf_texte.Printf( wxT( "%2.4f \"" ), valeur * 0.0001 );
break;
case UNSCALED_UNITS:
buf_texte.Printf( wxT( "%d" ), valeur );
break;
}
return buf_texte;
}
wxString& operator <<( wxString& aString, const wxPoint& aPos )
{
wxString temp;
aString << wxT( "@ (" ) << valeur_param( aPos.x, temp );
aString << wxT( "," ) << valeur_param( aPos.y, temp );
aString << wxT( ")" );
return aString;
}
double RoundTo0( double x, double precision )
{
assert( precision != 0 );
......
......@@ -584,6 +584,11 @@ wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils )
return ::CoordinateToString( aValue, aConvertToMils );
}
wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMils )
{
return ::LengthDoubleToString( aValue, aConvertToMils );
}
bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosition )
{
......
......@@ -30,6 +30,7 @@
#include <class_drc_item.h>
#include <erc.h>
#include <base_units.h>
wxString DRC_ITEM::GetErrorText() const
{
......@@ -57,14 +58,9 @@ wxString DRC_ITEM::GetErrorText() const
}
}
wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
{
wxString ret;
wxPoint pos_in_pcb_units = aPos;
pos_in_pcb_units.x *= 10;
pos_in_pcb_units.y *= 10;
ret << pos_in_pcb_units;
ret << aPos;
return ret;
}
......@@ -50,16 +50,27 @@ double To_User_Unit( EDA_UNITS_T aUnit, double aValue );
/**
* Function CoordinateToString
* is a helper to convert the integer coordinate \a aValue to a string in inches,
* is a helper to convert the \a integer coordinate \a aValue to a string in inches,
* millimeters, or unscaled units according to the current user units setting.
*
* @param aValue The coordinate to convert.
* @param aValue The integer coordinate to convert.
* @param aConvertToMils Convert inch values to mils if true. This setting has no effect if
* the current user unit is millimeters.
* @return The converted string for display in user interface elements.
*/
wxString CoordinateToString( int aValue, bool aConvertToMils = false );
/**
* Function LenghtDoubleToString
* is a helper to convert the \a double length \a aValue to a string in inches,
* millimeters, or unscaled units according to the current user units setting.
*
* @param aValue The double value to convert.
* @param aConvertToMils Convert inch values to mils if true. This setting has no effect if
* the current user unit is millimeters.
* @return The converted string for display in user interface elements.
*/
wxString LengthDoubleToString( double aValue, bool aConvertToMils = false );
/**
* Function ReturnStringFromValue
......@@ -72,6 +83,16 @@ wxString CoordinateToString( int aValue, bool aConvertToMils = false );
*/
wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol = false );
/**
* Operator << overload
* outputs a point to the argument string in a format resembling
* "@ (x,y)
* @param aString Where to put the text describing the point value
* @param aPoint The point to output.
* @return wxString& - the input string
*/
wxString& operator <<( wxString& aString, const wxPoint& aPoint );
/**
* Function PutValueInLocalUnits
* converts \a aValue from internal units to user units and append the units notation
......
......@@ -541,17 +541,6 @@ private:
bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString = NULL );
/**
* Operator << overload
* outputs a point to the argument string in a format resembling
* "@ (x,y)
* @param aString Where to put the text describing the point value
* @param aPoint The point to output.
* @return wxString& - the input string
*/
wxString& operator <<( wxString& aString, const wxPoint& aPoint );
/**
* Function ProcessExecute
* runs a child process.
......@@ -583,14 +572,6 @@ int GetCommandOptions( const int argc, const char** argv,
const char* stringtst, const char** optarg,
int* optind );
/* Returns to display the value of a parameter, by type of units selected
* Input: value in mils, buffer text
* Returns to buffer: text: value expressed in inches or millimeters
* Followed by " or mm
*/
const wxString& valeur_param( int valeur, wxString& buf_texte );
/**
* Returns the units symbol.
*
......
......@@ -29,9 +29,6 @@
#define M_PI 3.141592653
#endif
#define PCB_INTERNAL_UNIT 10000 // PCBNEW internal unit = 1/10000 inch
#define EESCHEMA_INTERNAL_UNIT 1000 // EESCHEMA internal unit = 1/1000 inch
#ifdef __WINDOWS__
#define DIR_SEP '\\'
#define STRING_DIR_SEP wxT( "\\" )
......
......@@ -841,7 +841,7 @@ public:
/**
* Function CoordinateToString
* is a helper to convert the integer coordinate \a aValue to a string in inches or mm
* is a helper to convert the \a integer coordinate \a aValue to a string in inches or mm
* according to the current user units setting.
* @param aValue The coordinate to convert.
* @param aConvertToMils Convert inch values to mils if true. This setting has no effect if
......@@ -850,6 +850,17 @@ public:
*/
wxString CoordinateToString( int aValue, bool aConvertToMils = false );
/**
* Function LengthDoubleToString
* is a helper to convert the \a double value \a aValue to a string in inches or mm
* according to the current user units setting.
* @param aValue The coordinate to convert.
* @param aConvertToMils Convert inch values to mils if true. This setting has no effect if
* the current user unit is millimeters.
* @return The converted string for display in user interface elements.
*/
wxString LengthDoubleToString( double aValue, bool aConvertToMils = false );
DECLARE_EVENT_TABLE()
};
......
......@@ -41,6 +41,7 @@
#include <class_board.h>
#include <class_pcb_text.h>
#include <class_dimension.h>
#include <base_units.h>
DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
......@@ -344,7 +345,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
if( !aDoNotChangeText )
{
m_Value = mesure;
valeur_param( m_Value, msg );
msg = ::CoordinateToString( m_Value );
SetText( msg );
}
}
......
......@@ -47,6 +47,7 @@
#include <class_board.h>
#include <class_module.h>
#include <class_drawsegment.h>
#include <base_units.h>
DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) :
......@@ -373,7 +374,7 @@ void DRAWSEGMENT::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Layer" ), board->GetLayerName( m_Layer ), DARKBROWN );
valeur_param( (unsigned) m_Width, msg );
msg = frame->CoordinateToString( m_Width );
frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN );
}
......@@ -527,12 +528,11 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect ) const
wxString DRAWSEGMENT::GetSelectMenuText() const
{
wxString text;
wxString temp;
wxString temp = ::LengthDoubleToString( GetLength() );
text.Printf( _( "Pcb Graphic: %s length: %s on %s" ),
GetChars( ShowShape( (STROKE_T) m_Shape ) ),
GetChars( valeur_param( GetLength(), temp ) ),
GetChars( GetLayerName() ) );
GetChars( temp ), GetChars( GetLayerName() ) );
return text;
}
......
......@@ -32,6 +32,7 @@
#include <pcbnew.h>
#include <drc_stuff.h>
#include <class_drc_item.h>
#include <base_units.h>
wxString DRC_ITEM::GetErrorText() const
......
......@@ -255,7 +255,7 @@ void EDGE_MODULE::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED );
frame->AppendMsgPanel( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED );
valeur_param( m_Width, msg );
msg = frame->CoordinateToString( m_Width );
frame->AppendMsgPanel( _( "Width" ), msg, BLUE );
}
......
......@@ -42,6 +42,7 @@
#include <class_board.h>
#include <class_mire.h>
#include <base_units.h>
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) :
......@@ -210,7 +211,7 @@ wxString PCB_TARGET::GetSelectMenuText() const
wxString text;
wxString msg;
valeur_param( m_Size, msg );
msg = ::CoordinateToString( m_Size );
text.Printf( _( "Target on %s size %s" ),
GetChars( GetLayerName() ), GetChars( msg ) );
......
......@@ -46,6 +46,7 @@
#include <pcbnew.h>
#include <protos.h>
#include <base_units.h>
/**
* Function ShowClearance
......@@ -138,10 +139,7 @@ EDA_ITEM* TRACK::Clone() const
wxString TRACK::ShowWidth() const
{
wxString msg;
valeur_param( m_Width, msg );
wxString msg = ::CoordinateToString( m_Width );
return msg;
}
......@@ -1173,7 +1171,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
// Display segment length
if( Type() != PCB_VIA_T ) // Display Diam and Drill values
{
msg = frame->CoordinateToString( KiROUND( GetLength() ) );
msg = frame->LengthDoubleToString( GetLength() );
frame->AppendMsgPanel( _( "Segment Length" ), msg, DARKCYAN );
}
}
......@@ -1553,7 +1551,7 @@ wxString TRACK::GetSelectMenuText() const
}
text << _( " on " ) << GetLayerName() << wxT(" ") << _("Net:") << GetNet()
<< wxT(" ") << _("Length:") << valeur_param( GetLength(), temp );
<< wxT(" ") << _("Length:") << ::LengthDoubleToString( GetLength() );
return text;
}
......
......@@ -789,13 +789,13 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() )
trackLen += track->GetLength();
valeur_param( KiROUND( trackLen ), msg );
msg = frame->LengthDoubleToString( trackLen );
frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN );
if( lenDie != 0 ) // display the track len on board and the actual track len
{
frame->AppendMsgPanel( _( "Full Len" ), msg, DARKCYAN );
valeur_param( KiROUND( trackLen+lenDie ), msg );
msg = frame->LengthDoubleToString( trackLen+lenDie );
frame->AppendMsgPanel( _( "On Die" ), msg, DARKCYAN );
}
......
......@@ -48,6 +48,7 @@
#include <class_track.h>
#include <class_zone.h>
#include <class_drawsegment.h>
#include <base_units.h>
#include <collectors.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment