From e888c3668d921f55de15513db43b0f4c5dfbfc70 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 7 Jun 2010 06:27:34 +0000 Subject: [PATCH] 0020902: EDF 1416 GUI: Problems in the Notebook and with Setcolor when switching the locale --- .../SALOMEDSImpl_ScalarVariable.cxx | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx index 0bc795290..e6bb38616 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_ScalarVariable.cxx @@ -23,10 +23,13 @@ // #include "SALOMEDSImpl_ScalarVariable.hxx" #include "SALOMEDSImpl_GenericVariable.hxx" +#include "Basics_Utils.hxx" #include #include #include +#define OLDSTUDY_COMPATIBILITY + //============================================================================ /*! Function : SALOMEDSImpl_ScalarVariable * Purpose : @@ -101,6 +104,8 @@ std::string SALOMEDSImpl_ScalarVariable::getStringValue() const */ //============================================================================ std::string SALOMEDSImpl_ScalarVariable::Save() const{ + Kernel_Utils::Localizer loc; + char buffer[255]; switch(Type()) { @@ -132,6 +137,8 @@ std::string SALOMEDSImpl_ScalarVariable::Save() const{ //============================================================================ std::string SALOMEDSImpl_ScalarVariable::SaveToScript() const { + Kernel_Utils::Localizer loc; + char buffer[255]; switch(Type()) { @@ -147,10 +154,7 @@ std::string SALOMEDSImpl_ScalarVariable::SaveToScript() const } case SALOMEDSImpl_GenericVariable::BOOLEAN_VAR: { - if((bool)myValue) - sprintf(buffer, "%s", "True"); - else - sprintf(buffer, "%s", "False"); + sprintf(buffer, "%s", ((bool)myValue) ? "True" : "False"); break; } case SALOMEDSImpl_GenericVariable::STRING_VAR: @@ -181,6 +185,19 @@ std::string SALOMEDSImpl_ScalarVariable::SaveType() const{ //============================================================================ void SALOMEDSImpl_ScalarVariable::Load(const std::string& theStrValue) { - double aValue = atof(theStrValue.c_str()); - setValue(aValue); + Kernel_Utils::Localizer loc; + + if ( Type() == SALOMEDSImpl_GenericVariable::STRING_VAR ) { + setStringValue( theStrValue ); + } + else { + std::string strCopy = theStrValue; +#ifdef OLDSTUDY_COMPATIBILITY + int dotpos = strCopy.find(','); + if (dotpos != std::string::npos) + strCopy.replace(dotpos, 1, "."); +#endif // OLDSTUDY_COMPATIBILITY + double aValue = atof(strCopy.c_str()); + setValue(aValue); + } } -- 2.39.2