diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 422d033ca3fb117839435fc2f093b4a5032d329c..f43f4ded952fd4c9f0be6a3a41969fa5a98f5b10 100644 (file)
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
+ * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
*
- * Copyright (C) 1999-2005 authors
+ * Copyright (C) 1999-2006 authors
* Copyright (C) 2000-2001 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
#include "style.h"
#include "attributes.h"
#include "sp-item-transform.h"
-
#include "sp-root.h"
#include "sp-use.h"
#include "prefs-utils.h"
+#include "sp-clippath.h"
+#include "sp-mask.h"
+#include "sp-path.h"
static void sp_group_class_init (SPGroupClass *klass);
static void sp_group_init (SPGroup *group);
if (flags & SP_OBJECT_WRITE_BUILD) {
GSList *l;
- if (!repr) repr = sp_repr_new ("svg:g");
+ if (!repr) {
+ Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
+ repr = xml_doc->createElement("svg:g");
+ }
l = NULL;
for (child = sp_object_first_child(object); child != NULL; child = SP_OBJECT_NEXT(child) ) {
crepr = child->updateRepr(NULL, flags);
o != NULL;
o = SP_OBJECT_NEXT(o))
{
- if (SP_IS_ITEM(o)) {
- sp_item_snappoints(SP_ITEM(o), p);
+ if (SP_IS_ITEM(o) && !SP_IS_PATH(o)) {
+ // getSnapPoints() and sp_group_snappoints are only being used in the selector tool,
+ // which should not snap path nodes. Only the node tool should snap those.
+ sp_item_snappoints(SP_ITEM(o), p);
}
}
}
child->updateRepr();
- Inkscape::XML::Node *nrepr = SP_OBJECT_REPR (child)->duplicate();
+ Inkscape::XML::Node *nrepr = SP_OBJECT_REPR (child)->duplicate(prepr->document());
// Merging transform
NR::Matrix ctrans;
// This is just a way to temporarily remember the transform in repr. When repr is
// reattached outside of the group, the transform will be written more properly
// (i.e. optimized into the object if the corresponding preference is set)
- gchar affinestr[80];
- if (sp_svg_transform_write(affinestr, 79, ctrans)) {
- nrepr->setAttribute("transform", affinestr);
- } else {
- nrepr->setAttribute("transform", NULL);
- }
+ gchar *affinestr=sp_svg_transform_write(ctrans);
+ nrepr->setAttribute("transform", affinestr);
+ g_free(affinestr);
items = g_slist_prepend (items, nrepr);
} else {
- Inkscape::XML::Node *nrepr = SP_OBJECT_REPR (child)->duplicate();
+ Inkscape::XML::Node *nrepr = SP_OBJECT_REPR (child)->duplicate(prepr->document());
objects = g_slist_prepend (objects, nrepr);
}
}
}
/* Step 4 - add items */
- gint const preserve = prefs_get_int_attribute("options.preservetransform", "value", 0);
while (items) {
Inkscape::XML::Node *repr = (Inkscape::XML::Node *) items->data;
// add item
repr->setPosition(pos > 0 ? pos : 0);
// fill in the children list if non-null
- SPItem *nitem = (SPItem *) doc->getObjectByRepr(repr);
-
- /* Optimize the transform matrix if requested. */
- // No compensations are required because this is supposed to be a non-transformation visually.
- if (!preserve) {
- NR::Matrix (*set_transform)(SPItem *, NR::Matrix const &) = ((SPItemClass *) G_OBJECT_GET_CLASS(nitem))->set_transform;
- if (set_transform) {
- sp_item_set_item_transform(nitem, set_transform(nitem, nitem->transform));
- nitem->updateRepr();
- }
- }
+ SPItem *item = (SPItem *) doc->getObjectByRepr(repr);
+ sp_item_write_transform(item, repr, item->transform, NULL, false);
+
Inkscape::GC::release(repr);
- if (children && SP_IS_ITEM (nitem))
- *children = g_slist_prepend (*children, nitem);
+ if (children && SP_IS_ITEM (item))
+ *children = g_slist_prepend (*children, item);
items = g_slist_remove (items, items->data);
}
@@ -761,3 +757,14 @@ void CGroup::onOrderChanged (Inkscape::XML::Node *child, Inkscape::XML::Node *,
_group->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :