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/live_effects/lpeobject.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/live_effects/lpeobject.cpp')
| -rw-r--r-- | src/live_effects/lpeobject.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index 6066f11f3..bcb01463a 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -1,21 +1,23 @@ #define INKSCAPE_LIVEPATHEFFECT_OBJECT_CPP /* - * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl> + * Copyright (C) Johan Engelen 2007-2008 <j.b.c.engelen@utwente.nl> * * Released under GNU GPL, read the file 'COPYING' for more information */ +#include "live_effects/lpeobject.h" + +#include "live_effects/effect.h" + #include "xml/repr.h" #include "xml/node-event-vector.h" #include "sp-object.h" #include "attributes.h" - #include "document.h" -#include <glibmm/i18n.h> +#include "document-private.h" -#include "live_effects/lpeobject.h" -#include "live_effects/effect.h" +#include <glibmm/i18n.h> //#define LIVEPATHEFFECT_VERBOSE @@ -251,6 +253,25 @@ livepatheffect_on_repr_attr_changed ( Inkscape::XML::Node * /*repr*/, lpeobj->requestModified(SP_OBJECT_MODIFIED_FLAG); } +/** + * If this has other users, create a new private duplicate and return it + * returns 'this' when no forking was necessary (and therefore no duplicate was made) + */ +LivePathEffectObject * +LivePathEffectObject::fork_private_if_necessary(int nr_of_allowed_users) +{ + if (SP_OBJECT_HREFCOUNT(this) > nr_of_allowed_users) { + SPDocument *doc = SP_OBJECT_DOCUMENT(this); + Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); + + Inkscape::XML::Node *repr = SP_OBJECT_REPR (this)->duplicate(xml_doc); + SP_OBJECT_REPR (SP_DOCUMENT_DEFS (doc))->addChild(repr, NULL); + LivePathEffectObject *lpeobj_new = (LivePathEffectObject *) doc->getObjectByRepr(repr); + Inkscape::GC::release(repr); + return lpeobj_new; + } + return this; +} /* Local Variables: |
