Fix a bug in the Adjuster class that were causing system Beep when reaching the limits, or at each move when the limits where below 1.0 (like for Distortion). Also fix the bug of the too small spin button (displaying not enough digits).

This commit is contained in:
natureh
2012-01-16 02:16:09 +01:00
parent e3f54d3260
commit 8703bcd103

View File

@@ -320,18 +320,22 @@ MySpinButton::MySpinButton () {
void MySpinButton::updateSize() {
double vMin, vMax;
double step, page;
double maxAbs;
int maxAbs;
unsigned int digits, digits2;
unsigned int maxLen;
get_range(vMin, vMax);
get_increments (step, page);
maxAbs = fmax(fabs(vMin), fabs(vMax));
digits = get_digits();
for (digits2=0; maxAbs/pow(double(10),digits2)>=1.0; digits2++);
maxAbs = (int)(fmax(fabs(vMin), fabs(vMax))+0.000001);
if (maxAbs==0)
digits2 = 1;
else {
digits2 = (int)(log10(double(maxAbs))+0.000001);
digits2++;
}
maxLen = digits+digits2+(vMin<0?1:0)+(digits>0?1:0);
set_max_length(maxLen);
set_width_chars(maxLen);
}