diff options
-rw-r--r-- | doc/scrollbar.n | 40 | ||||
-rw-r--r-- | generic/tkPack.c | 343 | ||||
-rw-r--r-- | generic/tkScrollbar.c | 58 | ||||
-rw-r--r-- | generic/tkScrollbar.h | 19 | ||||
-rw-r--r-- | macosx/Tk.xcodeproj/project.pbxproj | 2 | ||||
-rw-r--r-- | tests/oldpack.test | 558 |
6 files changed, 0 insertions, 1020 deletions
diff --git a/doc/scrollbar.n b/doc/scrollbar.n index 4f808f4..838dac1 100644 --- a/doc/scrollbar.n +++ b/doc/scrollbar.n @@ -236,46 +236,6 @@ the top or left of the window, or \-1, which means that one unit should scroll off the bottom or right of the window. Fractional numbers are rounded away from 0, so scrolling 0.001 units has the same effect as scrolling 1 unit. -.SH "OLD COMMAND SYNTAX" -.PP -In versions of Tk before 4.0, the \fBset\fR and \fBget\fR widget -commands used a different form. -This form is still supported for backward compatibility, but it -is deprecated. -In the old command syntax, the \fBset\fR widget command has the -following form: -.TP -\fIpathName \fBset \fItotalUnits windowUnits firstUnit lastUnit\fR -In this form the arguments are all integers. -\fITotalUnits\fR gives the total size of the object being displayed in the -associated widget. The meaning of one unit depends on the associated -widget; for example, in a text editor widget units might -correspond to lines of -text. \fIWindowUnits\fR indicates the total number of units that -can fit in the associated window at one time. \fIFirstUnit\fR -and \fIlastUnit\fR give the indices of the first and last units -currently visible in the associated window (zero corresponds to the -first unit of the object). -.LP -Under the old syntax the \fBget\fR widget command returns a list -of four integers, consisting of the \fItotalUnits\fR, \fIwindowUnits\fR, -\fIfirstUnit\fR, and \fIlastUnit\fR values from the last \fBset\fR -widget command. -.PP -The commands generated by scrollbars also have a different form -when the old syntax is being used: -.TP -\fIprefix\fR \fIunit\fR -\fIUnit\fR is an integer that indicates what should appear at -the top or left of the associated widget's window. -It has the same meaning as the \fIfirstUnit\fR and \fIlastUnit\fR -arguments to the \fBset\fR widget command. -.LP -The most recent \fBset\fR widget command determines whether or not -to use the old syntax. -If it is given two real arguments then the new syntax will be -used in the future, and if it is given four integer arguments then -the old syntax will be used. .SH BINDINGS .PP Tk automatically creates class bindings for scrollbars that give them diff --git a/generic/tkPack.c b/generic/tkPack.c index 8dc6284..baf2a70 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -122,10 +122,6 @@ static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, int objc, Tcl_Obj *const objv[]); static Tcl_FreeProc DestroyPacker; static Packer * GetPacker(Tk_Window tkwin); -#ifndef TK_NO_DEPRECATED -static int PackAfter(Tcl_Interp *interp, Packer *prevPtr, - Packer *containerPtr, int objc,Tcl_Obj *const objv[]); -#endif /* !TK_NO_DEPRECATED */ static void PackStructureProc(void *clientData, XEvent *eventPtr); static void Unlink(Packer *packPtr); @@ -199,16 +195,10 @@ Tk_PackObjCmd( Tk_Window tkwin = (Tk_Window)clientData; const char *argv2; static const char *const optionStrings[] = { -#ifndef TK_NO_DEPRECATED - "after", "append", "before", "unpack", -#endif /* !TK_NO_DEPRECATED */ "configure", "content", "forget", "info", "propagate", "slaves", NULL }; static const char *const optionStringsNoDep[] = { "configure", "content", "forget", "info", "propagate", NULL }; enum options { -#ifndef TK_NO_DEPRECATED - PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK, -#endif /* !TK_NO_DEPRECATED */ PACK_CONFIGURE, PACK_CONTENT, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES }; int index; @@ -239,72 +229,6 @@ Tk_PackObjCmd( argv2 = Tcl_GetString(objv[2]); switch ((enum options) index) { -#ifndef TK_NO_DEPRECATED - case PACK_AFTER: { - Packer *prevPtr; - Tk_Window tkwin2; - - if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { - return TCL_ERROR; - } - prevPtr = GetPacker(tkwin2); - if (prevPtr->containerPtr == NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "window \"%s\" isn't packed", argv2)); - Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL); - return TCL_ERROR; - } - return PackAfter(interp, prevPtr, prevPtr->containerPtr, objc-3, objv+3); - } - case PACK_APPEND: { - Packer *containerPtr; - Packer *prevPtr; - Tk_Window tkwin2; - - if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { - return TCL_ERROR; - } - containerPtr = GetPacker(tkwin2); - prevPtr = containerPtr->contentPtr; - if (prevPtr != NULL) { - while (prevPtr->nextPtr != NULL) { - prevPtr = prevPtr->nextPtr; - } - } - return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3); - } - case PACK_BEFORE: { - Packer *packPtr, *containerPtr; - Packer *prevPtr; - Tk_Window tkwin2; - - if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { - return TCL_ERROR; - } - packPtr = GetPacker(tkwin2); - if (packPtr->containerPtr == NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "window \"%s\" isn't packed", argv2)); - Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL); - return TCL_ERROR; - } - containerPtr = packPtr->containerPtr; - prevPtr = containerPtr->contentPtr; - if (prevPtr == packPtr) { - prevPtr = NULL; - } else { - for ( ; ; prevPtr = prevPtr->nextPtr) { - if (prevPtr == NULL) { - Tcl_Panic("\"pack before\" couldn't find predecessor"); - } - if (prevPtr->nextPtr == packPtr) { - break; - } - } - } - return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3); - } -#endif /* !TK_NO_DEPRECATED */ case PACK_CONFIGURE: if (argv2[0] != '.') { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -467,31 +391,6 @@ Tk_PackObjCmd( Tcl_SetObjResult(interp, resultObj); break; } -#ifndef TK_NO_DEPRECATED - case PACK_UNPACK: { - Tk_Window tkwin2; - Packer *packPtr; - - if (objc != 3) { - Tcl_WrongNumArgs(interp, 2, objv, "window"); - return TCL_ERROR; - } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { - return TCL_ERROR; - } - packPtr = GetPacker(tkwin2); - if ((packPtr != NULL) && (packPtr->containerPtr != NULL)) { - Tk_ManageGeometry(tkwin2, NULL, NULL); - if (packPtr->containerPtr->tkwin != Tk_Parent(packPtr->tkwin)) { - Tk_UnmaintainGeometry(packPtr->tkwin, - packPtr->containerPtr->tkwin); - } - Unlink(packPtr); - Tk_UnmapWindow(packPtr->tkwin); - } - break; - } -#endif /* !TK_NO_DEPRECATED */ } return TCL_OK; @@ -1078,248 +977,6 @@ GetPacker( } /* - *------------------------------------------------------------------------ - * - * PackAfter -- - * - * This function does most of the real work of adding one or more windows - * into the packing order for its container. - * - * Results: - * A standard Tcl return value. - * - * Side effects: - * The geometry of the specified windows may change, both now and again - * in the future. - * - *------------------------------------------------------------------------ - */ - -#ifndef TK_NO_DEPRECATED -static int -PackAfter( - Tcl_Interp *interp, /* Interpreter for error reporting. */ - Packer *prevPtr, /* Pack windows in argv just after this - * window; NULL means pack as first child of - * containerPtr. */ - Packer *containerPtr, /* Container in which to pack windows. */ - int objc, /* Number of elements in objv. */ - Tcl_Obj *const objv[]) /* Array of lists, each containing 2 elements: - * window name and side against which to - * pack. */ -{ - Packer *packPtr; - Tk_Window tkwin, ancestor, parent; - Tcl_Obj **options; - int c; - Tcl_Size index, optionCount; - - /* - * Iterate over all of the window specifiers, each consisting of two - * arguments. The first argument contains the window name and the - * additional arguments contain options such as "top" or "padx 20". - */ - - for ( ; objc > 0; objc -= 2, objv += 2, prevPtr = packPtr) { - if (objc < 2) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "wrong # args: window \"%s\" should be followed by options", - Tcl_GetString(objv[0]))); - Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL); - return TCL_ERROR; - } - - /* - * Find the packer for the window to be packed, and make sure that the - * window in which it will be packed is either its or a descendant of - * its parent. - */ - - if (TkGetWindowFromObj(interp, containerPtr->tkwin, objv[0], &tkwin) - != TCL_OK) { - return TCL_ERROR; - } - - parent = Tk_Parent(tkwin); - for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { - if (ancestor == parent) { - break; - } - if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_HIERARCHY) { - badWindow: - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't pack \"%s\" inside \"%s\"", Tcl_GetString(objv[0]), - Tk_PathName(containerPtr->tkwin))); - Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); - return TCL_ERROR; - } - } - if (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) { - goto badWindow; - } - if (tkwin == containerPtr->tkwin) { - goto badWindow; - } - packPtr = GetPacker(tkwin); - - /* - * Process options for this window. - */ - - if (Tcl_ListObjGetElements(interp, objv[1], &optionCount, &options) - != TCL_OK) { - return TCL_ERROR; - } - packPtr->side = TOP; - packPtr->anchor = TK_ANCHOR_CENTER; - packPtr->padX = packPtr->padY = 0; - packPtr->padLeft = packPtr->padTop = 0; - packPtr->iPadX = packPtr->iPadY = 0; - packPtr->flags &= ~(FILLX|FILLY|EXPAND); - packPtr->flags |= OLD_STYLE; - for (index = 0 ; index < optionCount; index++) { - Tcl_Obj *curOptPtr = options[index]; - Tcl_Size length; - const char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length); - - c = curOpt[0]; - - if ((c == 't') - && (strncmp(curOpt, "top", length)) == 0) { - packPtr->side = TOP; - } else if ((c == 'b') - && (strncmp(curOpt, "bottom", length)) == 0) { - packPtr->side = BOTTOM; - } else if ((c == 'l') - && (strncmp(curOpt, "left", length)) == 0) { - packPtr->side = LEFT; - } else if ((c == 'r') - && (strncmp(curOpt, "right", length)) == 0) { - packPtr->side = RIGHT; - } else if ((c == 'e') - && (strncmp(curOpt, "expand", length)) == 0) { - packPtr->flags |= EXPAND; - } else if ((c == 'f') - && (strcmp(curOpt, "fill")) == 0) { - packPtr->flags |= FILLX|FILLY; - } else if ((length == 5) && (strcmp(curOpt, "fillx")) == 0) { - packPtr->flags |= FILLX; - } else if ((length == 5) && (strcmp(curOpt, "filly")) == 0) { - packPtr->flags |= FILLY; - } else if ((c == 'p') && (strcmp(curOpt, "padx")) == 0) { - if (optionCount <= (index+1)) { - missingPad: - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "wrong # args: \"%s\" option must be" - " followed by screen distance", curOpt)); - Tcl_SetErrorCode(interp, "TK", "OLDPACK", "BAD_PARAMETER", - NULL); - return TCL_ERROR; - } - if (TkParsePadAmount(interp, tkwin, options[index+1], - &packPtr->padLeft, &packPtr->padX) != TCL_OK) { - return TCL_ERROR; - } - packPtr->padX /= 2; - packPtr->padLeft /= 2; - packPtr->iPadX = 0; - index++; - } else if ((c == 'p') && (strcmp(curOpt, "pady")) == 0) { - if (optionCount <= (index+1)) { - goto missingPad; - } - if (TkParsePadAmount(interp, tkwin, options[index+1], - &packPtr->padTop, &packPtr->padY) != TCL_OK) { - return TCL_ERROR; - } - packPtr->padY /= 2; - packPtr->padTop /= 2; - packPtr->iPadY = 0; - index++; - } else if ((c == 'f') && (length > 1) - && (strncmp(curOpt, "frame", length) == 0)) { - if (optionCount <= (index+1)) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "wrong # args: \"frame\"" - " option must be followed by anchor point", TCL_INDEX_NONE)); - Tcl_SetErrorCode(interp, "TK", "OLDPACK", "BAD_PARAMETER", - NULL); - return TCL_ERROR; - } - if (Tk_GetAnchorFromObj(interp, options[index+1], - &packPtr->anchor) != TCL_OK) { - return TCL_ERROR; - } - index++; - } else { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad option \"%s\": should be top, bottom, left," - " right, expand, fill, fillx, filly, padx, pady, or" - " frame", curOpt)); - Tcl_SetErrorCode(interp, "TK", "OLDPACK", "BAD_PARAMETER", - NULL); - return TCL_ERROR; - } - } - - if (packPtr != prevPtr) { - /* - * Unpack this window if it's currently packed. - */ - - if (packPtr->containerPtr != NULL) { - if ((packPtr->containerPtr != containerPtr) && - (packPtr->containerPtr->tkwin - != Tk_Parent(packPtr->tkwin))) { - Tk_UnmaintainGeometry(packPtr->tkwin, - packPtr->containerPtr->tkwin); - } - Unlink(packPtr); - } - - /* - * Add the window in the correct place in its container's packing - * order, then make sure that the window is managed by us. - */ - - packPtr->containerPtr = containerPtr; - if (prevPtr == NULL) { - packPtr->nextPtr = containerPtr->contentPtr; - containerPtr->contentPtr = packPtr; - } else { - packPtr->nextPtr = prevPtr->nextPtr; - prevPtr->nextPtr = packPtr; - } - Tk_ManageGeometry(tkwin, &packerType, packPtr); - - if (!(containerPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack") - != TCL_OK) { - Tk_ManageGeometry(tkwin, NULL, NULL); - Unlink(packPtr); - return TCL_ERROR; - } - containerPtr->flags |= ALLOCED_CONTAINER; - } - } - } - - /* - * Arrange for the container to be re-packed at the first idle moment. - */ - - if (containerPtr->abortPtr != NULL) { - *containerPtr->abortPtr = 1; - } - if (!(containerPtr->flags & REQUESTED_REPACK)) { - containerPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, containerPtr); - } - return TCL_OK; -} -#endif /* !TK_NO_DEPRECATED */ - -/* *---------------------------------------------------------------------- * * Unlink -- diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 4fb8b3c..dbe2c62 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -179,12 +179,6 @@ Tk_ScrollbarObjCmd( scrollPtr->sliderLast = 0; scrollPtr->activeField = 0; scrollPtr->activeRelief = TK_RELIEF_RAISED; -#ifndef TK_NO_DEPRECATED - scrollPtr->totalUnits = 0; - scrollPtr->windowUnits = 0; - scrollPtr->firstUnit = 0; - scrollPtr->lastUnit = 0; -#endif /* TK_NO_DEPRECATED */ scrollPtr->firstFraction = 0.0; scrollPtr->lastFraction = 0.0; scrollPtr->cursor = NULL; @@ -379,16 +373,6 @@ ScrollbarWidgetObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "get"); goto error; } -#ifndef TK_NO_DEPRECATED - if (scrollPtr->flags & OLD_STYLE_COMMANDS) { - resObjs[0] = Tcl_NewWideIntObj(scrollPtr->totalUnits); - resObjs[1] = Tcl_NewWideIntObj(scrollPtr->windowUnits); - resObjs[2] = Tcl_NewWideIntObj(scrollPtr->firstUnit); - resObjs[3] = Tcl_NewWideIntObj(scrollPtr->lastUnit); - Tcl_SetObjResult(interp, Tcl_NewListObj(4, resObjs)); - break; - } -#endif /* TK_NO_DEPRECATED */ resObjs[0] = Tcl_NewDoubleObj(scrollPtr->firstFraction); resObjs[1] = Tcl_NewDoubleObj(scrollPtr->lastFraction); Tcl_SetObjResult(interp, Tcl_NewListObj(2, resObjs)); @@ -440,48 +424,6 @@ ScrollbarWidgetObjCmd( } else { scrollPtr->lastFraction = last; } -#ifndef TK_NO_DEPRECATED - scrollPtr->flags &= ~OLD_STYLE_COMMANDS; - } else if (objc == 6) { - int totalUnits, windowUnits, firstUnit, lastUnit; - if (Tcl_GetIntFromObj(interp, objv[2], &totalUnits) != TCL_OK) { - goto error; - } - if (totalUnits < 0) { - totalUnits = 0; - } - if (Tcl_GetIntFromObj(interp, objv[3], &windowUnits) != TCL_OK) { - goto error; - } - if (windowUnits < 0) { - windowUnits = 0; - } - if (Tcl_GetIntFromObj(interp, objv[4], &firstUnit) != TCL_OK) { - goto error; - } - if (Tcl_GetIntFromObj(interp, objv[5], &lastUnit) != TCL_OK) { - goto error; - } - if (totalUnits > 0) { - if (lastUnit < firstUnit) { - lastUnit = firstUnit; - } - } else { - firstUnit = lastUnit = 0; - } - scrollPtr->totalUnits = totalUnits; - scrollPtr->windowUnits = windowUnits; - scrollPtr->firstUnit = firstUnit; - scrollPtr->lastUnit = lastUnit; - if (scrollPtr->totalUnits == 0) { - scrollPtr->firstFraction = 0.0; - scrollPtr->lastFraction = 1.0; - } else { - scrollPtr->firstFraction = ((double) firstUnit)/totalUnits; - scrollPtr->lastFraction = ((double) (lastUnit+1))/totalUnits; - } - scrollPtr->flags |= OLD_STYLE_COMMANDS; -#endif /* !TK_NO_DEPRECATED */ } else { Tcl_WrongNumArgs(interp, 1, objv, "set firstFraction lastFraction"); goto error; diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h index 6912e71..3543d4f 100644 --- a/generic/tkScrollbar.h +++ b/generic/tkScrollbar.h @@ -96,22 +96,6 @@ typedef struct TkScrollbar { * the OLD_STYLE_COMMANDS flag is 1. */ -#ifndef TK_NO_DEPRECATED - int totalUnits; /* Total dimension of application, in units. - * Valid only if the OLD_STYLE_COMMANDS flag - * is set. */ - int windowUnits; /* Maximum number of units that can be - * displayed in the window at once. Valid only - * if the OLD_STYLE_COMMANDS flag is set. */ - int firstUnit; /* Number of last unit visible in - * application's window. Valid only if the - * OLD_STYLE_COMMANDS flag is set. */ - int lastUnit; /* Index of last unit visible in window. - * Valid only if the OLD_STYLE_COMMANDS flag - * isn't set. */ -#else - int dummy1,dummy2,dummy3,dummy4; /* sizeof(TkScrollbar) should not depend on TK_NO_DEPRECATED */ -#endif /* TK_NO_DEPRECATED */ double firstFraction; /* Position of first visible thing in window, * specified as a fraction between 0 and * 1.0. */ @@ -157,9 +141,6 @@ typedef struct TkScrollbar { */ #define REDRAW_PENDING 1 -#ifndef TK_NO_DEPRECATED -# define OLD_STYLE_COMMANDS 2 -#endif /* TK_NO_DEPRECATED */ #define GOT_FOCUS 4 /* diff --git a/macosx/Tk.xcodeproj/project.pbxproj b/macosx/Tk.xcodeproj/project.pbxproj index e2acb38..c4c3b25 100644 --- a/macosx/Tk.xcodeproj/project.pbxproj +++ b/macosx/Tk.xcodeproj/project.pbxproj @@ -1121,7 +1121,6 @@ F966BC3C08F27A3C005CB29B /* message.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = message.test; sourceTree = "<group>"; }; F966BC3D08F27A3C005CB29B /* msgbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = msgbox.test; sourceTree = "<group>"; }; F966BC3E08F27A3C005CB29B /* obj.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = obj.test; sourceTree = "<group>"; }; - F966BC3F08F27A3C005CB29B /* oldpack.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = oldpack.test; sourceTree = "<group>"; }; F966BC4008F27A3C005CB29B /* option.file1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = option.file1; sourceTree = "<group>"; }; F966BC4108F27A3C005CB29B /* option.file2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = option.file2; sourceTree = "<group>"; }; F966BC4208F27A3C005CB29B /* option.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = option.test; sourceTree = "<group>"; }; @@ -2676,7 +2675,6 @@ F966BC3C08F27A3C005CB29B /* message.test */, F966BC3D08F27A3C005CB29B /* msgbox.test */, F966BC3E08F27A3C005CB29B /* obj.test */, - F966BC3F08F27A3C005CB29B /* oldpack.test */, F966BC4008F27A3C005CB29B /* option.file1 */, F966BC4108F27A3C005CB29B /* option.file2 */, F966BC4208F27A3C005CB29B /* option.test */, diff --git a/tests/oldpack.test b/tests/oldpack.test deleted file mode 100644 index d8a1bfe..0000000 --- a/tests/oldpack.test +++ /dev/null @@ -1,558 +0,0 @@ -# This file is a Tcl script to test out the old syntax of Tk's -# "pack" command (before release 3.3). It is organized in the -# standard fashion for Tcl tests. -# -# Copyright © 1991-1994 The Regents of the University of California. -# Copyright © 1994 Sun Microsystems, Inc. -# Copyright © 1998-1999 Scriptics Corporation. -# All rights reserved. - -package require tcltest 2.2 -eval tcltest::configure $argv -tcltest::loadTestedCommands -namespace import -force tcltest::test - -# First, test a single window packed in various ways in a parent - -destroy .pack -frame .pack -place .pack -width 100 -height 100 -frame .pack.red -width 10 -height 20 -label .pack.red.l -text R -bd 2 -relief raised -place .pack.red.l -relwidth 1.0 -relheight 1.0 -frame .pack.green -width 30 -height 40 -label .pack.green.l -text G -bd 2 -relief raised -place .pack.green.l -relwidth 1.0 -relheight 1.0 -frame .pack.blue -width 40 -height 40 -label .pack.blue.l -text B -bd 2 -relief raised -place .pack.blue.l -relwidth 1.0 -relheight 1.0 -frame .pack.violet -width 80 -height 20 -label .pack.violet.l -text P -bd 2 -relief raised -place .pack.violet.l -relwidth 1.0 -relheight 1.0 - -if {![catch {pack ap .pack .pack.red top}]} { - -# Don't execute any of this file if Tk is compiled with -DTK_NO_DEPRECATED - - -test oldpack-1.1 {basic positioning} -body { - #pack ap .pack .pack.red top - update - winfo geometry .pack.red -} -result 10x20+45+0 -test oldpack-1.2 {basic positioning} -body { - pack append .pack .pack.red bottom - update - winfo geometry .pack.red -} -result 10x20+45+80 -test oldpack-1.3 {basic positioning} -body { - pack append .pack .pack.red left - update - winfo geometry .pack.red -} -result 10x20+0+40 -test oldpack-1.4 {basic positioning} -body { - pack append .pack .pack.red right - update - winfo geometry .pack.red -} -result 10x20+90+40 - -# Try adding padding around the window and make sure that the -# window gets a larger frame. - -test oldpack-2.1 {padding} -body { - pack append .pack .pack.red {t padx 20} - update - winfo geometry .pack.red -} -result 10x20+45+0 -test oldpack-2.2 {padding} -body { - pack append .pack .pack.red {top pady 20} - update - winfo geometry .pack.red -} -result 10x20+45+10 -test oldpack-2.3 {padding} -body { - pack append .pack .pack.red {l padx 20} - update - winfo geometry .pack.red -} -result 10x20+10+40 -test oldpack-2.4 {padding} -body { - pack append .pack .pack.red {left pady 20} - update - winfo geometry .pack.red -} -result 10x20+0+40 - -# Position the window at different positions in its frame to -# make sure they all work. Try two differenet frame locations, -# to make sure that frame offsets are being added in correctly. - -test oldpack-3.1 {framing} -body { - pack append .pack .pack.red {b padx 20 pady 30} - update - winfo geometry .pack.red -} -result 10x20+45+65 -test oldpack-3.2 {framing} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 fr n} - update - winfo geometry .pack.red -} -result 10x20+45+50 -test oldpack-3.3 {framing} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 frame ne} - update - winfo geometry .pack.red -} -result 10x20+90+50 -test oldpack-3.4 {framing} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 frame e} - update - winfo geometry .pack.red -} -result 10x20+90+65 -test oldpack-3.5 {framing} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 frame se} - update - winfo geometry .pack.red -} -result 10x20+90+80 -test oldpack-3.6 {framing} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 frame s} - update - winfo geometry .pack.red -} -result 10x20+45+80 -test oldpack-3.7 {framing} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 frame sw} - update - winfo geometry .pack.red -} -result 10x20+0+80 -test oldpack-3.8 {framing} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 frame w} - update - winfo geometry .pack.red -} -result 10x20+0+65 -test oldpack-3.9 {framing} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 frame nw} - update - winfo geometry .pack.red -} -result 10x20+0+50 -test oldpack-3.10 {framing} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 frame c} - update - winfo geometry .pack.red -} -result 10x20+45+65 -test oldpack-3.11 {framing} -body { - pack append .pack .pack.red {r padx 20 pady 30} - update - winfo geometry .pack.red -} -result 10x20+80+40 -test oldpack-3.12 {framing} -body { - pack append .pack .pack.red {right padx 20 pady 30 frame n} - update - winfo geometry .pack.red -} -result 10x20+80+0 -test oldpack-3.13 {framing} -body { - pack append .pack .pack.red {right padx 20 pady 30 frame ne} - update - winfo geometry .pack.red -} -result 10x20+90+0 -test oldpack-3.14 {framing} -body { - pack append .pack .pack.red {right padx 20 pady 30 frame e} - update - winfo geometry .pack.red -} -result 10x20+90+40 -test oldpack-3.15 {framing} -body { - pack append .pack .pack.red {right padx 20 pady 30 frame se} - update - winfo geometry .pack.red -} -result 10x20+90+80 -test oldpack-3.16 {framing} -body { - pack append .pack .pack.red {right padx 20 pady 30 frame s} - update - winfo geometry .pack.red -} -result 10x20+80+80 -test oldpack-3.17 {framing} -body { - pack append .pack .pack.red {right padx 20 pady 30 frame sw} - update - winfo geometry .pack.red -} -result 10x20+70+80 -test oldpack-3.18 {framing} -body { - pack append .pack .pack.red {right padx 20 pady 30 frame w} - update - winfo geometry .pack.red -} -result 10x20+70+40 -test oldpack-3.19 {framing} -body { - pack append .pack .pack.red {right padx 20 pady 30 frame nw} - update - winfo geometry .pack.red -} -result 10x20+70+0 -test oldpack-3.20 {framing} -body { - pack append .pack .pack.red {right padx 20 pady 30 frame center} - update - winfo geometry .pack.red -} -result 10x20+80+40 - -# Try out various filling combinations in a couple of different -# frame locations. - -test oldpack-4.1 {filling} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 fillx} - update - winfo geometry .pack.red -} -result 100x20+0+65 -test oldpack-4.2 {filling} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 filly} - update - winfo geometry .pack.red -} -result 10x50+45+50 -test oldpack-4.3 {filling} -body { - pack append .pack .pack.red {bottom padx 20 pady 30 fill} - update - winfo geometry .pack.red -} -result 100x50+0+50 -test oldpack-4.4 {filling} -body { - pack append .pack .pack.red {right padx 20 pady 30 fillx} - update - winfo geometry .pack.red -} -result 30x20+70+40 -test oldpack-4.5 {filling} -body { - pack append .pack .pack.red {right padx 20 pady 30 filly} - update - winfo geometry .pack.red -} -result 10x100+80+0 -test oldpack-4.6 {filling} -body { - pack append .pack .pack.red {right padx 20 pady 30 fill} - update - winfo geometry .pack.red -} -result 30x100+70+0 - -# Multiple windows: make sure that space is properly subtracted -# from the cavity as windows are positioned inwards from all -# different sides. Also make sure that windows get unmapped if -# there isn't enough space for them. - -pack append .pack .pack.red top .pack.green top .pack.blue top \ - .pack.violet top -update -test oldpack-5.1 {multiple windows} -body { - winfo geometry .pack.red -} -result 10x20+45+0 -test oldpack-5.2 {multiple windows} -body { - winfo geometry .pack.green -} -result 30x40+35+20 -test oldpack-5.3 {multiple windows} -body { - winfo geometry .pack.blue -} -result 40x40+30+60 -test oldpack-5.4 {multiple windows} -body { - winfo ismapped .pack.violet -} -result 0 - -pack b .pack.blue .pack.violet top -update -test oldpack-5.5 {multiple windows} -body { - winfo ismapped .pack.violet -} -result 1 -test oldpack-5.6 {multiple windows} -body { - winfo geometry .pack.violet -} -result 80x20+10+60 -test oldpack-5.7 {multiple windows} -body { - winfo geometry .pack.blue -} -result 40x20+30+80 - -pack after .pack.blue .pack.red top -update -test oldpack-5.8 {multiple windows} -body { - winfo geometry .pack.green -} -result 30x40+35+0 -test oldpack-5.9 {multiple windows} -body { - winfo geometry .pack.violet -} -result 80x20+10+40 -test oldpack-5.10 {multiple windows} -body { - winfo geometry .pack.blue -} -result 40x40+30+60 -test oldpack-5.11 {multiple windows} -body { - winfo ismapped .pack.red -} -result 0 - -pack before .pack.green .pack.red right .pack.blue left -update -test oldpack-5.12 {multiple windows} -body { - winfo ismapped .pack.red -} -result 1 -test oldpack-5.13 {multiple windows} -body { - winfo geometry .pack.red -} -result 10x20+90+40 -test oldpack-5.14 {multiple windows} -body { - winfo geometry .pack.blue -} -result 40x40+0+30 -test oldpack-5.15 {multiple windows} -body { - winfo geometry .pack.green -} -result 30x40+50+0 -test oldpack-5.16 {multiple windows} -body { - winfo geometry .pack.violet -} -result 50x20+40+40 - -pack append .pack .pack.violet left .pack.green bottom .pack.red bottom \ - .pack.blue bottom -update -test oldpack-5.17 {multiple windows} -body { - winfo geometry .pack.violet -} -result 80x20+0+40 -test oldpack-5.18 {multiple windows} -body { - winfo geometry .pack.green -} -result 20x40+80+60 -test oldpack-5.19 {multiple windows} -body { - winfo geometry .pack.red -} -result 10x20+85+40 -test oldpack-5.20 {multiple windows} -body { - winfo geometry .pack.blue -} -result 20x40+80+0 - -pack after .pack.blue .pack.blue top .pack.red right .pack.green right \ - .pack.violet right -update -test oldpack-5.21 {multiple windows} -body { - winfo geometry .pack.blue -} -result 40x40+30+0 -test oldpack-5.22 {multiple windows} -body { - winfo geometry .pack.red -} -result 10x20+90+60 -test oldpack-5.23 {multiple windows} -body { - winfo geometry .pack.green -} -result 30x40+60+50 -test oldpack-5.24 {multiple windows} -body { - winfo geometry .pack.violet -} -result 60x20+0+60 - -pack after .pack.blue .pack.red left .pack.green left .pack.violet left -update -test oldpack-5.25 {multiple windows} -body { - winfo geometry .pack.blue -} -result 40x40+30+0 -test oldpack-5.26 {multiple windows} -body { - winfo geometry .pack.red -} -result 10x20+0+60 -test oldpack-5.27 {multiple windows} -body { - winfo geometry .pack.green -} -result 30x40+10+50 -test oldpack-5.28 {multiple windows} -body { - winfo geometry .pack.violet -} -result 60x20+40+60 - -pack append .pack .pack.violet left .pack.green left .pack.blue left \ - .pack.red left -update -test oldpack-5.29 {multiple windows} -body { - winfo geometry .pack.violet -} -result 80x20+0+40 -test oldpack-5.30 {multiple windows} -body { - winfo geometry .pack.green -} -result 20x40+80+30 -test oldpack-5.31 {multiple windows} -body { - winfo ismapped .pack.blue -} -result 0 -test oldpack-5.32 {multiple windows} -body { - winfo ismapped .pack.red -} -result 0 - - -# Test the ability of the packer to propagate geometry information -# to its parent. Make sure it computes the parent's needs both in -# the direction of packing (width for "left" and "right" windows, -# for example), and perpendicular to the pack direction (height for -# "left" and "right" windows). - -pack append .pack .pack.red top .pack.green top .pack.blue top \ - .pack.violet top -update -test oldpack-6.1 {geometry propagation} -body { - winfo reqwidth .pack} -result 80 -test oldpack-6.2 {geometry propagation} -body { - winfo reqheight .pack} -result 120 -destroy .pack.violet -update -test oldpack-6.3 {geometry propagation} -body { - winfo reqwidth .pack} -result 40 -test oldpack-6.4 {geometry propagation} -body { - winfo reqheight .pack} -result 100 -frame .pack.violet -width 80 -height 20 -bg violet -label .pack.violet.l -text P -bd 2 -relief raised -place .pack.violet.l -relwidth 1.0 -relheight 1.0 -pack append .pack .pack.red left .pack.green right .pack.blue bottom \ - .pack.violet top -update -test oldpack-6.5 {geometry propagation} -body { - winfo reqwidth .pack} -result 120 -test oldpack-6.6 {geometry propagation} -body { - winfo reqheight .pack} -result 60 -pack append .pack .pack.violet top .pack.green top .pack.blue left \ - .pack.red left -update -test oldpack-6.7 {geometry propagation} -body { - winfo reqwidth .pack} -result 80 -test oldpack-6.8 {geometry propagation} -body { - winfo reqheight .pack} -result 100 - -# Test the "expand" option, and make sure space is evenly divided -# when several windows request expansion. - -pack append .pack .pack.violet top .pack.green {left e} \ - .pack.blue {left expand} .pack.red {left expand} -update -test oldpack-7.1 {multiple expanded windows} -body { - pack append .pack .pack.violet top .pack.green {left e} \ - .pack.blue {left expand} .pack.red {left expand} - update - list [winfo geometry .pack.green] [winfo geometry .pack.blue] \ - [winfo geometry .pack.red] -} -result {30x40+3+40 40x40+39+40 10x20+86+50} -test oldpack-7.2 {multiple expanded windows} -body { - pack append .pack .pack.green left .pack.violet {bottom expand} \ - .pack.blue {bottom expand} .pack.red {bottom expand} - update - list [winfo geometry .pack.violet] [winfo geometry .pack.blue] \ - [winfo geometry .pack.red] -} -result {70x20+30+77 40x40+45+30 10x20+60+3} -test oldpack-7.3 {multiple expanded windows} -body { - foreach i [winfo child .pack] { - pack unpack $i - } - pack append .pack .pack.green {left e fill} .pack.red {left expand fill} \ - .pack.blue {top fill} - update - list [winfo geometry .pack.green] [winfo geometry .pack.red] \ - [winfo geometry .pack.blue] -} -result {40x100+0+0 20x100+40+0 40x40+60+0} -test oldpack-7.4 {multiple expanded windows} -body { - foreach i [winfo child .pack] { - pack unpack $i - } - pack append .pack .pack.red {top expand} .pack.violet {top expand} \ - .pack.blue {right fill} - update - list [winfo geometry .pack.red] [winfo geometry .pack.violet] \ - [winfo geometry .pack.blue] -} -result {10x20+45+5 80x20+10+35 40x40+60+60} -test oldpack-7.5 {multiple expanded windows} -body { - foreach i [winfo child .pack] { - pack unpack $i - } - pack append .pack .pack.green {right frame s} .pack.red {top expand} - update - list [winfo geometry .pack.green] [winfo geometry .pack.red] -} -result {30x40+70+60 10x20+30+40} -test oldpack-7.6 {multiple expanded windows} -body { - foreach i [winfo child .pack] { - pack unpack $i - } - pack append .pack .pack.violet {bottom frame e} .pack.red {right expand} - update - list [winfo geometry .pack.violet] [winfo geometry .pack.red] -} -result {80x20+20+80 10x20+45+30} - -# Need more bizarre tests with combinations of expanded windows and -# windows in opposing directions! Also, include padding in expanded -# (and unexpanded) windows. - -# Syntax errors on pack commands - -test oldpack-8.1 {syntax errors} -body { - pack -} -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"} -test oldpack-8.2 {syntax errors} -body { - pack append -} -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"} -test oldpack-8.3 {syntax errors} -body { - pack gorp foo -} -returnCodes error -result {bad option "gorp": must be configure, content, forget, info, or propagate} -test oldpack-8.4 {syntax errors} -body { - pack a .pack -} -returnCodes error -result {bad option "a": must be configure, content, forget, info, or propagate} -test oldpack-8.5 {syntax errors} -body { - pack after foobar -} -returnCodes error -result {bad window path name "foobar"} -test oldpack-8.6 {syntax errors} -setup { - destroy .pack.yellow -} -body { - frame .pack.yellow -bg yellow - pack after .pack.yellow -} -cleanup { - destroy .pack.yellow -} -returnCodes error -result {window ".pack.yellow" isn't packed} -test oldpack-8.7 {syntax errors} -body { - pack append foobar -} -returnCodes error -result {bad window path name "foobar"} -test oldpack-8.8 {syntax errors} -body { - pack before foobar -} -returnCodes error -result {bad window path name "foobar"} -test oldpack-8.9 {syntax errors} -setup { - destroy .pack.yellow -} -body { - frame .pack.yellow -bg yellow - pack before .pack.yellow -} -cleanup { - destroy .pack.yellow -} -returnCodes error -result {window ".pack.yellow" isn't packed} -test oldpack-8.10 {syntax errors} -body { - pack info .pack help -} -returnCodes error -result {wrong # args: should be "pack info window"} -test oldpack-8.11 {syntax errors} -body { - pack info foobar -} -returnCodes error -result {bad window path name "foobar"} -test oldpack-8.12 {syntax errors} -body { - pack append .pack .pack.blue -} -returnCodes error -result {wrong # args: window ".pack.blue" should be followed by options} -test oldpack-8.13 {syntax errors} -body { - pack append . .pack.blue top -} -returnCodes error -result {can't pack ".pack.blue" inside "."} -test oldpack-8.14 {syntax errors} -body { - pack append .pack .pack.blue f -} -returnCodes error -result {bad option "f": should be top, bottom, left, right, expand, fill, fillx, filly, padx, pady, or frame} -test oldpack-8.15 {syntax errors} -body { - pack append .pack .pack.blue pad -} -returnCodes error -result {bad option "pad": should be top, bottom, left, right, expand, fill, fillx, filly, padx, pady, or frame} -test oldpack-8.16 {syntax errors} -body { - pack append .pack .pack.blue {frame south} -} -returnCodes error -result {bad anchor "south": must be n, ne, e, se, s, sw, w, nw, or center} -test oldpack-8.17 {syntax errors} -body { - pack append .pack .pack.blue {padx -2} -} -returnCodes error -result {bad pad value "-2": must be positive screen distance} -test oldpack-8.18 {syntax errors} -body { - pack append .pack .pack.blue {padx} -} -returnCodes error -result {wrong # args: "padx" option must be followed by screen distance} -test oldpack-8.19 {syntax errors} -body { - pack append .pack .pack.blue {pady -2} -} -returnCodes error -result {bad pad value "-2": must be positive screen distance} -test oldpack-8.20 {syntax errors} -body { - pack append .pack .pack.blue {pady} -} -returnCodes error -result {wrong # args: "pady" option must be followed by screen distance} -test oldpack-8.21 {syntax errors} -body { - pack append .pack .pack.blue "\{abc" -} -returnCodes error -result {unmatched open brace in list} -test oldpack-8.22 {syntax errors} -body { - pack append .pack .pack.blue frame -} -returnCodes error -result {wrong # args: "frame" option must be followed by anchor point} - -# Test "pack info" command output. - -test oldpack-9.1 {information output} -body { - pack append .pack .pack.blue {top fillx frame n} \ - .pack.red {bottom filly frame s} .pack.green {left fill frame w} \ - .pack.violet {right expand frame e} - list [pack content .pack] [pack info .pack.blue] [pack info .pack.red] \ - [pack info .pack.green] [pack info .pack.violet] -} -result {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor n -expand 0 -fill x -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor s -expand 0 -fill y -ipadx 0 -ipady 0 -padx 0 -pady 0 -side bottom} {-in .pack -anchor w -expand 0 -fill both -ipadx 0 -ipady 0 -padx 0 -pady 0 -side left} {-in .pack -anchor e -expand 1 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side right}} -test oldpack-9.2 {information output} -body { - pack append .pack .pack.blue {padx 10 frame nw} \ - .pack.red {pady 20 frame ne} .pack.green {frame se} \ - .pack.violet {frame sw} - list [pack content .pack] [pack info .pack.blue] [pack info .pack.red] \ - [pack info .pack.green] [pack info .pack.violet] -} -result {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor nw -expand 0 -fill none -ipadx 0 -ipady 0 -padx 5 -pady 0 -side top} {-in .pack -anchor ne -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 10 -side top} {-in .pack -anchor se -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor sw -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top}} -test oldpack-9.3 {information output} -body { - pack append .pack .pack.blue {frame center} .pack.red {frame center} \ - .pack.green {frame c} .pack.violet {frame c} - list [pack content .pack] [pack info .pack.blue] [pack info .pack.red] \ - [pack info .pack.green] [pack info .pack.violet] -} -result {{.pack.blue .pack.red .pack.green .pack.violet} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top} {-in .pack -anchor center -expand 0 -fill none -ipadx 0 -ipady 0 -padx 0 -pady 0 -side top}} - -} -destroy .pack - -# cleanup -cleanupTests -return - |