summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-07-02 17:40:36 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-07-02 17:40:36 +0000
commit1f92ab5601340c1fe4fb850370e588f93660d058 (patch)
treec04b84df74295c22ddd1bceb65f38c69eb838e28 /src/live_effects
parentlpe-skeleton: add variable to control display of original path (diff)
downloadinkscape-1f92ab5601340c1fe4fb850370e588f93660d058.tar.gz
inkscape-1f92ab5601340c1fe4fb850370e588f93660d058.zip
lpe-skeleton: add boilerplate code to create knotholder handles for LPEs
(bzr r6122)
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/lpe-skeleton.cpp22
-rw-r--r--src/live_effects/lpe-skeleton.h12
2 files changed, 34 insertions, 0 deletions
diff --git a/src/live_effects/lpe-skeleton.cpp b/src/live_effects/lpe-skeleton.cpp
index c1a3e2601..ff601ef70 100644
--- a/src/live_effects/lpe-skeleton.cpp
+++ b/src/live_effects/lpe-skeleton.cpp
@@ -37,6 +37,9 @@ LPESkeleton::LPESkeleton(LivePathEffectObject *lpeobject) :
/* register all your parameters here, so Inkscape knows which parameters this effect has: */
registerParameter( dynamic_cast<Parameter *>(&number) );
+
+ /* register all your knotholder handles here: */
+ //registerKnotHolderHandle(new Skeleton::KnotHolderEntityAttachMyHandle(), _("help message"));
}
LPESkeleton::~LPESkeleton()
@@ -77,6 +80,25 @@ LPESkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
return output;
}
+/* ########################
+ * Define the classes for your knotholder handles here
+ */
+
+namespace Skeleton {
+
+class KnotHolderEntityMyHandle : public KnotHolderEntity
+{
+public:
+ virtual bool isLPEParam() { return true; } // this is always needed
+
+ // the set() and get() methods must be implemented, click() is optional
+ virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state);
+ virtual NR::Point knot_get();
+ //virtual void knot_click(guint state);
+};
+
+} // namespace Skeleton
+
/* ######################## */
} //namespace LivePathEffect
diff --git a/src/live_effects/lpe-skeleton.h b/src/live_effects/lpe-skeleton.h
index 532176a23..d961ad954 100644
--- a/src/live_effects/lpe-skeleton.h
+++ b/src/live_effects/lpe-skeleton.h
@@ -20,6 +20,15 @@
namespace Inkscape {
namespace LivePathEffect {
+// each knotholder handle for your LPE requires a separate class derived from KnotHolderEntity;
+// define it in lpe-skeleton.cpp and register it in the effect's constructor
+/**
+namespace Skeleton {
+ // we need a separate namespace to avoid clashes with other LPEs
+ class KnotHolderEntityMyHandle;
+}
+**/
+
class LPESkeleton : public Effect {
public:
LPESkeleton(LivePathEffectObject *lpeobject);
@@ -30,6 +39,9 @@ public:
// virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
+ /* the knotholder entity classes (if any) must be declared friends */
+ //friend class Skeleton::KnotHolderEntityMyHandle;
+
private:
// add the parameters for your effect here:
ScalarParam number;