Code

Fix behavior when loading a document
[inkscape.git] / src / live_effects / lpe-test-doEffect-stack.cpp
index 19f20b5a96af35dd5d56f6b4c4e19ddc3eb0abe4..bb6d36fdc61b2a3d4232e4191fadf425d1fad7e2 100644 (file)
@@ -1,96 +1,82 @@
-#define INKSCAPE_LPE_DOEFFECT_STACK_CPP\r
-\r
-/*\r
- * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
-\r
-#include "live_effects/lpe-test-doEffect-stack.h"\r
-\r
-#include <2geom/piecewise.h>\r
-#include <vector>\r
-#include <libnr/n-art-bpath.h>\r
-\r
-namespace Inkscape {\r
-namespace LivePathEffect {\r
-\r
-\r
-LPEdoEffectStackTest::LPEdoEffectStackTest(LivePathEffectObject *lpeobject) :\r
-    Effect(lpeobject),\r
-    step(_("Stack step"), (""), "step", &wr, this)\r
-{\r
-    registerParameter( dynamic_cast<Parameter *>(&step) );\r
-}\r
-\r
-LPEdoEffectStackTest::~LPEdoEffectStackTest()\r
-{\r
-\r
-}\r
-\r
-void\r
-LPEdoEffectStackTest::doEffect (SPCurve * curve)\r
-{\r
-    if (step >= 1) {\r
-        Effect::doEffect(curve);\r
-    } else {\r
-        // return here\r
-        return;\r
-    }\r
-}\r
-\r
-NArtBpath *\r
-LPEdoEffectStackTest::doEffect (NArtBpath * path_in)\r
-{\r
-    if (step >= 2) {\r
-        return Effect::doEffect(path_in);\r
-    } else {\r
-        // return here\r
-        NArtBpath *path_out;\r
-\r
-        unsigned ret = 0;\r
-        while ( path_in[ret].code != NR_END ) {\r
-            ++ret;\r
-        }\r
-        unsigned len = ++ret;\r
-\r
-        path_out = g_new(NArtBpath, len);\r
-        memcpy(path_out, path_in, len * sizeof(NArtBpath));\r
-        return path_out;\r
-    }\r
-}\r
-\r
-std::vector<Geom::Path>\r
-LPEdoEffectStackTest::doEffect (std::vector<Geom::Path> & path_in)\r
-{\r
-    if (step >= 3) {\r
-        return Effect::doEffect(path_in);\r
-    } else {\r
-        // return here\r
-        std::vector<Geom::Path> path_out = path_in;\r
-        return path_out;\r
-    }\r
-}\r
-\r
-Geom::Piecewise<Geom::D2<Geom::SBasis> > \r
-LPEdoEffectStackTest::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)\r
-{\r
-    Geom::Piecewise<Geom::D2<Geom::SBasis> > output = pwd2_in;\r
-\r
-    return output;\r
-}\r
-\r
-\r
-} // namespace LivePathEffect\r
-} /* namespace Inkscape */\r
-\r
-/*\r
-  Local Variables:\r
-  mode:c++\r
-  c-file-style:"stroustrup"\r
-  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
-  indent-tabs-mode:nil\r
-  fill-column:99\r
-  End:\r
-*/\r
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :\r
+#define INKSCAPE_LPE_DOEFFECT_STACK_CPP
+
+/*
+ * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/lpe-test-doEffect-stack.h"
+
+#include <2geom/piecewise.h>
+#include <vector>
+#include <cstring>
+using std::memcpy;
+
+namespace Inkscape {
+namespace LivePathEffect {
+
+
+LPEdoEffectStackTest::LPEdoEffectStackTest(LivePathEffectObject *lpeobject) :
+    Effect(lpeobject),
+    step(_("Stack step"), ("How deep we should go into the stack"), "step", &wr, this),
+    point(_("point param"), "tooltip of point parameter", "point_param", &wr, this),
+    path(_("path param"), "tooltip of path parameter", "path_param", &wr, this,"M 0,100 100,0")
+{
+    registerParameter( dynamic_cast<Parameter *>(&step) );
+    registerParameter( dynamic_cast<Parameter *>(&point) );
+    registerParameter( dynamic_cast<Parameter *>(&path) );
+
+    point.set_oncanvas_looks(SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR, 0x00ff0000);
+}
+
+LPEdoEffectStackTest::~LPEdoEffectStackTest()
+{
+
+}
+
+void
+LPEdoEffectStackTest::doEffect (SPCurve * curve)
+{
+    if (step >= 1) {
+        Effect::doEffect(curve);
+    } else {
+        // return here
+        return;
+    }
+}
+
+std::vector<Geom::Path>
+LPEdoEffectStackTest::doEffect_path (std::vector<Geom::Path> const & path_in)
+{
+    if (step >= 2) {
+        return Effect::doEffect_path(path_in);
+    } else {
+        // return here
+        std::vector<Geom::Path> path_out = path_in;
+        return path_out;
+    }
+}
+
+Geom::Piecewise<Geom::D2<Geom::SBasis> > 
+LPEdoEffectStackTest::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
+{
+    Geom::Piecewise<Geom::D2<Geom::SBasis> > output = pwd2_in;
+
+    return output;
+}
+
+
+} // namespace LivePathEffect
+} /* namespace Inkscape */
+
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :