summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2010-07-26 23:43:02 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2010-07-26 23:43:02 +0000
commit22cce088046ec5cfeff1ca9c7afe4aa8998ebe46 (patch)
treecfc10f6c60f347cfb5d0a94721e43e2f27c7670d /src
parentFix initial combo box values in filter effects dialog (diff)
downloadinkscape-22cce088046ec5cfeff1ca9c7afe4aa8998ebe46.tar.gz
inkscape-22cce088046ec5cfeff1ca9c7afe4aa8998ebe46.zip
more powerstroke build infrastructure
(bzr r9656)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-powerstroke.cpp29
-rw-r--r--src/live_effects/lpe-powerstroke.h16
-rw-r--r--src/live_effects/parameter/CMakeLists.txt1
-rw-r--r--src/live_effects/parameter/Makefile_insert2
-rw-r--r--src/live_effects/parameter/array.cpp16
5 files changed, 24 insertions, 40 deletions
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp
index c3de621ee..b349f9aa6 100644
--- a/src/live_effects/lpe-powerstroke.cpp
+++ b/src/live_effects/lpe-powerstroke.cpp
@@ -28,18 +28,15 @@ LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
offset_1(_("Start Offset"), _("Handle to control the distance of the offset from the curve"), "offset_1", &wr, this),
offset_2(_("End Offset"), _("Handle to control the distance of the offset from the curve"), "offset_2", &wr, this),
- offset_3(_("End Offset"), _("Handle to control the distance of the offset from the curve"), "offset_3", &wr, this)
-// offset_points(_("Offset points"), _("Offset points"), "offset_points", &wr, this)
+ offset_3(_("End Offset"), _("Handle to control the distance of the offset from the curve"), "offset_3", &wr, this),
+ offset_points(_("Offset points"), _("Offset points"), "offset_points", &wr, this)
{
show_orig_path = true;
registerParameter( dynamic_cast<Parameter *>(&offset_1) );
registerParameter( dynamic_cast<Parameter *>(&offset_2) );
registerParameter( dynamic_cast<Parameter *>(&offset_3) );
-// registerParameter( dynamic_cast<Parameter *>(&offset_points) );
-
- /* register all your knotholder handles here: */
- //registerKnotHolderHandle(new PowerStroke::KnotHolderEntityAttachMyHandle(), _("help message"));
+ registerParameter( dynamic_cast<Parameter *>(&offset_points) );
}
LPEPowerStroke::~LPEPowerStroke()
@@ -119,26 +116,6 @@ LPEPowerStroke::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &
return output;
}
-
-/* ########################
- * Define the classes for your knotholder handles here
- */
-
-/*
-namespace PowerStroke {
-
-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 PowerStroke
-*/
-
/* ######################## */
} //namespace LivePathEffect
diff --git a/src/live_effects/lpe-powerstroke.h b/src/live_effects/lpe-powerstroke.h
index 9c6e3effe..811c63259 100644
--- a/src/live_effects/lpe-powerstroke.h
+++ b/src/live_effects/lpe-powerstroke.h
@@ -14,20 +14,11 @@
#include "live_effects/effect.h"
#include "live_effects/parameter/point.h"
-#include "live_effects/parameter/array.h"
+#include "live_effects/parameter/powerstrokepointarray.h"
namespace Inkscape {
namespace LivePathEffect {
-// each knotholder handle for your LPE requires a separate class derived from KnotHolderEntity;
-// define it in lpe-powerstroke.cpp and register it in the effect's constructor
-/**
-namespace PowerStroke {
- // we need a separate namespace to avoid clashes with other LPEs
- class KnotHolderEntityMyHandle;
-}
-**/
-
class LPEPowerStroke : public Effect {
public:
LPEPowerStroke(LivePathEffectObject *lpeobject);
@@ -37,14 +28,11 @@ public:
virtual void doOnApply(SPLPEItem *lpeitem);
- /* the knotholder entity classes (if any) must be declared friends */
- //friend class PowerStroke::KnotHolderEntityMyHandle;
-
private:
PointParam offset_1;
PointParam offset_2;
PointParam offset_3;
-// ArrayParam<Geom::Point> offset_points;
+ PowerStrokePointArrayParam offset_points;
LPEPowerStroke(const LPEPowerStroke&);
LPEPowerStroke& operator=(const LPEPowerStroke&);
diff --git a/src/live_effects/parameter/CMakeLists.txt b/src/live_effects/parameter/CMakeLists.txt
index 2fa0d5bc6..8657b2bec 100644
--- a/src/live_effects/parameter/CMakeLists.txt
+++ b/src/live_effects/parameter/CMakeLists.txt
@@ -5,6 +5,7 @@ parameter.cpp
path.cpp
path-reference.cpp
point.cpp
+powerstrokepointarray.cpp
random.cpp
text.cpp
unit.cpp
diff --git a/src/live_effects/parameter/Makefile_insert b/src/live_effects/parameter/Makefile_insert
index 74b166e8b..99cd88d62 100644
--- a/src/live_effects/parameter/Makefile_insert
+++ b/src/live_effects/parameter/Makefile_insert
@@ -16,6 +16,8 @@ ink_common_sources += \
live_effects/parameter/path-reference.h \
live_effects/parameter/path.cpp \
live_effects/parameter/path.h \
+ live_effects/parameter/powerstrokepointarray.cpp \
+ live_effects/parameter/powerstrokepointarray.h \
live_effects/parameter/text.cpp \
live_effects/parameter/text.h \
live_effects/parameter/unit.cpp \
diff --git a/src/live_effects/parameter/array.cpp b/src/live_effects/parameter/array.cpp
index c576bedd5..d1c30edf7 100644
--- a/src/live_effects/parameter/array.cpp
+++ b/src/live_effects/parameter/array.cpp
@@ -12,6 +12,7 @@
#include "svg/stringstream.h"
#include <2geom/coord.h>
+#include <2geom/point.h>
namespace Inkscape {
@@ -35,6 +36,21 @@ ArrayParam<float>::readsvg(const gchar * str)
return newx;
}
+template <>
+Geom::Point
+ArrayParam<Geom::Point>::readsvg(const gchar * str)
+{
+ gchar ** strarray = g_strsplit(str, ",", 2);
+ double newx, newy;
+ unsigned int success = sp_svg_number_read_d(strarray[0], &newx);
+ success += sp_svg_number_read_d(strarray[1], &newy);
+ g_strfreev (strarray);
+ if (success == 2) {
+ return Geom::Point(newx, newy);
+ }
+ return Geom::Point(Geom::infinity(),Geom::infinity());
+}
+
} /* namespace LivePathEffect */
} /* namespace Inkscape */