← Back to team overview

kicad-developers team mailing list archive

Re: Locale fix in KiCAD is not working (breaks my build)

 

Thanks edwin, I will try to fix it this night with a 2.8 compatible solution,

Also thanks a lot for the suggestion,

Anyway, I don't like changing the locale back and forth, I know the risk
is minimal, but in a multithreading UI environment It could break anything
running/displaying/printing elsewhere.

So, for the moment I will stay with a replace solution, or use a system printf
ignoring the locale settings. I will check for that other option on the change.

My solution could break if we go into a locale that sets numbers like 1.000.000,1111


I'll change that in a few minutes and re-commit.



Miguel Angel Ajo
http://www.nbee.es
+34911407752
skype: ajoajoajo

On 15/03/2013, at 11:25, Edwin van den Oetelaar <oetelaar.automatisering@xxxxxxxxx> wrote:

> Hello Miguel,
> 
> My WX is 2.8
> 
> Your WX is 2.9 I guess
> http://wiki.wxwidgets.org/Converting_everything_to_and_from_wxString
> 
> I think there should be a cleaner way to handle this kind of thing.
> (comma/dot in floating point)
> Would it be possible to set LC_NUMERIC someway?
> 
> char prvlocale[255];
> strcpy( prvlocale, wxSetlocale(LC_NUMERIC, NULL) );
> const char *oldLocale = wxSetlocale(LC_NUMERIC, "C");
> 
> /* DO STUFF HERE */
> 
> if ( !oldLocale )
> {
> /* the current locale was not changed; no need to */
> /* restore the previous one... */
> } else {
> /* restore the original locale */
> wxSetlocale(LC_NUMERIC, prvlocale);
> }
> 
> /home/oetelaar/kicad_dev/kicad/pcbnew/footprint_wizard.cpp: In member
> function ‘void FOOTPRINT_WIZARD_FRAME::ParametersUpdated(wxGridEvent&)’:
> /home/oetelaar/kicad_dev/kicad/pcbnew/footprint_wizard.cpp:190: error:
> no matching function for call to ‘wxString::Replace(const char [2],
> const char [2])’
> /usr/include/wx-2.8/wx/string.h:1173: note: candidates are: size_t
> wxString::Replace(const wxChar*, const wxChar*, bool)
> make[2]: *** [pcbnew/CMakeFiles/_pcbnew.dir/footprint_wizard.cpp.o] Error 1
> make[1]: *** [pcbnew/CMakeFiles/_pcbnew.dir/all] Error 2



Follow ups

References