Tk Source Code

Check-in [0d9c0d50]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix [Bug 1252702]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-4-branch
Files: files | file ages | folders
SHA1: 0d9c0d50f9e08497b916aa770edafc9c66780258
User & Date: dkf 2005-08-11 12:17:08
Context
2005-08-16
16:18
Backport of fix for Tk_ConfigSpec-related part of [Bug 749908] check-in: 8efe94d3 user: dkf tags: core-8-4-branch
2005-08-11
12:17
Fix [Bug 1252702] check-in: 0d9c0d50 user: dkf tags: core-8-4-branch
2005-08-09
07:41
typo check-in: 090c0cc9 user: das tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.










1
2
3
4
5
6
7









2005-08-09  Daniel Steffen  <[email protected]>

	* macosx/tkMacOSXCarbonEvents.c (new): moved carbon events code into
	* macosx/tkMacOSXHLEvents.c:           new file like on HEAD,
	* macosx/tkMacOSXInit.c (TkpInit):     initialize carbon event handlers
	* macosx/tkMacOSXInt.h:                in TkpInit(), add new source
	* unix/Makefile.in:                    file to Makefile.in.
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2005-08-11  Donal K. Fellows  <[email protected]>

	* generic/tkCanvLine.c, generic/tkCanvPoly.c, generic/tkCanvText.c: 
	* generic/tkCanvas.c, generic/tkConfig.c, generic/tkFocus.c: 
	* generic/tkFrame.c, generic/tkGrid.c, generic/tkImgPhoto.c: 
	* generic/tkPack.c, generic/tkPanedWindow.c: Don't pass size_t
	arguments to Tcl_GetStringFromObj, even with casting; it's not
	portable to 64-bit systems. [Bug 1252702]

2005-08-09  Daniel Steffen  <[email protected]>

	* macosx/tkMacOSXCarbonEvents.c (new): moved carbon events code into
	* macosx/tkMacOSXHLEvents.c:           new file like on HEAD,
	* macosx/tkMacOSXInit.c (TkpInit):     initialize carbon event handlers
	* macosx/tkMacOSXInt.h:                in TkpInit(), add new source
	* unix/Makefile.in:                    file to Makefile.in.

Changes to generic/tkCanvLine.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tkCanvLine.c --
 *
 *	This file implements line items for canvas widgets.
 *
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * 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.13 2003/02/09 07:48:22 hobbs Exp $
 */

#include <stdio.h>
#include "tkInt.h"
#include "tkPort.h"
#include "tkCanvas.h"













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tkCanvLine.c --
 *
 *	This file implements line items for canvas widgets.
 *
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * 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.13.2.1 2005/08/11 12:17:09 dkf Exp $
 */

#include <stdio.h>
#include "tkInt.h"
#include "tkPort.h"
#include "tkCanvas.h"

