summaryrefslogtreecommitdiffstats
path: root/src/live_effects/effect.cpp
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/effect.cpp
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/effect.cpp')
-rw-r--r--src/live_effects/effect.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index 0749e4e93..db395c81b 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -321,22 +321,40 @@ Effect::registerParameter(Parameter * param)
param_vector.push_back(param);
}
+// TODO: Does it still make sense to use this? E.g., should we keep a list of knotholder entities
+// in the effect itself and add them here in a semi-automatic manner (similarly to how it is
+// done with parameters) instead of adding each one separately in the overloaded function
+// addKnotHolderHandles()?
void
Effect::registerKnotHolderHandle(SPKnotHolderSetFunc set_func, SPKnotHolderGetFunc get_func)
{
- knotholder_func_vector.push_back(std::make_pair(set_func, get_func));
+ //knotholder_func_vector.push_back(std::make_pair(set_func, get_func));
}
-// TODO: allow for adding click_functions and description strings, too
void
-Effect::addHandles(KnotHolder *knotholder) {
- std::vector<std::pair<SPKnotHolderSetFunc, SPKnotHolderGetFunc> >::iterator i;
- for (i = knotholder_func_vector.begin(); i != knotholder_func_vector.end(); ++i) {
- //knotholder->add(i->first, i->second, NULL, (""));
+Effect::addPointParamHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
+ using namespace std;
+ for (std::vector<Parameter *>::iterator p = param_vector.begin(); p != param_vector.end(); ++p) {
+ if ((*p)->paramType() == Inkscape::LivePathEffect::POINT_PARAM) {
+ g_print ("Parameter is of type PointParam\n");
+ KnotHolderEntity *e = dynamic_cast<KnotHolderEntity *>(*p);
+ e->create(desktop, item, knotholder);
+ knotholder->add(e);
+ } else {
+ g_print ("Parameter is *not* of type PointParam\n");
+ }
}
}
/**
+ * Virtual method to add knotholder handles for LPE items
+ */
+void
+Effect::addKnotHolderHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item)
+{
+}
+
+/**
* This *creates* a new widget, management of deletion should be done by the caller
*/
Gtk::Widget *