diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-01-02 18:10:43 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-01-02 18:10:43 +0000 |
| commit | 4517038755f4211da3b5e9afb5567e9d608875da (patch) | |
| tree | 6b8c8407c5e099d449cb206a7d9077221bd4cc2e /src/selection-chemistry.cpp | |
| parent | add libnr <=> 2geom conversion helper headerfile (diff) | |
| download | inkscape-4517038755f4211da3b5e9afb5567e9d608875da.tar.gz inkscape-4517038755f4211da3b5e9afb5567e9d608875da.zip | |
+ Fix bug #179840, forking of LPEs
+ Groundwork for fixing transforming LPE bugs. TODO: implement the actual transformation of LPE parameters.
(bzr r4367)
Diffstat (limited to 'src/selection-chemistry.cpp')
| -rw-r--r-- | src/selection-chemistry.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 040e5f839..56ef7b01f 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -76,6 +76,8 @@ #include "xml/simple-document.h" #include "sp-filter-reference.h" #include "gradient-drag.h" +#include "uri-references.h" +#include "live_effects/lpeobject.h" using NR::X; using NR::Y; @@ -1268,11 +1270,12 @@ void sp_selection_paste_livepatheffect() return; } - paste_defs (&defs_clipboard, sp_desktop_document(desktop)); + SPDocument *doc = sp_desktop_document(desktop); + paste_defs (&defs_clipboard, doc); Inkscape::XML::Node *repr = (Inkscape::XML::Node *) clipboard->data; - char const *effectstr = repr->attribute("inkscape:path-effect"); - if (!effectstr) { + char const *effecturi = repr->attribute("inkscape:path-effect"); + if (!effecturi) { SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Clipboard does not contain a live path effect.")); return; } @@ -1280,8 +1283,13 @@ void sp_selection_paste_livepatheffect() for ( GSList const *itemlist = selection->itemList(); itemlist != NULL; itemlist = g_slist_next(itemlist) ) { SPItem *item = reinterpret_cast<SPItem*>(itemlist->data); if ( item && SP_IS_SHAPE(item) ) { - Inkscape::XML::Node *selrepr = (Inkscape::XML::Node *) SP_OBJECT_REPR(item); - selrepr->setAttribute("inkscape:path-effect", effectstr); + SPShape * shape = SP_SHAPE(item); + + // create a private LPE object! + SPObject * obj = sp_uri_reference_resolve(doc, effecturi); + LivePathEffectObject * lpeobj = LIVEPATHEFFECT(obj)->fork_private_if_necessary(0); + + sp_shape_set_path_effect(shape, lpeobj); // set inkscape:original-d for paths. the other shapes don't need this. if ( SP_IS_PATH(item) ) { |
