From 0bab68cd24b3bf0176c941dadb6c039a3205d40c Mon Sep 17 00:00:00 2001 From: John Bintz Date: Sun, 21 Oct 2007 12:04:38 +0000 Subject: add precision option to float parameters in extensions (bzr r3936) --- src/extension/paramfloat.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/extension/paramfloat.cpp') diff --git a/src/extension/paramfloat.cpp b/src/extension/paramfloat.cpp index 85a0bc4b9..2d41720c9 100644 --- a/src/extension/paramfloat.cpp +++ b/src/extension/paramfloat.cpp @@ -41,6 +41,11 @@ ParamFloat::ParamFloat (const gchar * name, const gchar * guitext, const gchar * if (minval != NULL) _min = atof(minval); + _precision = 1; + const char * precision = xml->attribute("precision"); + if (precision != NULL) + _precision = atoi(precision); + /* We're handling this by just killing both values */ if (_max < _min) { _max = 10.0; @@ -144,7 +149,7 @@ ParamFloat::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::sign hbox->pack_start(*label, true, true); ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this, doc, node, changeSignal)); - Gtk::SpinButton * spin = Gtk::manage(new Gtk::SpinButton(*fadjust, 0.1, 1)); + Gtk::SpinButton * spin = Gtk::manage(new Gtk::SpinButton(*fadjust, 0.1, _precision)); spin->show(); hbox->pack_start(*spin, false, false); -- cgit v1.2.3