summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-03-20 23:00:52 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-03-20 23:00:52 +0000
commit887dd72ac8da405acdbf4c34336c93577e4d17a3 (patch)
treedb35247fa2ecf953c2d8c19102b90234c76bde0e /src
parentChange from Level3 to Level2 Views (diff)
downloadinkscape-887dd72ac8da405acdbf4c34336c93577e4d17a3.tar.gz
inkscape-887dd72ac8da405acdbf4c34336c93577e4d17a3.zip
Add on-canvas editing of LPE PointParam.
* made special KnotHolder for Pointparameters. todo: * pointparam numerical widgets display SVG info, instead of desktop coordinates. must be fixed * knots cannot be selected and moved by keys (bzr r5133)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/parameter/point.cpp19
-rw-r--r--src/live_effects/parameter/point.h8
-rw-r--r--src/shape-editor.cpp21
-rw-r--r--src/shape-editor.h2
-rw-r--r--src/verbs.h1
5 files changed, 42 insertions, 9 deletions
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index 075f7544f..841d11d27 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -7,6 +7,7 @@
*/
#include "live_effects/parameter/point.h"
+#include "live_effects/parameter/pointparam-knotholder.h"
#include "live_effects/effect.h"
#include "svg/svg.h"
#include "svg/stringstream.h"
@@ -133,8 +134,13 @@ PointParam::param_editOncanvas(SPItem * item, SPDesktop * dt)
tools_switch_current(TOOLS_NODES);
}
- ShapeEditor * shape_editor = SP_NODE_CONTEXT( dt->event_context )->shape_editor;
- shape_editor->set_item_lpe_point_parameter(item, SP_OBJECT(param_effect->getLPEObj()), param_key.c_str());
+ PointParamKnotHolder * kh = pointparam_knot_holder_new( dt, SP_OBJECT(param_effect->getLPEObj()), param_key.c_str(), item);
+ if (kh) {
+ pointparam_knot_holder_add_full(kh, * dynamic_cast<Geom::Point *>( this ), NULL, knot_shape, knot_mode, knot_color, param_getTooltip()->c_str() );
+
+ ShapeEditor * shape_editor = SP_NODE_CONTEXT( dt->event_context )->shape_editor;
+ shape_editor->set_knotholder(kh);
+ }
}
@@ -146,6 +152,15 @@ PointParam::param_transform_multiply(Geom::Matrix const& postmul, bool /*set*/)
}
+void
+PointParam::set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color)
+{
+ knot_shape = shape;
+ knot_mode = mode;
+ knot_color = color;
+}
+
+
// CALLBACKS:
void
diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h
index c167807d9..e200921ab 100644
--- a/src/live_effects/parameter/point.h
+++ b/src/live_effects/parameter/point.h
@@ -16,6 +16,8 @@
#include "live_effects/parameter/parameter.h"
+#include "knot-enums.h"
+
namespace Inkscape {
namespace LivePathEffect {
@@ -45,6 +47,8 @@ public:
virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/);
+ void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
+
private:
PointParam(const PointParam&);
PointParam& operator=(const PointParam&);
@@ -52,6 +56,10 @@ private:
void on_button_click();
Geom::Point defvalue;
+
+ SPKnotShapeType knot_shape;
+ SPKnotModeType knot_mode;
+ guint32 knot_color;
};
diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index b1da900f4..dd8e1124e 100644
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
@@ -22,6 +22,7 @@
#include "desktop.h"
#include "desktop-handles.h"
#include "knotholder.h"
+#include "live_effects/parameter/pointparam-knotholder.h"
#include "node-context.h"
#include "xml/node-event-vector.h"
#include "prefs-utils.h"
@@ -213,8 +214,8 @@ void ShapeEditor::set_item(SPItem *item) {
/** Please note that this function only works for path parameters.
* All other parameters probably will crash Inkscape!
*/
-void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, SPObject *lpeobject, const char * key) {
-
+void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, SPObject *lpeobject, const char * key)
+{
unset_item();
this->grab_node = -1;
@@ -236,11 +237,19 @@ void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, SPObject *lpeobject,
}
}
-/** Please note that this function only works for point parameters.
-* All other parameters probably will crash Inkscape!
+/**
+* pass a new knotholder to ShapeEditor to manage (and delete)
*/
-void ShapeEditor::set_item_lpe_point_parameter(SPItem */*item*/, SPObject */*lpeobject*/, const char * /*key*/) {
- g_message("ShapeEditor::set_item_lpe_point_parameter has not been implemented yet!");
+void
+ShapeEditor::set_knotholder(SPKnotHolder * knot_holder)
+{
+ unset_item();
+
+ this->grab_node = -1;
+
+ if (knot_holder) {
+ this->knotholder = knot_holder;
+ }
}
diff --git a/src/shape-editor.h b/src/shape-editor.h
index c78fb0d4a..bc4d9eff3 100644
--- a/src/shape-editor.h
+++ b/src/shape-editor.h
@@ -37,7 +37,7 @@ public:
void set_item (SPItem *item);
void set_item_lpe_path_parameter(SPItem *item, SPObject *lpeobject, const char * key);
- void set_item_lpe_point_parameter(SPItem *item, SPObject *lpeobject, const char * key);
+ void set_knotholder(SPKnotHolder * knot_holder);
void reset_item ();
void unset_item ();
diff --git a/src/verbs.h b/src/verbs.h
index 2961096f7..84aeb17c3 100644
--- a/src/verbs.h
+++ b/src/verbs.h
@@ -162,6 +162,7 @@ enum {
SP_VERB_CONTEXT_DROPPER,
SP_VERB_CONTEXT_CONNECTOR,
SP_VERB_CONTEXT_PAINTBUCKET,
+ SP_VERB_CONTEXT_LPE, //not really a tool but for editing LPE parameters on-canvas for example
/* Tool preferences */
SP_VERB_CONTEXT_SELECT_PREFS,
SP_VERB_CONTEXT_NODE_PREFS,