Code

Enable status bar tips for LPE handles that are automatically created from PointParams
authorcilix42 <cilix42@users.sourceforge.net>
Wed, 2 Jul 2008 16:33:20 +0000 (16:33 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Wed, 2 Jul 2008 16:33:20 +0000 (16:33 +0000)
src/live_effects/effect.cpp
src/live_effects/lpe-copy_rotate.cpp
src/live_effects/lpe-lattice.cpp
src/live_effects/lpe-parallel.cpp
src/live_effects/parameter/point.cpp
src/live_effects/parameter/point.h

index 9ee4105bc4da078f7b59fa561d16449c5ab91b0f..74e5c29fd17010f95a6dca8f8566fff81554e626 100644 (file)
@@ -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<Parameter *>::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<PointParam *>(*p);
             KnotHolderEntity *e = dynamic_cast<KnotHolderEntity *>(*p);
-            e->create(desktop, item, knotholder);
+            e->create(desktop, item, knotholder, pparam->handleTip());
             knotholder->add(e);
         }
     }
index 40a4b1a54833f70b4b7ec1d03790f570edfbd138..03cea89f72926c80ee1d4ea70fa27d17ea97bc20 100644 (file)
@@ -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;
index 6f929a9e50ff3894c66ce699979f022339f7bce3..8630c9cfa4898bac43994fde6fce481bf1cd5abf 100644 (file)
@@ -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:
index 51f3d3ac174e53e01e1669f68aa214ac654e995c..2f3a6d0cebdc1b2d26ee204fa67d888e3d2a6a3a 100644 (file)
@@ -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)
 {
index be8415d8d576a0b29b1f61a31bc30ffdff3476b7..84de8db0561d72d65fc2e3a0224bdc0edb30d16f 100644 (file)
@@ -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
index 3e8dc843ab9a7f3b95995e3d459d4abe0d4601bd..bbd4d815e0c89dc24c1ea5b10254798d0522404f 100644 (file)
@@ -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;
 };