diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-07-29 14:49:40 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-07-29 14:49:40 +0000 |
| commit | 70a05bc08bae10f00ba33415f5162b71e110d3b4 (patch) | |
| tree | bbf0ab490b347aeec457d47828cbcabfcb3c54bd /src/live_effects/parameter/point.cpp | |
| parent | added new translation from Martin Srebotnjak (diff) | |
| download | inkscape-70a05bc08bae10f00ba33415f5162b71e110d3b4.tar.gz inkscape-70a05bc08bae10f00ba33415f5162b71e110d3b4.zip | |
LPE knotholder refactoring: PointParams are not knotholder entities any more; instead, every parameter type can now return entities (and then forget about them)
(bzr r6446)
Diffstat (limited to 'src/live_effects/parameter/point.cpp')
| -rw-r--r-- | src/live_effects/parameter/point.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 69e2520c2..7889bf164 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -152,23 +152,46 @@ PointParam::set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint knot_color = color; } +class PointParamKnotHolderEntity : public KnotHolderEntity { +public: + PointParamKnotHolderEntity(PointParam *p) { this->pparam = p; } + virtual ~PointParamKnotHolderEntity() {} + + 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); + +private: + PointParam *pparam; +}; + void -PointParam::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) +PointParamKnotHolderEntity::knot_set(NR::Point const &p, NR::Point const &/*origin*/, guint /*state*/) { - param_setValue(p.to_2geom()); + pparam->param_setValue(p.to_2geom()); sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false); } NR::Point -PointParam::knot_get() +PointParamKnotHolderEntity::knot_get() +{ + return *pparam; +} + +void +PointParamKnotHolderEntity::knot_click(guint /*state*/) { - return *this; + g_print ("This is the handle associated to parameter '%s'\n", pparam->param_key.c_str()); } void -PointParam::knot_click(guint /*state*/) +PointParam::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { - g_print ("This is the handle associated to the parameter '%s'\n", param_key.c_str()); + PointParamKnotHolderEntity *e = new PointParamKnotHolderEntity(this); + // TODO: can we ditch handleTip() etc. because we have access to handle_tip etc. itself??? + e->create(desktop, item, knotholder, handleTip(), knotShape(), knotMode(), knotColor()); + knotholder->add(e); + } } /* namespace LivePathEffect */ |
