From 0b15096e0a4643b3e6a94507c44b981c722a209b Mon Sep 17 00:00:00 2001 From: Adonis Papaderos Date: Thu, 25 Nov 2010 12:40:29 +0200 Subject: [PATCH] Fix Bug #447385 - Drag'n'drop from swatches doesn't always work --- src/widgets/ege-paint-def.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/widgets/ege-paint-def.cpp b/src/widgets/ege-paint-def.cpp index cab675b29..2fc6927df 100644 --- a/src/widgets/ege-paint-def.cpp +++ b/src/widgets/ege-paint-def.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #if !defined(_) #define _(s) gettext(s) @@ -64,8 +65,6 @@ static std::string mimeTEXT("text/plain"); static std::string mimeX_COLOR("application/x-color"); static std::string mimeOSWB_COLOR("application/x-oswb-color"); -static std::string doubleToStr(double d); - PaintDef::PaintDef() : descr(_("none")), type(NONE), @@ -183,11 +182,11 @@ void PaintDef::getMIMEData(std::string const & type, char*& dest, int& len, int& { tmp += std::string(""; tmp += ""; tmp += ""; } @@ -233,20 +232,17 @@ bool PaintDef::fromMIMEData(std::string const & type, char const * data, int len this->type = ege::PaintDef::RGB; size_t numPos = srgb.find("r="); if (numPos != std::string::npos) { - char* endPtr = 0; - double dbl = strtod(srgb.c_str() + numPos + 3, &endPtr); + double dbl = Glib::Ascii::strtod(srgb.substr(numPos + 3)); this->r = static_cast(255 * dbl); } numPos = srgb.find("g="); if (numPos != std::string::npos) { - char* endPtr = 0; - double dbl = strtod(srgb.c_str() + numPos + 3, &endPtr); + double dbl = Glib::Ascii::strtod(srgb.substr(numPos + 3)); this->g = static_cast(255 * dbl); } numPos = srgb.find("b="); if (numPos != std::string::npos) { - char* endPtr = 0; - double dbl = strtod(srgb.c_str() + numPos + 3, &endPtr); + double dbl = Glib::Ascii::strtod(srgb.substr(numPos + 3)); this->b = static_cast(255 * dbl); } @@ -307,13 +303,6 @@ void PaintDef::removeCallback( ColorCallback /*cb*/, void* /*data*/ ) { } -static std::string doubleToStr(double d) -{ - // TODO ensure "." is used for decimal separator. - std::stringstream out; - out << d; - return out.str(); -} } // namespace ege -- 2.30.2