From a8d7f4db568ca421bab7f4d2828fe2d3c17e6072 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 27 Feb 2014 04:54:34 +0100 Subject: Partial fix for LP #1001756 (crash when ungrouping a selection containing both a group and its clone). There are still some problems with undo/redo (incomplete undo transaction somewhere). (bzr r13063) --- src/sp-use.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/sp-use.cpp') diff --git a/src/sp-use.cpp b/src/sp-use.cpp index b2a51b8d9..e394e84c2 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -299,6 +299,23 @@ SPItem const *SPUse::root() const { return const_cast(this)->root(); } +/** + * Get the number of dereferences or calls to get_original() needed to get an object + * which is not an svg:use. Returns -1 if there is no original object. + */ +int SPUse::cloneDepth() const { + unsigned depth = 1; + SPItem *orig = this->child; + + while (orig && SP_IS_USE(orig)) { + ++depth; + orig = SP_USE(orig)->child; + } + + if (!orig) return -1; + return depth; +} + /** * Returns the effective transform that goes from the ultimate original to given SPUse, both ends * included. -- cgit v1.2.3 From 6ef6a1f8505298a969ddbdbf577678fead2b9dbb Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 6 Mar 2014 17:07:00 +0100 Subject: Fix for Bug #1288401 (Hovering in symbols dialog over symbols with ampersand in description result in console warning). Fixed bugs: - https://launchpad.net/bugs/1288401 (bzr r13122) --- src/sp-use.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/sp-use.cpp') diff --git a/src/sp-use.cpp b/src/sp-use.cpp index e394e84c2..14f51159b 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -22,6 +22,7 @@ #include <2geom/transforms.h> #include +#include #include "display/drawing-group.h" #include "attributes.h" #include "document.h" @@ -219,7 +220,7 @@ const char* SPUse::displayName() const { gchar* SPUse::description() const { if (this->child) { if( SP_IS_SYMBOL( this->child ) ) { - return g_strdup_printf(_("called %s"), this->child->title()); + return g_strdup_printf(_("called %s"), Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(NULL, "Symbol", this->child->title()))).c_str()); } static unsigned recursion_depth = 0; -- cgit v1.2.3 From 177d4b53062fa9093c2e37d15fe4c101fef7e17d Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Mon, 17 Mar 2014 15:05:12 +0100 Subject: Fix for Bug #1293073 (Dragging a symbol crashes the application when the symbol has no title). Fixed bugs: - https://launchpad.net/bugs/1293073 (bzr r13159) --- src/sp-use.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/sp-use.cpp') diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 14f51159b..e8fe3687f 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -220,7 +220,11 @@ const char* SPUse::displayName() const { gchar* SPUse::description() const { if (this->child) { if( SP_IS_SYMBOL( this->child ) ) { - return g_strdup_printf(_("called %s"), Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(NULL, "Symbol", this->child->title()))).c_str()); + if (this->child->title()) { + return g_strdup_printf(_("called %s"), Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(NULL, "Symbol", this->child->title()))).c_str()); + } else { + return g_strdup_printf(_("called %s"), _("Unnamed Symbol")); + } } static unsigned recursion_depth = 0; -- cgit v1.2.3