From: cilix42 Date: Mon, 16 Jun 2008 16:17:27 +0000 (+0000) Subject: Activate automatic knotholders for LPE PointParams X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=42ba1b712b7b430669fc49aa9facb439181081be;p=inkscape.git Activate automatic knotholders for LPE PointParams --- 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::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(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;