summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-06-08 17:33:58 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-06-08 17:33:58 +0000
commitad092a3d734fcec79273f957e8d86c7a9ceb767b (patch)
treed1df1e2ac1ae259e7d8958990011fc3cba69d59a /src/live_effects/parameter
parentAdd 'Mode' label and icon for regular Bezier mode in pen/pencil toolbar (diff)
downloadinkscape-ad092a3d734fcec79273f957e8d86c7a9ceb767b.tar.gz
inkscape-ad092a3d734fcec79273f957e8d86c7a9ceb767b.zip
Make knotholders for LPE items finally work; each effect can now overload the addKnotHolderHandles() method to add handles which control its parameters.
There is now also a virtual onKnotUngrabbed() method for each knotholder entity which can be used to do cleanup tasks (for LPE parameters it currently writes the value to SVG, although this should probably happen automatically) (bzr r5855)
Diffstat (limited to 'src/live_effects/parameter')
-rw-r--r--src/live_effects/parameter/parameter.h3
-rw-r--r--src/live_effects/parameter/point.cpp21
-rw-r--r--src/live_effects/parameter/point.h11
3 files changed, 32 insertions, 3 deletions
diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h
index 511ce46a2..c4e58c8d5 100644
--- a/src/live_effects/parameter/parameter.h
+++ b/src/live_effects/parameter/parameter.h
@@ -58,7 +58,8 @@ public:
virtual bool param_readSVGValue(const gchar * strvalue) = 0; // returns true if new value is valid / accepted.
virtual gchar * param_getSVGValue() const = 0;
-
+ void write_to_SVG() { param_write_to_repr(param_getSVGValue()); }
+
virtual void param_set_default() = 0;
void printTypeName();
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index 49a47660f..502af1f23 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -162,12 +162,33 @@ PointParam::set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint
knot_color = color;
}
+void
+PointParam::knot_set(NR::Point const &p, NR::Point const &origin, guint state)
+{
+ g_print ("PointParam::knot_set() was called!\n");
+ param_setValue(p.to_2geom());
+}
+
+NR::Point
+PointParam::knot_get()
+{
+ g_print ("PointParam::knot_get() was called.\n");
+ g_print ("We return (%f, %f)\n", (*this)[0], (*this)[1]);
+ return *this;
+}
+
+void
+PointParam::knot_click(guint state)
+{
+ g_print ("PointParam::knot_click() was called!\n");
+}
// CALLBACKS:
void
PointParam::on_button_click()
{
+ g_print ("PointParam::on_button_click()\n");
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
SPItem * item = sp_desktop_selection(desktop)->singleItem();
if (item != NULL) {
diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h
index d963d835a..3e8dc843a 100644
--- a/src/live_effects/parameter/point.h
+++ b/src/live_effects/parameter/point.h
@@ -16,14 +16,14 @@
#include "live_effects/parameter/parameter.h"
-#include "knot-enums.h"
+#include "knot-holder-entity.h"
namespace Inkscape {
namespace LivePathEffect {
-class PointParam : public Geom::Point, public Parameter {
+class PointParam : public Geom::Point, public Parameter, public KnotHolderEntity {
public:
PointParam( const Glib::ustring& label,
const Glib::ustring& tip,
@@ -51,6 +51,13 @@ public:
void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
+ /* these are overloaded from KnotHolderEntity */
+ 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);
+
+ virtual bool isLPEParam() { return true; }
+
private:
PointParam(const PointParam&);
PointParam& operator=(const PointParam&);