summaryrefslogtreecommitdiffstats
path: root/src/sp-use.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2014-02-27 03:54:34 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2014-02-27 03:54:34 +0000
commita8d7f4db568ca421bab7f4d2828fe2d3c17e6072 (patch)
tree82179ff6ce776cb97a870b845f51dc29ac3b071a /src/sp-use.cpp
parentMove extended input events stuff from desktop-widget.cpp to sp-canvas.cpp, (diff)
downloadinkscape-a8d7f4db568ca421bab7f4d2828fe2d3c17e6072.tar.gz
inkscape-a8d7f4db568ca421bab7f4d2828fe2d3c17e6072.zip
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)
Diffstat (limited to 'src/sp-use.cpp')
-rw-r--r--src/sp-use.cpp17
1 files changed, 17 insertions, 0 deletions
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
@@ -300,6 +300,23 @@ SPItem const *SPUse::root() const {
}
/**
+ * 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.
*/