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

This commit is contained in:
charras 2008-09-05 19:02:39 +00:00
parent 5a904e460a
commit b02b170de2
3 changed files with 55 additions and 16 deletions

View File

@ -31,7 +31,7 @@ wxString GetBuildVersion()
wxString GetAboutBuildVersion()
/*********************************************/
{
return g_BuildAboutVersion;
return g_BuildAboutVersion;
}
/********************************/
@ -500,7 +500,9 @@ int GetTimeStamp()
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
* retourne en buffer : texte : valeur exprimee en pouces ou millimetres
* suivie de " ou mm
@ -518,6 +520,34 @@ const wxString& valeur_param( int valeur, wxString& 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 )
{

View File

@ -68,7 +68,7 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox();
/* Affichage du nom */
Affiche_1_Parametre( frame, 24, _( "PinName" ), m_PinName, DARKCYAN );
Affiche_1_Parametre( frame, 30, _( "PinName" ), m_PinName, DARKCYAN );
/* Affichage du numero */
if( m_PinNum == 0 )
@ -76,11 +76,11 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame )
else
ReturnPinStringNum( Text );
Affiche_1_Parametre( frame, 40, _( "PinNum" ), Text, DARKCYAN );
Affiche_1_Parametre( frame, 38, _( "PinNum" ), Text, DARKCYAN );
/* Affichage du type */
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 */
ii = m_Attributs;
@ -88,11 +88,11 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame )
Text = _( "no" );
else
Text = _( "yes" );
Affiche_1_Parametre( frame, 58, _( "Display" ), Text, DARKGREEN );
Affiche_1_Parametre( frame, 50, _( "Display" ), Text, DARKGREEN );
/* Affichage de la longueur */
Text.Printf( wxT( "%d" ), m_PinLen );
Affiche_1_Parametre( frame, 66, _( "Lengh" ), Text, MAGENTA );
/* Display pin length */
Text = MakeStringFromValue( m_PinLen, EESCHEMA_INTERNAL_UNIT );
Affiche_1_Parametre( frame, 56, _( "Length" ), Text, MAGENTA );
/* Affichage de l'orientation */
switch( m_Orient )
@ -113,7 +113,7 @@ void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame )
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 )
msg = _( "All" );
else
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 )
msg = _( "All" );
@ -178,11 +178,11 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame )
msg = _( "yes" );
else
msg = wxT( "?" );
Affiche_1_Parametre( frame, 16, _( "Convert" ), msg, BROWN );
Affiche_1_Parametre( frame, 14, _( "Convert" ), msg, BROWN );
if( m_Width )
valeur_param( m_Width, msg );
msg = MakeStringFromValue( m_Width, EESCHEMA_INTERNAL_UNIT );
else
msg = _( "default" );
Affiche_1_Parametre( frame, 24, _( "Width" ), msg, BLUE );
Affiche_1_Parametre( frame, 20, _( "Width" ), msg, BLUE );
}

View File

@ -647,13 +647,22 @@ int GetCommandOptions( const int argc, const char** argv, const char
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
* entree : valeur en mils , buffer de texte
* retourne en buffer : texte : valeur exprimee en pouces ou millimetres
* 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 );
int ReturnValueFromString( int Units, const wxString& TextValue, int Internal_Unit );