summaryrefslogtreecommitdiffstats
path: root/generic/tkScale.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-02-01 11:41:09 (GMT)
committerhobbs <hobbs>2000-02-01 11:41:09 (GMT)
commit72b28710ff138c84a191a1e44c2207ba58522870 (patch)
tree462f9d19d2583612b9c3969de777574a4889f209 /generic/tkScale.c
parenta7ac3c95aefe0dcd187bf66e8d86ee148193f397 (diff)
downloadtk-72b28710ff138c84a191a1e44c2207ba58522870.zip
tk-72b28710ff138c84a191a1e44c2207ba58522870.tar.gz
tk-72b28710ff138c84a191a1e44c2207ba58522870.tar.bz2
* generic/tkRectOval.c (ConfigureRectOval):
* generic/tkCanvLine.c (ConfigureLine): * generic/tkCanvPoly.c (ConfigurePoly): * generic/tkCanvArc.c (Configure/DisplayArc): fixed handling for negative dash values [Bug: 4104] * generic/tkScale.c (TkRoundToResolution): fixed incorrect assumption that (N+1)*delta = N*delta + delta with floating point math [Bug: 3689, 4099] (DestroyScale) Fixed check for cancelling TkpDisplayScale (was REDRAW_ALL, is now REDRAW_PENDING)
Diffstat (limited to 'generic/tkScale.c')
-rw-r--r--generic/tkScale.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/generic/tkScale.c b/generic/tkScale.c
index cb1fdce..bad80fe 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -18,7 +18,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkScale.c,v 1.10 1999/12/22 20:01:07 hobbs Exp $
+ * RCS: @(#) $Id: tkScale.c,v 1.11 2000/02/01 11:41:10 hobbs Exp $
*/
#include "tkPort.h"
@@ -531,7 +531,7 @@ DestroyScale(memPtr)
scalePtr->flags |= SCALE_DELETED;
Tcl_DeleteCommandFromToken(scalePtr->interp, scalePtr->widgetCmd);
- if (scalePtr->flags & REDRAW_ALL) {
+ if (scalePtr->flags & REDRAW_PENDING) {
Tcl_CancelIdleCall(TkpDisplayScale, (ClientData) scalePtr);
}
@@ -1147,20 +1147,21 @@ TkRoundToResolution(scalePtr, value)
TkScale *scalePtr; /* Information about scale widget. */
double value; /* Value to round. */
{
- double rem, new;
+ double rem, new, tick;
if (scalePtr->resolution <= 0) {
return value;
}
- new = scalePtr->resolution * floor(value/scalePtr->resolution);
+ tick = floor(value/scalePtr->resolution);
+ new = scalePtr->resolution * tick;
rem = value - new;
if (rem < 0) {
if (rem <= -scalePtr->resolution/2) {
- new -= scalePtr->resolution;
+ new = (tick - 1.0) * scalePtr->resolution;
}
} else {
if (rem >= scalePtr->resolution/2) {
- new += scalePtr->resolution;
+ new = (tick + 1.0) * scalePtr->resolution;
}
}
return new;