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

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
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -23,6 +23,18 @@
#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,
                                 const wxString& GroupName,
                                 bool            ForceUseLocalConfig )
+3 −17
Original line number Diff line number Diff line
@@ -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 */