Commit 3bddb98d authored by Dick Hollenbeck's avatar Dick Hollenbeck

Fix wierd ConfigBaseWriteDouble's Printf( wxT("%12f"), aValue ); format string

which was creating silly strings like 

  PcbTextThickness="    0.300000"

in kicad.pro files.
parent 94338e07
......@@ -19,8 +19,20 @@
#include <boost/foreach.hpp>
#define CONFIG_VERSION 1
#define FORCE_LOCAL_CONFIG true
#define CONFIG_VERSION 1
#define FORCE_LOCAL_CONFIG true
void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double aValue )
{
// Use a single strategy, regardless of wx version.
// Want C locale float string.
LOCALE_IO toggle;
wxString tnumber = wxString::Format( wxT( "%.16g" ), aValue );
aConfig->Write( aKey, tnumber );
}
bool EDA_APP::ReCreatePrjConfig( const wxString& fileName,
......
......@@ -15,28 +15,14 @@
/**
* inline ConfigBaseWriteDouble
* This is a helper funvtion tor write doubles in config
* Function ConfigBaseWriteDouble
* This is a helper function to write doubles in config
* We cannot use wxConfigBase->Write for a double, because
* this function uses a format with very few digits in mantissa,
* and truncation issues are frequent.
* We use here a better floating format.
*
* Note: prior to 2.9.1, the separator was localized, and after, uses
* the "C" notation
*/
void inline ConfigBaseWriteDouble( wxConfigBase* aConfig,
const wxString& aKey, double aValue )
{
wxString tnumber;
#if wxCHECK_VERSION(2,9,1)
tnumber = wxString::FromCDouble( aValue, 12 );
#else
tnumber.Printf( wxT("%12f"), aValue );
#endif
aConfig->Write( aKey, tnumber );
}
void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double aValue );
/** Type of parameter in the configuration file */
......
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