From 79d46cc367c4181803d9a7a327b163643f23e8a7 Mon Sep 17 00:00:00 2001 From: cilix42 Date: Wed, 2 Jul 2008 16:33:20 +0000 Subject: [PATCH] Enable status bar tips for LPE handles that are automatically created from PointParams --- src/live_effects/effect.cpp | 7 +++--- src/live_effects/lpe-copy_rotate.cpp | 4 ++-- src/live_effects/lpe-lattice.cpp | 32 ++++++++++++++-------------- src/live_effects/lpe-parallel.cpp | 2 +- src/live_effects/parameter/point.cpp | 5 ++++- src/live_effects/parameter/point.h | 5 ++++- 6 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 9ee4105bc..74e5c29fd 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -413,11 +413,12 @@ Effect::addHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { void Effect::addPointParamHandles(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { - using namespace std; + using namespace Inkscape::LivePathEffect; for (std::vector::iterator p = param_vector.begin(); p != param_vector.end(); ++p) { - if ((*p)->paramType() == Inkscape::LivePathEffect::POINT_PARAM) { + if ((*p)->paramType() == POINT_PARAM) { + PointParam *pparam = static_cast(*p); KnotHolderEntity *e = dynamic_cast(*p); - e->create(desktop, item, knotholder); + e->create(desktop, item, knotholder, pparam->handleTip()); knotholder->add(e); } } diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index 40a4b1a54..03cea89f7 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -38,10 +38,10 @@ public: LPECopyRotate::LPECopyRotate(LivePathEffectObject *lpeobject) : Effect(lpeobject), - include_original(_("Include original?"), _(""), "include_original", &wr, this, false), + include_original(_("Include original?"), _(""), "include_original", &wr, this, true), angle(_("Angle"), _("Angle"), "angle", &wr, this, 30.0), num_copies(_("Number of copies"), _("Number of copies of the original path"), "num_copies", &wr, this, 1), - origin(_("Origin"), _("Origin of the rotation"), "origin", &wr, this), + origin(_("Origin"), _("Origin of the rotation"), "origin", &wr, this, "Adjust the origin of the rotation"), dist_angle_handle(100) { show_orig_path = true; diff --git a/src/live_effects/lpe-lattice.cpp b/src/live_effects/lpe-lattice.cpp index 6f929a9e5..8630c9cfa 100644 --- a/src/live_effects/lpe-lattice.cpp +++ b/src/live_effects/lpe-lattice.cpp @@ -45,22 +45,22 @@ LPELattice::LPELattice(LivePathEffectObject *lpeobject) : Effect(lpeobject), // initialise your parameters here: - grid_point0(_("Control handle 0"), _("Tadah"), "gridpoint0", &wr, this), - grid_point1(_("Control handle 1"), _("Tadah"), "gridpoint1", &wr, this), - grid_point2(_("Control handle 2"), _("Tadah"), "gridpoint2", &wr, this), - grid_point3(_("Control handle 3"), _("Tadah"), "gridpoint3", &wr, this), - grid_point4(_("Control handle 4"), _("Tadah"), "gridpoint4", &wr, this), - grid_point5(_("Control handle 5"), _("Tadah"), "gridpoint5", &wr, this), - grid_point6(_("Control handle 6"), _("Tadah"), "gridpoint6", &wr, this), - grid_point7(_("Control handle 7"), _("Tadah"), "gridpoint7", &wr, this), - grid_point8(_("Control handle 8"), _("Tadah"), "gridpoint8", &wr, this), - grid_point9(_("Control handle 9"), _("Tadah"), "gridpoint9", &wr, this), - grid_point10(_("Control handle 10"), _("Tadah"), "gridpoint10", &wr, this), - grid_point11(_("Control handle 11"), _("Tadah"), "gridpoint11", &wr, this), - grid_point12(_("Control handle 12"), _("Tadah"), "gridpoint12", &wr, this), - grid_point13(_("Control handle 13"), _("Tadah"), "gridpoint13", &wr, this), - grid_point14(_("Control handle 14"), _("Tadah"), "gridpoint14", &wr, this), - grid_point15(_("Control handle 15"), _("Tadah"), "gridpoint15", &wr, this) + grid_point0(_("Control handle 0"), _("Control handle 0"), "gridpoint0", &wr, this), + grid_point1(_("Control handle 1"), _("Control handle 1"), "gridpoint1", &wr, this), + grid_point2(_("Control handle 2"), _("Control handle 2"), "gridpoint2", &wr, this), + grid_point3(_("Control handle 3"), _("Control handle 3"), "gridpoint3", &wr, this), + grid_point4(_("Control handle 4"), _("Control handle 4"), "gridpoint4", &wr, this), + grid_point5(_("Control handle 5"), _("Control handle 5"), "gridpoint5", &wr, this), + grid_point6(_("Control handle 6"), _("Control handle 6"), "gridpoint6", &wr, this), + grid_point7(_("Control handle 7"), _("Control handle 7"), "gridpoint7", &wr, this), + grid_point8(_("Control handle 8"), _("Control handle 8"), "gridpoint8", &wr, this), + grid_point9(_("Control handle 9"), _("Control handle 9"), "gridpoint9", &wr, this), + grid_point10(_("Control handle 10"), _("Control handle 10"), "gridpoint10", &wr, this), + grid_point11(_("Control handle 11"), _("Control handle 11"), "gridpoint11", &wr, this), + grid_point12(_("Control handle 12"), _("Control handle 12"), "gridpoint12", &wr, this), + grid_point13(_("Control handle 13"), _("Control handle 13"), "gridpoint13", &wr, this), + grid_point14(_("Control handle 14"), _("Control handle 14"), "gridpoint14", &wr, this), + grid_point15(_("Control handle 15"), _("Control handle 15"), "gridpoint15", &wr, this) { // register all your parameters here, so Inkscape knows which parameters this effect has: diff --git a/src/live_effects/lpe-parallel.cpp b/src/live_effects/lpe-parallel.cpp index 51f3d3ac1..2f3a6d0ce 100644 --- a/src/live_effects/lpe-parallel.cpp +++ b/src/live_effects/lpe-parallel.cpp @@ -47,7 +47,7 @@ public: LPEParallel::LPEParallel(LivePathEffectObject *lpeobject) : Effect(lpeobject), // initialise your parameters here: - offset_pt(_("Offset"), _("Tadah"), "offset_pt", &wr, this), + offset_pt(_("Offset"), _("Adjust the offset"), "offset_pt", &wr, this), length_left(_("Length left"), _("Specifies the left end of the parallel"), "length-left", &wr, this, 150), length_right(_("Length right"), _("Specifies the right end of the parallel"), "length-right", &wr, this, 150) { diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index be8415d8d..84de8db05 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -32,7 +32,7 @@ namespace LivePathEffect { PointParam::PointParam( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, - Effect* effect, Geom::Point default_value ) + Effect* effect, const gchar *htip, Geom::Point default_value) : Geom::Point(default_value), Parameter(label, tip, key, wr, effect), defvalue(default_value) { oncanvas_editable = true; @@ -40,10 +40,13 @@ PointParam::PointParam( const Glib::ustring& label, const Glib::ustring& tip, knot_shape = SP_KNOT_SHAPE_SQUARE; knot_mode = SP_KNOT_MODE_XOR; knot_color = 0x00ff0000; + handle_tip = g_strdup(htip); } PointParam::~PointParam() { + if (handle_tip) + g_free(handle_tip); } void diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h index 3e8dc843a..bbd4d815e 100644 --- a/src/live_effects/parameter/point.h +++ b/src/live_effects/parameter/point.h @@ -30,7 +30,8 @@ public: const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, Effect* effect, - Geom::Point default_value = Geom::Point(0,0)); + const gchar *handle_tip = NULL, + Geom::Point default_value = Geom::Point(0,0) ); // tip for automatically associated on-canvas handle virtual ~PointParam(); virtual ParamType paramType() { return POINT_PARAM; } @@ -39,6 +40,7 @@ public: bool param_readSVGValue(const gchar * strvalue); gchar * param_getSVGValue() const; + inline const gchar *handleTip() const { return handle_tip ? handle_tip : param_tooltip.c_str(); } void param_setValue(Geom::Point newpoint); void param_set_default(); @@ -69,6 +71,7 @@ private: SPKnotShapeType knot_shape; SPKnotModeType knot_mode; guint32 knot_color; + gchar *handle_tip; }; -- 2.30.2