summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-06-16 16:17:27 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-06-16 16:17:27 +0000
commit34ac54244271a679a72da82b1a5ff62be1d3c58f (patch)
tree6252b2888747e98c4efcf905f2d9e34640cba2d1 /src
parentTemporarily add shortcuts in pen context to activate some LPEs which need pat... (diff)
downloadinkscape-34ac54244271a679a72da82b1a5ff62be1d3c58f.tar.gz
inkscape-34ac54244271a679a72da82b1a5ff62be1d3c58f.zip
Activate automatic knotholders for LPE PointParams
(bzr r5963)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/effect.cpp17
-rw-r--r--src/live_effects/effect.h4
-rw-r--r--src/live_effects/parameter/point.cpp20
-rw-r--r--src/object-edit.cpp2
4 files changed, 22 insertions, 21 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index 164447387..7e56023a6 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -569,6 +569,23 @@ Effect::transform_multiply(Geom::Matrix const& postmul, bool set)
}
}
+bool
+Effect::providesKnotholder()
+{
+ // does the effect actively provide any knotholder entities of its own?
+ if (kh_entity_vector.size() > 0)
+ return true;
+
+ // otherwise: are there any PointParams?
+ for (std::vector<Parameter *>::iterator p = param_vector.begin(); p != param_vector.end(); ++p) {
+ if ((*p)->paramType() == Inkscape::LivePathEffect::POINT_PARAM) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
} /* namespace LivePathEffect */
} /* namespace Inkscape */
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index 6eeff94c4..54dcf0c8c 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -120,11 +120,12 @@ public:
// TODO: providesKnotholder() is currently used as an indicator of whether a nodepath is
// created for an item or not. When we allow both at the same time, this needs rethinking!
- bool providesKnotholder() { return (kh_entity_vector.size() > 0); }
+ bool providesKnotholder();
// TODO: in view of providesOwnFlashPaths() below, this is somewhat redundant
// (but spiro lpe still needs it!)
virtual LPEPathFlashType pathFlashType() { return DEFAULT; }
void addHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
+ void addPointParamHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
void addHelperPaths(SPLPEItem *lpeitem, SPDesktop *desktop);
inline bool providesOwnFlashPaths() {
@@ -160,7 +161,6 @@ protected:
void registerParameter(Parameter * param);
void registerKnotHolderHandle(KnotHolderEntity* entity, const char* descr);
- void addPointParamHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
Parameter * getNextOncanvasEditableParam();
virtual void addHelperPathsImpl(SPLPEItem *lpeitem, SPDesktop *desktop);
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index 502af1f23..be8415d8d 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -100,7 +100,6 @@ PointParam::param_newWidget(Gtk::Tooltips * tooltips)
pIcon->show();
pButton->add(*pIcon);
pButton->show();
- pButton->signal_clicked().connect(sigc::mem_fun(*this, &PointParam::on_button_click));
Gtk::HBox * hbox = Gtk::manage( new Gtk::HBox() );
static_cast<Gtk::HBox*>(hbox)->pack_start(*pButton, true, true);
@@ -165,35 +164,20 @@ PointParam::set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint
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());
+ sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
}
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) {
- param_editOncanvas(item, desktop);
- }
+ g_print ("This is the handle associated to the parameter '%s'\n", param_key.c_str());
}
} /* namespace LivePathEffect */
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index 94c3c5daf..8f9bf378c 100644
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
@@ -56,7 +56,7 @@ static KnotHolder *sp_lpe_knot_holder(SPItem *item, SPDesktop *desktop)
KnotHolder *knot_holder = new KnotHolder(desktop, item, NULL);
Inkscape::LivePathEffect::Effect *effect = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item));
-// effect->addPointParamHandles(knot_holder, desktop, item);
+ effect->addPointParamHandles(knot_holder, desktop, item);
effect->addHandles(knot_holder, desktop, item);
return knot_holder;