summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 02509d3)
raw | patch | inline | side by side (parent: 02509d3)
author | johncoswell <johncoswell@users.sourceforge.net> | |
Sun, 21 Oct 2007 12:04:38 +0000 (12:04 +0000) | ||
committer | johncoswell <johncoswell@users.sourceforge.net> | |
Sun, 21 Oct 2007 12:04:38 +0000 (12:04 +0000) |
src/extension/paramfloat.cpp | patch | blob | history | |
src/extension/paramfloat.h | patch | blob | history |
index 85a0bc4b9c3193a988c0171c007155ce62c592cc..2d41720c947a6ea6b1cf4db694cccecd159de42c 100644 (file)
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);
index ab9d61177cb4a321cf74352fe93a972e0d85ce67..fb8f8d5f8336a4873bbefc884539aa29cf78f361 100644 (file)
float _value;
float _min;
float _max;
+ int _precision;
public:
ParamFloat (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml);
/** \brief Returns \c _value */
float set (float in, SPDocument * doc, Inkscape::XML::Node * node);
float max (void) { return _max; }
float min (void) { return _min; }
+ float precision (void) { return _precision; }
Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal);
Glib::ustring * string (void);
};