From: cilix42 Date: Sun, 14 Sep 2008 18:29:40 +0000 (+0000) Subject: Make displaying of unit in lpe-path-length optional X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c5d7aa9126aa31d54e5ea38c1fb3a7dd1e5b54ed;p=inkscape.git Make displaying of unit in lpe-path-length optional --- 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