Code

Hide canvas text, too, when lpe-path-length is invisible
authorcilix42 <cilix42@users.sourceforge.net>
Sat, 13 Sep 2008 16:51:16 +0000 (16:51 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Sat, 13 Sep 2008 16:51:16 +0000 (16:51 +0000)
src/live_effects/lpe-path_length.cpp
src/live_effects/lpe-path_length.h
src/sp-lpe-item.cpp

index 3b9b07c82a1ab81d820a042766917b16530c6db7..5ecf2ffa29f74a74a276fe2b96cfd70b43092367 100644 (file)
@@ -34,6 +34,12 @@ LPEPathLength::~LPEPathLength()
 
 }
 
+bool
+LPEPathLength::hideCanvasText() {
+    // this is only used in sp-lpe-item.cpp to hide the canvas text when the effect is invisible
+    info_text.param_setValue("");
+}
+
 Geom::Piecewise<Geom::D2<Geom::SBasis> >
 LPEPathLength::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
 {
index 1ec5165e95c40c1cd1a4445d4de8012c661544d5..5a4638d904b66a6f901de9a725168be91032029c 100644 (file)
@@ -28,6 +28,8 @@ public:
 
     virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
 
+    bool hideCanvasText();
+
 private:
     LPEPathLength(const LPEPathLength&);
     LPEPathLength& operator=(const LPEPathLength&);
index 6e2e65d7d35aee8868d60c627a6ffa383ae088af..56ffd190c00c1a7f8a100b4cd507e70165a5c5d1 100644 (file)
@@ -18,6 +18,7 @@
 #endif
 
 #include "live_effects/effect.h"
+#include "live_effects/lpe-path_length.h"
 #include "live_effects/lpeobject.h"
 #include "live_effects/lpeobject-reference.h"
 
@@ -353,6 +354,19 @@ sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write)
     if (!sp_lpe_item_path_effects_enabled(lpeitem))
         return;
 
+    // TODO: hack! this will be removed when path length measuring is reimplemented in a better way
+    PathEffectList lpelist = sp_lpe_item_get_effect_list(lpeitem);
+    std::list<Inkscape::LivePathEffect::LPEObjectReference *>::iterator i;
+    for (i = lpelist.begin(); i != lpelist.end(); ++i) {
+        Inkscape::LivePathEffect::Effect *lpe = (*i)->lpeobject->lpe;
+        if (dynamic_cast<Inkscape::LivePathEffect::LPEPathLength *>(lpe)) {
+            if (!lpe->isVisible()) {
+                // we manually disable text for LPEPathLength
+                dynamic_cast<Inkscape::LivePathEffect::LPEPathLength *>(lpe)->hideCanvasText();
+            }
+        }
+    }
+
     SPLPEItem *top;
 
     if (wholetree) {