1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
    Tk_Item *itemPtr;		/* Item for which the index is being
				 * specified. */
    Tcl_Obj *obj;		/* Specification of a particular coord
				 * in itemPtr's line. */
    int *indexPtr;		/* Where to store converted index. */
{
    LineItem *linePtr = (LineItem *) itemPtr;
    size_t length;
    char *string = Tcl_GetStringFromObj(obj, (int *) &length);

    if (string[0] == 'e') {
	if (strncmp(string, "end", length) == 0) {
	    *indexPtr = 2*linePtr->numPoints;
	} else {
	    badIndex:

	    /*
	     * Some of the paths here leave messages in interp->result,
	     * so we have to clear it out before storing our own message.







|
|


|







1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
    Tk_Item *itemPtr;		/* Item for which the index is being
				 * specified. */
    Tcl_Obj *obj;		/* Specification of a particular coord
				 * in itemPtr's line. */
    int *indexPtr;		/* Where to store converted index. */
{
    LineItem *linePtr = (LineItem *) itemPtr;
    int length;
    char *string = Tcl_GetStringFromObj(obj, &length);

    if (string[0] == 'e') {
	if (strncmp(string, "end", (unsigned) length) == 0) {
	    *indexPtr = 2*linePtr->numPoints;
	} else {
	    badIndex:

	    /*
	     * Some of the paths here leave messages in interp->result,
	     * so we have to clear it out before storing our own message.

Changes to generic/tkCanvPoly.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tkCanvPoly.c --
 *
 *	This file implements polygon items for canvas widgets.
 *
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-2000 Ajuba Solutions.
 *
 * 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.10.2.1 2003/05/11 00:57:09 hobbs Exp $
 */

#include <stdio.h>
#include "tkInt.h"
#include "tkPort.h"
#include "tkCanvas.h"













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tkCanvPoly.c --
 *
 *	This file implements polygon items for canvas widgets.
 *
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-2000 Ajuba Solutions.
 *
 * 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.10.2.2 2005/08/11 12:17:09 dkf Exp $
 */

#include <stdio.h>
#include "tkInt.h"
#include "tkPort.h"
#include "tkCanvas.h"

1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
    Tk_Item *itemPtr;		/* Item for which the index is being
				 * specified. */
    Tcl_Obj *obj;		/* Specification of a particular coord
				 * in itemPtr's line. */
    int *indexPtr;		/* Where to store converted index. */
{
    PolygonItem *polyPtr = (PolygonItem *) itemPtr;
    size_t length;
    char *string = Tcl_GetStringFromObj(obj, (int *) &length);

    if (string[0] == 'e') {
	if (strncmp(string, "end", length) == 0) {
	    *indexPtr = 2*(polyPtr->numPoints - polyPtr->autoClosed);
	} else {
	    badIndex:

	    /*
	     * Some of the paths here leave messages in interp->result,
	     * so we have to clear it out before storing our own message.







|
|


|







1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
    Tk_Item *itemPtr;		/* Item for which the index is being
				 * specified. */
    Tcl_Obj *obj;		/* Specification of a particular coord
				 * in itemPtr's line. */
    int *indexPtr;		/* Where to store converted index. */
{
    PolygonItem *polyPtr = (PolygonItem *) itemPtr;
    int length;
    char *string = Tcl_GetStringFromObj(obj, &length);

    if (string[0] == 'e') {
	if (strncmp(string, "end", (unsigned) length) == 0) {
	    *indexPtr = 2*(polyPtr->numPoints - polyPtr->autoClosed);
	} else {
	    badIndex:

	    /*
	     * Some of the paths here leave messages in interp->result,
	     * so we have to clear it out before storing our own message.

Changes to generic/tkCanvText.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* 
 * tkCanvText.c --
 *
 *	This file implements text items for canvas widgets.
 *
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkCanvText.c,v 1.15.2.1 2004/06/08 20:44:11 mdejong Exp $
 */

#include <stdio.h>
#include "tkInt.h"
#include "tkCanvas.h"
#include "tkPort.h"
#include "default.h"











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* 
 * tkCanvText.c --
 *
 *	This file implements text items for canvas widgets.
 *
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkCanvText.c,v 1.15.2.2 2005/08/11 12:17:09 dkf Exp $
 */

#include <stdio.h>
#include "tkInt.h"
#include "tkCanvas.h"
#include "tkPort.h"
#include "default.h"
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
				 * specified. */
    Tcl_Obj *obj;		/* Specification of a particular character
				 * in itemPtr's text. */
    int *indexPtr;		/* Where to store converted character
				 * index. */
{
    TextItem *textPtr = (TextItem *) itemPtr;
    size_t length;
    int c;
    TkCanvas *canvasPtr = (TkCanvas *) canvas;
    Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
    char *string = Tcl_GetStringFromObj(obj, (int *) &length);

    c = string[0];
    length = strlen(string);

    if ((c == 'e') && (strncmp(string, "end", length) == 0)) {
	*indexPtr = textPtr->numChars;
    } else if ((c == 'i') && (strncmp(string, "insert", length) == 0)) {
	*indexPtr = textPtr->insertPos;
    } else if ((c == 's') && (strncmp(string, "sel.first", length) == 0)
	    && (length >= 5)) {
	if (textInfoPtr->selItemPtr != itemPtr) {
	    Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC);
	    return TCL_ERROR;
	}
	*indexPtr = textInfoPtr->selectFirst;
    } else if ((c == 's') && (strncmp(string, "sel.last", length) == 0)
	    && (length >= 5)) {
	if (textInfoPtr->selItemPtr != itemPtr) {
	    Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC);
	    return TCL_ERROR;
	}
	*indexPtr = textInfoPtr->selectLast;
    } else if (c == '@') {







|
<


|


<

|

|

|






|







1243
1244
1245
1246
1247
1248
1249
1250

1251
1252
1253
1254
1255

1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
				 * specified. */
    Tcl_Obj *obj;		/* Specification of a particular character
				 * in itemPtr's text. */
    int *indexPtr;		/* Where to store converted character
				 * index. */
{
    TextItem *textPtr = (TextItem *) itemPtr;
    int c, length;

    TkCanvas *canvasPtr = (TkCanvas *) canvas;
    Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
    char *string = Tcl_GetStringFromObj(obj, &length);

    c = string[0];


    if ((c == 'e') && (strncmp(string, "end", (unsigned) length) == 0)) {
	*indexPtr = textPtr->numChars;
    } else if ((c=='i') && (strncmp(string, "insert", (unsigned) length)==0)) {
	*indexPtr = textPtr->insertPos;
    } else if ((c=='s') && (strncmp(string, "sel.first", (unsigned) length)==0)
	    && (length >= 5)) {
	if (textInfoPtr->selItemPtr != itemPtr) {
	    Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC);
	    return TCL_ERROR;
	}
	*indexPtr = textInfoPtr->selectFirst;
    } else if ((c=='s') && (strncmp(string, "sel.last", (unsigned) length)==0)
	    && (length >= 5)) {
	if (textInfoPtr->selItemPtr != itemPtr) {
	    Tcl_SetResult(interp, "selection isn't in item", TCL_STATIC);
	    return TCL_ERROR;
	}
	*indexPtr = textInfoPtr->selectLast;
    } else if (c == '@') {

Changes to generic/tkCanvas.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkCanvas.c,v 1.21.2.2 2005/06/21 17:29:16 dgp Exp $
 */

/* #define USE_OLD_TAG_SEARCH 1 */

#include "default.h"
#include "tkInt.h"
#include "tkPort.h"







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-1999 by Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkCanvas.c,v 1.21.2.3 2005/08/11 12:17:09 dkf Exp $
 */

/* #define USE_OLD_TAG_SEARCH 1 */

#include "default.h"
#include "tkInt.h"
#include "tkPort.h"
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
    ClientData clientData;		/* Information about canvas
					 * widget. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int objc;				/* Number of arguments. */
    Tcl_Obj *CONST objv[];		/* Argument objects. */
{
    TkCanvas *canvasPtr = (TkCanvas *) clientData;
    unsigned int length;
    int c, result;
    Tk_Item *itemPtr = NULL;		/* Initialization needed only to
					 * prevent compiler warning. */
#ifdef USE_OLD_TAG_SEARCH
    TagSearch search;
#else /* USE_OLD_TAG_SEARCH */
    TagSearch *searchPtr = NULL;	/* Allocated by first TagSearchScan
					 * Freed by TagSearchDestroy */







<
|







517
518
519
520
521
522
523

524
525
526
527
528
529
530
531
    ClientData clientData;		/* Information about canvas
					 * widget. */
    Tcl_Interp *interp;			/* Current interpreter. */
    int objc;				/* Number of arguments. */
    Tcl_Obj *CONST objv[];		/* Argument objects. */
{
    TkCanvas *canvasPtr = (TkCanvas *) clientData;

    int c, length, result;
    Tk_Item *itemPtr = NULL;		/* Initialization needed only to
					 * prevent compiler warning. */
#ifdef USE_OLD_TAG_SEARCH
    TagSearch search;
#else /* USE_OLD_TAG_SEARCH */
    TagSearch *searchPtr = NULL;	/* Allocated by first TagSearchScan
					 * Freed by TagSearchDestroy */
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
	char *arg;

	if (objc < 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "type coords ?arg arg ...?");
	    result = TCL_ERROR;
	    goto done;
	}
	arg = Tcl_GetStringFromObj(objv[2], (int *) &length);
	c = arg[0];
	Tcl_MutexLock(&typeListMutex);
	for (typePtr = typeList; typePtr != NULL; typePtr = typePtr->nextPtr) {
	    if ((c == typePtr->name[0])
		    && (strncmp(arg, typePtr->name, length) == 0)) {
		if (matchPtr != NULL) {
		    Tcl_MutexUnlock(&typeListMutex);
		  badType:
		    Tcl_AppendResult(interp,
			    "unknown or ambiguous item type \"",
			    arg, "\"", (char *) NULL);
		    result = TCL_ERROR;







|




|







928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
	char *arg;

	if (objc < 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "type coords ?arg arg ...?");
	    result = TCL_ERROR;
	    goto done;
	}
	arg = Tcl_GetStringFromObj(objv[2], &length);
	c = arg[0];
	Tcl_MutexLock(&typeListMutex);
	for (typePtr = typeList; typePtr != NULL; typePtr = typePtr->nextPtr) {
	    if ((c == typePtr->name[0])
		    && (strncmp(arg, typePtr->name, (unsigned) length) == 0)) {
		if (matchPtr != NULL) {
		    Tcl_MutexUnlock(&typeListMutex);
		  badType:
		    Tcl_AppendResult(interp,
			    "unknown or ambiguous item type \"",
			    arg, "\"", (char *) NULL);
		    result = TCL_ERROR;
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
    register int i;
    CONST char **argv;
    if (argc <= 0) {
	return NULL;
    }
    argv = (CONST char **) ckalloc((argc+1) * sizeof(char *));
    for (i = 0; i < argc; i++) {
	argv[i]=Tcl_GetStringFromObj(objv[i], (int *) NULL);
    }
    argv[argc] = 0;
    return argv;
}

/*
 *--------------------------------------------------------------







|







5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
    register int i;
    CONST char **argv;
    if (argc <= 0) {
	return NULL;
    }
    argv = (CONST char **) ckalloc((argc+1) * sizeof(char *));
    for (i = 0; i < argc; i++) {
	argv[i] = Tcl_GetStringFromObj(objv[i], NULL);
    }
    argv[argc] = 0;
    return argv;
}

/*
 *--------------------------------------------------------------

Changes to generic/tkConfig.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* 
 * tkConfig.c --
 *
 *	This file contains procedures that manage configuration options
 *	for widgets and other things.
 *
 * Copyright (c) 1997-1998 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkConfig.c,v 1.18 2002/08/05 04:30:38 dgp Exp $
 */

/*
 * Temporary flag for working on new config package.
 */

#if 0











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* 
 * tkConfig.c --
 *
 *	This file contains procedures that manage configuration options
 *	for widgets and other things.
 *
 * Copyright (c) 1997-1998 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkConfig.c,v 1.18.2.1 2005/08/11 12:17:09 dkf Exp $
 */

/*
 * Temporary flag for working on new config package.
 */

#if 0
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
        }
    }

    /*
     * The answer isn't cached.
     */

    name = Tcl_GetStringFromObj(objPtr, (int *) NULL);
    bestPtr = GetOption(name, tablePtr);
    if (bestPtr == NULL) {
	goto error;
    }

    if ((objPtr->typePtr != NULL)
	    && (objPtr->typePtr->freeIntRepProc != NULL)) {







|







1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
        }
    }

    /*
     * The answer isn't cached.
     */

    name = Tcl_GetStringFromObj(objPtr, NULL);
    bestPtr = GetOption(name, tablePtr);
    if (bestPtr == NULL) {
	goto error;
    }

    if ((objPtr->typePtr != NULL)
	    && (objPtr->typePtr->freeIntRepProc != NULL)) {

Changes to generic/tkFocus.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tkFocus.c --
 *
 *	This file contains procedures that manage the input
 *	focus for Tk.
 *
 * Copyright (c) 1990-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkFocus.c,v 1.10 2002/10/08 19:57:59 hobbs Exp $
 */

#include "tkInt.h"
#include "tkPort.h"


/*












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tkFocus.c --
 *
 *	This file contains procedures that manage the input
 *	focus for Tk.
 *
 * Copyright (c) 1990-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkFocus.c,v 1.10.2.1 2005/08/11 12:17:09 dkf Exp $
 */

#include "tkInt.h"
#include "tkPort.h"


/*
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159

    /*
     * If invoked with a single argument beginning with "." then focus
     * on that window.
     */

    if (objc == 2) {
	windowName = Tcl_GetStringFromObj(objv[1], (int *) NULL);

	/*
	 * The empty string case exists for backwards compatibility.
	 */
	
	if (windowName[0] == '\0') {
	    return TCL_OK;







|







145
146
147
148
149
150
151
152
153
154
155
156
157
158
159

    /*
     * If invoked with a single argument beginning with "." then focus
     * on that window.
     */

    if (objc == 2) {
	windowName = Tcl_GetStringFromObj(objv[1], NULL);

	/*
	 * The empty string case exists for backwards compatibility.
	 */
	
	if (windowName[0] == '\0') {
	    return TCL_OK;
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
    }
    if (objc != 3) {
	Tcl_WrongNumArgs(interp, 2, objv, "window");
	return TCL_ERROR;
    }
    switch (index) {
        case 0: {        /* -displayof */
	    windowName = Tcl_GetStringFromObj(objv[2], (int *) NULL);
	    newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
	    if (newPtr == NULL) {
		return TCL_ERROR;
	    }
	    newPtr = TkGetFocusWin(newPtr);
	    if (newPtr != NULL) {
		Tcl_SetResult(interp, newPtr->pathName, TCL_STATIC);
	    }
	    break;
	}
        case 1: {        /* -force */
	    windowName = Tcl_GetStringFromObj(objv[2], (int *) NULL);

	    /*
	     * The empty string case exists for backwards compatibility.
	     */
	
	    if (windowName[0] == '\0') {
		return TCL_OK;
	    }
	    newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
	    if (newPtr == NULL) {
		return TCL_ERROR;
	    }
	    TkSetFocusWin(newPtr, 1);
	    break;
	}
        case 2: {        /* -lastfor */
	    windowName = Tcl_GetStringFromObj(objv[2], (int *) NULL);
	    newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
	    if (newPtr == NULL) {
		return TCL_ERROR;
	    }
	    for (topLevelPtr = newPtr; topLevelPtr != NULL;
		    topLevelPtr = topLevelPtr->parentPtr)  {
		if (topLevelPtr->flags & TK_TOP_HIERARCHY) {







|











|
















|







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
    }
    if (objc != 3) {
	Tcl_WrongNumArgs(interp, 2, objv, "window");
	return TCL_ERROR;
    }
    switch (index) {
        case 0: {        /* -displayof */
	    windowName = Tcl_GetStringFromObj(objv[2], NULL);
	    newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
	    if (newPtr == NULL) {
		return TCL_ERROR;
	    }
	    newPtr = TkGetFocusWin(newPtr);
	    if (newPtr != NULL) {
		Tcl_SetResult(interp, newPtr->pathName, TCL_STATIC);
	    }
	    break;
	}
        case 1: {        /* -force */
	    windowName = Tcl_GetStringFromObj(objv[2], NULL);

	    /*
	     * The empty string case exists for backwards compatibility.
	     */
	
	    if (windowName[0] == '\0') {
		return TCL_OK;
	    }
	    newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
	    if (newPtr == NULL) {
		return TCL_ERROR;
	    }
	    TkSetFocusWin(newPtr, 1);
	    break;
	}
        case 2: {        /* -lastfor */
	    windowName = Tcl_GetStringFromObj(objv[2], NULL);
	    newPtr = (TkWindow *) Tk_NameToWindow(interp, windowName, tkwin);
	    if (newPtr == NULL) {
		return TCL_ERROR;
	    }
	    for (topLevelPtr = newPtr; topLevelPtr != NULL;
		    topLevelPtr = topLevelPtr->parentPtr)  {
		if (topLevelPtr->flags & TK_TOP_HIERARCHY) {

Changes to generic/tkFrame.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * Copyright (c) 1990-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkFrame.c,v 1.15.2.2 2005/07/28 04:57:37 hobbs Exp $
 */

#include "default.h"
#include "tkPort.h"
#include "tkInt.h"

/*







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * Copyright (c) 1990-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkFrame.c,v 1.15.2.3 2005/08/11 12:17:09 dkf Exp $
 */

#include "default.h"
#include "tkPort.h"
#include "tkInt.h"

/*
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
				 * new application. */
{
    Tk_Window tkwin;
    Frame *framePtr;
    Tk_OptionTable optionTable;
    Tk_Window new;
    CONST char *className, *screenName, *visualName, *colormapName, *arg, *useOption;
    int i, c, depth;
    size_t length;
    unsigned int mask;
    Colormap colormap;
    Visual *visual;

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?");
	return TCL_ERROR;







|
<







481
482
483
484
485
486
487
488

489
490
491
492
493
494
495
				 * new application. */
{
    Tk_Window tkwin;
    Frame *framePtr;
    Tk_OptionTable optionTable;
    Tk_Window new;
    CONST char *className, *screenName, *visualName, *colormapName, *arg, *useOption;
    int i, c, depth, length;

    unsigned int mask;
    Colormap colormap;
    Visual *visual;

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?");
	return TCL_ERROR;
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
     * arguments need to be processed specially, before the window
     * is configured using the usual Tk mechanisms.
     */

    className = colormapName = screenName = visualName = useOption = NULL;
    colormap = None;
    for (i = 2; i < objc; i += 2) {
	arg = Tcl_GetStringFromObj(objv[i], (int *) &length);
	if (length < 2) {
	    continue;
	}
	c = arg[1];
	if ((c == 'c') && (strncmp(arg, "-class", length) == 0)
		&& (length >= 3)) {
	    className = Tcl_GetString(objv[i+1]);
	} else if ((c == 'c')
		&& (strncmp(arg, "-colormap", length) == 0)) {
	    colormapName = Tcl_GetString(objv[i+1]);
	} else if ((c == 's') && (type == TYPE_TOPLEVEL)
		&& (strncmp(arg, "-screen", length) == 0)) {
	    screenName = Tcl_GetString(objv[i+1]);
	} else if ((c == 'u') && (type == TYPE_TOPLEVEL)
		&& (strncmp(arg, "-use", length) == 0)) {
	    useOption = Tcl_GetString(objv[i+1]);
	} else if ((c == 'v')
		&& (strncmp(arg, "-visual", length) == 0)) {
	    visualName = Tcl_GetString(objv[i+1]);
	}
    }

    /*
     * Create the window, and deal with the special options -use,
     * -classname, -colormap, -screenname, and -visual.  These options







|




|



|


|


|


|







508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
     * arguments need to be processed specially, before the window
     * is configured using the usual Tk mechanisms.
     */

    className = colormapName = screenName = visualName = useOption = NULL;
    colormap = None;
    for (i = 2; i < objc; i += 2) {
	arg = Tcl_GetStringFromObj(objv[i], &length);
	if (length < 2) {
	    continue;
	}
	c = arg[1];
	if ((c == 'c') && (strncmp(arg, "-class", (unsigned) length) == 0)
		&& (length >= 3)) {
	    className = Tcl_GetString(objv[i+1]);
	} else if ((c == 'c')
		&& (strncmp(arg, "-colormap", (unsigned) length) == 0)) {
	    colormapName = Tcl_GetString(objv[i+1]);
	} else if ((c == 's') && (type == TYPE_TOPLEVEL)
		&& (strncmp(arg, "-screen", (unsigned) length) == 0)) {
	    screenName = Tcl_GetString(objv[i+1]);
	} else if ((c == 'u') && (type == TYPE_TOPLEVEL)
		&& (strncmp(arg, "-use", (unsigned) length) == 0)) {
	    useOption = Tcl_GetString(objv[i+1]);
	} else if ((c == 'v')
		&& (strncmp(arg, "-visual", (unsigned) length) == 0)) {
	    visualName = Tcl_GetString(objv[i+1]);
	}
    }

    /*
     * Create the window, and deal with the special options -use,
     * -classname, -colormap, -screenname, and -visual.  These options
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
	"cget", "configure", (char *) NULL
    };
    enum options {
	FRAME_CGET, FRAME_CONFIGURE
    };
    register Frame *framePtr = (Frame *) clientData;
    int result = TCL_OK, index;
    size_t length;
    int c, i;
    Tcl_Obj *objPtr;

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
	return TCL_ERROR;
    }
    if (Tcl_GetIndexFromObj(interp, objv[1], frameOptions, "option", 0,







<
|







730
731
732
733
734
735
736

737
738
739
740
741
742
743
744
	"cget", "configure", (char *) NULL
    };
    enum options {
	FRAME_CGET, FRAME_CONFIGURE
    };
    register Frame *framePtr = (Frame *) clientData;
    int result = TCL_OK, index;

    int c, i, length;
    Tcl_Obj *objPtr;

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
	return TCL_ERROR;
    }
    if (Tcl_GetIndexFromObj(interp, objv[1], frameOptions, "option", 0,
780
781
782
783
784
785
786
787
788
789
790
791
792

793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
	} else {
	    /*
	     * Don't allow the options -class, -colormap, -container,
	     * -newcmap, -screen, -use, or -visual to be changed.
	     */

	    for (i = 2; i < objc; i++) {
		char *arg = Tcl_GetStringFromObj(objv[i], (int *) &length);
		if (length < 2) {
		    continue;
		}
		c = arg[1];
		if (((c == 'c') && (strncmp(arg, "-class", length) == 0)

			&& (length >= 2))
			|| ((c == 'c')
			&& (strncmp(arg, "-colormap", length) == 0)
			&& (length >= 3))
			|| ((c == 'c')
			&& (strncmp(arg, "-container", length) == 0)
			&& (length >= 3))
			|| ((c == 's') && (framePtr->type == TYPE_TOPLEVEL)
			&& (strncmp(arg, "-screen", length) == 0))
			|| ((c == 'u') && (framePtr->type == TYPE_TOPLEVEL)
			&& (strncmp(arg, "-use", length) == 0))
			|| ((c == 'v')
			&& (strncmp(arg, "-visual", length) == 0))) {
		    Tcl_AppendResult(interp, "can't modify ", arg,
			    " option after widget is created", (char *) NULL);
		    result = TCL_ERROR;
		    goto done;
		}
	    }
	    result = ConfigureFrame(interp, framePtr, objc-2, objv+2);







|




|
>


|


|


|

|

|







778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
	} else {
	    /*
	     * Don't allow the options -class, -colormap, -container,
	     * -newcmap, -screen, -use, or -visual to be changed.
	     */

	    for (i = 2; i < objc; i++) {
		char *arg = Tcl_GetStringFromObj(objv[i], &length);
		if (length < 2) {
		    continue;
		}
		c = arg[1];
		if (((c == 'c')
			&& (strncmp(arg, "-class", (unsigned) length) == 0)
			&& (length >= 2))
			|| ((c == 'c')
			&& (strncmp(arg, "-colormap", (unsigned) length) == 0)
			&& (length >= 3))
			|| ((c == 'c')
			&& (strncmp(arg, "-container", (unsigned) length) == 0)
			&& (length >= 3))
			|| ((c == 's') && (framePtr->type == TYPE_TOPLEVEL)
			&& (strncmp(arg, "-screen", (unsigned) length) == 0))
			|| ((c == 'u') && (framePtr->type == TYPE_TOPLEVEL)
			&& (strncmp(arg, "-use", (unsigned) length) == 0))
			|| ((c == 'v')
			&& (strncmp(arg, "-visual", (unsigned) length) ==0))) {
		    Tcl_AppendResult(interp, "can't modify ", arg,
			    " option after widget is created", (char *) NULL);
		    result = TCL_ERROR;
		    goto done;
		}
	    }
	    result = ConfigureFrame(interp, framePtr, objc-2, objv+2);

Changes to generic/tkGrid.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * tkGrid.c --
 *
 *	Grid based geometry manager.
 *
 * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkGrid.c,v 1.25.2.2 2005/01/11 10:46:39 dkf Exp $
 */

#include "tkInt.h"

/*
 * Convenience Macros
 */










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * tkGrid.c --
 *
 *	Grid based geometry manager.
 *
 * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkGrid.c,v 1.25.2.3 2005/08/11 12:17:09 dkf Exp $
 */

#include "tkInt.h"

/*
 * Convenience Macros
 */
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
    /*
     * Count the number of windows, or window short-cuts.
     */

    firstChar = 0;
    for (numWindows = i = 0; i < objc; i++) {
	prevChar = firstChar;
	string = Tcl_GetStringFromObj(objv[i], (int *) &length);
    	firstChar = string[0];
	
	if (firstChar == '.') {
	    numWindows++;
	    continue;
    	}
	if (length > 1 && i == 0) {







|







2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
    /*
     * Count the number of windows, or window short-cuts.
     */

    firstChar = 0;
    for (numWindows = i = 0; i < objc; i++) {
	prevChar = firstChar;
	string = Tcl_GetStringFromObj(objv[i], &length);
    	firstChar = string[0];
	
	if (firstChar == '.') {
	    numWindows++;
	    continue;
    	}
	if (length > 1 && i == 0) {

Changes to generic/tkImgPhoto.c.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * Author: Paul Mackerras ([email protected]),
 *	   Department of Computer Science,
 *	   Australian National University.
 *
 * RCS: @(#) $Id: tkImgPhoto.c,v 1.36.2.13 2004/12/09 10:05:38 dkf Exp $
 */

#include "tkInt.h"
#include "tkPort.h"
#include "tclMath.h"
#include <ctype.h>








|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * Author: Paul Mackerras ([email protected]),
 *	   Department of Computer Science,
 *	   Australian National University.
 *
 * RCS: @(#) $Id: tkImgPhoto.c,v 1.36.2.14 2005/08/11 12:17:09 dkf Exp $
 */

#include "tkInt.h"
#include "tkPort.h"
#include "tclMath.h"
#include <ctype.h>

670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
    CONST char **srcArgv;
    unsigned char *pixelPtr;
    Tk_PhotoImageBlock block;
    Tk_Window tkwin;
    XColor color;
    Tk_PhotoImageFormat *imageFormat;
    int imageWidth, imageHeight;
    int matched;
    Tcl_Channel chan;
    Tk_PhotoHandle srcHandle;
    size_t length;
    ThreadSpecificData *tsdPtr = (ThreadSpecificData *) 
            Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
	return TCL_ERROR;
    }







|


<







670
671
672
673
674
675
676
677
678
679

680
681
682
683
684
685
686
    CONST char **srcArgv;
    unsigned char *pixelPtr;
    Tk_PhotoImageBlock block;
    Tk_Window tkwin;
    XColor color;
    Tk_PhotoImageFormat *imageFormat;
    int imageWidth, imageHeight;
    int length, matched;
    Tcl_Channel chan;
    Tk_PhotoHandle srcHandle;

    ThreadSpecificData *tsdPtr = (ThreadSpecificData *) 
            Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg ...?");
	return TCL_ERROR;
    }
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
    case PHOTO_CGET: {
	char *arg;

	if (objc != 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "option");
	    return TCL_ERROR;
	}
	arg = Tcl_GetStringFromObj(objv[2], (int *) &length);
	if (strncmp(arg,"-data", length) == 0) {
	    if (masterPtr->dataString) {
		Tcl_SetObjResult(interp, masterPtr->dataString);
	    }
	} else if (strncmp(arg,"-format", length) == 0) {
	    if (masterPtr->format) {
		Tcl_SetObjResult(interp, masterPtr->format);
	    }
	} else {
	    Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
		    (char *) masterPtr, Tcl_GetString(objv[2]), 0);
	}







|
|



|







712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
    case PHOTO_CGET: {
	char *arg;

	if (objc != 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "option");
	    return TCL_ERROR;
	}
	arg = Tcl_GetStringFromObj(objv[2], &length);
	if (strncmp(arg,"-data", (unsigned) length) == 0) {
	    if (masterPtr->dataString) {
		Tcl_SetObjResult(interp, masterPtr->dataString);
	    }
	} else if (strncmp(arg,"-format", (unsigned) length) == 0) {
	    if (masterPtr->format) {
		Tcl_SetObjResult(interp, masterPtr->format);
	    }
	} else {
	    Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
		    (char *) masterPtr, Tcl_GetString(objv[2]), 0);
	}
761
762
763
764
765
766
767
768

769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
	    }
	    Tcl_ListObjAppendElement(interp, obj, subobj);
	    Tcl_ListObjAppendList(interp, obj, Tcl_GetObjResult(interp));
	    Tcl_SetObjResult(interp, obj);
	    return TCL_OK;
	}
	if (objc == 3) {
	    char *arg = Tcl_GetStringFromObj(objv[2], (int *) &length);

	    if (!strncmp(arg, "-data", length)) {
		Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
			"-data {} {} {}", (char *) NULL);
		if (masterPtr->dataString) {
		    Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp),
			    masterPtr->dataString);
		} else {
		    Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
			    " {}", (char *) NULL);
		}
		return TCL_OK;
	    } else if (!strncmp(arg, "-format", length)) {
		Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
			"-format {} {} {}", (char *) NULL);
		if (masterPtr->format) {
		    Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp),
			    masterPtr->format);
		} else {
		    Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),







|
>
|










|







760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
	    }
	    Tcl_ListObjAppendElement(interp, obj, subobj);
	    Tcl_ListObjAppendList(interp, obj, Tcl_GetObjResult(interp));
	    Tcl_SetObjResult(interp, obj);
	    return TCL_OK;
	}
	if (objc == 3) {
	    char *arg = Tcl_GetStringFromObj(objv[2], &length);

	    if (!strncmp(arg, "-data", (unsigned) length)) {
		Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
			"-data {} {} {}", (char *) NULL);
		if (masterPtr->dataString) {
		    Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp),
			    masterPtr->dataString);
		} else {
		    Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
			    " {}", (char *) NULL);
		}
		return TCL_OK;
	    } else if (!strncmp(arg, "-format", (unsigned) length)) {
		Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
			"-format {} {} {}", (char *) NULL);
		if (masterPtr->format) {
		    Tcl_ListObjAppendElement(interp, Tcl_GetObjResult(interp),
			    masterPtr->format);
		} else {
		    Tcl_AppendStringsToObj(Tcl_GetObjResult(interp),
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837

5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
} OptionAssocData;

static Tcl_ObjCmdProc *
PhotoOptionFind(interp, obj)
    Tcl_Interp *interp;		/* Interpreter that is being deleted. */
    Tcl_Obj *obj;			/* Name of option to be found. */
{
    size_t length;
    char *name = Tcl_GetStringFromObj(obj, (int *) &length);
    OptionAssocData *list;
    char *prevname = NULL;
    Tcl_ObjCmdProc *proc = (Tcl_ObjCmdProc *) NULL;

    list = (OptionAssocData *) Tcl_GetAssocData(interp, "photoOption",
	    (Tcl_InterpDeleteProc **) NULL);
    while (list != (OptionAssocData *) NULL) {
	if (strncmp(name, list->name, length) == 0) {
	    if (proc != (Tcl_ObjCmdProc *) NULL) {
		Tcl_ResetResult(interp);
		Tcl_AppendResult(interp, "ambiguous option \"", name,
			"\": must be ", prevname, (char *) NULL);
		while (list->nextPtr != (OptionAssocData *) NULL) {
		    Tcl_AppendResult(interp, prevname, ", ",(char *) NULL);
		    list = list->nextPtr;







|
|



>



|







5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
} OptionAssocData;

static Tcl_ObjCmdProc *
PhotoOptionFind(interp, obj)
    Tcl_Interp *interp;		/* Interpreter that is being deleted. */
    Tcl_Obj *obj;			/* Name of option to be found. */
{
    int length;
    char *name = Tcl_GetStringFromObj(obj, &length);
    OptionAssocData *list;
    char *prevname = NULL;
    Tcl_ObjCmdProc *proc = (Tcl_ObjCmdProc *) NULL;

    list = (OptionAssocData *) Tcl_GetAssocData(interp, "photoOption",
	    (Tcl_InterpDeleteProc **) NULL);
    while (list != (OptionAssocData *) NULL) {
	if (strncmp(name, list->name, (unsigned) length) == 0) {
	    if (proc != (Tcl_ObjCmdProc *) NULL) {
		Tcl_ResetResult(interp);
		Tcl_AppendResult(interp, "ambiguous option \"", name,
			"\": must be ", prevname, (char *) NULL);
		while (list->nextPtr != (OptionAssocData *) NULL) {
		    Tcl_AppendResult(interp, prevname, ", ",(char *) NULL);
		    list = list->nextPtr;

Changes to generic/tkPack.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tkPack.c --
 *
 *	This file contains code to implement the "packer"
 *	geometry manager for Tk.
 *
 * Copyright (c) 1990-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkPack.c,v 1.16.2.2 2005/01/11 10:46:39 dkf Exp $
 */

#include "tkPort.h"
#include "tkInt.h"

typedef enum {TOP, BOTTOM, LEFT, RIGHT} Side;
static CONST char *sideNames[] = {












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* 
 * tkPack.c --
 *
 *	This file contains code to implement the "packer"
 *	geometry manager for Tk.
 *
 * Copyright (c) 1990-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkPack.c,v 1.16.2.3 2005/08/11 12:17:09 dkf Exp $
 */

#include "tkPort.h"
#include "tkInt.h"

typedef enum {TOP, BOTTOM, LEFT, RIGHT} Side;
static CONST char *sideNames[] = {
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
	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];
	    char *curOpt = Tcl_GetStringFromObj(curOptPtr, (int *) &length);

	    c = curOpt[0];

	    if ((c == 't')
		    && (strncmp(curOpt, "top", (size_t) length)) == 0) {
		packPtr->side = TOP;
	    } else if ((c == 'b')
		    && (strncmp(curOpt, "bottom", (size_t) length)) == 0) {
		packPtr->side = BOTTOM;
	    } else if ((c == 'l')
		    && (strncmp(curOpt, "left", (size_t) length)) == 0) {
		packPtr->side = LEFT;
	    } else if ((c == 'r')
		    && (strncmp(curOpt, "right", (size_t) length)) == 0) {
		packPtr->side = RIGHT;
	    } else if ((c == 'e')
		    && (strncmp(curOpt, "expand", (size_t) 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) {







|




|


|


|


|


|







1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
	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];
	    char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length);

	    c = curOpt[0];

	    if ((c == 't')
		    && (strncmp(curOpt, "top", (unsigned) length)) == 0) {
		packPtr->side = TOP;
	    } else if ((c == 'b')
		    && (strncmp(curOpt, "bottom", (unsigned) length)) == 0) {
		packPtr->side = BOTTOM;
	    } else if ((c == 'l')
		    && (strncmp(curOpt, "left", (unsigned) length)) == 0) {
		packPtr->side = LEFT;
	    } else if ((c == 'r')
		    && (strncmp(curOpt, "right", (unsigned) length)) == 0) {
		packPtr->side = RIGHT;
	    } else if ((c == 'e')
		    && (strncmp(curOpt, "expand", (unsigned) 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) {
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
		    return TCL_ERROR;
		}
		packPtr->padY /= 2;
		packPtr->padTop /= 2;
		packPtr->iPadY = 0;
		index++;
	    } else if ((c == 'f') && (length > 1)
		    && (strncmp(curOpt, "frame", (size_t) length) == 0)) {
		if (optionCount < (index+2)) {
		    Tcl_AppendResult(interp, "wrong # args: \"frame\" ",
			    "option must be followed by anchor point",
			    (char *) NULL);
		    return TCL_ERROR;
		}
		if (Tk_GetAnchorFromObj(interp, options[index+1],







|







1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
		    return TCL_ERROR;
		}
		packPtr->padY /= 2;
		packPtr->padTop /= 2;
		packPtr->iPadY = 0;
		index++;
	    } else if ((c == 'f') && (length > 1)
		    && (strncmp(curOpt, "frame", (unsigned) length) == 0)) {
		if (optionCount < (index+2)) {
		    Tcl_AppendResult(interp, "wrong # args: \"frame\" ",
			    "option must be followed by anchor point",
			    (char *) NULL);
		    return TCL_ERROR;
		}
		if (Tk_GetAnchorFromObj(interp, options[index+1],

Changes to generic/tkPanedWindow.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * Copyright (c) 1997 Sun Microsystems, Inc.
 * Copyright (c) 2000 Ajuba Solutions.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkPanedWindow.c,v 1.13.2.8 2005/05/31 05:22:06 hobbs Exp $
 */

#include "tkPort.h"
#include "default.h"
#include "tkInt.h"

/* Flag values for "sticky"ness  The 16 combinations subsume the packer's







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *
 * Copyright (c) 1997 Sun Microsystems, Inc.
 * Copyright (c) 2000 Ajuba Solutions.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tkPanedWindow.c,v 1.13.2.9 2005/08/11 12:17:09 dkf Exp $
 */

#include "tkPort.h"
#include "default.h"
#include "tkInt.h"

/* Flag values for "sticky"ness  The 16 combinations subsume the packer's
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?");
	return TCL_ERROR;
    }

    tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), 
	    Tcl_GetStringFromObj(objv[1], NULL), (char *) NULL);
    if (tkwin == NULL) {
	return TCL_ERROR;
    }

    pwOpts = (OptionTables *)
	Tcl_GetAssocData(interp, "PanedWindowOptionTables", NULL);
    if (pwOpts == NULL) {







|







345
346
347
348
349
350
351
352
353
354
355
356
357
358
359

    if (objc < 2) {
	Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?");
	return TCL_ERROR;
    }

    tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp), 
	    Tcl_GetStringFromObj(objv[1], NULL), NULL);
    if (tkwin == NULL) {
	return TCL_ERROR;
    }

    pwOpts = (OptionTables *)
	Tcl_GetAssocData(interp, "PanedWindowOptionTables", NULL);
    if (pwOpts == NULL) {