summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2006-04-05 20:15:52 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2006-04-05 20:15:52 +0000
commitc7f5fd5aa419e9d9ba3245f1e0ac0cb0c80e04e1 (patch)
treee98c4d1cd2d44951ed425c5e3168ab14ac5f8487 /src/selection-chemistry.cpp
parentnow sp_item_invoke_bbox_full does union of the item's bbox (after clippath cr... (diff)
downloadinkscape-c7f5fd5aa419e9d9ba3245f1e0ac0cb0c80e04e1.tar.gz
inkscape-c7f5fd5aa419e9d9ba3245f1e0ac0cb0c80e04e1.zip
insert clippath/mask item above the unmasked item into the same parent, instead of just putting it on top of everything in the current layer
(bzr r431)
Diffstat (limited to 'src/selection-chemistry.cpp')
-rw-r--r--src/selection-chemistry.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index d4bc26c5d..e6684010e 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -2366,10 +2366,10 @@ sp_selection_set_mask(bool apply_clip_path, bool apply_to_layer)
// 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;
}
@@ -2472,7 +2472,7 @@ void sp_selection_unset_mask(bool apply_clip_path) {
// 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;
}
@@ -2516,14 +2516,24 @@ void sp_selection_unset_mask(bool apply_clip_path) {
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);