Commit b02b170d authored by charras's avatar charras

Eeschema: minor bug solved: bad value when display lines widths in info screen in libedit

parent 5a904e46
...@@ -31,7 +31,7 @@ wxString GetBuildVersion() ...@@ -31,7 +31,7 @@ wxString GetBuildVersion()
wxString GetAboutBuildVersion() wxString GetAboutBuildVersion()
/*********************************************/ /*********************************************/
{ {
return g_BuildAboutVersion; return g_BuildAboutVersion;
} }
/********************************/ /********************************/
...@@ -500,7 +500,9 @@ int GetTimeStamp() ...@@ -500,7 +500,9 @@ int GetTimeStamp()
const wxString& valeur_param( int valeur, wxString& buf_texte ) const wxString& valeur_param( int valeur, wxString& buf_texte )
/**************************************************************/ /**************************************************************/
/* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies /**
* @todo replace this obsolete funtion by MakeStringFromValue
* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies
* entree : valeur en mils , buffer de texte * entree : valeur en mils , buffer de texte
* retourne en buffer : texte : valeur exprimee en pouces ou millimetres * retourne en buffer : texte : valeur exprimee en pouces ou millimetres
* suivie de " ou mm * suivie de " ou mm
...@@ -518,6 +520,34 @@ const wxString& valeur_param( int valeur, wxString& buf_texte ) ...@@ -518,6 +520,34 @@ const wxString& valeur_param( int valeur, wxString& buf_texte )
return buf_texte; return buf_texte;
} }
/****************************************************************************************/
const wxString MakeStringFromValue( int value, int internal_unit )
/****************************************************************************************/
/** Function MakeStringFromValue
* convert the value of a parameter to a string like <value in prefered units> <unit symbol>
* like 100 mils converted to 0.1 " or 0.245 mm
* use g_UnitMetric do select inch or metric format
* @param : value in internal units
* @param : internal_unit per inch: currently 1000 for eeschema and 10000 for pcbnew
* @return : the string to display or print
*/
{
wxString text;
if( g_UnitMetric )
{
text.Printf( wxT( "%3.3f mm" ), (float) value * 2.54 / (float) internal_unit );
}
else
{
text.Printf( wxT( "%2.4f \"" ), (float) value / (float) internal_unit );
}
return text;
}
wxString& operator << ( wxString& aString, const wxPoint& aPos ) wxString& operator << ( wxString& aString, const wxPoint& aPos )
{ {
......
...@@ -68,7 +68,7 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -68,7 +68,7 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
/* Affichage du nom */ /* Affichage du nom */
Affiche_1_Parametre( frame, 24, _( "PinName" ), m_PinName, DARKCYAN ); Affiche_1_Parametre( frame, 30, _( "PinName" ), m_PinName, DARKCYAN );
/* Affichage du numero */ /* Affichage du numero */
if( m_PinNum == 0 ) if( m_PinNum == 0 )
...@@ -76,11 +76,11 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -76,11 +76,11 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame )
else else
ReturnPinStringNum( Text ); ReturnPinStringNum( Text );
Affiche_1_Parametre( frame, 40, _( "PinNum" ), Text, DARKCYAN ); Affiche_1_Parametre( frame, 38, _( "PinNum" ), Text, DARKCYAN );
/* Affichage du type */ /* Affichage du type */
ii = m_PinType; ii = m_PinType;
Affiche_1_Parametre( frame, 48, _( "PinType" ), MsgPinElectricType[ii], RED ); Affiche_1_Parametre( frame, 44, _( "PinType" ), MsgPinElectricType[ii], RED );
/* Affichage de la visiblite */ /* Affichage de la visiblite */
ii = m_Attributs; ii = m_Attributs;
...@@ -88,11 +88,11 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -88,11 +88,11 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame )
Text = _( "no" ); Text = _( "no" );
else else
Text = _( "yes" ); Text = _( "yes" );
Affiche_1_Parametre( frame, 58, _( "Display" ), Text, DARKGREEN ); Affiche_1_Parametre( frame, 50, _( "Display" ), Text, DARKGREEN );
/* Affichage de la longueur */ /* Display pin length */
Text.Printf( wxT( "%d" ), m_PinLen ); Text = MakeStringFromValue( m_PinLen, EESCHEMA_INTERNAL_UNIT );
Affiche_1_Parametre( frame, 66, _( "Lengh" ), Text, MAGENTA ); Affiche_1_Parametre( frame, 56, _( "Length" ), Text, MAGENTA );
/* Affichage de l'orientation */ /* Affichage de l'orientation */
switch( m_Orient ) switch( m_Orient )
...@@ -113,7 +113,7 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -113,7 +113,7 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame )
Text = wxT( "??" ); break; Text = wxT( "??" ); break;
} }
Affiche_1_Parametre( frame, 72, _( "Orient" ), Text, MAGENTA ); Affiche_1_Parametre( frame, 62, _( "Orient" ), Text, MAGENTA );
} }
...@@ -168,7 +168,7 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame ) ...@@ -168,7 +168,7 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame )
msg = _( "All" ); msg = _( "All" );
else else
msg.Printf( wxT( "%d" ), m_Unit ); msg.Printf( wxT( "%d" ), m_Unit );
Affiche_1_Parametre( frame, 10, _( "Unit" ), msg, BROWN ); Affiche_1_Parametre( frame, 8, _( "Unit" ), msg, BROWN );
if( m_Convert == 0 ) if( m_Convert == 0 )
msg = _( "All" ); msg = _( "All" );
...@@ -178,11 +178,11 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame ) ...@@ -178,11 +178,11 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame )
msg = _( "yes" ); msg = _( "yes" );
else else
msg = wxT( "?" ); msg = wxT( "?" );
Affiche_1_Parametre( frame, 16, _( "Convert" ), msg, BROWN ); Affiche_1_Parametre( frame, 14, _( "Convert" ), msg, BROWN );
if( m_Width ) if( m_Width )
valeur_param( m_Width, msg ); msg = MakeStringFromValue( m_Width, EESCHEMA_INTERNAL_UNIT );
else else
msg = _( "default" ); msg = _( "default" );
Affiche_1_Parametre( frame, 24, _( "Width" ), msg, BLUE ); Affiche_1_Parametre( frame, 20, _( "Width" ), msg, BLUE );
} }
...@@ -647,13 +647,22 @@ int GetCommandOptions( const int argc, const char** argv, const char ...@@ -647,13 +647,22 @@ int GetCommandOptions( const int argc, const char** argv, const char
const char** optarg, int* optind ); const char** optarg, int* optind );
const wxString& valeur_param( int valeur, wxString& buf_texte );
/* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies /* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies
* entree : valeur en mils , buffer de texte * entree : valeur en mils , buffer de texte
* retourne en buffer : texte : valeur exprimee en pouces ou millimetres * retourne en buffer : texte : valeur exprimee en pouces ou millimetres
* suivie de " ou mm * suivie de " ou mm
*/ */
const wxString& valeur_param( int valeur, wxString& buf_texte );
/** Function MakeStringFromValue
* convert the value of a parameter to a string like <value in prefered units> <unit symbol>
* like 100 mils converted to 0.1 " or 0.245 mm
* use g_UnitMetric do select inch or metric format
* @param : value in internal units
* @param : internal_unit per inch: currently 1000 for eeschema and 10000 for pcbnew
* @return : the string to display or print
*/
const wxString MakeStringFromValue( int value, int internal_unit );
wxString ReturnUnitSymbol( int Units = g_UnitMetric ); wxString ReturnUnitSymbol( int Units = g_UnitMetric );
int ReturnValueFromString( int Units, const wxString& TextValue, int Internal_Unit ); int ReturnValueFromString( int Units, const wxString& TextValue, int Internal_Unit );
......
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