diff options
| author | Andrius Ramanauskas <knutux@gmail.com> | 2006-03-21 07:22:28 +0000 |
|---|---|---|
| committer | knutux <knutux@users.sourceforge.net> | 2006-03-21 07:22:28 +0000 |
| commit | 086316f55a991168a44febbb1826678fd38dce89 (patch) | |
| tree | 721a8eec93395d994d58a5d3997c48b7d6261503 /src/selection-chemistry.cpp | |
| parent | fixing misspelled name in copyright notice (diff) | |
| download | inkscape-086316f55a991168a44febbb1826678fd38dce89.tar.gz inkscape-086316f55a991168a44febbb1826678fd38dce89.zip | |
Fixes to unmasking:
- Fixed crash if unmask/unclip is used on unmasked object
- Restoring mask/clippath object even if it is still referenced
- Adding restored mask objects to selected item list
(bzr r267)
Diffstat (limited to 'src/selection-chemistry.cpp')
| -rw-r--r-- | src/selection-chemistry.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 91686d277..ba0d89850 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2385,8 +2385,9 @@ void sp_selection_unset_mask(bool apply_clip_path) { } else { uri_ref = item->mask_ref; } - - if (NULL != uri_ref && referenced_objects.end() == referenced_objects.find(uri_ref->getObject())) { + + // collect distinct mask object + if (NULL != uri_ref && NULL != uri_ref->getObject() && referenced_objects.end() == referenced_objects.find(uri_ref->getObject())) { referenced_objects.insert(uri_ref->getObject()); } } @@ -2394,23 +2395,26 @@ void sp_selection_unset_mask(bool apply_clip_path) { SP_OBJECT_REPR(i->data)->setAttribute(attributeName, "none"); } + // restore mask objects into a document for ( std::set<SPObject*>::iterator it = referenced_objects.begin() ; it != referenced_objects.end() ; ++it) { SPObject *obj = (*it); + GSList *items_to_move = NULL; + for (SPObject *child = sp_object_first_child(obj) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + Inkscape::XML::Node *copy = SP_OBJECT_REPR(child)->duplicate(); + items_to_move = g_slist_prepend (items_to_move, copy); + } + if (!obj->isReferenced()) { - GSList *items_to_move = NULL; - for (SPObject *child = sp_object_first_child(obj) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { - Inkscape::XML::Node *copy = SP_OBJECT_REPR(child)->duplicate(); - items_to_move = g_slist_prepend (items_to_move, copy); - } - + // delete from defs if no other object references this mask obj->deleteObject(false); + } - for (GSList *i = items_to_move; NULL != i; i = i->next) { - desktop->currentLayer()->appendChildRepr((Inkscape::XML::Node *)i->data); - } - - g_slist_free (items_to_move); + for (GSList *i = items_to_move; NULL != i; i = i->next) { + desktop->currentLayer()->appendChildRepr((Inkscape::XML::Node *)i->data); + selection->add((Inkscape::XML::Node *)i->data); } + + g_slist_free (items_to_move); } sp_document_done (document); |
