Code

Connector tool: make connectors avoid the convex hull of shapes.
[inkscape.git] / src / live_effects / lpe-skeleton.cpp
index a2c4cf1fbbf362fd45689bcbbbf57d97b60acc47..fdee68b88423bbf9d2421ed683c0eaab10b8173b 100644 (file)
@@ -1,7 +1,7 @@
 #define INKSCAPE_LPE_SKELETON_CPP
 /** \file
- * LPE <skeleton> implementation, used as an example for a base starting class
- * when implementing new LivePathEffects.
+ * @brief Minimal dummy LPE effect implementation, used as an example for a base
+ * starting class when implementing new LivePathEffects.
  *
  * In vi, three global search-and-replaces will let you rename everything
  * in this and the .h file:
  *   :%s/Skeleton/Yourname/g
  *   :%s/skeleton/yourname/g
  */
-/*
- * Authors:
- *   Johan Engelen
-*
-* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
+/* Authors:
+ *   Johan Engelen <j.b.c.engelen@utwente.nl>
+ *
+ * Copyright (C) 2007 Authors
  *
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
 
 #include "live_effects/lpe-skeleton.h"
-#include "display/curve.h"
-#include <libnr/n-art-bpath.h>
 
 // You might need to include other 2geom files. You can add them here:
 #include <2geom/path.h>
@@ -34,8 +31,14 @@ LPESkeleton::LPESkeleton(LivePathEffectObject *lpeobject) :
     // initialise your parameters here:
     number(_("Float parameter"), _("just a real number like 1.4!"), "svgname", &wr, this, 1.2)
 {
-    // register all your parameters here, so Inkscape knows which parameters this effect has:
+    /* uncomment the following line to have the original path displayed while the item is selected */
+    //show_orig_path = true;
+
+    /* 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()
@@ -46,7 +49,7 @@ LPESkeleton::~LPESkeleton()
 
 /* ########################
  *  Choose to implement one of the doEffect functions. You can delete or comment out the others.
-*/
+ */
 
 /*
 void
@@ -55,24 +58,8 @@ LPESkeleton::doEffect (SPCurve * curve)
     // spice this up to make the effect actually *do* something!
 }
 
-NArtBpath *
-LPESkeleton::doEffect_nartbpath (NArtBpath * path_in)
-{
-        NArtBpath *path_out;
-        unsigned ret = 0;
-        while ( path_in[ret].code != NR_END ) {
-            ++ret;
-        }
-        unsigned len = ++ret;
-        path_out = g_new(NArtBpath, len);
-
-        memcpy(path_out, path_in, len * sizeof(NArtBpath));   // spice this up to make the effect actually *do* something!
-
-        return path_out;
-}
-
 std::vector<Geom::Path>
-LPESkeleton::doEffect_path (std::vector<Geom::Path> & path_in)
+LPESkeleton::doEffect_path (std::vector<Geom::Path> const & path_in)
 {
         std::vector<Geom::Path> path_out;
 
@@ -83,7 +70,7 @@ LPESkeleton::doEffect_path (std::vector<Geom::Path> & path_in)
 */
 
 Geom::Piecewise<Geom::D2<Geom::SBasis> >
-LPESkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
+LPESkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
 {
     Geom::Piecewise<Geom::D2<Geom::SBasis> > output;
 
@@ -92,6 +79,25 @@ LPESkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
     return output;
 }
 
+/* ########################
+ *  Define the classes for your knotholder handles here
+ */
+
+/*
+namespace Skeleton {
+
+class KnotHolderEntityMyHandle : public LPEKnotHolderEntity
+{
+public:
+    // the set() and get() methods must be implemented, click() is optional
+    virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
+    virtual Geom::Point knot_get();
+    //virtual void knot_click(guint state);
+};
+
+} // namespace Skeleton
+*/
+
 /* ######################## */
 
 } //namespace LivePathEffect
@@ -106,4 +112,4 @@ LPESkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :