summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-09-14 18:29:20 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-09-14 18:29:20 +0000
commita0ec999fffb4de6fa45fa12438a87ba12deda992 (patch)
treee6ffb42bb079fed1dab0061dee6ea1af6e4f6c76 /src
parentFixes for clipping and masking: (diff)
downloadinkscape-a0ec999fffb4de6fa45fa12438a87ba12deda992.tar.gz
inkscape-a0ec999fffb4de6fa45fa12438a87ba12deda992.zip
Scaling factor for lpe-path-length
(bzr r6811)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-path_length.cpp8
-rw-r--r--src/live_effects/lpe-path_length.h3
2 files changed, 6 insertions, 5 deletions
diff --git a/src/live_effects/lpe-path_length.cpp b/src/live_effects/lpe-path_length.cpp
index a032026b7..15a5df165 100644
--- a/src/live_effects/lpe-path_length.cpp
+++ b/src/live_effects/lpe-path_length.cpp
@@ -22,9 +22,11 @@ namespace LivePathEffect {
LPEPathLength::LPEPathLength(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
+ scale(_("Scale"), _("Scaling factor"), "scale", &wr, this, 1.0),
info_text(this),
unit(_("Unit"), _("Unit"), "unit", &wr, this)
{
+ registerParameter(dynamic_cast<Parameter *>(&scale));
registerParameter(dynamic_cast<Parameter *>(&info_text));
registerParameter(dynamic_cast<Parameter *>(&unit));
}
@@ -34,12 +36,10 @@ LPEPathLength::~LPEPathLength()
}
-bool
+void
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("");
-// TODO must return something to avoid nasty bugs
- g_warning("random value");
}
Geom::Piecewise<Geom::D2<Geom::SBasis> >
@@ -48,7 +48,7 @@ LPEPathLength::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & p
using namespace Geom;
/* convert the measured length to the correct unit ... */
- double lengthval = Geom::length(pwd2_in);
+ double lengthval = Geom::length(pwd2_in) * scale;
gboolean success = sp_convert_distance(&lengthval, &sp_unit_get_by_id(SP_UNIT_PX), unit);
/* ... set it as the canvas text ... */
diff --git a/src/live_effects/lpe-path_length.h b/src/live_effects/lpe-path_length.h
index 5a4638d90..e032bf3c9 100644
--- a/src/live_effects/lpe-path_length.h
+++ b/src/live_effects/lpe-path_length.h
@@ -28,11 +28,12 @@ public:
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
- bool hideCanvasText();
+ void hideCanvasText();
private:
LPEPathLength(const LPEPathLength&);
LPEPathLength& operator=(const LPEPathLength&);
+ ScalarParam scale;
TextParamInternal info_text;
UnitParam unit;
};