summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2000-02-01 11:41:09 (GMT)
committerhobbs <hobbs@noemail.net>2000-02-01 11:41:09 (GMT)
commit76fc956dab289585f1abed5c590fff5fb6c7e41b (patch)
tree462f9d19d2583612b9c3969de777574a4889f209 /generic
parentc7f37f050043d072ff619ff5df5a6067113d99c8 (diff)
downloadtk-76fc956dab289585f1abed5c590fff5fb6c7e41b.zip
tk-76fc956dab289585f1abed5c590fff5fb6c7e41b.tar.gz
tk-76fc956dab289585f1abed5c590fff5fb6c7e41b.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) FossilOrigin-Name: 5e295d879b98ead52bc6eb51dc3c636e202b2597
Diffstat (limited to 'generic')
-rw-r--r--generic/tkCanvArc.c12
-rw-r--r--generic/tkCanvLine.c4
-rw-r--r--generic/tkCanvPoly.c4
-rw-r--r--generic/tkCmds.c217
-rw-r--r--generic/tkRectOval.c4
-rw-r--r--generic/tkScale.c13
6 files changed, 235 insertions, 19 deletions
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index 1d0934e..f90061f 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvArc.c,v 1.7 1999/12/14 06:52:25 hobbs Exp $
+ * RCS: @(#) $Id: tkCanvArc.c,v 1.8 2000/02/01 11:41:09 hobbs Exp $
*/
#include <stdio.h>
@@ -482,7 +482,7 @@ ConfigureArc(interp, canvas, itemPtr, argc, argv, flags)
*/
if (arcPtr->outline.activeWidth > arcPtr->outline.width ||
- arcPtr->outline.activeDash.number > 0 ||
+ arcPtr->outline.activeDash.number != 0 ||
arcPtr->outline.activeColor != NULL ||
arcPtr->outline.activeStipple != None ||
arcPtr->activeFillColor != NULL ||
@@ -842,17 +842,17 @@ DisplayArc(canvas, itemPtr, display, drawable, x, y, width, height)
if (arcPtr->outline.activeWidth>lineWidth) {
lineWidth = arcPtr->outline.activeWidth;
}
- if (arcPtr->outline.activeDash.number>0) {
+ if (arcPtr->outline.activeDash.number != 0) {
dashnumber = arcPtr->outline.activeDash.number;
}
if (arcPtr->activeFillStipple != None) {
stipple = arcPtr->activeFillStipple;
}
} else if (state==TK_STATE_DISABLED) {
- if (arcPtr->outline.disabledWidth>0) {
+ if (arcPtr->outline.disabledWidth > 0) {
lineWidth = arcPtr->outline.disabledWidth;
}
- if (arcPtr->outline.disabledDash.number>0) {
+ if (arcPtr->outline.disabledDash.number != 0) {
dashnumber = arcPtr->outline.disabledDash.number;
}
if (arcPtr->disabledFillStipple != None) {
@@ -931,7 +931,7 @@ DisplayArc(canvas, itemPtr, display, drawable, x, y, width, height)
* the outline is dashed, because then polygons don't work.
*/
- if (lineWidth < 1.5 || dashnumber > 0) {
+ if (lineWidth < 1.5 || dashnumber != 0) {
Tk_CanvasDrawableCoords(canvas, arcPtr->center1[0],
arcPtr->center1[1], &x1, &y1);
Tk_CanvasDrawableCoords(canvas, arcPtr->center2[0],
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 59c936e..7fbd51e 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvLine.c,v 1.6 2000/01/21 03:54:41 hobbs Exp $
+ * RCS: @(#) $Id: tkCanvLine.c,v 1.7 2000/02/01 11:41:09 hobbs Exp $
*/
#include <stdio.h>
@@ -514,7 +514,7 @@ ConfigureLine(interp, canvas, itemPtr, argc, argv, flags)
}
if (linePtr->outline.activeWidth > linePtr->outline.width ||
- linePtr->outline.activeDash.number > 0 ||
+ linePtr->outline.activeDash.number != 0 ||
linePtr->outline.activeColor != NULL ||
linePtr->outline.activeStipple != None) {
itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT;
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index f64ccd6..79ba527 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvPoly.c,v 1.4 1999/12/14 06:52:26 hobbs Exp $
+ * RCS: @(#) $Id: tkCanvPoly.c,v 1.5 2000/02/01 11:41:09 hobbs Exp $
*/
#include <stdio.h>
@@ -464,7 +464,7 @@ ConfigurePolygon(interp, canvas, itemPtr, argc, argv, flags)
state = itemPtr->state;
if (polyPtr->outline.activeWidth > polyPtr->outline.width ||
- polyPtr->outline.activeDash.number > 0 ||
+ polyPtr->outline.activeDash.number != 0 ||
polyPtr->outline.activeColor != NULL ||
polyPtr->outline.activeStipple != None ||
polyPtr->activeFillColor != NULL ||
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index ffa171f..34d383c 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCmds.c,v 1.10 1999/12/21 23:55:10 hobbs Exp $
+ * RCS: @(#) $Id: tkCmds.c,v 1.11 2000/02/01 11:41:10 hobbs Exp $
*/
#include "tkPort.h"
@@ -1508,6 +1508,221 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv)
return TCL_OK;
}
+#if 0
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_WmObjCmd --
+ *
+ * This procedure is invoked to process the "wm" Tcl command.
+ * See the user documentation for details on what it does.
+ *
+ * Results:
+ * A standard Tcl result.
+ *
+ * Side effects:
+ * See the user documentation.
+ *
+ *----------------------------------------------------------------------
+ */
+
+ /* ARGSUSED */
+int
+Tk_WmObjCmd(clientData, interp, objc, objv)
+ ClientData clientData; /* Main window associated with
+ * interpreter. */
+ Tcl_Interp *interp; /* Current interpreter. */
+ int objc; /* Number of arguments. */
+ Tcl_Obj *CONST objv[]; /* Argument objects. */
+{
+ Tk_Window tkwin;
+ TkWindow *winPtr;
+
+ static char *optionStrings[] = {
+ "aspect", "client", "command", "deiconify",
+ "focusmodel", "frame", "geometry", "grid",
+ "group", "iconbitmap", "iconify", "iconmask",
+ "iconname", "iconposition", "iconwindow", "maxsize",
+ "minsize", "overrideredirect", "positionfrom", "protocol",
+ "resizable", "sizefrom", "state", "title",
+ "tracing", "transient", "withdraw", (char *) NULL
+ };
+ enum options {
+ TKWM_ASPECT, TKWM_CLIENT, TKWM_COMMAND, TKWM_DEICONIFY,
+ TKWM_FOCUSMOD, TKWM_FRAME, TKWM_GEOMETRY, TKWM_GRID,
+ TKWM_GROUP, TKWM_ICONBMP, TKWM_ICONIFY, TKWM_ICONMASK,
+ TKWM_ICONNAME, TKWM_ICONPOS, TKWM_ICONWIN, TKWM_MAXSIZE,
+ TKWM_MINSIZE, TKWM_OVERRIDE, TKWM_POSFROM, TKWM_PROTOCOL,
+ TKWM_RESIZABLE, TKWM_SIZEFROM, TKWM_STATE, TKWM_TITLE,
+ TKWM_TRACING, TKWM_TRANSIENT, TKWM_WITHDRAW
+ };
+
+ tkwin = (Tk_Window) clientData;
+
+ if (objc < 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg?");
+ return TCL_ERROR;
+ }
+ if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
+ &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
+ if (index == TKWM_TRACING) {
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
+
+ if ((objc != 2) && (objc != 3)) {
+ Tcl_WrongNumArgs(interp, 1, objv, "tracing ?boolean?");
+ return TCL_ERROR;
+ }
+ if (objc == 2) {
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(dispPtr->wmTracing));
+ return TCL_OK;
+ }
+ return Tcl_GetBooleanFromObj(interp, objv[2], &dispPtr->wmTracing);
+ }
+
+ if (objc < 3) {
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?arg?");
+ return TCL_ERROR;
+ }
+
+ winPtr = (TkWindow *) Tk_NameToWindow(interp,
+ Tcl_GetString(objv[2]), tkwin);
+ if (winPtr == NULL) {
+ return TCL_ERROR;
+ }
+ if (!(winPtr->flags & TK_TOP_LEVEL)) {
+ Tcl_AppendResult(interp, "window \"", winPtr->pathName,
+ "\" isn't a top-level window", (char *) NULL);
+ return TCL_ERROR;
+ }
+
+ switch ((enum options) index) {
+ case TKWM_ASPECT: {
+ TkpWmAspectCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_CLIENT: {
+ TkpWmClientCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_COMMAND: {
+ TkpWmCommandCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_DEICONIFY: {
+ TkpWmDeiconifyCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_FOCUSMOD: {
+ TkpWmFocusmodCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_FRAME: {
+ TkpWmFrameCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_GEOMETRY: {
+ TkpWmGeometryCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_GRID: {
+ TkpWmGridCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_GROUP: {
+ TkpWmGroupCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_ICONBMP: {
+ TkpWmIconbitmapCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_ICONIFY: {
+ TkpWmIconifyCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_ICONMASK: {
+ TkpWmIconmaskCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_ICONNAME: {
+ /* slight Unix variation */
+ TkpWmIconnameCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_ICONPOS: {
+ /* nearly same - 1 line more on Unix */
+ TkpWmIconpositionCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_ICONWIN: {
+ TkpWmIconwindowCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_MAXSIZE: {
+ /* nearly same, win diffs */
+ TkpWmMaxsizeCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_MINSIZE: {
+ /* nearly same, win diffs */
+ TkpWmMinsizeCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_OVERRIDE: {
+ /* almost same */
+ TkpWmOverrideCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_POSFROM: {
+ /* Equal across platforms */
+ TkpWmPositionfromCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_PROTOCOL: {
+ /* Equal across platforms */
+ TkpWmProtocolCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_RESIZABLE: {
+ /* almost same */
+ TkpWmResizableCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_SIZEFROM: {
+ /* Equal across platforms */
+ TkpWmSizefromCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_STATE: {
+ TkpWmStateCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_TITLE: {
+ TkpWmTitleCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_TRANSIENT: {
+ TkpWmTransientCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ case TKWM_WITHDRAW: {
+ TkpWmWithdrawCmd(interp, tkwin, winPtr, objc, objv);
+ break;
+ }
+ }
+
+ updateGeom:
+ if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) {
+ Tcl_DoWhenIdle(UpdateGeometryInfo, (ClientData) winPtr);
+ wmPtr->flags |= WM_UPDATE_PENDING;
+ }
+ return TCL_OK;
+}
+#endif
+
/*
*----------------------------------------------------------------------
*
diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c
index f5900c5..b5c78e2 100644
--- a/generic/tkRectOval.c
+++ b/generic/tkRectOval.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkRectOval.c,v 1.5 2000/01/12 11:45:03 hobbs Exp $
+ * RCS: @(#) $Id: tkRectOval.c,v 1.6 2000/02/01 11:41:10 hobbs Exp $
*/
#include <stdio.h>
@@ -439,7 +439,7 @@ ConfigureRectOval(interp, canvas, itemPtr, argc, argv, flags)
*/
if (rectOvalPtr->outline.activeWidth > rectOvalPtr->outline.width ||
- rectOvalPtr->outline.activeDash.number > 0 ||
+ rectOvalPtr->outline.activeDash.number != 0 ||
rectOvalPtr->outline.activeColor != NULL ||
rectOvalPtr->outline.activeStipple != None ||
rectOvalPtr->activeFillColor != NULL ||
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;