summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e30b526)
raw | patch | inline | side by side (parent: e30b526)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Wed, 5 Apr 2006 20:15:52 +0000 (20:15 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Wed, 5 Apr 2006 20:15:52 +0000 (20:15 +0000) |
src/selection-chemistry.cpp | patch | blob | history |
index d4bc26c5d08a68879f9d9ae2a555ecced6bb3384..e6684010e6b705c5a1f8a039e1b4674dd21129f5 100644 (file)
// check if something is selected
bool is_empty = selection->isEmpty();
if ( apply_to_layer && is_empty) {
- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to create mask from."));
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to create clippath or mask from."));
return;
} else if (!apply_to_layer && ( is_empty || NULL == selection->itemList()->next )) {
- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select mask object and <b>object(s)</b> to apply mask to."));
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select mask object and <b>object(s)</b> to apply clippath or mask to."));
return;
}
// check if something is selected
if (selection->isEmpty()) {
- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to remove mask from."));
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to remove clippath or mask from."));
return;
}
obj->deleteObject(false);
}
+ // remember parent and position of the item to which the clippath/mask was applied
+ Inkscape::XML::Node *parent = SP_OBJECT_REPR((*it).second)->parent();
+ gint pos = SP_OBJECT_REPR((*it).second)->position();
+
for (GSList *i = items_to_move; NULL != i; i = i->next) {
- SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr((Inkscape::XML::Node *)i->data));
- selection->add((Inkscape::XML::Node *)i->data);
+ Inkscape::XML::Node *repr = (Inkscape::XML::Node *)i->data;
+
+ // insert into parent, restore pos
+ parent->appendChild(repr);
+ repr->setPosition((pos + 1) > 0 ? (pos + 1) : 0);
+
+ SPItem *mask_item = (SPItem *) SP_DT_DOCUMENT (desktop)->getObjectByRepr(repr);
+ selection->add(repr);
- // transform mask, so it is moved the same spot there mask was applied
- NR::Matrix transform (item->transform);
+ // transform mask, so it is moved the same spot where mask was applied
+ NR::Matrix transform (mask_item->transform);
transform *= (*it).second->transform;
- sp_item_write_transform(item, SP_OBJECT_REPR(item), transform);
+ sp_item_write_transform(mask_item, SP_OBJECT_REPR(mask_item), transform);
}
g_slist_free (items_to_move);