summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-11-25 20:14:15 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-11-25 20:14:15 +0000
commit3bf84c3c6b6faf95269ad33739f2439984030a84 (patch)
treee9c3bbb9ed1dbd134eb2a9aa0e676cef0c5c2807 /src
parentPatch for bug #588181 (Eraser: eraser stroke is drawn after clicking canvas b... (diff)
parentFix Bug #447385 - Drag'n'drop from swatches doesn't always work (diff)
downloadinkscape-3bf84c3c6b6faf95269ad33739f2439984030a84.tar.gz
inkscape-3bf84c3c6b6faf95269ad33739f2439984030a84.zip
Fix drag & drop from swatches - patch by Adonis Papaderos
Fixed bugs: - https://launchpad.net/bugs/447385 (bzr r9919)
Diffstat (limited to 'src')
-rw-r--r--src/ui/tool/node-tool.cpp4
-rw-r--r--src/widgets/ege-paint-def.cpp25
2 files changed, 9 insertions, 20 deletions
diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp
index 9809ee848..e046fb573 100644
--- a/src/ui/tool/node-tool.cpp
+++ b/src/ui/tool/node-tool.cpp
@@ -567,13 +567,13 @@ void ink_node_tool_update_tip(InkNodeTool *nt, GdkEvent *event)
// TRANSLATORS: The %s below is where the "%u of %u nodes selected" sentence gets put
char *dyntip = g_strdup_printf(C_("Node tool tip",
"%s Drag to select nodes, click to edit only this object (more: Shift)"),
- nodestring, sz, total);
+ nodestring);
nt->_node_message_context->set(Inkscape::NORMAL_MESSAGE, dyntip);
g_free(dyntip);
} else {
char *dyntip = g_strdup_printf(C_("Node tool tip",
"%s Drag to select nodes, click clear the selection"),
- nodestring, sz, total);
+ nodestring);
nt->_node_message_context->set(Inkscape::NORMAL_MESSAGE, dyntip);
g_free(dyntip);
}
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 <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <glibmm/stringutils.h>
#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("<color name=\"") + descr + "\">";
tmp += "<sRGB r=\"";
- tmp += doubleToStr(getR()/255.0);
+ tmp += Glib::Ascii::dtostr(getR()/255.0);
tmp += "\" g=\"";
- tmp += doubleToStr(getG()/255.0);
+ tmp += Glib::Ascii::dtostr(getG()/255.0);
tmp += "\" b=\"";
- tmp += doubleToStr(getB()/255.0);
+ tmp += Glib::Ascii::dtostr(getB()/255.0);
tmp += "\"/>";
tmp += "</color>";
}
@@ -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<int>(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<int>(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<int>(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