From c5d7aa9126aa31d54e5ea38c1fb3a7dd1e5b54ed Mon Sep 17 00:00:00 2001 From: cilix42 Date: Sun, 14 Sep 2008 18:29:40 +0000 Subject: [PATCH] Make displaying of unit in lpe-path-length optional --- src/live_effects/lpe-path_length.cpp | 7 +++++-- src/live_effects/lpe-path_length.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/live_effects/lpe-path_length.cpp b/src/live_effects/lpe-path_length.cpp index 15a5df165..e33a16002 100644 --- a/src/live_effects/lpe-path_length.cpp +++ b/src/live_effects/lpe-path_length.cpp @@ -24,11 +24,13 @@ LPEPathLength::LPEPathLength(LivePathEffectObject *lpeobject) : Effect(lpeobject), scale(_("Scale"), _("Scaling factor"), "scale", &wr, this, 1.0), info_text(this), - unit(_("Unit"), _("Unit"), "unit", &wr, this) + unit(_("Unit"), _("Unit"), "unit", &wr, this), + display_unit(_("Display unit"), _("Print unit after path length"), "display_unit", &wr, this, true) { registerParameter(dynamic_cast(&scale)); registerParameter(dynamic_cast(&info_text)); registerParameter(dynamic_cast(&unit)); + registerParameter(dynamic_cast(&display_unit)); } LPEPathLength::~LPEPathLength() @@ -52,7 +54,8 @@ LPEPathLength::doEffect_pwd2 (Geom::Piecewise > const & p gboolean success = sp_convert_distance(&lengthval, &sp_unit_get_by_id(SP_UNIT_PX), unit); /* ... set it as the canvas text ... */ - gchar *arc_length = g_strdup_printf("%.2f %s", lengthval, success ? unit.get_abbreviation() : "px"); + gchar *arc_length = g_strdup_printf("%.2f %s", lengthval, + display_unit ? (success ? unit.get_abbreviation() : "px") : ""); info_text.param_setValue(arc_length); g_free(arc_length); diff --git a/src/live_effects/lpe-path_length.h b/src/live_effects/lpe-path_length.h index e032bf3c9..e108e770a 100644 --- a/src/live_effects/lpe-path_length.h +++ b/src/live_effects/lpe-path_length.h @@ -17,6 +17,7 @@ #include "live_effects/effect.h" #include "live_effects/parameter/text.h" #include "live_effects/parameter/unit.h" +#include "live_effects/parameter/bool.h" namespace Inkscape { namespace LivePathEffect { @@ -36,6 +37,7 @@ private: ScalarParam scale; TextParamInternal info_text; UnitParam unit; + BoolParam display_unit; }; } //namespace LivePathEffect -- 2.30.2