author | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Thu, 25 Nov 2010 21:19:50 +0000 (22:19 +0100) | ||
committer | Krzysztof Kosiński <tweenk.pl@gmail.com> | |
Thu, 25 Nov 2010 21:19:50 +0000 (22:19 +0100) |
Patch from Adnois Papaderos.
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 021479843a1a4ff9de526345c2a139b5b6c80931..9b00dcd036eaa13ed3ba3b1a7d4b22bc3ad217f1 100644 (file)
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
dc->repr = NULL;
}
- Inkscape::Rubberband::get(desktop)->stop();
dc->_message_context->clear();
ret = TRUE;
}
+ if (Inkscape::Rubberband::get(desktop)->is_started()) {
+ Inkscape::Rubberband::get(desktop)->stop();
+ }
+
break;
}
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index 9ad52eb1eded179bcc5a65b693ce1da31b8eb28c..9c0b61b9c6f7e78ee5c7672b2f12c7b1c075c2de 100644 (file)
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
SP_OBJECT_REPR(rect)->setAttribute("ry", SP_OBJECT_REPR(rect)->attribute("rx"));
}
- update_knot();
}
Geom::Point
index 61db7f9610cbac5a5e5514f05151177ade4c1134..6786479d6230bda78540ff89461b2c80f323141e 100644 (file)
SPItem *unlink;
if (SP_IS_USE(item)) {
unlink = sp_use_unlink(SP_USE(item));
+ // Unable to unlink use (external or invalid href?)
+ if (!unlink) {
+ new_select = g_slist_prepend(new_select, item);
+ continue;
+ }
} else /*if (SP_IS_TREF(use))*/ {
unlink = SP_ITEM(sp_tref_convert_to_tspan(item));
}
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp
index ec0d0d576c8b78cffd56631fc5850179eecfab86..a2fc9a6b29b76840eb3c752cf3a0c304522b02d6 100644 (file)
--- a/src/sp-pattern.cpp
+++ b/src/sp-pattern.cpp
/* Conditional to avoid causing infinite loop if there's a cycle in the href chain. */
}
+
+/**
+Count how many times pat is used by the styles of o and its descendants
+*/
guint
-pattern_users (SPPattern *pattern)
+count_pattern_hrefs(SPObject *o, SPPattern *pat)
{
- return SP_OBJECT (pattern)->hrefcount;
+ if (!o)
+ return 1;
+
+ guint i = 0;
+
+ SPStyle *style = SP_OBJECT_STYLE(o);
+ if (style
+ && style->fill.isPaintserver()
+ && SP_IS_PATTERN(SP_STYLE_FILL_SERVER(style))
+ && SP_PATTERN(SP_STYLE_FILL_SERVER(style)) == pat)
+ {
+ i ++;
+ }
+ if (style
+ && style->stroke.isPaintserver()
+ && SP_IS_PATTERN(SP_STYLE_STROKE_SERVER(style))
+ && SP_PATTERN(SP_STYLE_STROKE_SERVER(style)) == pat)
+ {
+ i ++;
+ }
+
+ for (SPObject *child = sp_object_first_child(o);
+ child != NULL; child = SP_OBJECT_NEXT(child)) {
+ i += count_pattern_hrefs(child, pat);
+ }
+
+ return i;
}
SPPattern *
SPPattern *
sp_pattern_clone_if_necessary (SPItem *item, SPPattern *pattern, const gchar *property)
{
- if (pattern_users(pattern) > 1) {
+ if (!pattern->href || SP_OBJECT_HREFCOUNT(pattern) > count_pattern_hrefs(item, pattern)) {
pattern = pattern_chain (pattern);
gchar *href = g_strconcat ("url(#", SP_OBJECT_REPR (pattern)->attribute("id"), ")", NULL);
diff --git a/src/sp-use.cpp b/src/sp-use.cpp
index 9cd38e4b3e70b5ebf7e87734a2feb1073a8604c8..ecb7eb788b137c69537c43312d9950e96ce06518 100644 (file)
--- a/src/sp-use.cpp
+++ b/src/sp-use.cpp
// Track the ultimate source of a chain of uses.
SPItem *orig = sp_use_root(use);
- g_return_val_if_fail(orig, NULL);
+ if (!orig) return NULL ;
// Calculate the accumulated transform, starting from the original.
Geom::Matrix t = sp_use_get_root_transform(use);
index 9809ee848e28162e35a63958508c538b55c08287..e046fb57338b67f5ce9a28878c9ebbe91379113b 100644 (file)
// 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);
}
index cab675b295b44c8448878dd5dba2a375acc1a30e..2fc6927df2e626bdb632b8a44f38c02f1359b077 100644 (file)
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <glibmm/stringutils.h>
#if !defined(_)
#define _(s) gettext(s)
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);
}
{
}
-static std::string doubleToStr(double d)
-{
- // TODO ensure "." is used for decimal separator.
- std::stringstream out;
- out << d;
- return out.str();
-}
} // namespace ege