summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-02-16 20:50:29 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-02-16 20:50:29 +0000
commit1f9a15c19208b0be8f8e865fd9c35fb296201440 (patch)
tree9f7ad20540b0cfc2544f59f4cfa6e203f3c9fd0b /src/selection-chemistry.cpp
parentcontinuing fillet/chamfer (diff)
parenti18n (diff)
downloadinkscape-1f9a15c19208b0be8f8e865fd9c35fb296201440.tar.gz
inkscape-1f9a15c19208b0be8f8e865fd9c35fb296201440.zip
update to trunk
(bzr r13645.1.14)
Diffstat (limited to 'src/selection-chemistry.cpp')
-rw-r--r--src/selection-chemistry.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index c9837aabe..17b31f8b7 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -1321,6 +1321,26 @@ void sp_selection_paste_size_separately(SPDesktop *desktop, bool apply_x, bool a
}
}
+/**
+ * Ensures that the clones of objects are not modified when moving objects between layers.
+ * Calls the same function as ungroup
+ */
+void sp_selection_change_layer_maintain_clones(GSList const *items,SPObject *where)
+{
+ for (const GSList *i = items; i != NULL; i = i->next) {
+ SPItem *item = dynamic_cast<SPItem *>(SP_OBJECT(i->data));
+ if (item) {
+ SPItem *oldparent = dynamic_cast<SPItem *>(item->parent);
+ SPItem *newparent = dynamic_cast<SPItem *>(where);
+ sp_item_group_ungroup_handle_clones(item->document->getRoot(),
+ item,
+ (oldparent->i2doc_affine())
+ *((newparent->i2doc_affine()).inverse()));
+ }
+ }
+}
+
+
void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone)
{
Inkscape::Selection *selection = dt->getSelection();
@@ -1336,6 +1356,7 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone)
bool no_more = false; // Set to true, if no more layers above
SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
if (next) {
+ sp_selection_change_layer_maintain_clones(items,next);
GSList *temp_clip = NULL;
sp_selection_copy_impl(items, &temp_clip, dt->doc()->getReprDoc());
sp_selection_delete_impl(items, false, false);
@@ -1381,6 +1402,7 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone)
bool no_more = false; // Set to true, if no more layers below
SPObject *next=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
if (next) {
+ sp_selection_change_layer_maintain_clones(items,next);
GSList *temp_clip = NULL;
sp_selection_copy_impl(items, &temp_clip, dt->doc()->getReprDoc()); // we're in the same doc, so no need to copy defs
sp_selection_delete_impl(items, false, false);
@@ -1424,6 +1446,7 @@ void sp_selection_to_layer(SPDesktop *dt, SPObject *moveto, bool suppressDone)
GSList const *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
if (moveto) {
+ sp_selection_change_layer_maintain_clones(items,moveto);
GSList *temp_clip = NULL;
sp_selection_copy_impl(items, &temp_clip, dt->doc()->getReprDoc()); // we're in the same doc, so no need to copy defs
sp_selection_delete_impl(items, false, false);