From 92d1c774b263648abaaf65699c867f37d6a43644 Mon Sep 17 00:00:00 2001 From: cilix42 Date: Sat, 13 Sep 2008 16:51:16 +0000 Subject: [PATCH] Hide canvas text, too, when lpe-path-length is invisible --- src/live_effects/lpe-path_length.cpp | 6 ++++++ src/live_effects/lpe-path_length.h | 2 ++ src/sp-lpe-item.cpp | 14 ++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/src/live_effects/lpe-path_length.cpp b/src/live_effects/lpe-path_length.cpp index 3b9b07c82..5ecf2ffa2 100644 --- a/src/live_effects/lpe-path_length.cpp +++ b/src/live_effects/lpe-path_length.cpp @@ -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 > LPEPathLength::doEffect_pwd2 (Geom::Piecewise > const & pwd2_in) { diff --git a/src/live_effects/lpe-path_length.h b/src/live_effects/lpe-path_length.h index 1ec5165e9..5a4638d90 100644 --- a/src/live_effects/lpe-path_length.h +++ b/src/live_effects/lpe-path_length.h @@ -28,6 +28,8 @@ public: virtual Geom::Piecewise > doEffect_pwd2 (Geom::Piecewise > const & pwd2_in); + bool hideCanvasText(); + private: LPEPathLength(const LPEPathLength&); LPEPathLength& operator=(const LPEPathLength&); diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 6e2e65d7d..56ffd190c 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -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::iterator i; + for (i = lpelist.begin(); i != lpelist.end(); ++i) { + Inkscape::LivePathEffect::Effect *lpe = (*i)->lpeobject->lpe; + if (dynamic_cast(lpe)) { + if (!lpe->isVisible()) { + // we manually disable text for LPEPathLength + dynamic_cast(lpe)->hideCanvasText(); + } + } + } + SPLPEItem *top; if (wholetree) { -- 2.30.2