diff options
Diffstat (limited to 'generic/tkGrid.c')
-rw-r--r-- | generic/tkGrid.c | 215 |
1 files changed, 120 insertions, 95 deletions
diff --git a/generic/tkGrid.c b/generic/tkGrid.c index b58acdc..50068b5 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -3,7 +3,7 @@ * * Grid based geometry manager. * - * Copyright (c) 1996-1997 Sun Microsystems, Inc. + * Copyright © 1996-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. @@ -255,45 +255,45 @@ typedef struct UniformGroup { static void AdjustForSticky(Gridder *contentPtr, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); -static int AdjustOffsets(int width, int elements, +static int AdjustOffsets(int width, Tcl_Size elements, SlotInfo *slotPtr); -static void ArrangeGrid(ClientData clientData); -static int CheckSlotData(Gridder *containerPtr, int slot, +static void ArrangeGrid(void *clientData); +static int CheckSlotData(Gridder *containerPtr, Tcl_Size slot, int slotType, int checkOnly); static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static Tcl_FreeProc DestroyGrid; static Gridder * GetGrid(Tk_Window tkwin); static int GridAnchorCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static int GridBboxCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static int GridForgetRemoveCommand(Tk_Window tkwin, - Tcl_Interp *interp, int objc, + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridInfoCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static int GridLocationCommand(Tk_Window tkwin, - Tcl_Interp *interp, int objc, + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridPropagateCommand(Tk_Window tkwin, - Tcl_Interp *interp, int objc, + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridRowColumnConfigureCommand(Tk_Window tkwin, - Tcl_Interp *interp, int objc, + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); static int GridSizeCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); static int GridContentCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); -static void GridStructureProc(ClientData clientData, + Tcl_Size objc, Tcl_Obj *const objv[]); +static void GridStructureProc(void *clientData, XEvent *eventPtr); -static void GridLostContentProc(ClientData clientData, +static void GridLostContentProc(void *clientData, Tk_Window tkwin); -static void GridReqProc(ClientData clientData, Tk_Window tkwin); +static void GridReqProc(void *clientData, Tk_Window tkwin); static void InitContainerData(Gridder *containerPtr); -static Tcl_Obj * NewPairObj(int, int); -static Tcl_Obj * NewQuadObj(int, int, int, int); +static Tcl_Obj * NewPairObj(Tcl_WideInt, Tcl_WideInt); +static Tcl_Obj * NewQuadObj(Tcl_WideInt, Tcl_WideInt, Tcl_WideInt, Tcl_WideInt); static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn, int maxOffset); static void SetGridSize(Gridder *gridPtr); @@ -308,7 +308,7 @@ static void Unlink(Gridder *gridPtr); static const Tk_GeomMgr gridMgrType = { "grid", /* name */ GridReqProc, /* requestProc */ - GridLostContentProc, /* lostSlaveProc */ + GridLostContentProc, /* lostContentProc */ }; /* @@ -330,7 +330,7 @@ static const Tk_GeomMgr gridMgrType = { int Tk_GridObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -341,6 +341,11 @@ Tk_GridObjCmd( "content", "forget", "info", "location", "propagate", "remove", "rowconfigure", "size", "slaves", NULL }; + static const char *const optionStringsNoDep[] = { + "anchor", "bbox", "columnconfigure", "configure", + "content", "forget", "info", "location", "propagate", + "remove", "rowconfigure", "size", NULL + }; enum options { GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE, GRID_CONTENT, GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, @@ -361,8 +366,16 @@ Tk_GridObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + if (Tcl_GetIndexFromObjStruct(NULL, objv[1], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { + /* + * Call it again without the deprecated ones to get a proper error + * message. This works well since there can't be any ambiguity between + * deprecated and new options. + */ + + Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep, + sizeof(char *), "option", 0, &index); return TCL_ERROR; } @@ -403,7 +416,7 @@ Tk_GridObjCmd( } /* This should not happen */ - Tcl_SetObjResult(interp, Tcl_NewStringObj("internal error in grid", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("internal error in grid", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "API_ABUSE", NULL); return TCL_ERROR; } @@ -429,7 +442,7 @@ static int GridAnchorCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -498,7 +511,7 @@ static int GridBboxCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -511,7 +524,7 @@ GridBboxCommand( int width, height; /* size of the bounding box */ if (objc!=3 && objc != 5 && objc != 7) { - Tcl_WrongNumArgs(interp, 2, objv, "master ?column row ?column row??"); + Tcl_WrongNumArgs(interp, 2, objv, "window ?column row ?column row??"); return TCL_ERROR; } @@ -628,12 +641,12 @@ static int GridForgetRemoveCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window content; Gridder *contentPtr; - int i; + Tcl_Size i; const char *string = Tcl_GetString(objv[1]); char c = string[0]; @@ -681,7 +694,7 @@ GridForgetRemoveCommand( } if (contentPtr->containerPtr != NULL) { contentPtr->in = Tcl_NewStringObj( - Tk_PathName(contentPtr->containerPtr->tkwin), -1); + Tk_PathName(contentPtr->containerPtr->tkwin), TCL_INDEX_NONE); Tcl_IncrRefCount(contentPtr->in); } } @@ -718,7 +731,7 @@ static int GridInfoCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Gridder *contentPtr; @@ -739,21 +752,21 @@ GridInfoCommand( } infoObj = Tcl_NewObj(); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), - TkNewWindowObj(contentPtr->containerPtr->tkwin)); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1), - Tcl_NewIntObj(contentPtr->column)); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1), - Tcl_NewIntObj(contentPtr->row)); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", -1), - Tcl_NewIntObj(contentPtr->numCols)); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", -1), - Tcl_NewIntObj(contentPtr->numRows)); + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", TCL_INDEX_NONE), + Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", TCL_INDEX_NONE), + Tcl_NewWideIntObj(contentPtr->column)); + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", TCL_INDEX_NONE), + Tcl_NewWideIntObj(contentPtr->row)); + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", TCL_INDEX_NONE), + Tcl_NewWideIntObj(contentPtr->numCols)); + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", TCL_INDEX_NONE), + Tcl_NewWideIntObj(contentPtr->numRows)); TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX); TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY); TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft, contentPtr->padX); TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-sticky", -1), + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-sticky", TCL_INDEX_NONE), StickyToObj(contentPtr->sticky)); Tcl_SetObjResult(interp, infoObj); return TCL_OK; @@ -780,7 +793,7 @@ static int GridLocationCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -792,7 +805,7 @@ GridLocationCommand( int endX, endY; /* End of grid. */ if (objc != 5) { - Tcl_WrongNumArgs(interp, 2, objv, "master x y"); + Tcl_WrongNumArgs(interp, 2, objv, "window x y"); return TCL_ERROR; } @@ -809,7 +822,7 @@ GridLocationCommand( containerPtr = GetGrid(container); if (containerPtr->containerDataPtr == NULL) { - Tcl_SetObjResult(interp, NewPairObj(-1, -1)); + Tcl_SetObjResult(interp, NewPairObj(-1, TCL_INDEX_NONE)); return TCL_OK; } gridPtr = containerPtr->containerDataPtr; @@ -873,7 +886,7 @@ static int GridPropagateCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -961,7 +974,7 @@ static int GridRowColumnConfigureCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container, content; @@ -970,10 +983,10 @@ GridRowColumnConfigureCommand( int slot; /* the column or row number */ int slotType; /* COLUMN or ROW */ int size; /* the configuration value */ - int lObjc; /* Number of items in index list */ + Tcl_Size lObjc; /* Number of items in index list */ Tcl_Obj **lObjv; /* array of indices */ int ok; /* temporary TCL result code */ - int i, j, first, last; + Tcl_Size i, j, first, last; const char *string; static const char *const optionStrings[] = { "-minsize", "-pad", "-uniform", "-weight", NULL @@ -985,7 +998,7 @@ GridRowColumnConfigureCommand( Tcl_Obj *listCopy; if (((objc % 2 != 0) && (objc > 6)) || (objc < 4)) { - Tcl_WrongNumArgs(interp, 2, objv, "master index ?-option value ...?"); + Tcl_WrongNumArgs(interp, 2, objv, "window index ?-option value ...?"); return TCL_ERROR; } @@ -1017,7 +1030,7 @@ GridRowColumnConfigureCommand( if ((objc == 4) || (objc == 5)) { if (lObjc != 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "must specify a single element on retrieval", -1)); + "must specify a single element on retrieval", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "USAGE", NULL); Tcl_DecrRefCount(listCopy); return TCL_ERROR; @@ -1055,18 +1068,18 @@ GridRowColumnConfigureCommand( } Tcl_ListObjAppendElement(interp, res, - Tcl_NewStringObj("-minsize", -1)); - Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(minsize)); + Tcl_NewStringObj("-minsize", TCL_INDEX_NONE)); + Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(minsize)); Tcl_ListObjAppendElement(interp, res, - Tcl_NewStringObj("-pad", -1)); - Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(pad)); + Tcl_NewStringObj("-pad", TCL_INDEX_NONE)); + Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(pad)); Tcl_ListObjAppendElement(interp, res, - Tcl_NewStringObj("-uniform", -1)); + Tcl_NewStringObj("-uniform", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, - Tcl_NewStringObj(uniform == NULL ? "" : uniform, -1)); + Tcl_NewStringObj(uniform == NULL ? "" : uniform, TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, - Tcl_NewStringObj("-weight", -1)); - Tcl_ListObjAppendElement(interp, res, Tcl_NewIntObj(weight)); + Tcl_NewStringObj("-weight", TCL_INDEX_NONE)); + Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(weight)); Tcl_SetObjResult(interp, res); Tcl_DecrRefCount(listCopy); return TCL_OK; @@ -1083,18 +1096,18 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } if (index == ROWCOL_MINSIZE) { - Tcl_SetObjResult(interp, Tcl_NewIntObj( + Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].minSize : 0)); } else if (index == ROWCOL_WEIGHT) { - Tcl_SetObjResult(interp, Tcl_NewIntObj( + Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].weight : 0)); } else if (index == ROWCOL_UNIFORM) { Tk_Uid value = (ok == TCL_OK) ? slotPtr[slot].uniform : ""; Tcl_SetObjResult(interp, Tcl_NewStringObj( - (value == NULL) ? "" : value, -1)); + (value == NULL) ? "" : value, TCL_INDEX_NONE)); } else if (index == ROWCOL_PAD) { - Tcl_SetObjResult(interp, Tcl_NewIntObj( + Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].pad : 0)); } Tcl_DecrRefCount(listCopy); @@ -1131,7 +1144,7 @@ GridRowColumnConfigureCommand( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the window \"%s\" is not managed by \"%s\"", Tcl_GetString(lObjv[j]), Tcl_GetString(objv[2]))); - Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MASTER", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MANAGED", NULL); Tcl_DecrRefCount(listCopy); return TCL_ERROR; } @@ -1294,7 +1307,7 @@ static int GridSizeCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -1345,7 +1358,7 @@ static int GridContentCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container; @@ -1401,7 +1414,7 @@ GridContentCommand( contentPtr->row+contentPtr->numRows-1 < row)) { continue; } - Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(contentPtr->tkwin)); + Tcl_ListObjAppendElement(interp,res, Tk_NewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, res); return TCL_OK; @@ -1427,7 +1440,7 @@ GridContentCommand( static void GridReqProc( - ClientData clientData, /* Grid's information about window that got + void *clientData, /* Grid's information about window that got * new preferred geometry. */ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ @@ -1460,7 +1473,7 @@ GridReqProc( static void GridLostContentProc( - ClientData clientData, /* Grid structure for content window that was + void *clientData, /* Grid structure for content window that was * stolen away. */ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */ { @@ -1496,10 +1509,10 @@ GridLostContentProc( static int AdjustOffsets( int size, /* The total layout size (in pixels). */ - int slots, /* Number of slots. */ + Tcl_Size slots, /* Number of slots. */ SlotInfo *slotPtr) /* Pointer to slot array. */ { - int slot; /* Current slot. */ + Tcl_Size slot; /* Current slot. */ int diff; /* Extra pixels needed to add to the layout. */ int totalWeight; /* Sum of the weights for all the slots. */ int weight; /* Sum of the weights so far. */ @@ -1719,7 +1732,7 @@ AdjustForSticky( static void ArrangeGrid( - ClientData clientData) /* Structure describing container whose content + void *clientData) /* Structure describing container whose content * are to be re-layed out. */ { Gridder *containerPtr = (Gridder *)clientData; @@ -2581,7 +2594,7 @@ SetContentRow( lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows; if (lastRow >= MAX_ELEMENT) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("row out of bounds", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("row out of bounds", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_ROW", NULL); return TCL_ERROR; } @@ -2614,11 +2627,11 @@ SetContentRow( static int CheckSlotData( Gridder *containerPtr, /* The geometry container for this grid. */ - int slot, /* Which slot to look at. */ + Tcl_Size slot, /* Which slot to look at. */ int slotType, /* ROW or COLUMN. */ int checkOnly) /* Don't allocate new space if true. */ { - int numSlot; /* Number of slots already allocated (Space) */ + Tcl_Size numSlot; /* Number of slots already allocated (Space) */ int end; /* Last used constraint. */ /* @@ -2777,11 +2790,15 @@ Unlink( /* * If we have emptied this container from content it means we are no longer * handling it and should mark it as free. + * + * Send the event "NoManagedChild" to the container to inform it about there + * being no managed children inside it. */ if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { TkFreeGeometryContainer(containerPtr->tkwin, "grid"); containerPtr->flags &= ~ALLOCED_CONTAINER; + Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL); } } @@ -2807,7 +2824,11 @@ Unlink( static void DestroyGrid( - char *memPtr) /* Info about window that is now dead. */ +#if TCL_MAJOR_VERSION > 8 + void *memPtr) /* Info about window that is now dead. */ +#else + char *memPtr) +#endif { Gridder *gridPtr = (Gridder *)memPtr; @@ -2849,7 +2870,7 @@ DestroyGrid( static void GridStructureProc( - ClientData clientData, /* Our information about window referred to by + void *clientData, /* Our information about window referred to by * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { @@ -2885,7 +2906,7 @@ GridStructureProc( contentPtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable, - (char *)gridPtr->tkwin)); + gridPtr->tkwin)); if (gridPtr->flags & REQUESTED_RELAYOUT) { Tcl_CancelIdleCall(ArrangeGrid, gridPtr); } @@ -2932,7 +2953,7 @@ ConfigureContent( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Any window in application containing * content. Used to look up content names. */ - int objc, /* Number of elements in argv. */ + Tcl_Size objc, /* Number of elements in argv. */ Tcl_Obj *const objv[]) /* Argument objects: contains one or more * window names followed by any number of * "option value" pairs. Caller must make sure @@ -2969,7 +2990,7 @@ ConfigureContent( firstChar = 0; for (numWindows=0, i=0; i < objc; i++) { - int length; + Tcl_Size length; char prevChar = firstChar; string = Tcl_GetStringFromObj(objv[i], &length); @@ -3030,7 +3051,7 @@ ConfigureContent( if ((firstChar == REL_HORIZ) && ((numWindows == 0) || (prevChar == REL_SKIP) || (prevChar == REL_VERT))) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "must specify window before shortcut '-'", -1)); + "must specify window before shortcut '-'", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } @@ -3050,7 +3071,7 @@ ConfigureContent( if ((objc - numWindows) & 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "extra option or option with no value", -1)); + "extra option or option with no value", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_PARAMETER", NULL); return TCL_ERROR; } @@ -3203,7 +3224,7 @@ ConfigureContent( } if (other == content) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "window can't be managed in itself", -1)); + "window can't be managed in itself", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); return TCL_ERROR; } @@ -3347,7 +3368,7 @@ ConfigureContent( } if (Tk_TopWinHierarchy(ancestor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't put %s inside %s", Tcl_GetString(objv[j]), + "can't put \"%s\" inside \"%s\"", Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); Unlink(contentPtr); @@ -3363,7 +3384,7 @@ ConfigureContent( container = (TkWindow *)TkGetContainer(container)) { if (container == (TkWindow *)content) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't put %s inside %s, would cause management loop", + "can't put \"%s\" inside \"%s\": would cause management loop", Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); Unlink(contentPtr); @@ -3448,7 +3469,7 @@ ConfigureContent( if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't use '^', cant find master", -1)); + "can't use '^', can't find container window", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } @@ -3502,7 +3523,7 @@ ConfigureContent( } if (!match) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't find slave to extend with \"^\"", -1)); + "can't find content to extend with \"^\"", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } @@ -3510,7 +3531,7 @@ ConfigureContent( if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't determine master window", -1)); + "can't determine container window", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } @@ -3519,11 +3540,15 @@ ConfigureContent( /* * If we have emptied this container from content it means we are no longer * handling it and should mark it as free. + * + * Send the event "NoManagedChild" to the container to inform it about there + * being no managed children inside it. */ if (containerPtr->contentPtr == NULL && containerPtr->flags & ALLOCED_CONTAINER) { TkFreeGeometryContainer(containerPtr->tkwin, "grid"); containerPtr->flags &= ~ALLOCED_CONTAINER; + Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL); } return TCL_OK; @@ -3634,12 +3659,12 @@ StringToSticky( static Tcl_Obj * NewPairObj( - int val1, int val2) + Tcl_WideInt val1, Tcl_WideInt val2) { Tcl_Obj *ary[2]; - ary[0] = Tcl_NewIntObj(val1); - ary[1] = Tcl_NewIntObj(val2); + ary[0] = Tcl_NewWideIntObj(val1); + ary[1] = Tcl_NewWideIntObj(val2); return Tcl_NewListObj(2, ary); } @@ -3661,14 +3686,14 @@ NewPairObj( static Tcl_Obj * NewQuadObj( - int val1, int val2, int val3, int val4) + Tcl_WideInt val1, Tcl_WideInt val2, Tcl_WideInt val3, Tcl_WideInt val4) { Tcl_Obj *ary[4]; - ary[0] = Tcl_NewIntObj(val1); - ary[1] = Tcl_NewIntObj(val2); - ary[2] = Tcl_NewIntObj(val3); - ary[3] = Tcl_NewIntObj(val4); + ary[0] = Tcl_NewWideIntObj(val1); + ary[1] = Tcl_NewWideIntObj(val2); + ary[2] = Tcl_NewWideIntObj(val3); + ary[3] = Tcl_NewWideIntObj(val4); return Tcl_NewListObj(4, ary); } |