Code

Fix self-snapping when dragging the transformation center of a selection containing...
[inkscape.git] / src / sp-object.cpp
index f77f228cbfcaff724872ebc7435a1366d7243389..fd17b3c12f521daeb688391ae93946cbc7aefe6c 100644 (file)
@@ -38,6 +38,7 @@
 #include "helper/sp-marshal.h"
 #include "xml/node-event-vector.h"
 #include "attributes.h"
+#include "color-profile-fns.h"
 #include "document.h"
 #include "style.h"
 #include "sp-object-repr.h"
@@ -53,8 +54,8 @@
 #include "debug/demangle.h"
 #include "util/share.h"
 #include "util/format.h"
+#include "util/longest-common-suffix.h"
 
-#include "algorithms/longest-common-suffix.h"
 using std::memcpy;
 using std::strchr;
 using std::strcmp;
@@ -539,29 +540,33 @@ SPObject::setLabel(gchar const *label) {
 
 
 /** Queues the object for orphan collection */
-void
-SPObject::requestOrphanCollection() {
+void SPObject::requestOrphanCollection() {
     g_return_if_fail(document != NULL);
 
     // do not remove style or script elements (Bug #276244)
-    if (SP_IS_STYLE_ELEM(this))
-        return;
-    if (SP_IS_SCRIPT(this))
-        return;
-
-    document->queueForOrphanCollection(this);
+    if (SP_IS_STYLE_ELEM(this)) {
+        // leave it
+    } else if (SP_IS_SCRIPT(this)) {
+        // leave it
+    } else if (SP_IS_PAINT_SERVER(this) && static_cast<SPPaintServer*>(this)->isSwatch() ) {
+        // leave it
+    } else if (IS_COLORPROFILE(this)) {
+        // leave it
+    } else {
+        document->queueForOrphanCollection(this);
 
-    /** \todo
-     * This is a temporary hack added to make fill&stroke rebuild its
-     * gradient list when the defs are vacuumed.  gradient-vector.cpp
-     * listens to the modified signal on defs, and now we give it that
-     * signal.  Mental says that this should be made automatic by
-     * merging SPObjectGroup with SPObject; SPObjectGroup would issue
-     * this signal automatically. Or maybe just derive SPDefs from
-     * SPObjectGroup?
-     */
+        /** \todo
+         * This is a temporary hack added to make fill&stroke rebuild its
+         * gradient list when the defs are vacuumed.  gradient-vector.cpp
+         * listens to the modified signal on defs, and now we give it that
+         * signal.  Mental says that this should be made automatic by
+         * merging SPObjectGroup with SPObject; SPObjectGroup would issue
+         * this signal automatically. Or maybe just derive SPDefs from
+         * SPObjectGroup?
+         */
 
-    this->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG);
+        this->requestModified(SP_OBJECT_CHILD_MODIFIED_FLAG);
+    }
 }
 
 /** Sends the delete signal to all children of this object recursively */
@@ -946,6 +951,17 @@ void SPObject::releaseReferences() {
     this->repr = NULL;
 }
 
+
+SPObject *SPObject::getNext()
+{
+    return next;
+}
+
+SPObject *SPObject::getPrev()
+{
+    return sp_object_prev(this);
+}
+
 /**
  * Callback for child_added node event.
  */