diff options
| -rw-r--r-- | FL/Fl_Spinner.H | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/FL/Fl_Spinner.H b/FL/Fl_Spinner.H index 4016a9980..22da7886f 100644 --- a/FL/Fl_Spinner.H +++ b/FL/Fl_Spinner.H @@ -43,7 +43,7 @@ \image latex Fl_Spinner.png "Fl_Spinner widget" width=6cm */ class FL_EXPORT Fl_Spinner : public Fl_Group { - + double value_; // Current value double minimum_; // Minimum value double maximum_; // Maximum value @@ -92,26 +92,26 @@ private: sb->update(); } - sb->set_changed(); + sb->set_changed(); sb->do_callback(); } void update() { char s[255]; // Value string - if (format_[0]=='%'&&format_[1]=='.'&&format_[2]=='*') { // precision argument - // this code block is a simplified version of - // Fl_Valuator::format() and works well (but looks ugly) - int c = 0; - char temp[64], *sp = temp; - sprintf(temp, "%.12f", step_); - while (*sp) sp++; - sp--; - while (sp>temp && *sp=='0') sp--; - while (sp>temp && (*sp>='0' && *sp<='9')) { sp--; c++; } + if (format_[0]=='%'&&format_[1]=='.'&&format_[2]=='*') { // precision argument + // this code block is a simplified version of + // Fl_Valuator::format() and works well (but looks ugly) + int c = 0; + char temp[64], *sp = temp; + sprintf(temp, "%.12f", step_); + while (*sp) sp++; + sp--; + while (sp>temp && *sp=='0') sp--; + while (sp>temp && (*sp>='0' && *sp<='9')) { sp--; c++; } sprintf(s, format_, c, value_); - } else { + } else { sprintf(s, format_, value_); - } + } input_.value(s); } @@ -172,9 +172,9 @@ private: H / 2 + 2, H / 2); } /** - Sets or returns the amount to change the value when the user clicks a button. - Before setting step to a non-integer value, the spinner - type() should be changed to floating point. + Sets or returns the amount to change the value when the user clicks a button. + Before setting step to a non-integer value, the spinner + type() should be changed to floating point. */ double step() const { return (step_); } /** See double Fl_Spinner::step() const */ @@ -209,29 +209,29 @@ private: input_.textsize(s); } /** Gets the numeric representation in the input field. - \see Fl_Spinner::type(uchar) + \see Fl_Spinner::type(uchar) */ uchar type() const { return (input_.type()); } /** Sets the numeric representation in the input field. Valid values are FL_INT_INPUT and FL_FLOAT_INPUT. Also changes the format() template. Setting a new spinner type via a superclass pointer will not work. - \note type is not a virtual function. + \note type is not a virtual function. */ - void type(uchar v) { - if (v==FL_FLOAT_INPUT) { - format("%.*f"); - } else { - format("%.0f"); - } - input_.type(v); - } + void type(uchar v) { + if (v==FL_FLOAT_INPUT) { + format("%.*f"); + } else { + format("%.0f"); + } + input_.type(v); + } /** Gets the current value of the widget. */ double value() const { return (value_); } /** Sets the current value of the widget. - Before setting value to a non-integer value, the spinner - type() should be changed to floating point. + Before setting value to a non-integer value, the spinner + type() should be changed to floating point. */ void value(double v) { value_ = v; update(); } /** |
