diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-09 11:05:25 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-09 11:05:25 (GMT) |
commit | e59d11829980b85d1a4c263d108f0a601fce5e5b (patch) | |
tree | 4909d393da1e0d6ebffb2e96915a5c1fca3cb051 /generic | |
parent | 28c1f407a28c2c2f5824dba9c2ad233d25bd9500 (diff) | |
parent | 9c82b94f7f8be2ebc6cf88f55d08d6e087cff5a5 (diff) | |
download | tk-e59d11829980b85d1a4c263d108f0a601fce5e5b.zip tk-e59d11829980b85d1a4c263d108f0a601fce5e5b.tar.gz tk-e59d11829980b85d1a4c263d108f0a601fce5e5b.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic')
49 files changed, 2712 insertions, 2556 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index 59977ef..e891dbb 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -472,7 +472,7 @@ declare 116 { Tk_Window Tk_IdToWindow(Display *display, Window window) } declare 117 { - void Tk_ImageChanged(Tk_ImageModel master, int x, int y, + void Tk_ImageChanged(Tk_ImageMaster model, int x, int y, int width, int height, int imageWidth, int imageHeight) } declare 118 { @@ -486,8 +486,8 @@ declare 120 { int width, int height) } declare 121 { - void Tk_MaintainGeometry(Tk_Window slave, - Tk_Window master, int x, int y, int width, int height) + void Tk_MaintainGeometry(Tk_Window window, + Tk_Window container, int x, int y, int width, int height) } declare 122 { Tk_Window Tk_MainWindow(Tcl_Interp *interp) @@ -539,7 +539,7 @@ declare 136 { CONST84_RETURN char *Tk_NameOfFont(Tk_Font font) } declare 137 { - CONST84_RETURN char *Tk_NameOfImage(Tk_ImageModel imageMaster) + CONST84_RETURN char *Tk_NameOfImage(Tk_ImageMaster model) } declare 138 { CONST84_RETURN char *Tk_NameOfJoinStyle(int join) @@ -692,7 +692,7 @@ declare 180 { void Tk_Ungrab(Tk_Window tkwin) } declare 181 { - void Tk_UnmaintainGeometry(Tk_Window slave, Tk_Window master) + void Tk_UnmaintainGeometry(Tk_Window window, Tk_Window container) } declare 182 { void Tk_UnmapWindow(Tk_Window tkwin) @@ -1068,6 +1068,9 @@ declare 272 { declare 273 { void Tk_CreateOldPhotoImageFormat(const Tk_PhotoImageFormat *formatPtr) } +declare 280 { + void TkUnusedStubEntry(void) +} # Define the platform specific public Tk interface. These functions are # only available on the designated platform. @@ -1139,6 +1142,16 @@ declare 9 aqua { declare 10 aqua { int Tk_MacOSXIsAppInFront(void) } +declare 11 aqua { + Tk_Window Tk_MacOSXGetTkWindow(void *w) +} +declare 12 aqua { + void *Tk_MacOSXGetCGContextForDrawable(Drawable drawable) +} +# Replaces TkMacOSXDrawable +declare 13 aqua { + void *Tk_MacOSXGetNSWindowForDrawable(Drawable drawable) +} declare 16 aqua { void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, int width, int height, int flags) diff --git a/generic/tk.h b/generic/tk.h index 4905aae..50195b9 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -129,7 +129,7 @@ typedef struct Tk_Cursor_ *Tk_Cursor; typedef struct Tk_ErrorHandler_ *Tk_ErrorHandler; typedef struct Tk_Font_ *Tk_Font; typedef struct Tk_Image__ *Tk_Image; -typedef struct Tk_ImageMaster_ *Tk_ImageModel; +typedef struct Tk_ImageMaster_ *Tk_ImageMaster; typedef struct Tk_OptionTable_ *Tk_OptionTable; typedef struct Tk_PostscriptInfo_ *Tk_PostscriptInfo; typedef struct Tk_TextLayout_ *Tk_TextLayout; @@ -615,21 +615,22 @@ typedef struct Tk_ClassProcs { * the geometry manager to carry out certain functions. */ +#define Tk_GeomLostContentProc Tk_GeomLostSlaveProc typedef void (Tk_GeomRequestProc) (ClientData clientData, Tk_Window tkwin); -typedef void (Tk_GeomLostSlaveProc) (ClientData clientData, Tk_Window tkwin); +typedef void (Tk_GeomLostContentProc) (ClientData clientData, Tk_Window tkwin); typedef struct Tk_GeomMgr { const char *name; /* Name of the geometry manager (command used * to invoke it, or name of widget class that * allows embedded widgets). */ Tk_GeomRequestProc *requestProc; - /* Procedure to invoke when a slave's + /* Procedure to invoke when a content's * requested geometry changes. */ - Tk_GeomLostSlaveProc *lostSlaveProc; - /* Procedure to invoke when a slave is taken + Tk_GeomLostContentProc *lostSlaveProc; + /* Procedure to invoke when content is taken * away from one geometry manager by another. * NULL means geometry manager doesn't care - * when slaves are lost. */ + * when content lost. */ } Tk_GeomMgr; /* @@ -1229,19 +1230,19 @@ typedef struct Tk_Outline { typedef struct Tk_ImageType Tk_ImageType; #ifdef USE_OLD_IMAGE typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc, - char **argv, Tk_ImageType *typePtr, Tk_ImageModel model, - ClientData *masterDataPtr); + char **argv, Tk_ImageType *typePtr, Tk_ImageMaster model, + ClientData *clientDataPtr); #else typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, CONST86 char *name, int objc, - Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageModel model, - ClientData *modelDataPtr); + Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageMaster model, + ClientData *clientDataPtr); #endif /* USE_OLD_IMAGE */ -typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData masterData); -typedef void (Tk_ImageDisplayProc) (ClientData instanceData, Display *display, +typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData clientData); +typedef void (Tk_ImageDisplayProc) (ClientData clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); -typedef void (Tk_ImageFreeProc) (ClientData instanceData, Display *display); -typedef void (Tk_ImageDeleteProc) (ClientData masterData); +typedef void (Tk_ImageFreeProc) (ClientData clientData, Display *display); +typedef void (Tk_ImageDeleteProc) (ClientData clientData); typedef void (Tk_ImageChangedProc) (ClientData clientData, int x, int y, int width, int height, int imageWidth, int imageHeight); typedef int (Tk_ImagePostscriptProc) (ClientData clientData, diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index f73546f..4047b0f 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -85,7 +85,7 @@ static void TranslateWinItem(Tk_Canvas canvas, static int WinItemCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); -static void WinItemLostSlaveProc(ClientData clientData, +static void WinItemLostContentProc(ClientData clientData, Tk_Window tkwin); static void WinItemRequestProc(ClientData clientData, Tk_Window tkwin); @@ -141,7 +141,7 @@ Tk_ItemType tkWindowType = { static const Tk_GeomMgr canvasGeomType = { "canvas", /* name */ WinItemRequestProc, /* requestProc */ - WinItemLostSlaveProc, /* lostSlaveProc */ + WinItemLostContentProc, /* lostSlaveProc */ }; /* @@ -1053,26 +1053,26 @@ WinItemRequestProc( /* *-------------------------------------------------------------- * - * WinItemLostSlaveProc -- + * WinItemLostContentProc -- * * This function is invoked by Tk whenever some other geometry claims - * control over a slave that used to be managed by us. + * control over a content window that used to be managed by us. * * Results: * None. * * Side effects: - * Forgets all canvas-related information about the slave. + * Forgets all canvas-related information about the content window. * *-------------------------------------------------------------- */ /* ARGSUSED */ static void -WinItemLostSlaveProc( - ClientData clientData, /* WindowItem structure for slave window that +WinItemLostContentProc( + ClientData clientData, /* WindowItem structure for content window that * was stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + Tk_Window tkwin) /* Tk's handle for the content window. */ { WindowItem *winItemPtr = clientData; Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas); diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 44af1ea..7e0943d 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -67,7 +67,7 @@ typedef struct TkOption { * monochrome displays. */ struct TkOption *synonymPtr; /* For synonym options, this points to the - * master entry. */ + * original entry. */ const struct Tk_ObjCustomOption *custom; /* For TK_OPTION_CUSTOM. */ } extra; @@ -237,8 +237,8 @@ Tk_CreateOptionTable( if (specPtr->type == TK_OPTION_SYNONYM) { /* - * This is a synonym option; find the master option that it refers - * to and create a pointer from the synonym to the master. + * This is a synonym option; find the original option that it refers + * to and create a pointer from the synonym to the origin. */ for (specPtr2 = templatePtr, i = 0; ; specPtr2++, i++) { @@ -1500,9 +1500,8 @@ Tk_FreeSavedOptions( Tk_FreeSavedOptions(savePtr->nextPtr); ckfree(savePtr->nextPtr); } - for (count = savePtr->numItems, - savedOptionPtr = &savePtr->items[savePtr->numItems-1]; - count > 0; count--, savedOptionPtr--) { + for (count = savePtr->numItems; count > 0; count--) { + savedOptionPtr = &savePtr->items[count-1]; if (savedOptionPtr->optionPtr->flags & OPTION_NEEDS_FREEING) { FreeResources(savedOptionPtr->optionPtr, savedOptionPtr->valuePtr, (char *) &savedOptionPtr->internalForm, savePtr->tkwin); diff --git a/generic/tkDecls.h b/generic/tkDecls.h index c96039d..87bb218 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -402,7 +402,7 @@ EXTERN void Tk_HandleEvent(XEvent *eventPtr); /* 116 */ EXTERN Tk_Window Tk_IdToWindow(Display *display, Window window); /* 117 */ -EXTERN void Tk_ImageChanged(Tk_ImageModel master, int x, int y, +EXTERN void Tk_ImageChanged(Tk_ImageMaster model, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 118 */ @@ -413,8 +413,8 @@ EXTERN Atom Tk_InternAtom(Tk_Window tkwin, const char *name); EXTERN int Tk_IntersectTextLayout(Tk_TextLayout layout, int x, int y, int width, int height); /* 121 */ -EXTERN void Tk_MaintainGeometry(Tk_Window slave, - Tk_Window master, int x, int y, int width, +EXTERN void Tk_MaintainGeometry(Tk_Window window, + Tk_Window container, int x, int y, int width, int height); /* 122 */ EXTERN Tk_Window Tk_MainWindow(Tcl_Interp *interp); @@ -453,7 +453,7 @@ EXTERN CONST84_RETURN char * Tk_NameOfCursor(Display *display, /* 136 */ EXTERN CONST84_RETURN char * Tk_NameOfFont(Tk_Font font); /* 137 */ -EXTERN CONST84_RETURN char * Tk_NameOfImage(Tk_ImageModel imageMaster); +EXTERN CONST84_RETURN char * Tk_NameOfImage(Tk_ImageMaster model); /* 138 */ EXTERN CONST84_RETURN char * Tk_NameOfJoinStyle(int join); /* 139 */ @@ -582,8 +582,8 @@ EXTERN void Tk_UnderlineTextLayout(Display *display, /* 180 */ EXTERN void Tk_Ungrab(Tk_Window tkwin); /* 181 */ -EXTERN void Tk_UnmaintainGeometry(Tk_Window slave, - Tk_Window master); +EXTERN void Tk_UnmaintainGeometry(Tk_Window window, + Tk_Window container); /* 182 */ EXTERN void Tk_UnmapWindow(Tk_Window tkwin); /* 183 */ @@ -864,6 +864,14 @@ EXTERN void Tk_CreateOldImageType(const Tk_ImageType *typePtr); /* 273 */ EXTERN void Tk_CreateOldPhotoImageFormat( const Tk_PhotoImageFormat *formatPtr); +/* Slot 274 is reserved */ +/* Slot 275 is reserved */ +/* Slot 276 is reserved */ +/* Slot 277 is reserved */ +/* Slot 278 is reserved */ +/* Slot 279 is reserved */ +/* 280 */ +EXTERN void TkUnusedStubEntry(void); typedef struct { const struct TkPlatStubs *tkPlatStubs; @@ -993,11 +1001,11 @@ typedef struct TkStubs { int (*tk_Grab) (Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal); /* 114 */ void (*tk_HandleEvent) (XEvent *eventPtr); /* 115 */ Tk_Window (*tk_IdToWindow) (Display *display, Window window); /* 116 */ - void (*tk_ImageChanged) (Tk_ImageModel master, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */ + void (*tk_ImageChanged) (Tk_ImageMaster model, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */ int (*tk_Init) (Tcl_Interp *interp); /* 118 */ Atom (*tk_InternAtom) (Tk_Window tkwin, const char *name); /* 119 */ int (*tk_IntersectTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height); /* 120 */ - void (*tk_MaintainGeometry) (Tk_Window slave, Tk_Window master, int x, int y, int width, int height); /* 121 */ + void (*tk_MaintainGeometry) (Tk_Window window, Tk_Window container, int x, int y, int width, int height); /* 121 */ Tk_Window (*tk_MainWindow) (Tcl_Interp *interp); /* 122 */ void (*tk_MakeWindowExist) (Tk_Window tkwin); /* 123 */ void (*tk_ManageGeometry) (Tk_Window tkwin, const Tk_GeomMgr *mgrPtr, ClientData clientData); /* 124 */ @@ -1013,7 +1021,7 @@ typedef struct TkStubs { CONST84_RETURN char * (*tk_NameOfColor) (XColor *colorPtr); /* 134 */ CONST84_RETURN char * (*tk_NameOfCursor) (Display *display, Tk_Cursor cursor); /* 135 */ CONST84_RETURN char * (*tk_NameOfFont) (Tk_Font font); /* 136 */ - CONST84_RETURN char * (*tk_NameOfImage) (Tk_ImageModel imageMaster); /* 137 */ + CONST84_RETURN char * (*tk_NameOfImage) (Tk_ImageMaster model); /* 137 */ CONST84_RETURN char * (*tk_NameOfJoinStyle) (int join); /* 138 */ CONST84_RETURN char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */ CONST84_RETURN char * (*tk_NameOfRelief) (int relief); /* 140 */ @@ -1057,7 +1065,7 @@ typedef struct TkStubs { void (*tk_UnderlineChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int x, int y, int firstByte, int lastByte); /* 178 */ void (*tk_UnderlineTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int underline); /* 179 */ void (*tk_Ungrab) (Tk_Window tkwin); /* 180 */ - void (*tk_UnmaintainGeometry) (Tk_Window slave, Tk_Window master); /* 181 */ + void (*tk_UnmaintainGeometry) (Tk_Window window, Tk_Window container); /* 181 */ void (*tk_UnmapWindow) (Tk_Window tkwin); /* 182 */ void (*tk_UnsetGrid) (Tk_Window tkwin); /* 183 */ void (*tk_UpdatePointer) (Tk_Window tkwin, int x, int y, int state); /* 184 */ @@ -1150,6 +1158,13 @@ typedef struct TkStubs { Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */ void (*tk_CreateOldImageType) (const Tk_ImageType *typePtr); /* 272 */ void (*tk_CreateOldPhotoImageFormat) (const Tk_PhotoImageFormat *formatPtr); /* 273 */ + void (*reserved274)(void); + void (*reserved275)(void); + void (*reserved276)(void); + void (*reserved277)(void); + void (*reserved278)(void); + void (*reserved279)(void); + void (*tkUnusedStubEntry) (void); /* 280 */ } TkStubs; extern const TkStubs *tkStubsPtr; @@ -1710,6 +1725,14 @@ extern const TkStubs *tkStubsPtr; (tkStubsPtr->tk_CreateOldImageType) /* 272 */ #define Tk_CreateOldPhotoImageFormat \ (tkStubsPtr->tk_CreateOldPhotoImageFormat) /* 273 */ +/* Slot 274 is reserved */ +/* Slot 275 is reserved */ +/* Slot 276 is reserved */ +/* Slot 277 is reserved */ +/* Slot 278 is reserved */ +/* Slot 279 is reserved */ +#define TkUnusedStubEntry \ + (tkStubsPtr->tkUnusedStubEntry) /* 280 */ #endif /* defined(USE_TK_STUBS) */ diff --git a/generic/tkFrame.c b/generic/tkFrame.c index ce7dc8c..1112f81 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -314,7 +314,7 @@ static void DisplayFrame(ClientData clientData); static void FrameCmdDeletedProc(ClientData clientData); static void FrameEventProc(ClientData clientData, XEvent *eventPtr); -static void FrameLostSlaveProc(ClientData clientData, +static void FrameLostContentProc(ClientData clientData, Tk_Window tkwin); static void FrameRequestProc(ClientData clientData, Tk_Window tkwin); @@ -346,7 +346,7 @@ static const Tk_ClassProcs frameClass = { static const Tk_GeomMgr frameGeomType = { "labelframe", /* name */ FrameRequestProc, /* requestProc */ - FrameLostSlaveProc /* lostSlaveProc */ + FrameLostContentProc /* lostSlaveProc */ }; /* @@ -1914,25 +1914,25 @@ FrameRequestProc( /* *-------------------------------------------------------------- * - * FrameLostSlaveProc -- + * FrameLostContentProc -- * * This function is invoked by Tk whenever some other geometry claims - * control over a slave that used to be managed by us. + * control over a content window that used to be managed by us. * * Results: * None. * * Side effects: - * Forgets all frame-related information about the slave. + * Forgets all frame-related information about the content window. * *-------------------------------------------------------------- */ static void -FrameLostSlaveProc( - ClientData clientData, /* Frame structure for slave window that was +FrameLostContentProc( + ClientData clientData, /* Frame structure for content window that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + Tk_Window tkwin) /* Tk's handle for the content window. */ { Frame *framePtr = clientData; Labelframe *labelframePtr = clientData; diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 870c1f3..5ecac0e 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -15,29 +15,29 @@ /* * Data structures of the following type are used by Tk_MaintainGeometry. For - * each slave managed by Tk_MaintainGeometry, there is one of these structures - * associated with its master. + * each content managed by Tk_MaintainGeometry, there is one of these structures + * associated with its container. */ -typedef struct MaintainSlave { - Tk_Window slave; /* The slave window being positioned. */ - Tk_Window master; /* The master that determines slave's +typedef struct MaintainContent { + Tk_Window content; /* The content window being positioned. */ + Tk_Window container; /* The container that determines content's * position; it must be a descendant of - * slave's parent. */ - int x, y; /* Desired position of slave relative to - * master. */ - int width, height; /* Desired dimensions of slave. */ - struct MaintainSlave *nextPtr; + * content's parent. */ + int x, y; /* Desired position of content relative to + * container. */ + int width, height; /* Desired dimensions of content. */ + struct MaintainContent *nextPtr; /* Next in list of Maintains associated with - * master. */ -} MaintainSlave; + * container. */ +} MaintainContent; /* - * For each window that has been specified as a master to Tk_MaintainGeometry, + * For each window that has been specified as a content to Tk_MaintainGeometry, * there is a structure of the following type: */ -typedef struct MaintainMaster { +typedef struct MaintainContainer { Tk_Window ancestor; /* The lowest ancestor of this window for * which we have *not* created a * StructureNotify handler. May be the same as @@ -45,18 +45,18 @@ typedef struct MaintainMaster { int checkScheduled; /* Non-zero means that there is already a call * to MaintainCheckProc scheduled as an idle * handler. */ - MaintainSlave *slavePtr; /* First in list of all slaves associated with - * this master. */ -} MaintainMaster; + MaintainContent *contentPtr; /* First in list of all content associated with + * this container. */ +} MaintainContainer; /* * Prototypes for static procedures in this file: */ static void MaintainCheckProc(ClientData clientData); -static void MaintainMasterProc(ClientData clientData, +static void MaintainContainerProc(ClientData clientData, XEvent *eventPtr); -static void MaintainSlaveProc(ClientData clientData, +static void MaintainContentProc(ClientData clientData, XEvent *eventPtr); /* @@ -65,7 +65,7 @@ static void MaintainSlaveProc(ClientData clientData, * Tk_ManageGeometry -- * * Arrange for a particular procedure to manage the geometry of a given - * slave window. + * content window. * * Results: * None. @@ -90,7 +90,7 @@ Tk_ManageGeometry( ClientData clientData) /* Arbitrary one-word argument to pass to * geometry manager procedures. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if ((winPtr->geomMgrPtr != NULL) && (mgrPtr != NULL) && ((winPtr->geomMgrPtr != mgrPtr) @@ -132,7 +132,7 @@ Tk_GeometryRequest( int reqWidth, int reqHeight)/* Minimum desired dimensions for window, in * pixels. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; /* * X gets very upset if a window requests a width or height of zero, so @@ -182,8 +182,8 @@ Tk_SetInternalBorderEx( int left, int right, /* Width of internal border, in pixels. */ int top, int bottom) { - register TkWindow *winPtr = (TkWindow *) tkwin; - register int changed = 0; + TkWindow *winPtr = (TkWindow *) tkwin; + int changed = 0; if (left < 0) { left = 0; @@ -218,7 +218,7 @@ Tk_SetInternalBorderEx( } /* - * All the slaves for which this is the master window must now be + * All the content for which this is the container window must now be * repositioned to take account of the new internal border width. To * signal all the geometry managers to do this, trigger a ConfigureNotify * event. This will cause geometry managers to recompute everything. @@ -279,7 +279,7 @@ Tk_SetMinimumRequestSize( Tk_Window tkwin, /* Window that will have internal border. */ int minWidth, int minHeight)/* Minimum requested size, in pixels. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if ((winPtr->minReqWidth == minWidth) && (winPtr->minReqHeight == minHeight)) { @@ -303,31 +303,31 @@ Tk_SetMinimumRequestSize( /* *---------------------------------------------------------------------- * - * TkSetGeometryMaster -- + * TkSetGeometryContainer -- * - * Set a geometry master for this window. Only one master may own + * Set a geometry container for this window. Only one container may own * a window at any time. * * Results: * A standard Tcl result. * * Side effects: - * The geometry master is recorded for the window. + * The geometry container is recorded for the window. * *---------------------------------------------------------------------- */ int -TkSetGeometryMaster( +TkSetGeometryContainer( Tcl_Interp *interp, /* Current interpreter, for error. */ - Tk_Window tkwin, /* Window that will have geometry master + Tk_Window tkwin, /* Window that will have geometry container * set. */ - const char *master) /* The master identity. */ + const char *name) /* The name of the geometry manager. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->geomMgrName != NULL && - strcmp(winPtr->geomMgrName, master) == 0) { + strcmp(winPtr->geomMgrName, name) == 0) { return TCL_OK; } if (winPtr->geomMgrName != NULL) { @@ -335,46 +335,46 @@ TkSetGeometryMaster( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "cannot use geometry manager %s inside %s which already" " has slaves managed by %s", - master, Tk_PathName(tkwin), winPtr->geomMgrName)); + name, Tk_PathName(tkwin), winPtr->geomMgrName)); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "FIGHT", NULL); } return TCL_ERROR; } - winPtr->geomMgrName = ckalloc(strlen(master) + 1); - strcpy(winPtr->geomMgrName, master); + winPtr->geomMgrName = (char *)ckalloc(strlen(name) + 1); + strcpy(winPtr->geomMgrName, name); return TCL_OK; } /* *---------------------------------------------------------------------- * - * TkFreeGeometryMaster -- + * TkFreeGeometryContainer -- * - * Remove a geometry master for this window. Only one master may own + * Remove a geometry container for this window. Only one container may own * a window at any time. * * Results: * None. * * Side effects: - * The geometry master is cleared for the window. + * The geometry container is cleared for the window. * *---------------------------------------------------------------------- */ void -TkFreeGeometryMaster( - Tk_Window tkwin, /* Window that will have geometry master +TkFreeGeometryContainer( + Tk_Window tkwin, /* Window that will have geometry container * cleared. */ - const char *master) /* The master identity. */ + const char *name) /* The name of the geometry manager. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->geomMgrName != NULL && - strcmp(winPtr->geomMgrName, master) != 0) { + strcmp(winPtr->geomMgrName, name) != 0) { Tcl_Panic("Trying to free %s from geometry manager %s", - winPtr->geomMgrName, master); + winPtr->geomMgrName, name); } if (winPtr->geomMgrName != NULL) { ckfree(winPtr->geomMgrName); @@ -387,12 +387,12 @@ TkFreeGeometryMaster( * * Tk_MaintainGeometry -- * - * This procedure is invoked by geometry managers to handle slaves whose - * master's are not their parents. It translates the desired geometry for - * the slave into the coordinate system of the parent and respositions - * the slave if it isn't already at the right place. Furthermore, it sets - * up event handlers so that if the master (or any of its ancestors up to - * the slave's parent) is mapped, unmapped, or moved, then the slave will + * This procedure is invoked by geometry managers to handle content whose + * container's are not their parents. It translates the desired geometry for + * the content into the coordinate system of the parent and respositions + * the content if it isn't already at the right place. Furthermore, it sets + * up event handlers so that if the container (or any of its ancestors up to + * the content's parent) is mapped, unmapped, or moved, then the content will * be adjusted to match. * * Results: @@ -400,7 +400,7 @@ TkFreeGeometryMaster( * * Side effects: * Event handlers are created and state is allocated to keep track of - * slave. Note: if slave was already managed for master by + * content. Note: if content was already managed for container by * Tk_MaintainGeometry, then the previous information is replaced with * the new information. The caller must eventually call * Tk_UnmaintainGeometry to eliminate the correspondence (or, the state @@ -411,40 +411,40 @@ TkFreeGeometryMaster( void Tk_MaintainGeometry( - Tk_Window slave, /* Slave for geometry management. */ - Tk_Window master, /* Master for slave; must be a descendant of - * slave's parent. */ - int x, int y, /* Desired position of slave within master. */ - int width, int height) /* Desired dimensions for slave. */ + Tk_Window window, /* Window for geometry management. */ + Tk_Window container, /* Container for window; must be a descendant of + * window's parent. */ + int x, int y, /* Desired position of window within container. */ + int width, int height) /* Desired dimensions for window. */ { Tcl_HashEntry *hPtr; - MaintainMaster *masterPtr; - register MaintainSlave *slavePtr; + MaintainContainer *containerPtr; + MaintainContent *contentPtr; int isNew, map; Tk_Window ancestor, parent; - TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr; + TkDisplay *dispPtr = ((TkWindow *) container)->dispPtr; - ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master; + ((TkWindow *)window)->maintainerPtr = (TkWindow *)container; - ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master; - if (master == Tk_Parent(slave)) { + ((TkWindow *)window)->maintainerPtr = (TkWindow *)container; + if (container == Tk_Parent(window)) { /* - * If the slave is a direct descendant of the master, don't bother + * If the window is a direct descendant of the container, don't bother * setting up the extra infrastructure for management, just make a * call to Tk_MoveResizeWindow; the parent/child relationship will * take care of the rest. */ - Tk_MoveResizeWindow(slave, x, y, width, height); + Tk_MoveResizeWindow(window, x, y, width, height); /* - * Map the slave if the master is already mapped; otherwise, wait - * until the master is mapped later (in which case mapping the slave + * Map the window if the container is already mapped; otherwise, wait + * until the container is mapped later (in which case mapping the window * is taken care of elsewhere). */ - if (Tk_IsMapped(master)) { - Tk_MapWindow(slave); + if (Tk_IsMapped(container)) { + Tk_MapWindow(window); } return; } @@ -455,55 +455,55 @@ Tk_MaintainGeometry( } /* - * See if there is already a MaintainMaster structure for the master; if + * See if there is already a MaintainContainer structure for the container; if * not, then create one. */ - parent = Tk_Parent(slave); + parent = Tk_Parent(window); hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable, - (char *) master, &isNew); + (char *) container, &isNew); if (!isNew) { - masterPtr = Tcl_GetHashValue(hPtr); + containerPtr = (MaintainContainer *)Tcl_GetHashValue(hPtr); } else { - masterPtr = ckalloc(sizeof(MaintainMaster)); - masterPtr->ancestor = master; - masterPtr->checkScheduled = 0; - masterPtr->slavePtr = NULL; - Tcl_SetHashValue(hPtr, masterPtr); + containerPtr = (MaintainContainer *)ckalloc(sizeof(MaintainContainer)); + containerPtr->ancestor = container; + containerPtr->checkScheduled = 0; + containerPtr->contentPtr = NULL; + Tcl_SetHashValue(hPtr, containerPtr); } /* - * Create a MaintainSlave structure for the slave if there isn't already + * Create a MaintainContent structure for the window if there isn't already * one. */ - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - if (slavePtr->slave == slave) { - goto gotSlave; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + if (contentPtr->content == window) { + goto gotContent; } } - slavePtr = ckalloc(sizeof(MaintainSlave)); - slavePtr->slave = slave; - slavePtr->master = master; - slavePtr->nextPtr = masterPtr->slavePtr; - masterPtr->slavePtr = slavePtr; - Tk_CreateEventHandler(slave, StructureNotifyMask, MaintainSlaveProc, - slavePtr); + contentPtr = (MaintainContent *)ckalloc(sizeof(MaintainContent)); + contentPtr->content = window; + contentPtr->container = container; + contentPtr->nextPtr = containerPtr->contentPtr; + containerPtr->contentPtr = contentPtr; + Tk_CreateEventHandler(window, StructureNotifyMask, MaintainContentProc, + contentPtr); /* * Make sure that there are event handlers registered for all the windows - * between master and slave's parent (including master but not slave's - * parent). There may already be handlers for master and some of its - * ancestors (masterPtr->ancestor tells how many). + * between container and windows's parent (including container but not window's + * parent). There may already be handlers for container and some of its + * ancestors (containerPtr->ancestor tells how many). */ - for (ancestor = master; ancestor != parent; + for (ancestor = container; ancestor != parent; ancestor = Tk_Parent(ancestor)) { - if (ancestor == masterPtr->ancestor) { + if (ancestor == containerPtr->ancestor) { Tk_CreateEventHandler(ancestor, StructureNotifyMask, - MaintainMasterProc, masterPtr); - masterPtr->ancestor = Tk_Parent(ancestor); + MaintainContainerProc, containerPtr); + containerPtr->ancestor = Tk_Parent(ancestor); } } @@ -512,27 +512,27 @@ Tk_MaintainGeometry( * if it's not currently in the right place or state. */ - gotSlave: - slavePtr->x = x; - slavePtr->y = y; - slavePtr->width = width; - slavePtr->height = height; + gotContent: + contentPtr->x = x; + contentPtr->y = y; + contentPtr->width = width; + contentPtr->height = height; map = 1; - for (ancestor = slavePtr->master; ; ancestor = Tk_Parent(ancestor)) { + for (ancestor = contentPtr->container; ; ancestor = Tk_Parent(ancestor)) { if (!Tk_IsMapped(ancestor) && (ancestor != parent)) { map = 0; } if (ancestor == parent) { - if ((x != Tk_X(slavePtr->slave)) - || (y != Tk_Y(slavePtr->slave)) - || (width != Tk_Width(slavePtr->slave)) - || (height != Tk_Height(slavePtr->slave))) { - Tk_MoveResizeWindow(slavePtr->slave, x, y, width, height); + if ((x != Tk_X(contentPtr->content)) + || (y != Tk_Y(contentPtr->content)) + || (width != Tk_Width(contentPtr->content)) + || (height != Tk_Height(contentPtr->content))) { + Tk_MoveResizeWindow(contentPtr->content, x, y, width, height); } if (map) { - Tk_MapWindow(slavePtr->slave); + Tk_MapWindow(contentPtr->content); } else { - Tk_UnmapWindow(slavePtr->slave); + Tk_UnmapWindow(contentPtr->content); } break; } @@ -547,37 +547,37 @@ Tk_MaintainGeometry( * Tk_UnmaintainGeometry -- * * This procedure cancels a previous Tk_MaintainGeometry call, so that - * the relationship between slave and master is no longer maintained. + * the relationship between window and container is no longer maintained. * * Results: * None. * * Side effects: - * The slave is unmapped and state is released, so that slave won't track - * master any more. If we weren't previously managing slave relative to - * master, then this procedure has no effect. + * The window is unmapped and state is released, so that window won't track + * container any more. If we weren't previously managing window relative to + * container, then this procedure has no effect. * *---------------------------------------------------------------------- */ void Tk_UnmaintainGeometry( - Tk_Window slave, /* Slave for geometry management. */ - Tk_Window master) /* Master for slave; must be a descendant of - * slave's parent. */ + Tk_Window window, /* WIndow for geometry management. */ + Tk_Window container) /* Container for window; must be a descendant of + * window's parent. */ { Tcl_HashEntry *hPtr; - MaintainMaster *masterPtr; - register MaintainSlave *slavePtr, *prevPtr; + MaintainContainer *containerPtr; + MaintainContent *contentPtr, *prevPtr; Tk_Window ancestor; - TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr; + TkDisplay *dispPtr = ((TkWindow *) window)->dispPtr; - ((TkWindow *)slave)->maintainerPtr = NULL; + ((TkWindow *)window)->maintainerPtr = NULL; - ((TkWindow *)slave)->maintainerPtr = NULL; - if (master == Tk_Parent(slave)) { + ((TkWindow *)window)->maintainerPtr = NULL; + if (container == Tk_Parent(window)) { /* - * If the slave is a direct descendant of the master, + * If the window is a direct descendant of the container, * Tk_MaintainGeometry will not have set up any of the extra * infrastructure. Don't even bother to look for it, just return. */ @@ -589,57 +589,57 @@ Tk_UnmaintainGeometry( Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS); } - if (!(((TkWindow *) slave)->flags & TK_ALREADY_DEAD)) { - Tk_UnmapWindow(slave); + if (!(((TkWindow *) window)->flags & TK_ALREADY_DEAD)) { + Tk_UnmapWindow(window); } - hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, (char *) master); + hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, container); if (hPtr == NULL) { return; } - masterPtr = Tcl_GetHashValue(hPtr); - slavePtr = masterPtr->slavePtr; - if (slavePtr->slave == slave) { - masterPtr->slavePtr = slavePtr->nextPtr; + containerPtr = (MaintainContainer *)Tcl_GetHashValue(hPtr); + contentPtr = containerPtr->contentPtr; + if (contentPtr->content == window) { + containerPtr->contentPtr = contentPtr->nextPtr; } else { - for (prevPtr = slavePtr, slavePtr = slavePtr->nextPtr; ; - prevPtr = slavePtr, slavePtr = slavePtr->nextPtr) { - if (slavePtr == NULL) { + for (prevPtr = contentPtr, contentPtr = contentPtr->nextPtr; ; + prevPtr = contentPtr, contentPtr = contentPtr->nextPtr) { + if (contentPtr == NULL) { return; } - if (slavePtr->slave == slave) { - prevPtr->nextPtr = slavePtr->nextPtr; + if (contentPtr->content == window) { + prevPtr->nextPtr = contentPtr->nextPtr; break; } } } - Tk_DeleteEventHandler(slavePtr->slave, StructureNotifyMask, - MaintainSlaveProc, slavePtr); - ckfree(slavePtr); - if (masterPtr->slavePtr == NULL) { - if (masterPtr->ancestor != NULL) { - for (ancestor = master; ; ancestor = Tk_Parent(ancestor)) { + Tk_DeleteEventHandler(contentPtr->content, StructureNotifyMask, + MaintainContentProc, contentPtr); + ckfree(contentPtr); + if (containerPtr->contentPtr == NULL) { + if (containerPtr->ancestor != NULL) { + for (ancestor = container; ; ancestor = Tk_Parent(ancestor)) { Tk_DeleteEventHandler(ancestor, StructureNotifyMask, - MaintainMasterProc, masterPtr); - if (ancestor == masterPtr->ancestor) { + MaintainContainerProc, containerPtr); + if (ancestor == containerPtr->ancestor) { break; } } } - if (masterPtr->checkScheduled) { - Tcl_CancelIdleCall(MaintainCheckProc, masterPtr); + if (containerPtr->checkScheduled) { + Tcl_CancelIdleCall(MaintainCheckProc, containerPtr); } Tcl_DeleteHashEntry(hPtr); - ckfree(masterPtr); + ckfree(containerPtr); } } /* *---------------------------------------------------------------------- * - * MaintainMasterProc -- + * MaintainContainerProc -- * * This procedure is invoked by the Tk event dispatcher in response to - * StructureNotify events on the master or one of its ancestors, on + * StructureNotify events on the container or one of its ancestors, on * behalf of Tk_MaintainGeometry. * * Results: @@ -648,43 +648,43 @@ Tk_UnmaintainGeometry( * Side effects: * It schedules a call to MaintainCheckProc, which will eventually caused * the postions and mapped states to be recalculated for all the - * maintained slaves of the master. Or, if the master window is being + * maintained windows of the container. Or, if the container window is being * deleted then state is cleaned up. * *---------------------------------------------------------------------- */ static void -MaintainMasterProc( - ClientData clientData, /* Pointer to MaintainMaster structure for the - * master window. */ +MaintainContainerProc( + ClientData clientData, /* Pointer to MaintainContainer structure for the + * container window. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainMaster *masterPtr = clientData; - MaintainSlave *slavePtr; + MaintainContainer *containerPtr = (MaintainContainer *)clientData; + MaintainContent *contentPtr; int done; if ((eventPtr->type == ConfigureNotify) || (eventPtr->type == MapNotify) || (eventPtr->type == UnmapNotify)) { - if (!masterPtr->checkScheduled) { - masterPtr->checkScheduled = 1; - Tcl_DoWhenIdle(MaintainCheckProc, masterPtr); + if (!containerPtr->checkScheduled) { + containerPtr->checkScheduled = 1; + Tcl_DoWhenIdle(MaintainCheckProc, containerPtr); } } else if (eventPtr->type == DestroyNotify) { /* - * Delete all of the state associated with this master, but be careful - * not to use masterPtr after the last slave is deleted, since its + * Delete all of the state associated with this container, but be careful + * not to use containerPtr after the last window is deleted, since its * memory will have been freed. */ done = 0; do { - slavePtr = masterPtr->slavePtr; - if (slavePtr->nextPtr == NULL) { + contentPtr = containerPtr->contentPtr; + if (contentPtr->nextPtr == NULL) { done = 1; } - Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master); + Tk_UnmaintainGeometry(contentPtr->content, contentPtr->container); } while (!done); } } @@ -692,10 +692,10 @@ MaintainMasterProc( /* *---------------------------------------------------------------------- * - * MaintainSlaveProc -- + * MaintainContentProc -- * * This procedure is invoked by the Tk event dispatcher in response to - * StructureNotify events on a slave being managed by + * StructureNotify events on a window being managed by * Tk_MaintainGeometry. * * Results: @@ -703,21 +703,21 @@ MaintainMasterProc( * * Side effects: * If the event is a DestroyNotify event then the Maintain state and - * event handlers for this slave are deleted. + * event handlers for this window are deleted. * *---------------------------------------------------------------------- */ static void -MaintainSlaveProc( - ClientData clientData, /* Pointer to MaintainSlave structure for - * master-slave pair. */ +MaintainContentProc( + ClientData clientData, /* Pointer to MaintainContent structure for + * container-window pair. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainSlave *slavePtr = clientData; + MaintainContent *contentPtr = (MaintainContent *)clientData; if (eventPtr->type == DestroyNotify) { - Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master); + Tk_UnmaintainGeometry(contentPtr->content, contentPtr->container); } } @@ -727,50 +727,50 @@ MaintainSlaveProc( * MaintainCheckProc -- * * This procedure is invoked by the Tk event dispatcher as an idle - * handler, when a master or one of its ancestors has been reconfigured, - * mapped, or unmapped. Its job is to scan all of the slaves for the - * master and reposition them, map them, or unmap them as needed to - * maintain their geometry relative to the master. + * handler, when a container or one of its ancestors has been reconfigured, + * mapped, or unmapped. Its job is to scan all of the windows for the + * container and reposition them, map them, or unmap them as needed to + * maintain their geometry relative to the container. * * Results: * None. * * Side effects: - * Slaves can get repositioned, mapped, or unmapped. + * Windows can get repositioned, mapped, or unmapped. * *---------------------------------------------------------------------- */ static void MaintainCheckProc( - ClientData clientData) /* Pointer to MaintainMaster structure for the - * master window. */ + ClientData clientData) /* Pointer to MaintainContainer structure for the + * container window. */ { - MaintainMaster *masterPtr = clientData; - MaintainSlave *slavePtr; + MaintainContainer *containerPtr = (MaintainContainer *)clientData; + MaintainContent *contentPtr; Tk_Window ancestor, parent; int x, y, map; - masterPtr->checkScheduled = 0; - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - parent = Tk_Parent(slavePtr->slave); - x = slavePtr->x; - y = slavePtr->y; + containerPtr->checkScheduled = 0; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + parent = Tk_Parent(contentPtr->content); + x = contentPtr->x; + y = contentPtr->y; map = 1; - for (ancestor = slavePtr->master; ; ancestor = Tk_Parent(ancestor)) { + for (ancestor = contentPtr->container; ; ancestor = Tk_Parent(ancestor)) { if (!Tk_IsMapped(ancestor) && (ancestor != parent)) { map = 0; } if (ancestor == parent) { - if ((x != Tk_X(slavePtr->slave)) - || (y != Tk_Y(slavePtr->slave))) { - Tk_MoveWindow(slavePtr->slave, x, y); + if ((x != Tk_X(contentPtr->content)) + || (y != Tk_Y(contentPtr->content))) { + Tk_MoveWindow(contentPtr->content, x, y); } if (map) { - Tk_MapWindow(slavePtr->slave); + Tk_MapWindow(contentPtr->content); } else { - Tk_UnmapWindow(slavePtr->slave); + Tk_UnmapWindow(contentPtr->content); } break; } diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 835971d..75ce1a9 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -66,7 +66,7 @@ #define GRID_DEFAULT_ANCHOR TK_ANCHOR_NW /* - * Structure to hold information for grid masters. A slot is either a row or + * Structure to hold information for grid containers. A slot is either a row or * column. */ @@ -80,7 +80,7 @@ typedef struct SlotInfo { * inproportion to their weights. */ int pad; /* Extra padding, in pixels, required for this * slot. This amount is "added" to the largest - * slave in the slot. */ + * content in the slot. */ Tk_Uid uniform; /* Value of -uniform option. It is used to * group slots that should have the same * size. */ @@ -99,13 +99,13 @@ typedef struct SlotInfo { */ typedef struct GridLayout { - struct Gridder *binNextPtr; /* The next slave window in this bin. Each bin - * contains a list of all slaves whose spans + struct Gridder *binNextPtr; /* The next content window in this bin. Each bin + * contains a list of all content whose spans * are >1 and whose right edges fall in this * slot. */ int minSize; /* Minimum size needed for this slot, in * pixels. This is the space required to hold - * any slaves contained entirely in this slot, + * any content contained entirely in this slot, * adjusted for any slot constrants, such as * size or padding. */ int pad; /* Padding needed for this slot */ @@ -124,31 +124,31 @@ typedef struct GridLayout { } GridLayout; /* - * Keep one of these for each geometry master. + * Keep one of these for each geometry container. */ typedef struct { SlotInfo *columnPtr; /* Pointer to array of column constraints. */ SlotInfo *rowPtr; /* Pointer to array of row constraints. */ - int columnEnd; /* The last column occupied by any slave. */ + int columnEnd; /* The last column occupied by any content. */ int columnMax; /* The number of columns with constraints. */ int columnSpace; /* The number of slots currently allocated for * column constraints. */ - int rowEnd; /* The last row occupied by any slave. */ + int rowEnd; /* The last row occupied by any content. */ int rowMax; /* The number of rows with constraints. */ int rowSpace; /* The number of slots currently allocated for * row constraints. */ int startX; /* Pixel offset of this layout within its - * master. */ + * container. */ int startY; /* Pixel offset of this layout within its - * master. */ + * container. */ Tk_Anchor anchor; /* Value of anchor option: specifies where a * grid without weight should be placed. */ -} GridMaster; +} GridContainer; /* * For each window that the grid cares about (either because the window is - * managed by the grid or because the window has slaves that are managed by + * managed by the grid or because the window has content that are managed by * the grid), there is a structure of the following type: */ @@ -157,18 +157,18 @@ typedef struct Gridder { * window has been deleted, but the gridder * hasn't had a chance to clean up yet because * the structure is still in use. */ - struct Gridder *masterPtr; /* Master window within which this window is + struct Gridder *containerPtr; /* Container window within which this window is * managed (NULL means this window isn't * managed by the gridder). */ - struct Gridder *nextPtr; /* Next window managed within same master. + struct Gridder *nextPtr; /* Next window managed within same container. * List order doesn't matter. */ - struct Gridder *slavePtr; /* First in list of slaves managed inside this - * window (NULL means no grid slaves). */ - GridMaster *masterDataPtr; /* Additional data for geometry master. */ - Tcl_Obj *in; /* Store master name when removed. */ + struct Gridder *contentPtr; /* First in list of content managed inside this + * window (NULL means no grid content). */ + GridContainer *containerDataPtr; /* Additional data for geometry container. */ + Tcl_Obj *in; /* Store container name when removed. */ int column, row; /* Location in the grid (starting from * zero). */ - int numCols, numRows; /* Number of columns or rows this slave spans. + int numCols, numRows; /* Number of columns or rows this content spans. * Should be at least 1. */ int padX, padY; /* Total additional pixels to leave around the * window. Some is of this space is on each @@ -185,12 +185,12 @@ typedef struct Gridder { * sticks to. See below for definitions */ int doubleBw; /* Twice the window's last known border width. * If this changes, the window must be - * re-arranged within its master. */ + * re-arranged within its container. */ int *abortPtr; /* If non-NULL, it means that there is a * nested call to ArrangeGrid already working * on this window. *abortPtr may be set to 1 * to abort that nested call. This happens, - * for example, if tkwin or any of its slaves + * for example, if tkwin or any of its content * is deleted. */ int flags; /* Miscellaneous flags; see below for * definitions. */ @@ -199,9 +199,9 @@ typedef struct Gridder { * These fields are used temporarily for layout calculations only. */ - struct Gridder *binNextPtr; /* Link to next span>1 slave in this bin. */ + struct Gridder *binNextPtr; /* Link to next span>1 content in this bin. */ int size; /* Nominal size (width or height) in pixels of - * the slave. This includes the padding. */ + * the content. This includes the padding. */ } Gridder; /* @@ -235,32 +235,32 @@ typedef struct UniformGroup { * Flag values for Grid structures: * * REQUESTED_RELAYOUT 1 means a Tcl_DoWhenIdle request has already - * been made to re-arrange all the slaves of this + * been made to re-arrange all the content of this * window. * DONT_PROPAGATE 1 means don't set this window's requested - * size. 0 means if this window is a master then + * size. 0 means if this window is a container then * Tk will set its requested size to fit the - * needs of its slaves. - * ALLOCED_MASTER 1 means that Grid has allocated itself as - * geometry master for this window. + * needs of its content. + * ALLOCED_CONTAINER 1 means that Grid has allocated itself as + * geometry container for this window. */ #define REQUESTED_RELAYOUT 1 #define DONT_PROPAGATE 2 -#define ALLOCED_MASTER 4 +#define ALLOCED_CONTAINER 4 /* * Prototypes for procedures used only in this file: */ -static void AdjustForSticky(Gridder *slavePtr, int *xPtr, +static void AdjustForSticky(Gridder *contentPtr, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); static int AdjustOffsets(int width, int elements, SlotInfo *slotPtr); static void ArrangeGrid(ClientData clientData); -static int CheckSlotData(Gridder *masterPtr, int slot, +static int CheckSlotData(Gridder *containerPtr, int slot, int slotType, int checkOnly); -static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin, +static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, int objc, Tcl_Obj *const objv[]); static void DestroyGrid(void *memPtr); static Gridder * GetGrid(Tk_Window tkwin); @@ -284,22 +284,22 @@ static int GridRowColumnConfigureCommand(Tk_Window tkwin, Tcl_Obj *const objv[]); static int GridSizeCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int GridSlavesCommand(Tk_Window tkwin, Tcl_Interp *interp, +static int GridContentCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void GridStructureProc(ClientData clientData, XEvent *eventPtr); -static void GridLostSlaveProc(ClientData clientData, +static void GridLostContentProc(ClientData clientData, Tk_Window tkwin); static void GridReqProc(ClientData clientData, Tk_Window tkwin); -static void InitMasterData(Gridder *masterPtr); +static void InitContainerData(Gridder *containerPtr); static Tcl_Obj * NewPairObj(int, int); static Tcl_Obj * NewQuadObj(int, int, int, int); static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn, int maxOffset); static void SetGridSize(Gridder *gridPtr); -static int SetSlaveColumn(Tcl_Interp *interp, Gridder *slavePtr, +static int SetContentColumn(Tcl_Interp *interp, Gridder *contentPtr, int column, int numCols); -static int SetSlaveRow(Tcl_Interp *interp, Gridder *slavePtr, +static int SetContentRow(Tcl_Interp *interp, Gridder *contentPtr, int row, int numRows); static Tcl_Obj * StickyToObj(int flags); static int StringToSticky(const char *string); @@ -308,7 +308,7 @@ static void Unlink(Gridder *gridPtr); static const Tk_GeomMgr gridMgrType = { "grid", /* name */ GridReqProc, /* requestProc */ - GridLostSlaveProc, /* lostSlaveProc */ + GridLostContentProc, /* lostSlaveProc */ }; /* @@ -335,7 +335,7 @@ Tk_GridObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "anchor", "bbox", "columnconfigure", "configure", "content", "forget", "info", "location", "propagate", @@ -353,7 +353,7 @@ Tk_GridObjCmd( if ((argv1[0] == '.') || (argv1[0] == REL_SKIP) || (argv1[0] == REL_VERT)) { - return ConfigureSlaves(interp, tkwin, objc-1, objv+1); + return ConfigureContent(interp, tkwin, objc-1, objv+1); } } if (objc < 3) { @@ -372,7 +372,7 @@ Tk_GridObjCmd( case GRID_BBOX: return GridBboxCommand(tkwin, interp, objc, objv); case GRID_CONFIGURE: - return ConfigureSlaves(interp, tkwin, objc-2, objv+2); + return ConfigureContent(interp, tkwin, objc-2, objv+2); case GRID_FORGET: case GRID_REMOVE: return GridForgetRemoveCommand(tkwin, interp, objc, objv); @@ -386,15 +386,15 @@ Tk_GridObjCmd( return GridSizeCommand(tkwin, interp, objc, objv); case GRID_CONTENT: case GRID_SLAVES: - return GridSlavesCommand(tkwin, interp, objc, objv); + return GridContentCommand(tkwin, interp, objc, objv); /* * Sample argument combinations: - * grid columnconfigure <master> <index> -option - * grid columnconfigure <master> <index> -option value -option value - * grid rowconfigure <master> <index> - * grid rowconfigure <master> <index> -option - * grid rowconfigure <master> <index> -option value -option value. + * grid columnconfigure <container> <index> -option + * grid columnconfigure <container> <index> -option value -option value + * grid rowconfigure <container> <index> + * grid rowconfigure <container> <index> -option + * grid rowconfigure <container> <index> -option value -option value. */ case GRID_COLUMNCONFIGURE: @@ -432,9 +432,9 @@ GridAnchorCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; - GridMaster *gridPtr; + Tk_Window container; + Gridder *containerPtr; + GridContainer *gridPtr; Tk_Anchor old; if (objc > 4) { @@ -442,21 +442,21 @@ GridAnchorCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); if (objc == 3) { - gridPtr = masterPtr->masterDataPtr; + gridPtr = containerPtr->containerDataPtr; Tcl_SetObjResult(interp, Tcl_NewStringObj( Tk_NameOfAnchor(gridPtr?gridPtr->anchor:GRID_DEFAULT_ANCHOR), -1)); return TCL_OK; } - InitMasterData(masterPtr); - gridPtr = masterPtr->masterDataPtr; + InitContainerData(containerPtr); + gridPtr = containerPtr->containerDataPtr; old = gridPtr->anchor; if (Tk_GetAnchorFromObj(interp, objv[3], &gridPtr->anchor) != TCL_OK) { return TCL_ERROR; @@ -467,12 +467,12 @@ GridAnchorCommand( */ if (old != gridPtr->anchor) { - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } } return TCL_OK; @@ -501,9 +501,9 @@ GridBboxCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; /* master grid record */ - GridMaster *gridPtr; /* pointer to grid data */ + Tk_Window container; + Gridder *containerPtr; /* container grid record */ + GridContainer *gridPtr; /* pointer to grid data */ int row, column; /* origin for bounding box */ int row2, column2; /* end of bounding box */ int endX, endY; /* last column/row in the layout */ @@ -515,10 +515,10 @@ GridBboxCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); if (objc >= 5) { if (Tcl_GetIntFromObj(interp, objv[3], &column) != TCL_OK) { @@ -540,13 +540,13 @@ GridBboxCommand( } } - gridPtr = masterPtr->masterDataPtr; + gridPtr = containerPtr->containerDataPtr; if (gridPtr == NULL) { Tcl_SetObjResult(interp, NewQuadObj(0, 0, 0, 0)); return TCL_OK; } - SetGridSize(masterPtr); + SetGridSize(containerPtr); endX = MAX(gridPtr->columnEnd, gridPtr->columnMax); endY = MAX(gridPtr->rowEnd, gridPtr->rowMax); @@ -631,67 +631,67 @@ GridForgetRemoveCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window slave; - Gridder *slavePtr; + Tk_Window content; + Gridder *contentPtr; int i; const char *string = Tcl_GetString(objv[1]); char c = string[0]; for (i = 2; i < objc; i++) { - if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) { return TCL_ERROR; } - slavePtr = GetGrid(slave); - if (slavePtr->masterPtr != NULL) { + contentPtr = GetGrid(content); + if (contentPtr->containerPtr != NULL) { /* * For "forget", reset all the settings to their defaults */ if (c == 'f') { - slavePtr->column = -1; - slavePtr->row = -1; - slavePtr->numCols = 1; - slavePtr->numRows = 1; - slavePtr->padX = 0; - slavePtr->padY = 0; - slavePtr->padLeft = 0; - slavePtr->padTop = 0; - slavePtr->iPadX = 0; - slavePtr->iPadY = 0; - if (slavePtr->in != NULL) { - Tcl_DecrRefCount(slavePtr->in); - slavePtr->in = NULL; + contentPtr->column = -1; + contentPtr->row = -1; + contentPtr->numCols = 1; + contentPtr->numRows = 1; + contentPtr->padX = 0; + contentPtr->padY = 0; + contentPtr->padLeft = 0; + contentPtr->padTop = 0; + contentPtr->iPadX = 0; + contentPtr->iPadY = 0; + if (contentPtr->in != NULL) { + Tcl_DecrRefCount(contentPtr->in); + contentPtr->in = NULL; } - slavePtr->doubleBw = 2*Tk_Changes(tkwin)->border_width; - if (slavePtr->flags & REQUESTED_RELAYOUT) { - Tcl_CancelIdleCall(ArrangeGrid, slavePtr); + contentPtr->doubleBw = 2*Tk_Changes(tkwin)->border_width; + if (contentPtr->flags & REQUESTED_RELAYOUT) { + Tcl_CancelIdleCall(ArrangeGrid, contentPtr); } - slavePtr->flags = 0; - slavePtr->sticky = 0; + contentPtr->flags = 0; + contentPtr->sticky = 0; } else { /* - * When removing, store name of master to be able to - * restore it later, even if the master is recreated. + * When removing, store name of container to be able to + * restore it later, even if the container is recreated. */ - if (slavePtr->in != NULL) { - Tcl_DecrRefCount(slavePtr->in); - slavePtr->in = NULL; + if (contentPtr->in != NULL) { + Tcl_DecrRefCount(contentPtr->in); + contentPtr->in = NULL; } - if (slavePtr->masterPtr != NULL) { - slavePtr->in = Tcl_NewStringObj( - Tk_PathName(slavePtr->masterPtr->tkwin), -1); - Tcl_IncrRefCount(slavePtr->in); + if (contentPtr->containerPtr != NULL) { + contentPtr->in = Tcl_NewStringObj( + Tk_PathName(contentPtr->containerPtr->tkwin), -1); + Tcl_IncrRefCount(contentPtr->in); } } - Tk_ManageGeometry(slave, NULL, NULL); - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->masterPtr->tkwin); + Tk_ManageGeometry(content, NULL, NULL); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, + contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } } return TCL_OK; @@ -721,40 +721,40 @@ GridInfoCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Gridder *slavePtr; - Tk_Window slave; + Gridder *contentPtr; + Tk_Window content; Tcl_Obj *infoObj; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) { return TCL_ERROR; } - slavePtr = GetGrid(slave); - if (slavePtr->masterPtr == NULL) { + contentPtr = GetGrid(content); + if (contentPtr->containerPtr == NULL) { Tcl_ResetResult(interp); return TCL_OK; } infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), - TkNewWindowObj(slavePtr->masterPtr->tkwin)); + TkNewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1), - Tcl_NewIntObj(slavePtr->column)); + Tcl_NewIntObj(contentPtr->column)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1), - Tcl_NewIntObj(slavePtr->row)); + Tcl_NewIntObj(contentPtr->row)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", -1), - Tcl_NewIntObj(slavePtr->numCols)); + Tcl_NewIntObj(contentPtr->numCols)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", -1), - Tcl_NewIntObj(slavePtr->numRows)); - TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX); - TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY); - TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft, slavePtr->padX); - TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY); + Tcl_NewIntObj(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), - StickyToObj(slavePtr->sticky)); + StickyToObj(contentPtr->sticky)); Tcl_SetObjResult(interp, infoObj); return TCL_OK; } @@ -783,11 +783,11 @@ GridLocationCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; /* Master grid record. */ - GridMaster *gridPtr; /* Pointer to grid data. */ - register SlotInfo *slotPtr; - int x, y; /* Offset in pixels, from edge of master. */ + Tk_Window container; + Gridder *containerPtr; /* Container grid record. */ + GridContainer *gridPtr; /* Pointer to grid data. */ + SlotInfo *slotPtr; + int x, y; /* Offset in pixels, from edge of container. */ int i, j; /* Corresponding column and row indeces. */ int endX, endY; /* End of grid. */ @@ -796,23 +796,23 @@ GridLocationCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - if (Tk_GetPixelsFromObj(interp, master, objv[3], &x) != TCL_OK) { + if (Tk_GetPixelsFromObj(interp, container, objv[3], &x) != TCL_OK) { return TCL_ERROR; } - if (Tk_GetPixelsFromObj(interp, master, objv[4], &y) != TCL_OK) { + if (Tk_GetPixelsFromObj(interp, container, objv[4], &y) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); - if (masterPtr->masterDataPtr == NULL) { + containerPtr = GetGrid(container); + if (containerPtr->containerDataPtr == NULL) { Tcl_SetObjResult(interp, NewPairObj(-1, -1)); return TCL_OK; } - gridPtr = masterPtr->masterDataPtr; + gridPtr = containerPtr->containerDataPtr; /* * Update any pending requests. This is not always the steady state value, @@ -820,29 +820,29 @@ GridLocationCommand( * its easy to get. */ - while (masterPtr->flags & REQUESTED_RELAYOUT) { - Tcl_CancelIdleCall(ArrangeGrid, masterPtr); - ArrangeGrid(masterPtr); + while (containerPtr->flags & REQUESTED_RELAYOUT) { + Tcl_CancelIdleCall(ArrangeGrid, containerPtr); + ArrangeGrid(containerPtr); } - SetGridSize(masterPtr); + SetGridSize(containerPtr); endX = MAX(gridPtr->columnEnd, gridPtr->columnMax); endY = MAX(gridPtr->rowEnd, gridPtr->rowMax); - slotPtr = masterPtr->masterDataPtr->columnPtr; - if (x < masterPtr->masterDataPtr->startX) { + slotPtr = containerPtr->containerDataPtr->columnPtr; + if (x < containerPtr->containerDataPtr->startX) { i = -1; } else { - x -= masterPtr->masterDataPtr->startX; + x -= containerPtr->containerDataPtr->startX; for (i = 0; slotPtr[i].offset < x && i < endX; i++) { /* null body */ } } - slotPtr = masterPtr->masterDataPtr->rowPtr; - if (y < masterPtr->masterDataPtr->startY) { + slotPtr = containerPtr->containerDataPtr->rowPtr; + if (y < containerPtr->containerDataPtr->startY) { j = -1; } else { - y -= masterPtr->masterDataPtr->startY; + y -= containerPtr->containerDataPtr->startY; for (j = 0; slotPtr[j].offset < y && j < endY; j++) { /* null body */ } @@ -876,8 +876,8 @@ GridPropagateCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; + Tk_Window container; + Gridder *containerPtr; int propagate, old; if (objc > 4) { @@ -885,13 +885,13 @@ GridPropagateCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); if (objc == 3) { Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(!(masterPtr->flags & DONT_PROPAGATE))); + Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE))); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) { @@ -902,39 +902,39 @@ GridPropagateCommand( * Only request a relayout if the propagation bit changes. */ - old = !(masterPtr->flags & DONT_PROPAGATE); + old = !(containerPtr->flags & DONT_PROPAGATE); if (propagate != old) { if (propagate) { /* - * If we have slaves, we need to register as geometry master. + * If we have content, we need to register as geometry container. */ - if (masterPtr->slavePtr != NULL) { - if (TkSetGeometryMaster(interp, master, "grid") != TCL_OK) { + if (containerPtr->contentPtr != NULL) { + if (TkSetGeometryContainer(interp, container, "grid") != TCL_OK) { return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } - masterPtr->flags &= ~DONT_PROPAGATE; + containerPtr->flags &= ~DONT_PROPAGATE; } else { - if (masterPtr->flags & ALLOCED_MASTER) { - TkFreeGeometryMaster(master, "grid"); - masterPtr->flags &= ~ALLOCED_MASTER; + if (containerPtr->flags & ALLOCED_CONTAINER) { + TkFreeGeometryContainer(container, "grid"); + containerPtr->flags &= ~ALLOCED_CONTAINER; } - masterPtr->flags |= DONT_PROPAGATE; + containerPtr->flags |= DONT_PROPAGATE; } /* - * Re-arrange the master to allow new geometry information to - * propagate upwards to the master's master. + * Re-arrange the container to allow new geometry information to + * propagate upwards to the container's container. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } } return TCL_OK; @@ -964,8 +964,8 @@ GridRowColumnConfigureCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master, slave; - Gridder *masterPtr, *slavePtr; + Tk_Window container, content; + Gridder *containerPtr, *contentPtr; SlotInfo *slotPtr = NULL; int slot; /* the column or row number */ int slotType; /* COLUMN or ROW */ @@ -989,7 +989,7 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } @@ -1010,9 +1010,9 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } - masterPtr = GetGrid(master); - first = 0; /* lint */ - last = 0; /* lint */ + containerPtr = GetGrid(container); + first = 0; + last = 0; if ((objc == 4) || (objc == 5)) { if (lObjc != 1) { @@ -1030,11 +1030,11 @@ GridRowColumnConfigureCommand( Tcl_DecrRefCount(listCopy); return TCL_ERROR; } - ok = CheckSlotData(masterPtr, slot, slotType, /* checkOnly */ 1); + ok = CheckSlotData(containerPtr, slot, slotType, /* checkOnly */ 1); if (ok == TCL_OK) { slotPtr = (slotType == COLUMN) ? - masterPtr->masterDataPtr->columnPtr : - masterPtr->masterDataPtr->rowPtr; + containerPtr->containerDataPtr->columnPtr : + containerPtr->containerDataPtr->rowPtr; } /* @@ -1102,32 +1102,32 @@ GridRowColumnConfigureCommand( } for (j = 0; j < lObjc; j++) { - int allSlaves = 0; + int allContent = 0; if (Tcl_GetIntFromObj(NULL, lObjv[j], &slot) == TCL_OK) { first = slot; last = slot; - slavePtr = NULL; + contentPtr = NULL; } else if (strcmp(Tcl_GetString(lObjv[j]), "all") == 0) { /* - * Make sure master is initialised. + * Make sure container is initialised. */ - InitMasterData(masterPtr); + InitContainerData(containerPtr); - slavePtr = masterPtr->slavePtr; - if (slavePtr == NULL) { + contentPtr = containerPtr->contentPtr; + if (contentPtr == NULL) { continue; } - allSlaves = 1; - } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &slave) + allContent = 1; + } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &content) == TCL_OK) { /* - * Is it gridded in this master? + * Is it gridded in this container? */ - slavePtr = GetGrid(slave); - if (slavePtr->masterPtr != masterPtr) { + contentPtr = GetGrid(content); + if (contentPtr->containerPtr != containerPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the window \"%s\" is not managed by \"%s\"", Tcl_GetString(lObjv[j]), Tcl_GetString(objv[2]))); @@ -1148,15 +1148,15 @@ GridRowColumnConfigureCommand( */ do { - if (slavePtr != NULL) { + if (contentPtr != NULL) { first = (slotType == COLUMN) ? - slavePtr->column : slavePtr->row; + contentPtr->column : contentPtr->row; last = first - 1 + ((slotType == COLUMN) ? - slavePtr->numCols : slavePtr->numRows); + contentPtr->numCols : contentPtr->numRows); } for (slot = first; slot <= last; slot++) { - ok = CheckSlotData(masterPtr, slot, slotType, /*checkOnly*/ 0); + ok = CheckSlotData(containerPtr, slot, slotType, /*checkOnly*/ 0); if (ok != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "\"%s\" is out of range", @@ -1167,8 +1167,8 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } slotPtr = (slotType == COLUMN) ? - masterPtr->masterDataPtr->columnPtr : - masterPtr->masterDataPtr->rowPtr; + containerPtr->containerDataPtr->columnPtr : + containerPtr->containerDataPtr->rowPtr; /* * Loop through each option value pair, setting the values as @@ -1182,7 +1182,7 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } if (index == ROWCOL_MINSIZE) { - if (Tk_GetPixelsFromObj(interp, master, objv[i+1], + if (Tk_GetPixelsFromObj(interp, container, objv[i+1], &size) != TCL_OK) { Tcl_DecrRefCount(listCopy); return TCL_ERROR; @@ -1209,7 +1209,7 @@ GridRowColumnConfigureCommand( slotPtr[slot].uniform = NULL; } } else if (index == ROWCOL_PAD) { - if (Tk_GetPixelsFromObj(interp, master, objv[i+1], + if (Tk_GetPixelsFromObj(interp, container, objv[i+1], &size) != TCL_OK) { Tcl_DecrRefCount(listCopy); return TCL_ERROR; @@ -1222,10 +1222,10 @@ GridRowColumnConfigureCommand( } } } - if (slavePtr != NULL) { - slavePtr = slavePtr->nextPtr; + if (contentPtr != NULL) { + contentPtr = contentPtr->nextPtr; } - } while ((allSlaves == 1) && (slavePtr != NULL)); + } while ((allContent == 1) && (contentPtr != NULL)); } Tcl_DecrRefCount(listCopy); @@ -1236,32 +1236,32 @@ GridRowColumnConfigureCommand( if (slotPtr != NULL) { if (slotType == ROW) { - int last = masterPtr->masterDataPtr->rowMax - 1; + int last = containerPtr->containerDataPtr->rowMax - 1; while ((last >= 0) && (slotPtr[last].weight == 0) && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0) && (slotPtr[last].uniform == NULL)) { last--; } - masterPtr->masterDataPtr->rowMax = last+1; + containerPtr->containerDataPtr->rowMax = last+1; } else { - int last = masterPtr->masterDataPtr->columnMax - 1; + int last = containerPtr->containerDataPtr->columnMax - 1; while ((last >= 0) && (slotPtr[last].weight == 0) && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0) && (slotPtr[last].uniform == NULL)) { last--; } - masterPtr->masterDataPtr->columnMax = last + 1; + containerPtr->containerDataPtr->columnMax = last + 1; } } - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } return TCL_OK; @@ -1297,23 +1297,23 @@ GridSizeCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; - GridMaster *gridPtr; /* pointer to grid data */ + Tk_Window container; + Gridder *containerPtr; + GridContainer *gridPtr; /* pointer to grid data */ if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); - if (masterPtr->masterDataPtr != NULL) { - SetGridSize(masterPtr); - gridPtr = masterPtr->masterDataPtr; + if (containerPtr->containerDataPtr != NULL) { + SetGridSize(containerPtr); + gridPtr = containerPtr->containerDataPtr; Tcl_SetObjResult(interp, NewPairObj( MAX(gridPtr->columnEnd, gridPtr->columnMax), MAX(gridPtr->rowEnd, gridPtr->rowMax))); @@ -1326,37 +1326,37 @@ GridSizeCommand( /* *---------------------------------------------------------------------- * - * GridSlavesCommand -- + * GridContentCommand -- * - * Implementation of the [grid slaves] subcommand. See the user + * Implementation of the [grid content] subcommand. See the user * documentation for details on what it does. * * Results: * Standard Tcl result. * * Side effects: - * Places a list of slaves of the specified window in the interpreter's - * result field. + * Places a list of content windows of the specified window in the + * interpreter's result field. * *---------------------------------------------------------------------- */ static int -GridSlavesCommand( +GridContentCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; /* master grid record */ - Gridder *slavePtr; + Tk_Window container; + Gridder *containerPtr; /* container grid record */ + Gridder *contentPtr; int i, value, index; int row = -1, column = -1; static const char *const optionStrings[] = { "-column", "-row", NULL }; - enum options { SLAVES_COLUMN, SLAVES_ROW }; + enum options { CONTENT_COLUMN, CONTENT_ROW }; Tcl_Obj *res; if ((objc < 3) || ((objc % 2) == 0)) { @@ -1378,30 +1378,30 @@ GridSlavesCommand( Tcl_SetErrorCode(interp, "TK", "GRID", "NEG_INDEX", NULL); return TCL_ERROR; } - if (index == SLAVES_COLUMN) { + if (index == CONTENT_COLUMN) { column = value; } else { row = value; } } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); res = Tcl_NewListObj(0, NULL); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - if ((column >= 0) && (slavePtr->column > column - || slavePtr->column+slavePtr->numCols-1 < column)) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + if ((column >= 0) && (contentPtr->column > column + || contentPtr->column+contentPtr->numCols-1 < column)) { continue; } - if ((row >= 0) && (slavePtr->row > row || - slavePtr->row+slavePtr->numRows-1 < row)) { + if ((row >= 0) && (contentPtr->row > row || + contentPtr->row+contentPtr->numRows-1 < row)) { continue; } - Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(slavePtr->tkwin)); + Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, res); return TCL_OK; @@ -1429,12 +1429,12 @@ static void GridReqProc( ClientData clientData, /* Grid's information about window that got * new preferred geometry. */ - Tk_Window tkwin) /* Other Tk-related information about the + TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ { - register Gridder *gridPtr = clientData; + Gridder *gridPtr = (Gridder *)clientData; - gridPtr = gridPtr->masterPtr; + gridPtr = gridPtr->containerPtr; if (gridPtr && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr); @@ -1444,33 +1444,33 @@ GridReqProc( /* *---------------------------------------------------------------------- * - * GridLostSlaveProc -- + * GridLostContentProc -- * * This procedure is invoked by Tk whenever some other geometry claims - * control over a slave that used to be managed by us. + * control over a content that used to be managed by us. * * Results: * None. * * Side effects: - * Forgets all grid-related information about the slave. + * Forgets all grid-related information about the content. * *---------------------------------------------------------------------- */ static void -GridLostSlaveProc( - ClientData clientData, /* Grid structure for slave window that was +GridLostContentProc( + ClientData clientData, /* Grid structure for content window that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */ { - register Gridder *slavePtr = clientData; + Gridder *contentPtr = (Gridder *)clientData; - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } /* @@ -1497,9 +1497,9 @@ static int AdjustOffsets( int size, /* The total layout size (in pixels). */ int slots, /* Number of slots. */ - register SlotInfo *slotPtr) /* Pointer to slot array. */ + SlotInfo *slotPtr) /* Pointer to slot array. */ { - register int slot; /* Current slot. */ + int 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. */ @@ -1644,12 +1644,12 @@ AdjustOffsets( * * AdjustForSticky -- * - * This procedure adjusts the size of a slave in its cavity based on its + * This procedure adjusts the size of a content in its cavity based on its * "sticky" flags. * * Results: * The input x, y, width, and height are changed to represent the desired - * coordinates of the slave. + * coordinates of the content. * * Side effects: * None. @@ -1659,29 +1659,29 @@ AdjustOffsets( static void AdjustForSticky( - Gridder *slavePtr, /* Slave window to arrange in its cavity. */ + Gridder *contentPtr, /* Content window to arrange in its cavity. */ int *xPtr, /* Pixel location of the left edge of the cavity. */ int *yPtr, /* Pixel location of the top edge of the cavity. */ int *widthPtr, /* Width of the cavity (in pixels). */ int *heightPtr) /* Height of the cavity (in pixels). */ { - int diffx = 0; /* Cavity width - slave width. */ - int diffy = 0; /* Cavity hight - slave height. */ - int sticky = slavePtr->sticky; + int diffx = 0; /* Cavity width - content width. */ + int diffy = 0; /* Cavity hight - content height. */ + int sticky = contentPtr->sticky; - *xPtr += slavePtr->padLeft; - *widthPtr -= slavePtr->padX; - *yPtr += slavePtr->padTop; - *heightPtr -= slavePtr->padY; + *xPtr += contentPtr->padLeft; + *widthPtr -= contentPtr->padX; + *yPtr += contentPtr->padTop; + *heightPtr -= contentPtr->padY; - if (*widthPtr > (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX)) { - diffx = *widthPtr - (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX); - *widthPtr = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX; + if (*widthPtr > (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX)) { + diffx = *widthPtr - (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX); + *widthPtr = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX; } - if (*heightPtr > (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY)) { - diffy = *heightPtr - (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY); - *heightPtr = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY; + if (*heightPtr > (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY)) { + diffy = *heightPtr - (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY); + *heightPtr = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY; } if (sticky&STICK_EAST && sticky&STICK_WEST) { @@ -1712,38 +1712,38 @@ AdjustForSticky( * None. * * Side effects: - * The slaves of masterPtr may get resized or moved. + * The content of containerPtr may get resized or moved. * *---------------------------------------------------------------------- */ static void ArrangeGrid( - ClientData clientData) /* Structure describing master whose slaves + ClientData clientData) /* Structure describing container whose content * are to be re-layed out. */ { - register Gridder *masterPtr = clientData; - register Gridder *slavePtr; - GridMaster *slotPtr = masterPtr->masterDataPtr; + Gridder *containerPtr = (Gridder *)clientData; + Gridder *contentPtr; + GridContainer *slotPtr = containerPtr->containerDataPtr; int abort; int width, height; /* Requested size of layout, in pixels. */ int realWidth, realHeight; /* Actual size layout should take-up. */ int usedX, usedY; - masterPtr->flags &= ~REQUESTED_RELAYOUT; + containerPtr->flags &= ~REQUESTED_RELAYOUT; /* - * If the master has no slaves anymore, then don't do anything at all: - * just leave the master's size as-is. Otherwise there is no way to - * "relinquish" control over the master so another geometry manager can + * If the container has no content anymore, then don't do anything at all: + * just leave the container's size as-is. Otherwise there is no way to + * "relinquish" control over the container so another geometry manager can * take over. */ - if (masterPtr->slavePtr == NULL) { + if (containerPtr->contentPtr == NULL) { return; } - if (masterPtr->masterDataPtr == NULL) { + if (containerPtr->containerDataPtr == NULL) { return; } @@ -1753,128 +1753,128 @@ ArrangeGrid( * necessary. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - masterPtr->abortPtr = &abort; + containerPtr->abortPtr = &abort; abort = 0; - Tcl_Preserve(masterPtr); + Tcl_Preserve(containerPtr); /* * Call the constraint engine to fill in the row and column offsets. */ - SetGridSize(masterPtr); - width = ResolveConstraints(masterPtr, COLUMN, 0); - height = ResolveConstraints(masterPtr, ROW, 0); - width += Tk_InternalBorderLeft(masterPtr->tkwin) + - Tk_InternalBorderRight(masterPtr->tkwin); - height += Tk_InternalBorderTop(masterPtr->tkwin) + - Tk_InternalBorderBottom(masterPtr->tkwin); + SetGridSize(containerPtr); + width = ResolveConstraints(containerPtr, COLUMN, 0); + height = ResolveConstraints(containerPtr, ROW, 0); + width += Tk_InternalBorderLeft(containerPtr->tkwin) + + Tk_InternalBorderRight(containerPtr->tkwin); + height += Tk_InternalBorderTop(containerPtr->tkwin) + + Tk_InternalBorderBottom(containerPtr->tkwin); - if (width < Tk_MinReqWidth(masterPtr->tkwin)) { - width = Tk_MinReqWidth(masterPtr->tkwin); + if (width < Tk_MinReqWidth(containerPtr->tkwin)) { + width = Tk_MinReqWidth(containerPtr->tkwin); } - if (height < Tk_MinReqHeight(masterPtr->tkwin)) { - height = Tk_MinReqHeight(masterPtr->tkwin); + if (height < Tk_MinReqHeight(containerPtr->tkwin)) { + height = Tk_MinReqHeight(containerPtr->tkwin); } - if (((width != Tk_ReqWidth(masterPtr->tkwin)) - || (height != Tk_ReqHeight(masterPtr->tkwin))) - && !(masterPtr->flags & DONT_PROPAGATE)) { - Tk_GeometryRequest(masterPtr->tkwin, width, height); + if (((width != Tk_ReqWidth(containerPtr->tkwin)) + || (height != Tk_ReqHeight(containerPtr->tkwin))) + && !(containerPtr->flags & DONT_PROPAGATE)) { + Tk_GeometryRequest(containerPtr->tkwin, width, height); if (width>1 && height>1) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } - masterPtr->abortPtr = NULL; - Tcl_Release(masterPtr); + containerPtr->abortPtr = NULL; + Tcl_Release(containerPtr); return; } /* - * If the currently requested layout size doesn't match the master's + * If the currently requested layout size doesn't match the container's * window size, then adjust the slot offsets according to the weights. If * all of the weights are zero, place the layout according to the anchor * value. */ - realWidth = Tk_Width(masterPtr->tkwin) - - Tk_InternalBorderLeft(masterPtr->tkwin) - - Tk_InternalBorderRight(masterPtr->tkwin); - realHeight = Tk_Height(masterPtr->tkwin) - - Tk_InternalBorderTop(masterPtr->tkwin) - - Tk_InternalBorderBottom(masterPtr->tkwin); + realWidth = Tk_Width(containerPtr->tkwin) - + Tk_InternalBorderLeft(containerPtr->tkwin) - + Tk_InternalBorderRight(containerPtr->tkwin); + realHeight = Tk_Height(containerPtr->tkwin) - + Tk_InternalBorderTop(containerPtr->tkwin) - + Tk_InternalBorderBottom(containerPtr->tkwin); usedX = AdjustOffsets(realWidth, MAX(slotPtr->columnEnd, slotPtr->columnMax), slotPtr->columnPtr); usedY = AdjustOffsets(realHeight, MAX(slotPtr->rowEnd, slotPtr->rowMax), slotPtr->rowPtr); - TkComputeAnchor(masterPtr->masterDataPtr->anchor, masterPtr->tkwin, + TkComputeAnchor(containerPtr->containerDataPtr->anchor, containerPtr->tkwin, 0, 0, usedX, usedY, &slotPtr->startX, &slotPtr->startY); /* - * Now adjust the actual size of the slave to its cavity by computing the + * Now adjust the actual size of the content to its cavity by computing the * cavity size, and adjusting the widget according to its stickyness. */ - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort; - slavePtr = slavePtr->nextPtr) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort; + contentPtr = contentPtr->nextPtr) { int x, y; /* Top left coordinate */ - int width, height; /* Slot or slave size */ - int col = slavePtr->column; - int row = slavePtr->row; + int width, height; /* Slot or content size */ + int col = contentPtr->column; + int row = contentPtr->row; x = (col>0) ? slotPtr->columnPtr[col-1].offset : 0; y = (row>0) ? slotPtr->rowPtr[row-1].offset : 0; - width = slotPtr->columnPtr[slavePtr->numCols+col-1].offset - x; - height = slotPtr->rowPtr[slavePtr->numRows+row-1].offset - y; + width = slotPtr->columnPtr[contentPtr->numCols+col-1].offset - x; + height = slotPtr->rowPtr[contentPtr->numRows+row-1].offset - y; x += slotPtr->startX; y += slotPtr->startY; - AdjustForSticky(slavePtr, &x, &y, &width, &height); + AdjustForSticky(contentPtr, &x, &y, &width, &height); /* * Now put the window in the proper spot. (This was taken directly - * from tkPack.c.) If the slave is a child of the master, then do this + * from tkPack.c.) If the content is a child of the container, then do this * here. Otherwise let Tk_MaintainGeometry do the work. */ - if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { + if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) { if ((width <= 0) || (height <= 0)) { - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - if ((x != Tk_X(slavePtr->tkwin)) - || (y != Tk_Y(slavePtr->tkwin)) - || (width != Tk_Width(slavePtr->tkwin)) - || (height != Tk_Height(slavePtr->tkwin))) { - Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height); + if ((x != Tk_X(contentPtr->tkwin)) + || (y != Tk_Y(contentPtr->tkwin)) + || (width != Tk_Width(contentPtr->tkwin)) + || (height != Tk_Height(contentPtr->tkwin))) { + Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height); } if (abort) { break; } /* - * Don't map the slave if the master isn't mapped: wait until - * the master gets mapped later. + * Don't map the content if the container isn't mapped: wait until + * the container gets mapped later. */ - if (Tk_IsMapped(masterPtr->tkwin)) { - Tk_MapWindow(slavePtr->tkwin); + if (Tk_IsMapped(containerPtr->tkwin)) { + Tk_MapWindow(contentPtr->tkwin); } } } else if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin); - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, x, y, + Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y, width, height); } } - masterPtr->abortPtr = NULL; - Tcl_Release(masterPtr); + containerPtr->abortPtr = NULL; + Tcl_Release(containerPtr); } /* @@ -1892,20 +1892,20 @@ ArrangeGrid( * * Side effects: * The slot offsets are copied into the SlotInfo structure for the - * geometry master. + * geometry container. * *---------------------------------------------------------------------- */ static int ResolveConstraints( - Gridder *masterPtr, /* The geometry master for this grid. */ + Gridder *containerPtr, /* The geometry container for this grid. */ int slotType, /* Either ROW or COLUMN. */ int maxOffset) /* The actual maximum size of this layout in * pixels, or 0 (not currently used). */ { - register SlotInfo *slotPtr; /* Pointer to row/col constraints. */ - register Gridder *slavePtr; /* List of slave windows in this grid. */ + SlotInfo *slotPtr; /* Pointer to row/col constraints. */ + Gridder *contentPtr; /* List of content windows in this grid. */ int constraintCount; /* Count of rows or columns that have * constraints. */ int slotCount; /* Last occupied row or column. */ @@ -1914,7 +1914,7 @@ ResolveConstraints( GridLayout *layoutPtr; /* Temporary layout structure. */ int requiredSize; /* The natural size of the grid (pixels). * This is the minimum size needed to - * accommodate all of the slaves at their + * accommodate all of the content at their * requested sizes. */ int offset; /* The pixel offset of the right edge of the * current slot from the beginning of the @@ -1942,13 +1942,13 @@ ResolveConstraints( GridLayout layoutData[TYPICAL_SIZE + 1]; if (slotType == COLUMN) { - constraintCount = masterPtr->masterDataPtr->columnMax; - slotCount = masterPtr->masterDataPtr->columnEnd; - slotPtr = masterPtr->masterDataPtr->columnPtr; + constraintCount = containerPtr->containerDataPtr->columnMax; + slotCount = containerPtr->containerDataPtr->columnEnd; + slotPtr = containerPtr->containerDataPtr->columnPtr; } else { - constraintCount = masterPtr->masterDataPtr->rowMax; - slotCount = masterPtr->masterDataPtr->rowEnd; - slotPtr = masterPtr->masterDataPtr->rowPtr; + constraintCount = containerPtr->containerDataPtr->rowMax; + slotCount = containerPtr->containerDataPtr->rowEnd; + slotPtr = containerPtr->containerDataPtr->rowPtr; } /* @@ -1957,7 +1957,7 @@ ResolveConstraints( gridCount = MAX(constraintCount, slotCount); if (gridCount >= TYPICAL_SIZE) { - layoutPtr = ckalloc(sizeof(GridLayout) * (1+gridCount)); + layoutPtr = (GridLayout *)ckalloc(sizeof(GridLayout) * (1+gridCount)); } else { layoutPtr = layoutData; } @@ -1998,29 +1998,29 @@ ResolveConstraints( /* * Step 2. - * Slaves with a span of 1 are used to determine the minimum size of each - * slot. Slaves whose span is two or more slots don't contribute to the + * Content with a span of 1 are used to determine the minimum size of each + * slot. Content whose span is two or more slots don't contribute to the * minimum size of each slot directly, but can cause slots to grow if * their size exceeds the the sizes of the slots they span. * - * Bin all slaves whose spans are > 1 by their right edges. This allows + * Bin all content whose spans are > 1 by their right edges. This allows * the computation on minimum and maximum possible layout sizes at each - * slot boundary, without the need to re-sort the slaves. + * slot boundary, without the need to re-sort the content. */ switch (slotType) { case COLUMN: - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - int rightEdge = slavePtr->column + slavePtr->numCols - 1; - - slavePtr->size = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->padX - + slavePtr->iPadX + slavePtr->doubleBw; - if (slavePtr->numCols > 1) { - slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; - layoutPtr[rightEdge].binNextPtr = slavePtr; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + int rightEdge = contentPtr->column + contentPtr->numCols - 1; + + contentPtr->size = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->padX + + contentPtr->iPadX + contentPtr->doubleBw; + if (contentPtr->numCols > 1) { + contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; + layoutPtr[rightEdge].binNextPtr = contentPtr; } else if (rightEdge >= 0) { - int size = slavePtr->size + layoutPtr[rightEdge].pad; + int size = contentPtr->size + layoutPtr[rightEdge].pad; if (size > layoutPtr[rightEdge].minSize) { layoutPtr[rightEdge].minSize = size; @@ -2029,17 +2029,17 @@ ResolveConstraints( } break; case ROW: - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - int rightEdge = slavePtr->row + slavePtr->numRows - 1; - - slavePtr->size = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->padY - + slavePtr->iPadY + slavePtr->doubleBw; - if (slavePtr->numRows > 1) { - slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; - layoutPtr[rightEdge].binNextPtr = slavePtr; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + int rightEdge = contentPtr->row + contentPtr->numRows - 1; + + contentPtr->size = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->padY + + contentPtr->iPadY + contentPtr->doubleBw; + if (contentPtr->numRows > 1) { + contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; + layoutPtr[rightEdge].binNextPtr = contentPtr; } else if (rightEdge >= 0) { - int size = slavePtr->size + layoutPtr[rightEdge].pad; + int size = contentPtr->size + layoutPtr[rightEdge].pad; if (size > layoutPtr[rightEdge].minSize) { layoutPtr[rightEdge].minSize = size; @@ -2079,7 +2079,7 @@ ResolveConstraints( * sizeof(UniformGroup); size_t newSize = (uniformGroupsAlloced + UNIFORM_PREALLOC) * sizeof(UniformGroup); - UniformGroup *newUG = ckalloc(newSize); + UniformGroup *newUG = (UniformGroup *)ckalloc(newSize); UniformGroup *oldUG = uniformGroupPtr; memcpy(newUG, oldUG, oldSize); @@ -2130,16 +2130,16 @@ ResolveConstraints( /* * Step 3. * Determine the minimum slot offsets going from left to right that would - * fit all of the slaves. This determines the minimum + * fit all of the content. This determines the minimum */ for (offset=0,slot=0; slot < gridCount; slot++) { layoutPtr[slot].minOffset = layoutPtr[slot].minSize + offset; - for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL; - slavePtr = slavePtr->binNextPtr) { + for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL; + contentPtr = contentPtr->binNextPtr) { int span = (slotType == COLUMN) ? - slavePtr->numCols : slavePtr->numRows; - int required = slavePtr->size + layoutPtr[slot - span].minOffset; + contentPtr->numCols : contentPtr->numRows; + int required = contentPtr->size + layoutPtr[slot - span].minOffset; if (required > layoutPtr[slot].minOffset) { layoutPtr[slot].minOffset = required; @@ -2150,7 +2150,7 @@ ResolveConstraints( /* * At this point, we know the minimum required size of the entire layout. - * It might be prudent to stop here if our "master" will resize itself to + * It might be prudent to stop here if our "container" will resize itself to * this size. */ @@ -2171,11 +2171,11 @@ ResolveConstraints( layoutPtr[slot].maxOffset = offset; } for (slot=gridCount-1; slot > 0;) { - for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL; - slavePtr = slavePtr->binNextPtr) { + for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL; + contentPtr = contentPtr->binNextPtr) { int span = (slotType == COLUMN) ? - slavePtr->numCols : slavePtr->numRows; - int require = offset - slavePtr->size; + contentPtr->numCols : contentPtr->numRows; + int require = offset - contentPtr->size; int startSlot = slot - span; if (startSlot >=0 && require < layoutPtr[startSlot].maxOffset) { @@ -2385,7 +2385,7 @@ ResolveConstraints( /* * Step 6. * All of the space has been apportioned; copy the layout information back - * into the master. + * into the container. */ for (slot=0; slot < gridCount; slot++) { @@ -2423,7 +2423,7 @@ GetGrid( Tk_Window tkwin) /* Token for window for which grid structure * is desired. */ { - register Gridder *gridPtr; + Gridder *gridPtr; Tcl_HashEntry *hPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -2440,14 +2440,14 @@ GetGrid( hPtr = Tcl_CreateHashEntry(&dispPtr->gridHashTable, (char*) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Gridder *)Tcl_GetHashValue(hPtr); } - gridPtr = ckalloc(sizeof(Gridder)); + gridPtr = (Gridder *)ckalloc(sizeof(Gridder)); gridPtr->tkwin = tkwin; - gridPtr->masterPtr = NULL; - gridPtr->masterDataPtr = NULL; + gridPtr->containerPtr = NULL; + gridPtr->containerDataPtr = NULL; gridPtr->nextPtr = NULL; - gridPtr->slavePtr = NULL; + gridPtr->contentPtr = NULL; gridPtr->binNextPtr = NULL; gridPtr->column = -1; @@ -2467,7 +2467,7 @@ GetGrid( gridPtr->sticky = 0; gridPtr->size = 0; gridPtr->in = NULL; - gridPtr->masterDataPtr = NULL; + gridPtr->containerDataPtr = NULL; Tcl_SetHashValue(hPtr, gridPtr); Tk_CreateEventHandler(tkwin, StructureNotifyMask, GridStructureProc, gridPtr); @@ -2479,13 +2479,13 @@ GetGrid( * * SetGridSize -- * - * This internal procedure sets the size of the grid occupied by slaves. + * This internal procedure sets the size of the grid occupied by content. * * Results: * None * * Side effects: - * The width and height arguments are filled in the master data + * The width and height arguments are filled in the container data * structure. Additional space is allocated for the constraints to * accommodate the offsets. * @@ -2494,50 +2494,50 @@ GetGrid( static void SetGridSize( - Gridder *masterPtr) /* The geometry master for this grid. */ + Gridder *containerPtr) /* The geometry container for this grid. */ { - register Gridder *slavePtr; /* Current slave window. */ + Gridder *contentPtr; /* Current content window. */ int maxX = 0, maxY = 0; - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - maxX = MAX(maxX, slavePtr->numCols + slavePtr->column); - maxY = MAX(maxY, slavePtr->numRows + slavePtr->row); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + maxX = MAX(maxX, contentPtr->numCols + contentPtr->column); + maxY = MAX(maxY, contentPtr->numRows + contentPtr->row); } - masterPtr->masterDataPtr->columnEnd = maxX; - masterPtr->masterDataPtr->rowEnd = maxY; - CheckSlotData(masterPtr, maxX, COLUMN, CHECK_SPACE); - CheckSlotData(masterPtr, maxY, ROW, CHECK_SPACE); + containerPtr->containerDataPtr->columnEnd = maxX; + containerPtr->containerDataPtr->rowEnd = maxY; + CheckSlotData(containerPtr, maxX, COLUMN, CHECK_SPACE); + CheckSlotData(containerPtr, maxY, ROW, CHECK_SPACE); } /* *---------------------------------------------------------------------- * - * SetSlaveColumn -- + * SetContentColumn -- * - * Update column data for a slave, checking that MAX_ELEMENT bound + * Update column data for a content, checking that MAX_ELEMENT bound * is not passed. * * Results: * TCL_ERROR if out of bounds, TCL_OK otherwise * * Side effects: - * Slave fields are updated. + * Content fields are updated. * *---------------------------------------------------------------------- */ static int -SetSlaveColumn( +SetContentColumn( Tcl_Interp *interp, /* Interp for error message. */ - Gridder *slavePtr, /* Slave to be updated. */ + Gridder *contentPtr, /* Content to be updated. */ int column, /* New column or -1 to be unchanged. */ int numCols) /* New columnspan or -1 to be unchanged. */ { int newColumn, newNumCols, lastCol; - newColumn = (column >= 0) ? column : slavePtr->column; - newNumCols = (numCols >= 1) ? numCols : slavePtr->numCols; + newColumn = (column >= 0) ? column : contentPtr->column; + newNumCols = (numCols >= 1) ? numCols : contentPtr->numCols; lastCol = ((newColumn >= 0) ? newColumn : 0) + newNumCols; if (lastCol >= MAX_ELEMENT) { @@ -2546,39 +2546,39 @@ SetSlaveColumn( return TCL_ERROR; } - slavePtr->column = newColumn; - slavePtr->numCols = newNumCols; + contentPtr->column = newColumn; + contentPtr->numCols = newNumCols; return TCL_OK; } /* *---------------------------------------------------------------------- * - * SetSlaveRow -- + * SetContentRow -- * - * Update row data for a slave, checking that MAX_ELEMENT bound + * Update row data for a content, checking that MAX_ELEMENT bound * is not passed. * * Results: * TCL_ERROR if out of bounds, TCL_OK otherwise * * Side effects: - * Slave fields are updated. + * Content fields are updated. * *---------------------------------------------------------------------- */ static int -SetSlaveRow( +SetContentRow( Tcl_Interp *interp, /* Interp for error message. */ - Gridder *slavePtr, /* Slave to be updated. */ + Gridder *contentPtr, /* Content to be updated. */ int row, /* New row or -1 to be unchanged. */ int numRows) /* New rowspan or -1 to be unchanged. */ { int newRow, newNumRows, lastRow; - newRow = (row >= 0) ? row : slavePtr->row; - newNumRows = (numRows >= 1) ? numRows : slavePtr->numRows; + newRow = (row >= 0) ? row : contentPtr->row; + newNumRows = (numRows >= 1) ? numRows : contentPtr->numRows; lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows; if (lastRow >= MAX_ELEMENT) { @@ -2587,8 +2587,8 @@ SetSlaveRow( return TCL_ERROR; } - slavePtr->row = newRow; - slavePtr->numRows = newNumRows; + contentPtr->row = newRow; + contentPtr->numRows = newNumRows; return TCL_OK; } @@ -2604,7 +2604,7 @@ SetSlaveRow( * TRUE if the index is OK, False otherwise. * * Side effects: - * A new master grid structure may be created. If so, then it is + * A new container grid structure may be created. If so, then it is * initialized. In addition, additional storage for a row or column * constraints may be allocated, and the constraint maximums are * adjusted. @@ -2614,7 +2614,7 @@ SetSlaveRow( static int CheckSlotData( - Gridder *masterPtr, /* The geometry master for this grid. */ + Gridder *containerPtr, /* The geometry container for this grid. */ int slot, /* Which slot to look at. */ int slotType, /* ROW or COLUMN. */ int checkOnly) /* Don't allocate new space if true. */ @@ -2630,7 +2630,7 @@ CheckSlotData( return TCL_ERROR; } - if ((checkOnly == CHECK_ONLY) && (masterPtr->masterDataPtr == NULL)) { + if ((checkOnly == CHECK_ONLY) && (containerPtr->containerDataPtr == NULL)) { return TCL_ERROR; } @@ -2640,39 +2640,39 @@ CheckSlotData( * of the offsets as well. */ - InitMasterData(masterPtr); - end = (slotType == ROW) ? masterPtr->masterDataPtr->rowMax : - masterPtr->masterDataPtr->columnMax; + InitContainerData(containerPtr); + end = (slotType == ROW) ? containerPtr->containerDataPtr->rowMax : + containerPtr->containerDataPtr->columnMax; if (checkOnly == CHECK_ONLY) { return ((end < slot) ? TCL_ERROR : TCL_OK); } else { - numSlot = (slotType == ROW) ? masterPtr->masterDataPtr->rowSpace - : masterPtr->masterDataPtr->columnSpace; + numSlot = (slotType == ROW) ? containerPtr->containerDataPtr->rowSpace + : containerPtr->containerDataPtr->columnSpace; if (slot >= numSlot) { int newNumSlot = slot + PREALLOC; size_t oldSize = numSlot * sizeof(SlotInfo); size_t newSize = newNumSlot * sizeof(SlotInfo); - SlotInfo *newSI = ckalloc(newSize); + SlotInfo *newSI = (SlotInfo *)ckalloc(newSize); SlotInfo *oldSI = (slotType == ROW) - ? masterPtr->masterDataPtr->rowPtr - : masterPtr->masterDataPtr->columnPtr; + ? containerPtr->containerDataPtr->rowPtr + : containerPtr->containerDataPtr->columnPtr; memcpy(newSI, oldSI, oldSize); memset(newSI+numSlot, 0, newSize - oldSize); ckfree(oldSI); if (slotType == ROW) { - masterPtr->masterDataPtr->rowPtr = newSI; - masterPtr->masterDataPtr->rowSpace = newNumSlot; + containerPtr->containerDataPtr->rowPtr = newSI; + containerPtr->containerDataPtr->rowSpace = newNumSlot; } else { - masterPtr->masterDataPtr->columnPtr = newSI; - masterPtr->masterDataPtr->columnSpace = newNumSlot; + containerPtr->containerDataPtr->columnPtr = newSI; + containerPtr->containerDataPtr->columnSpace = newNumSlot; } } if (slot >= end && checkOnly != CHECK_SPACE) { if (slotType == ROW) { - masterPtr->masterDataPtr->rowMax = slot+1; + containerPtr->containerDataPtr->rowMax = slot+1; } else { - masterPtr->masterDataPtr->columnMax = slot+1; + containerPtr->containerDataPtr->columnMax = slot+1; } } return TCL_OK; @@ -2682,37 +2682,37 @@ CheckSlotData( /* *---------------------------------------------------------------------- * - * InitMasterData -- + * InitContainerData -- * * This internal procedure is used to allocate and initialize the data - * for a geometry master, if the data doesn't exist already. + * for a geometry container, if the data doesn't exist already. * * Results: * none * * Side effects: - * A new master grid structure may be created. If so, then it is + * A new container grid structure may be created. If so, then it is * initialized. * *---------------------------------------------------------------------- */ static void -InitMasterData( - Gridder *masterPtr) +InitContainerData( + Gridder *containerPtr) { - if (masterPtr->masterDataPtr == NULL) { - GridMaster *gridPtr = masterPtr->masterDataPtr = - ckalloc(sizeof(GridMaster)); + if (containerPtr->containerDataPtr == NULL) { + GridContainer *gridPtr = containerPtr->containerDataPtr = + ckalloc(sizeof(GridContainer)); size_t size = sizeof(SlotInfo) * TYPICAL_SIZE; gridPtr->columnEnd = 0; gridPtr->columnMax = 0; - gridPtr->columnPtr = ckalloc(size); + gridPtr->columnPtr = (SlotInfo *)ckalloc(size); gridPtr->columnSpace = TYPICAL_SIZE; gridPtr->rowEnd = 0; gridPtr->rowMax = 0; - gridPtr->rowPtr = ckalloc(size); + gridPtr->rowPtr = (SlotInfo *)ckalloc(size); gridPtr->rowSpace = TYPICAL_SIZE; gridPtr->startX = 0; gridPtr->startY = 0; @@ -2728,13 +2728,13 @@ InitMasterData( * * Unlink -- * - * Remove a grid from its master's list of slaves. + * Remove a grid from its container's list of content. * * Results: * None. * * Side effects: - * The master will be scheduled for re-arranging, and the size of the + * The container will be scheduled for re-arranging, and the size of the * grid will be adjusted accordingly * *---------------------------------------------------------------------- @@ -2742,47 +2742,47 @@ InitMasterData( static void Unlink( - register Gridder *slavePtr) /* Window to unlink. */ + Gridder *contentPtr) /* Window to unlink. */ { - register Gridder *masterPtr, *slavePtr2; + Gridder *containerPtr, *contentPtr2; - masterPtr = slavePtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = contentPtr->containerPtr; + if (containerPtr == NULL) { return; } - if (masterPtr->slavePtr == slavePtr) { - masterPtr->slavePtr = slavePtr->nextPtr; + if (containerPtr->contentPtr == contentPtr) { + containerPtr->contentPtr = contentPtr->nextPtr; } else { - for (slavePtr2=masterPtr->slavePtr ; ; slavePtr2=slavePtr2->nextPtr) { - if (slavePtr2 == NULL) { + for (contentPtr2=containerPtr->contentPtr ; ; contentPtr2=contentPtr2->nextPtr) { + if (contentPtr2 == NULL) { Tcl_Panic("Unlink couldn't find previous window"); } - if (slavePtr2->nextPtr == slavePtr) { - slavePtr2->nextPtr = slavePtr->nextPtr; + if (contentPtr2->nextPtr == contentPtr) { + contentPtr2->nextPtr = contentPtr->nextPtr; break; } } } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - SetGridSize(slavePtr->masterPtr); - slavePtr->masterPtr = NULL; + SetGridSize(contentPtr->containerPtr); + contentPtr->containerPtr = NULL; /* - * If we have emptied this master from slaves it means we are no longer + * If we have emptied this container from content it means we are no longer * handling it and should mark it as free. */ - if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { - TkFreeGeometryMaster(masterPtr->tkwin, "grid"); - masterPtr->flags &= ~ALLOCED_MASTER; + if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { + TkFreeGeometryContainer(containerPtr->tkwin, "grid"); + containerPtr->flags &= ~ALLOCED_CONTAINER; } } @@ -2794,7 +2794,7 @@ Unlink( * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to * clean up the internal structure of a grid at a safe time (when no-one * is using it anymore). Cleaning up the grid involves freeing the main - * structure for all windows and the master structure for geometry + * structure for all windows and the container structure for geometry * managers. * * Results: @@ -2810,16 +2810,16 @@ static void DestroyGrid( void *memPtr) /* Info about window that is now dead. */ { - register Gridder *gridPtr = memPtr; + Gridder *gridPtr = (Gridder *)memPtr; - if (gridPtr->masterDataPtr != NULL) { - if (gridPtr->masterDataPtr->rowPtr != NULL) { - ckfree(gridPtr->masterDataPtr -> rowPtr); + if (gridPtr->containerDataPtr != NULL) { + if (gridPtr->containerDataPtr->rowPtr != NULL) { + ckfree(gridPtr->containerDataPtr -> rowPtr); } - if (gridPtr->masterDataPtr->columnPtr != NULL) { - ckfree(gridPtr->masterDataPtr -> columnPtr); + if (gridPtr->containerDataPtr->columnPtr != NULL) { + ckfree(gridPtr->containerDataPtr -> columnPtr); } - ckfree(gridPtr->masterDataPtr); + ckfree(gridPtr->containerDataPtr); } if (gridPtr->in != NULL) { Tcl_DecrRefCount(gridPtr->in); @@ -2840,7 +2840,7 @@ DestroyGrid( * * Side effects: * If a window was just deleted, clean up all its grid-related - * information. If it was just resized, re-configure its slaves, if any. + * information. If it was just resized, re-configure its content, if any. * *---------------------------------------------------------------------- */ @@ -2851,56 +2851,56 @@ GridStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Gridder *gridPtr = clientData; + Gridder *gridPtr = (Gridder *)clientData; TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr; if (eventPtr->type == ConfigureNotify) { - if ((gridPtr->slavePtr != NULL) + if ((gridPtr->contentPtr != NULL) && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } - if ((gridPtr->masterPtr != NULL) && + if ((gridPtr->containerPtr != NULL) && (gridPtr->doubleBw != 2*Tk_Changes(gridPtr->tkwin)->border_width)) { - if (!(gridPtr->masterPtr->flags & REQUESTED_RELAYOUT)) { + if (!(gridPtr->containerPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->doubleBw = 2*Tk_Changes(gridPtr->tkwin)->border_width; - gridPtr->masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, gridPtr->masterPtr); + gridPtr->containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, gridPtr->containerPtr); } } } else if (eventPtr->type == DestroyNotify) { - register Gridder *slavePtr, *nextPtr; + Gridder *contentPtr, *nextPtr; - if (gridPtr->masterPtr != NULL) { + if (gridPtr->containerPtr != NULL) { Unlink(gridPtr); } - for (slavePtr = gridPtr->slavePtr; slavePtr != NULL; - slavePtr = nextPtr) { - Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL); - Tk_UnmapWindow(slavePtr->tkwin); - slavePtr->masterPtr = NULL; - nextPtr = slavePtr->nextPtr; - slavePtr->nextPtr = NULL; + for (contentPtr = gridPtr->contentPtr; contentPtr != NULL; + contentPtr = nextPtr) { + Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL); + Tk_UnmapWindow(contentPtr->tkwin); + contentPtr->containerPtr = NULL; + nextPtr = contentPtr->nextPtr; + contentPtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable, - (char *) gridPtr->tkwin)); + (char *)gridPtr->tkwin)); if (gridPtr->flags & REQUESTED_RELAYOUT) { Tcl_CancelIdleCall(ArrangeGrid, gridPtr); } gridPtr->tkwin = NULL; Tcl_EventuallyFree(gridPtr, (Tcl_FreeProc *)DestroyGrid); } else if (eventPtr->type == MapNotify) { - if ((gridPtr->slavePtr != NULL) + if ((gridPtr->contentPtr != NULL) && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } } else if (eventPtr->type == UnmapNotify) { - register Gridder *slavePtr; + Gridder *contentPtr; - for (slavePtr = gridPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - Tk_UnmapWindow(slavePtr->tkwin); + for (contentPtr = gridPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + Tk_UnmapWindow(contentPtr->tkwin); } } } @@ -2908,11 +2908,11 @@ GridStructureProc( /* *---------------------------------------------------------------------- * - * ConfigureSlaves -- + * ConfigureContent -- * * This implements the guts of the "grid configure" command. Given a list - * of slaves and configuration options, it arranges for the grid to - * manage the slaves and sets the specified options. Arguments consist + * of content and configuration options, it arranges for the grid to + * manage the content and sets the specified options. Arguments consist * of windows or window shortcuts followed by "-option value" pairs. * * Results: @@ -2920,26 +2920,26 @@ GridStructureProc( * and the interp's result is set to contain an error message. * * Side effects: - * Slave windows get taken over by the grid. + * Content windows get taken over by the grid. * *---------------------------------------------------------------------- */ static int -ConfigureSlaves( +ConfigureContent( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Any window in application containing - * slaves. Used to look up slave names. */ + * content. Used to look up content names. */ int 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 * that there is at least one window name. */ { - Gridder *masterPtr = NULL; - Gridder *slavePtr; - Tk_Window other, slave, parent, ancestor; - TkWindow *master; + Gridder *containerPtr = NULL; + Gridder *contentPtr; + Tk_Window other, content, parent, ancestor; + TkWindow *container; int i, j, tmp; int numWindows; int width; @@ -2975,34 +2975,34 @@ ConfigureSlaves( if (firstChar == '.') { /* - * Check that windows are valid, and locate the first slave's + * Check that windows are valid, and locate the first content's * parent window (default for -in). */ - if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) { return TCL_ERROR; } - if (masterPtr == NULL) { + if (containerPtr == NULL) { /* - * Is there any saved -in from a removed slave? + * Is there any saved -in from a removed content? * If there is, it becomes default for -in. - * If the stored master does not exist, just ignore it. + * If the stored container does not exist, just ignore it. */ - struct Gridder *slavePtr = GetGrid(slave); - if (slavePtr->in != NULL) { - if (TkGetWindowFromObj(interp, slave, slavePtr->in, &parent) + struct Gridder *contentPtr = GetGrid(content); + if (contentPtr->in != NULL) { + if (TkGetWindowFromObj(interp, content, contentPtr->in, &parent) == TCL_OK) { - masterPtr = GetGrid(parent); - InitMasterData(masterPtr); + containerPtr = GetGrid(parent); + InitContainerData(containerPtr); } } } - if (masterPtr == NULL) { - parent = Tk_Parent(slave); + if (containerPtr == NULL) { + parent = Tk_Parent(content); if (parent != NULL) { - masterPtr = GetGrid(parent); - InitMasterData(masterPtr); + containerPtr = GetGrid(parent); + InitContainerData(containerPtr); } } numWindows++; @@ -3070,8 +3070,8 @@ ConfigureSlaves( TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(other); - InitMasterData(masterPtr); + containerPtr = GetGrid(other); + InitContainerData(containerPtr); } else if (index == CONF_ROW) { if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK || tmp < 0) { @@ -3087,23 +3087,23 @@ ConfigureSlaves( /* * If no -row is given, use the next row after the highest occupied row - * of the master. + * of the container. */ if (defaultRow < 0) { - if (masterPtr != NULL && masterPtr->masterDataPtr != NULL) { - SetGridSize(masterPtr); - defaultRow = masterPtr->masterDataPtr->rowEnd; + if (containerPtr != NULL && containerPtr->containerDataPtr != NULL) { + SetGridSize(containerPtr); + defaultRow = containerPtr->containerDataPtr->rowEnd; } else { defaultRow = 0; } } /* - * Iterate over all of the slave windows and short-cuts, parsing options - * for each slave. It's a bit wasteful to re-parse the options for each - * slave, but things get too messy if we try to parse the arguments just - * once at the beginning. For example, if a slave already is managed we + * Iterate over all of the content windows and short-cuts, parsing options + * for each content. It's a bit wasteful to re-parse the options for each + * content, but things get too messy if we try to parse the arguments just + * once at the beginning. For example, if a content already is managed we * want to just change a few existing values without resetting everything. * If there are multiple windows, the -in option only gets processed for * the first window. @@ -3116,7 +3116,7 @@ ConfigureSlaves( /* * '^' and 'x' cause us to skip a column. '-' is processed as part of - * its preceeding slave. + * its preceeding content. */ if ((firstChar == REL_VERT) || (firstChar == REL_SKIP)) { @@ -3136,27 +3136,27 @@ ConfigureSlaves( } } - if (TkGetWindowFromObj(interp, tkwin, objv[j], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[j], &content) != TCL_OK) { return TCL_ERROR; } - if (Tk_TopWinHierarchy(slave)) { + if (Tk_TopWinHierarchy(content)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't manage \"%s\": it's a top-level window", Tcl_GetString(objv[j]))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL); return TCL_ERROR; } - slavePtr = GetGrid(slave); + contentPtr = GetGrid(content); /* * The following statement is taken from tkPack.c: * - * "If the slave isn't currently managed, reset all of its + * "If the content isn't currently managed, reset all of its * configuration information to default values (there could be old * values left from a previous packer)." * - * I [D.S.] disagree with this statement. If a slave is disabled + * I [D.S.] disagree with this statement. If a content is disabled * (using "forget") and then re-enabled, I submit that 90% of the time * the programmer will want it to retain its old configuration * information. If the programmer doesn't want this behavior, then the @@ -3177,7 +3177,7 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL); return TCL_ERROR; } - if (SetSlaveColumn(interp, slavePtr, tmp, -1) != TCL_OK) { + if (SetContentColumn(interp, contentPtr, tmp, -1) != TCL_OK) { return TCL_ERROR; } break; @@ -3190,7 +3190,7 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL); return TCL_ERROR; } - if (SetSlaveColumn(interp, slavePtr, -1, tmp) != TCL_OK) { + if (SetContentColumn(interp, contentPtr, -1, tmp) != TCL_OK) { return TCL_ERROR; } break; @@ -3199,15 +3199,15 @@ ConfigureSlaves( &other) != TCL_OK) { return TCL_ERROR; } - if (other == slave) { + if (other == content) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "window can't be managed in itself", -1)); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); return TCL_ERROR; } positionGiven = 1; - masterPtr = GetGrid(other); - InitMasterData(masterPtr); + containerPtr = GetGrid(other); + InitContainerData(containerPtr); break; case CONF_STICKY: { int sticky = StringToSticky(Tcl_GetString(objv[i+1])); @@ -3220,11 +3220,11 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "STICKY", NULL); return TCL_ERROR; } - slavePtr->sticky = sticky; + contentPtr->sticky = sticky; break; } case CONF_IPADX: - if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1], + if ((Tk_GetPixelsFromObj(NULL, content, objv[i+1], &tmp) != TCL_OK) || (tmp < 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipadx value \"%s\": must be positive screen distance", @@ -3232,10 +3232,10 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadX = tmp * 2; + contentPtr->iPadX = tmp * 2; break; case CONF_IPADY: - if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1], + if ((Tk_GetPixelsFromObj(NULL, content, objv[i+1], &tmp) != TCL_OK) || (tmp < 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipady value \"%s\": must be positive screen distance", @@ -3243,17 +3243,17 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadY = tmp * 2; + contentPtr->iPadY = tmp * 2; break; case CONF_PADX: if (TkParsePadAmount(interp, tkwin, objv[i+1], - &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) { + &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) { return TCL_ERROR; } break; case CONF_PADY: if (TkParsePadAmount(interp, tkwin, objv[i+1], - &slavePtr->padTop, &slavePtr->padY) != TCL_OK) { + &contentPtr->padTop, &contentPtr->padY) != TCL_OK) { return TCL_ERROR; } break; @@ -3266,7 +3266,7 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL); return TCL_ERROR; } - if (SetSlaveRow(interp, slavePtr, tmp, -1) != TCL_OK) { + if (SetContentRow(interp, contentPtr, tmp, -1) != TCL_OK) { return TCL_ERROR; } break; @@ -3279,7 +3279,7 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL); return TCL_ERROR; } - if (SetSlaveRow(interp, slavePtr, -1, tmp) != TCL_OK) { + if (SetContentRow(interp, contentPtr, -1, tmp) != TCL_OK) { return TCL_ERROR; } break; @@ -3287,12 +3287,12 @@ ConfigureSlaves( } /* - * If no position was specified via -in and the slave is already + * If no position was specified via -in and the content is already * packed, then leave it in its current location. */ - if (!positionGiven && (slavePtr->masterPtr != NULL)) { - masterPtr = slavePtr->masterPtr; + if (!positionGiven && (contentPtr->containerPtr != NULL)) { + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } @@ -3301,54 +3301,54 @@ ConfigureSlaves( * its current location. */ - if (positionGiven && (masterPtr == slavePtr->masterPtr)) { + if (positionGiven && (containerPtr == contentPtr->containerPtr)) { goto scheduleLayout; } /* - * Make sure we have a geometry master. We look at: + * Make sure we have a geometry container. We look at: * 1) the -in flag - * 2) the parent of the first slave. + * 2) the parent of the first content. */ - parent = Tk_Parent(slave); - if (masterPtr == NULL) { - masterPtr = GetGrid(parent); - InitMasterData(masterPtr); + parent = Tk_Parent(content); + if (containerPtr == NULL) { + containerPtr = GetGrid(parent); + InitContainerData(containerPtr); } - if (slavePtr->masterPtr != NULL && slavePtr->masterPtr != masterPtr) { - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (contentPtr->containerPtr != NULL && contentPtr->containerPtr != containerPtr) { + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - slavePtr->masterPtr = NULL; + Unlink(contentPtr); + contentPtr->containerPtr = NULL; } - if (slavePtr->masterPtr == NULL) { - Gridder *tempPtr = masterPtr->slavePtr; + if (contentPtr->containerPtr == NULL) { + Gridder *tempPtr = containerPtr->contentPtr; - slavePtr->masterPtr = masterPtr; - masterPtr->slavePtr = slavePtr; - slavePtr->nextPtr = tempPtr; + contentPtr->containerPtr = containerPtr; + containerPtr->contentPtr = contentPtr; + contentPtr->nextPtr = tempPtr; } /* - * Make sure that the slave's parent is either the master or an - * ancestor of the master, and that the master and slave aren't the + * Make sure that the content's parent is either the container or an + * ancestor of the container, and that the container and content aren't the * same. */ - for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { + for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { if (ancestor == parent) { break; } if (Tk_TopWinHierarchy(ancestor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s", Tcl_GetString(objv[j]), - Tk_PathName(masterPtr->tkwin))); + Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); - Unlink(slavePtr); + Unlink(contentPtr); return TCL_ERROR; } } @@ -3357,65 +3357,65 @@ ConfigureSlaves( * Check for management loops. */ - for (master = (TkWindow *)masterPtr->tkwin; master != NULL; - master = (TkWindow *)TkGetGeomMaster(master)) { - if (master == (TkWindow *)slave) { + for (container = (TkWindow *)containerPtr->tkwin; container != NULL; + container = (TkWindow *)TkGetGeomMaster(container)) { + if (container == (TkWindow *)content) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", - Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin))); + Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); - Unlink(slavePtr); + Unlink(contentPtr); return TCL_ERROR; } } - if (masterPtr->tkwin != Tk_Parent(slave)) { - ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin; + if (containerPtr->tkwin != Tk_Parent(content)) { + ((TkWindow *)content)->maintainerPtr = (TkWindow *)containerPtr->tkwin; } - Tk_ManageGeometry(slave, &gridMgrType, slavePtr); + Tk_ManageGeometry(content, &gridMgrType, contentPtr); - if (!(masterPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryMaster(interp, masterPtr->tkwin, "grid") + if (!(containerPtr->flags & DONT_PROPAGATE)) { + if (TkSetGeometryContainer(interp, containerPtr->tkwin, "grid") != TCL_OK) { - Tk_ManageGeometry(slave, NULL, NULL); - Unlink(slavePtr); + Tk_ManageGeometry(content, NULL, NULL); + Unlink(contentPtr); return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } /* * Assign default position information. */ - if (slavePtr->column == -1) { - if (SetSlaveColumn(interp, slavePtr, defaultColumn,-1) != TCL_OK){ + if (contentPtr->column == -1) { + if (SetContentColumn(interp, contentPtr, defaultColumn,-1) != TCL_OK){ return TCL_ERROR; } } - if (SetSlaveColumn(interp, slavePtr, -1, - slavePtr->numCols + defaultColumnSpan - 1) != TCL_OK) { + if (SetContentColumn(interp, contentPtr, -1, + contentPtr->numCols + defaultColumnSpan - 1) != TCL_OK) { return TCL_ERROR; } - if (slavePtr->row == -1) { - if (SetSlaveRow(interp, slavePtr, defaultRow, -1) != TCL_OK) { + if (contentPtr->row == -1) { + if (SetContentRow(interp, contentPtr, defaultRow, -1) != TCL_OK) { return TCL_ERROR; } } - defaultColumn += slavePtr->numCols; + defaultColumn += contentPtr->numCols; defaultColumnSpan = 1; /* - * Arrange for the master to be re-arranged at the first idle moment. + * Arrange for the container to be re-arranged at the first idle moment. */ scheduleLayout: - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } } @@ -3444,7 +3444,7 @@ ConfigureSlaves( continue; } - if (masterPtr == NULL) { + if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't use '^', cant find master", -1)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); @@ -3480,19 +3480,19 @@ ConfigureSlaves( lastColumn += numSkip; match = 0; - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - - if (slavePtr->column == lastColumn - && slavePtr->row + slavePtr->numRows - 1 == lastRow) { - if (slavePtr->numCols <= width) { - if (SetSlaveRow(interp, slavePtr, -1, - slavePtr->numRows + 1) != TCL_OK) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + + if (contentPtr->column == lastColumn + && contentPtr->row + contentPtr->numRows - 1 == lastRow) { + if (contentPtr->numCols <= width) { + if (SetContentRow(interp, contentPtr, -1, + contentPtr->numRows + 1) != TCL_OK) { return TCL_ERROR; } match++; - j += slavePtr->numCols - 1; - lastWindow = Tk_PathName(slavePtr->tkwin); + j += contentPtr->numCols - 1; + lastWindow = Tk_PathName(contentPtr->tkwin); numSkip = 0; break; } @@ -3506,22 +3506,22 @@ ConfigureSlaves( } } - if (masterPtr == NULL) { + if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't determine master window", -1)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } - SetGridSize(masterPtr); + SetGridSize(containerPtr); /* - * If we have emptied this master from slaves it means we are no longer + * If we have emptied this container from content it means we are no longer * handling it and should mark it as free. */ - if (masterPtr->slavePtr == NULL && masterPtr->flags & ALLOCED_MASTER) { - TkFreeGeometryMaster(masterPtr->tkwin, "grid"); - masterPtr->flags &= ~ALLOCED_MASTER; + if (containerPtr->contentPtr == NULL && containerPtr->flags & ALLOCED_CONTAINER) { + TkFreeGeometryContainer(containerPtr->tkwin, "grid"); + containerPtr->flags &= ~ALLOCED_CONTAINER; } return TCL_OK; diff --git a/generic/tkImage.c b/generic/tkImage.c index 8192c23..763c65b 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -26,8 +26,8 @@ typedef struct Image { Display *display; /* Display for tkwin. Needed because when the * image is eventually freed tkwin may not * exist anymore. */ - struct ImageModel *masterPtr; - /* Master for this image (identifiers image + struct ImageModel *modelPtr; + /* Model for this image (identifiers image * manager, for example). */ ClientData instanceData; /* One word argument to pass to image manager * when dealing with this image instance. */ @@ -40,7 +40,7 @@ typedef struct Image { } Image; /* - * For each image master there is one of the following structures, which + * For each image model there is one of the following structures, which * represents a name in the image table and all of the images instantiated * from it. Entries in mainPtr->imageTable point to these structures. */ @@ -49,8 +49,8 @@ typedef struct ImageModel { Tk_ImageType *typePtr; /* Information about image type. NULL means * that no image manager owns this image: the * image was deleted. */ - ClientData masterData; /* One-word argument to pass to image mgr when - * dealing with the master, as opposed to + ClientData modelData; /* One-word argument to pass to image mgr when + * dealing with the model, as opposed to * instances. */ int width, height; /* Last known dimensions for image. */ Tcl_HashTable *tablePtr; /* Pointer to hash table containing image (the @@ -82,8 +82,8 @@ static Tcl_ThreadDataKey dataKey; */ static void ImageTypeThreadExitProc(ClientData clientData); -static void DeleteImage(ImageModel *masterPtr); -static void EventuallyDeleteImage(ImageModel *masterPtr, +static void DeleteImage(ImageModel *modelPtr); +static void EventuallyDeleteImage(ImageModel *modelPtr, int forgetImageHashNow); /* @@ -104,10 +104,10 @@ static void EventuallyDeleteImage(ImageModel *masterPtr, static void ImageTypeThreadExitProc( - ClientData clientData) /* not used */ + TCL_UNUSED(void *)) { Tk_ImageType *freePtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); while (tsdPtr->oldImageTypeList != NULL) { @@ -149,14 +149,14 @@ Tk_CreateOldImageType( * by caller. */ { Tk_ImageType *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_ImageType)); + copyPtr = (Tk_ImageType *)ckalloc(sizeof(Tk_ImageType)); *copyPtr = *typePtr; copyPtr->nextPtr = tsdPtr->oldImageTypeList; tsdPtr->oldImageTypeList = copyPtr; @@ -170,14 +170,14 @@ Tk_CreateImageType( * by caller. */ { Tk_ImageType *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_ImageType)); + copyPtr = (Tk_ImageType *)ckalloc(sizeof(Tk_ImageType)); *copyPtr = *typePtr; copyPtr->nextPtr = tsdPtr->imageTypeList; tsdPtr->imageTypeList = copyPtr; @@ -215,10 +215,10 @@ Tk_ImageObjCmd( IMAGE_CREATE, IMAGE_DELETE, IMAGE_HEIGHT, IMAGE_INUSE, IMAGE_NAMES, IMAGE_TYPE, IMAGE_TYPES, IMAGE_WIDTH }; - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; int i, isNew, firstOption, index; Tk_ImageType *typePtr; - ImageModel *masterPtr; + ImageModel *modelPtr; Image *imagePtr; Tcl_HashEntry *hPtr; Tcl_HashSearch search; @@ -226,7 +226,7 @@ Tk_ImageObjCmd( TkDisplay *dispPtr = winPtr->dispPtr; const char *arg, *name; Tcl_Obj *resultObj; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { @@ -297,7 +297,7 @@ Tk_ImageObjCmd( /* * Need to check if the _command_ that we are about to create is - * the name of the current master widget command (normally "." but + * the name of the current model widget command (normally "." but * could have been renamed) and fail in that case before a really * nasty and hard to stop crash happens. */ @@ -318,37 +318,37 @@ Tk_ImageObjCmd( hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable, name, &isNew); if (isNew) { - masterPtr = ckalloc(sizeof(ImageModel)); - masterPtr->typePtr = NULL; - masterPtr->masterData = NULL; - masterPtr->width = masterPtr->height = 1; - masterPtr->tablePtr = &winPtr->mainPtr->imageTable; - masterPtr->hPtr = hPtr; - masterPtr->instancePtr = NULL; - masterPtr->deleted = 0; - masterPtr->winPtr = winPtr->mainPtr->winPtr; - Tcl_Preserve(masterPtr->winPtr); - Tcl_SetHashValue(hPtr, masterPtr); + modelPtr = (ImageModel *)ckalloc(sizeof(ImageModel)); + modelPtr->typePtr = NULL; + modelPtr->modelData = NULL; + modelPtr->width = modelPtr->height = 1; + modelPtr->tablePtr = &winPtr->mainPtr->imageTable; + modelPtr->hPtr = hPtr; + modelPtr->instancePtr = NULL; + modelPtr->deleted = 0; + modelPtr->winPtr = winPtr->mainPtr->winPtr; + Tcl_Preserve(modelPtr->winPtr); + Tcl_SetHashValue(hPtr, modelPtr); } else { /* * An image already exists by this name. Disconnect the instances - * from the master. + * from the model. */ - masterPtr = Tcl_GetHashValue(hPtr); - if (masterPtr->typePtr != NULL) { - for (imagePtr = masterPtr->instancePtr; imagePtr != NULL; + modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr); + if (modelPtr->typePtr != NULL) { + for (imagePtr = modelPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { - masterPtr->typePtr->freeProc(imagePtr->instanceData, + modelPtr->typePtr->freeProc(imagePtr->instanceData, imagePtr->display); imagePtr->changeProc(imagePtr->widgetClientData, 0, 0, - masterPtr->width, masterPtr->height, - masterPtr->width, masterPtr->height); + modelPtr->width, modelPtr->height, + modelPtr->width, modelPtr->height); } - masterPtr->typePtr->deleteProc(masterPtr->masterData); - masterPtr->typePtr = NULL; + modelPtr->typePtr->deleteProc(modelPtr->modelData); + modelPtr->typePtr = NULL; } - masterPtr->deleted = 0; + modelPtr->deleted = 0; } /* @@ -363,34 +363,34 @@ Tk_ImageObjCmd( if (oldimage) { int i; - args = ckalloc((objc+1) * sizeof(char *)); + args = (Tcl_Obj **)ckalloc((objc+1) * sizeof(Tcl_Obj *)); for (i = 0; i < objc; i++) { args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]); } args[objc] = NULL; } - Tcl_Preserve(masterPtr); + Tcl_Preserve(modelPtr); if (typePtr->createProc(interp, name, objc, args, typePtr, - (Tk_ImageModel)masterPtr, &masterPtr->masterData) != TCL_OK){ - EventuallyDeleteImage(masterPtr, 0); - Tcl_Release(masterPtr); + (Tk_ImageModel)modelPtr, &modelPtr->modelData) != TCL_OK){ + EventuallyDeleteImage(modelPtr, 0); + Tcl_Release(modelPtr); if (oldimage) { ckfree(args); } return TCL_ERROR; } - Tcl_Release(masterPtr); + Tcl_Release(modelPtr); if (oldimage) { ckfree(args); } - masterPtr->typePtr = typePtr; - for (imagePtr = masterPtr->instancePtr; imagePtr != NULL; + modelPtr->typePtr = typePtr; + for (imagePtr = modelPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { imagePtr->instanceData = typePtr->getProc(imagePtr->tkwin, - masterPtr->masterData); + modelPtr->modelData); } Tcl_SetObjResult(interp, Tcl_NewStringObj( - Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); + (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); break; } case IMAGE_DELETE: @@ -400,11 +400,11 @@ Tk_ImageObjCmd( if (hPtr == NULL) { goto alreadyDeleted; } - masterPtr = Tcl_GetHashValue(hPtr); - if (masterPtr->deleted) { + modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr); + if (modelPtr->deleted) { goto alreadyDeleted; } - DeleteImage(masterPtr); + DeleteImage(modelPtr); } break; case IMAGE_NAMES: @@ -415,12 +415,12 @@ Tk_ImageObjCmd( hPtr = Tcl_FirstHashEntry(&winPtr->mainPtr->imageTable, &search); resultObj = Tcl_NewObj(); for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - masterPtr = Tcl_GetHashValue(hPtr); - if (masterPtr->deleted) { + modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr); + if (modelPtr->deleted) { continue; } Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); + (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); break; @@ -449,7 +449,7 @@ Tk_ImageObjCmd( case IMAGE_WIDTH: /* * These operations all parse virtually identically. First check to - * see if three args are given. Then get a non-deleted master from the + * see if three args are given. Then get a non-deleted model from the * third arg. */ @@ -463,8 +463,8 @@ Tk_ImageObjCmd( if (hPtr == NULL) { goto alreadyDeleted; } - masterPtr = Tcl_GetHashValue(hPtr); - if (masterPtr->deleted) { + modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr); + if (modelPtr->deleted) { goto alreadyDeleted; } @@ -474,20 +474,20 @@ Tk_ImageObjCmd( switch ((enum options) index) { case IMAGE_HEIGHT: - Tcl_SetObjResult(interp, Tcl_NewIntObj(masterPtr->height)); + Tcl_SetObjResult(interp, Tcl_NewIntObj(modelPtr->height)); break; case IMAGE_INUSE: Tcl_SetObjResult(interp, Tcl_NewBooleanObj( - masterPtr->typePtr && masterPtr->instancePtr)); + modelPtr->typePtr && modelPtr->instancePtr)); break; case IMAGE_TYPE: - if (masterPtr->typePtr != NULL) { + if (modelPtr->typePtr != NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj(masterPtr->typePtr->name, -1)); + Tcl_NewStringObj(modelPtr->typePtr->name, -1)); } break; case IMAGE_WIDTH: - Tcl_SetObjResult(interp, Tcl_NewIntObj(masterPtr->width)); + Tcl_SetObjResult(interp, Tcl_NewIntObj(modelPtr->width)); break; default: Tcl_Panic("can't happen"); @@ -534,12 +534,12 @@ Tk_ImageChanged( int imageWidth, int imageHeight) /* New dimensions of image. */ { - ImageModel *masterPtr = (ImageModel *) imageModel; + ImageModel *modelPtr = (ImageModel *) imageModel; Image *imagePtr; - masterPtr->width = imageWidth; - masterPtr->height = imageHeight; - for (imagePtr = masterPtr->instancePtr; imagePtr != NULL; + modelPtr->width = imageWidth; + modelPtr->height = imageHeight; + for (imagePtr = modelPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { imagePtr->changeProc(imagePtr->widgetClientData, x, y, width, height, imageWidth, imageHeight); @@ -551,7 +551,7 @@ Tk_ImageChanged( * * Tk_NameOfImage -- * - * Given a token for an image master, this function returns the name of + * Given a token for an image model, this function returns the name of * the image. * * Results: @@ -567,12 +567,12 @@ const char * Tk_NameOfImage( Tk_ImageModel imageModel) /* Token for image. */ { - ImageModel *masterPtr = (ImageModel *) imageModel; + ImageModel *modelPtr = (ImageModel *) imageModel; - if (masterPtr->hPtr == NULL) { + if (modelPtr->hPtr == NULL) { return NULL; } - return Tcl_GetHashKey(masterPtr->tablePtr, masterPtr->hPtr); + return (const char *)Tcl_GetHashKey(modelPtr->tablePtr, modelPtr->hPtr); } /* @@ -610,30 +610,30 @@ Tk_GetImage( ClientData clientData) /* One-word argument to pass to damageProc. */ { Tcl_HashEntry *hPtr; - ImageModel *masterPtr; + ImageModel *modelPtr; Image *imagePtr; hPtr = Tcl_FindHashEntry(&((TkWindow *) tkwin)->mainPtr->imageTable, name); if (hPtr == NULL) { goto noSuchImage; } - masterPtr = Tcl_GetHashValue(hPtr); - if (masterPtr->typePtr == NULL) { + modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr); + if (modelPtr->typePtr == NULL) { goto noSuchImage; } - if (masterPtr->deleted) { + if (modelPtr->deleted) { goto noSuchImage; } - imagePtr = ckalloc(sizeof(Image)); + imagePtr = (Image *)ckalloc(sizeof(Image)); imagePtr->tkwin = tkwin; imagePtr->display = Tk_Display(tkwin); - imagePtr->masterPtr = masterPtr; + imagePtr->modelPtr = modelPtr; imagePtr->instanceData = - masterPtr->typePtr->getProc(tkwin, masterPtr->masterData); + modelPtr->typePtr->getProc(tkwin, modelPtr->modelData); imagePtr->changeProc = changeProc; imagePtr->widgetClientData = clientData; - imagePtr->nextPtr = masterPtr->instancePtr; - masterPtr->instancePtr = imagePtr; + imagePtr->nextPtr = modelPtr->instancePtr; + modelPtr->instancePtr = imagePtr; return (Tk_Image) imagePtr; noSuchImage: @@ -669,20 +669,20 @@ Tk_FreeImage( * a widget. */ { Image *imagePtr = (Image *) image; - ImageModel *masterPtr = imagePtr->masterPtr; + ImageModel *modelPtr = imagePtr->modelPtr; Image *prevPtr; /* * Clean up the particular instance. */ - if (masterPtr->typePtr != NULL) { - masterPtr->typePtr->freeProc(imagePtr->instanceData, + if (modelPtr->typePtr != NULL) { + modelPtr->typePtr->freeProc(imagePtr->instanceData, imagePtr->display); } - prevPtr = masterPtr->instancePtr; + prevPtr = modelPtr->instancePtr; if (prevPtr == imagePtr) { - masterPtr->instancePtr = imagePtr->nextPtr; + modelPtr->instancePtr = imagePtr->nextPtr; } else { while (prevPtr->nextPtr != imagePtr) { prevPtr = prevPtr->nextPtr; @@ -692,16 +692,16 @@ Tk_FreeImage( ckfree(imagePtr); /* - * If there are no more instances left for the master, and if the master - * image has been deleted, then delete the master too. + * If there are no more instances left for the model, and if the model + * image has been deleted, then delete the model too. */ - if ((masterPtr->typePtr == NULL) && (masterPtr->instancePtr == NULL)) { - if (masterPtr->hPtr != NULL) { - Tcl_DeleteHashEntry(masterPtr->hPtr); + if ((modelPtr->typePtr == NULL) && (modelPtr->instancePtr == NULL)) { + if (modelPtr->hPtr != NULL) { + Tcl_DeleteHashEntry(modelPtr->hPtr); } - Tcl_Release(masterPtr->winPtr); - ckfree(masterPtr); + Tcl_Release(modelPtr->winPtr); + ckfree(modelPtr); } } @@ -741,9 +741,9 @@ Tk_PostscriptImage( GC newGC; XGCValues gcValues; - if (imagePtr->masterPtr->typePtr == NULL) { + if (imagePtr->modelPtr->typePtr == NULL) { /* - * No master for image, so nothing to display on postscript. + * No model for image, so nothing to display on postscript. */ return TCL_OK; @@ -754,9 +754,9 @@ Tk_PostscriptImage( * otherwise go on with generic code. */ - if (imagePtr->masterPtr->typePtr->postscriptProc != NULL) { - return imagePtr->masterPtr->typePtr->postscriptProc( - imagePtr->masterPtr->masterData, interp, tkwin, psinfo, + if (imagePtr->modelPtr->typePtr->postscriptProc != NULL) { + return imagePtr->modelPtr->typePtr->postscriptProc( + imagePtr->modelPtr->modelData, interp, tkwin, psinfo, x, y, width, height, prepass); } @@ -837,9 +837,9 @@ Tk_RedrawImage( { Image *imagePtr = (Image *) image; - if (imagePtr->masterPtr->typePtr == NULL) { + if (imagePtr->modelPtr->typePtr == NULL) { /* - * No master for image, so nothing to display. + * No model for image, so nothing to display. */ return; @@ -859,13 +859,13 @@ Tk_RedrawImage( drawableY -= imageY; imageY = 0; } - if ((imageX + width) > imagePtr->masterPtr->width) { - width = imagePtr->masterPtr->width - imageX; + if ((imageX + width) > imagePtr->modelPtr->width) { + width = imagePtr->modelPtr->width - imageX; } - if ((imageY + height) > imagePtr->masterPtr->height) { - height = imagePtr->masterPtr->height - imageY; + if ((imageY + height) > imagePtr->modelPtr->height) { + height = imagePtr->modelPtr->height - imageY; } - imagePtr->masterPtr->typePtr->displayProc(imagePtr->instanceData, + imagePtr->modelPtr->typePtr->displayProc(imagePtr->instanceData, imagePtr->display, drawable, imageX, imageY, width, height, drawableX, drawableY); } @@ -895,8 +895,8 @@ Tk_SizeOfImage( { Image *imagePtr = (Image *) image; - *widthPtr = imagePtr->masterPtr->width; - *heightPtr = imagePtr->masterPtr->height; + *widthPtr = imagePtr->modelPtr->width; + *heightPtr = imagePtr->modelPtr->height; } /* @@ -933,7 +933,7 @@ Tk_DeleteImage( if (hPtr == NULL) { return; } - DeleteImage(Tcl_GetHashValue(hPtr)); + DeleteImage((ImageModel *)Tcl_GetHashValue(hPtr)); } /* @@ -948,7 +948,7 @@ Tk_DeleteImage( * * Side effects: * The connection is dropped between instances of this image and an image - * master. Image instances will redisplay themselves as empty areas, but + * model. Image instances will redisplay themselves as empty areas, but * existing instances will not be deleted. * *---------------------------------------------------------------------- @@ -956,31 +956,31 @@ Tk_DeleteImage( static void DeleteImage( - ImageModel *masterPtr) /* Pointer to main data structure for image. */ + ImageModel *modelPtr) /* Pointer to main data structure for image. */ { Image *imagePtr; Tk_ImageType *typePtr; - typePtr = masterPtr->typePtr; - masterPtr->typePtr = NULL; + typePtr = modelPtr->typePtr; + modelPtr->typePtr = NULL; if (typePtr != NULL) { - for (imagePtr = masterPtr->instancePtr; imagePtr != NULL; + for (imagePtr = modelPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { typePtr->freeProc(imagePtr->instanceData, imagePtr->display); imagePtr->changeProc(imagePtr->widgetClientData, 0, 0, - masterPtr->width, masterPtr->height, masterPtr->width, - masterPtr->height); + modelPtr->width, modelPtr->height, modelPtr->width, + modelPtr->height); } - typePtr->deleteProc(masterPtr->masterData); + typePtr->deleteProc(modelPtr->modelData); } - if (masterPtr->instancePtr == NULL) { - if (masterPtr->hPtr != NULL) { - Tcl_DeleteHashEntry(masterPtr->hPtr); + if (modelPtr->instancePtr == NULL) { + if (modelPtr->hPtr != NULL) { + Tcl_DeleteHashEntry(modelPtr->hPtr); } - Tcl_Release(masterPtr->winPtr); - ckfree(masterPtr); + Tcl_Release(modelPtr->winPtr); + ckfree(modelPtr); } else { - masterPtr->deleted = 1; + modelPtr->deleted = 1; } } @@ -1004,16 +1004,16 @@ DeleteImage( static void EventuallyDeleteImage( - ImageModel *masterPtr, /* Pointer to main data structure for image. */ + ImageModel *modelPtr, /* Pointer to main data structure for image. */ int forgetImageHashNow) /* Flag to say whether the hash table is about * to vanish. */ { if (forgetImageHashNow) { - masterPtr->hPtr = NULL; + modelPtr->hPtr = NULL; } - if (!masterPtr->deleted) { - masterPtr->deleted = 1; - Tcl_EventuallyFree(masterPtr, (Tcl_FreeProc *) DeleteImage); + if (!modelPtr->deleted) { + modelPtr->deleted = 1; + Tcl_EventuallyFree(modelPtr, (Tcl_FreeProc *) DeleteImage); } } @@ -1045,7 +1045,7 @@ TkDeleteAllImages( for (hPtr = Tcl_FirstHashEntry(&mainPtr->imageTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - EventuallyDeleteImage(Tcl_GetHashValue(hPtr), 1); + EventuallyDeleteImage((ImageModel *)Tcl_GetHashValue(hPtr), 1); } Tcl_DeleteHashTable(&mainPtr->imageTable); } @@ -1056,7 +1056,7 @@ TkDeleteAllImages( * Tk_GetImageModelData -- * * Given the name of an image, this function returns the type of the - * image and the clientData associated with its master. + * image and the clientData associated with its model. * * Results: * If there is no image by the given name, then NULL is returned and a @@ -1081,20 +1081,20 @@ Tk_GetImageModelData( { TkWindow *winPtr = (TkWindow *) Tk_MainWindow(interp); Tcl_HashEntry *hPtr; - ImageModel *masterPtr; + ImageModel *modelPtr; hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, name); if (hPtr == NULL) { *typePtrPtr = NULL; return NULL; } - masterPtr = Tcl_GetHashValue(hPtr); - if (masterPtr->deleted) { + modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr); + if (modelPtr->deleted) { *typePtrPtr = NULL; return NULL; } - *typePtrPtr = masterPtr->typePtr; - return masterPtr->masterData; + *typePtrPtr = modelPtr->typePtr; + return modelPtr->modelData; } /* @@ -1118,7 +1118,6 @@ Tk_GetImageModelData( *---------------------------------------------------------------------- */ -/*ARGSUSED*/ void Tk_SetTSOrigin( Tk_Window tkwin, diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index a5c21bb..c6ab05d 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -14,7 +14,7 @@ #include "tkInt.h" /* - * The following data structure represents the master for a bitmap + * The following data structure represents the model for a bitmap * image: */ @@ -40,7 +40,7 @@ typedef struct BitmapModel { char *maskDataString; /* Value of -maskdata option (malloc'ed). */ struct BitmapInstance *instancePtr; /* First in list of all instances associated - * with this master. */ + * with this model. */ } BitmapModel; /* @@ -51,7 +51,7 @@ typedef struct BitmapModel { typedef struct BitmapInstance { int refCount; /* Number of instances that share this data * structure. */ - BitmapModel *modelPtr; /* Pointer to master for image. */ + BitmapModel *modelPtr; /* Pointer to model for image. */ Tk_Window tkwin; /* Window in which the instances will be * displayed. */ XColor *fg; /* Foreground color for displaying image. */ @@ -149,7 +149,7 @@ static int ImgBmapCmd(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *const objv[]); static void ImgBmapCmdDeletedProc(ClientData clientData); static void ImgBmapConfigureInstance(BitmapInstance *instancePtr); -static int ImgBmapConfigureMaster(BitmapModel *modelPtr, +static int ImgBmapConfigureModel(BitmapModel *modelPtr, int argc, Tcl_Obj *const objv[], int flags); static int NextBitmapWord(ParseInfo *parseInfoPtr); @@ -200,7 +200,7 @@ ImgBmapCreate( modelPtr->maskFileString = NULL; modelPtr->maskDataString = NULL; modelPtr->instancePtr = NULL; - if (ImgBmapConfigureMaster(modelPtr, argc, argv, 0) != TCL_OK) { + if (ImgBmapConfigureModel(modelPtr, argc, argv, 0) != TCL_OK) { ImgBmapDelete(modelPtr); return TCL_ERROR; } @@ -211,7 +211,7 @@ ImgBmapCreate( /* *---------------------------------------------------------------------- * - * ImgBmapConfigureMaster -- + * ImgBmapConfigureModel -- * * This procedure is called when a bitmap image is created or * reconfigured. It process configuration options and resets any @@ -229,7 +229,7 @@ ImgBmapCreate( */ static int -ImgBmapConfigureMaster( +ImgBmapConfigureModel( BitmapModel *modelPtr, /* Pointer to data structure describing * overall bitmap image to (reconfigure). */ int objc, /* Number of entries in objv. */ @@ -322,8 +322,8 @@ ImgBmapConfigureMaster( * ImgBmapConfigureInstance -- * * This procedure is called to create displaying information for a bitmap - * image instance based on the configuration information in the master. - * It is invoked both when new instances are created and when the master + * image instance based on the configuration information in the model. + * It is invoked both when new instances are created and when the model * is reconfigured. * * Results: @@ -751,7 +751,7 @@ NextBitmapWord( static int ImgBmapCmd( - ClientData clientData, /* Information about the image master. */ + ClientData clientData, /* Information about the image model. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -785,7 +785,7 @@ ImgBmapCmd( configSpecs, (char *) modelPtr, Tcl_GetString(objv[2]), 0); } else { - return ImgBmapConfigureMaster(modelPtr, objc-2, objv+2, + return ImgBmapConfigureModel(modelPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); } default: @@ -816,10 +816,10 @@ static ClientData ImgBmapGet( Tk_Window tkwin, /* Window in which the instance will be * used. */ - ClientData masterData) /* Pointer to our master structure for the + ClientData modelData) /* Pointer to our model structure for the * image. */ { - BitmapModel *modelPtr = masterData; + BitmapModel *modelPtr = modelData; BitmapInstance *instancePtr; /* @@ -993,7 +993,7 @@ ImgBmapFree( * * ImgBmapDelete -- * - * This procedure is called by the image code to delete the master + * This procedure is called by the image code to delete the model * structure for an image. * * Results: @@ -1007,10 +1007,10 @@ ImgBmapFree( static void ImgBmapDelete( - ClientData masterData) /* Pointer to BitmapModel structure for + ClientData modelData) /* Pointer to BitmapModel structure for * image. Must not have any more instances. */ { - BitmapModel *modelPtr = masterData; + BitmapModel *modelPtr = modelData; if (modelPtr->instancePtr != NULL) { Tcl_Panic("tried to delete bitmap image when instances still exist"); diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index a8e5b5e..a40ee7f 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -59,8 +59,8 @@ static int imgPhotoColorHashInitialized; * TkImgPhotoConfigureInstance -- * * This function is called to create displaying information for a photo - * image instance based on the configuration information in the master. - * It is invoked both when new instances are created and when the master + * image instance based on the configuration information in the model. + * It is invoked both when new instances are created and when the model * is reconfigured. * * Results: @@ -77,25 +77,25 @@ void TkImgPhotoConfigureInstance( PhotoInstance *instancePtr) /* Instance to reconfigure. */ { - PhotoModel *masterPtr = instancePtr->masterPtr; + PhotoModel *modelPtr = instancePtr->masterPtr; XImage *imagePtr; int bitsPerPixel; ColorTable *colorTablePtr; XRectangle validBox; /* - * If the -palette configuration option has been set for the master, use + * If the -palette configuration option has been set for the model, use * the value specified for our palette, but only if it is a valid palette - * for our windows. Use the gamma value specified the master. + * for our windows. Use the gamma value specified the model. */ - if ((masterPtr->palette && masterPtr->palette[0]) - && IsValidPalette(instancePtr, masterPtr->palette)) { - instancePtr->palette = masterPtr->palette; + if ((modelPtr->palette && modelPtr->palette[0]) + && IsValidPalette(instancePtr, modelPtr->palette)) { + instancePtr->palette = modelPtr->palette; } else { instancePtr->palette = instancePtr->defaultPalette; } - instancePtr->gamma = masterPtr->gamma; + instancePtr->gamma = modelPtr->gamma; /* * If we don't currently have a color table, or if the one we have no @@ -159,15 +159,15 @@ TkImgPhotoConfigureInstance( } /* - * If the user has specified a width and/or height for the master which is + * If the user has specified a width and/or height for the model which is * different from our current width/height, set the size to the values * specified by the user. If we have no pixmap, we do this also, since it * has the side effect of allocating a pixmap for us. */ if ((instancePtr->pixels == None) || (instancePtr->error == NULL) - || (instancePtr->width != masterPtr->width) - || (instancePtr->height != masterPtr->height)) { + || (instancePtr->width != modelPtr->width) + || (instancePtr->height != modelPtr->height)) { TkImgPhotoInstanceSetSize(instancePtr); } @@ -175,9 +175,9 @@ TkImgPhotoConfigureInstance( * Redither this instance if necessary. */ - if ((masterPtr->flags & IMAGE_CHANGED) + if ((modelPtr->flags & IMAGE_CHANGED) || (instancePtr->colorTablePtr != colorTablePtr)) { - TkClipBox(masterPtr->validRegion, &validBox); + TkClipBox(modelPtr->validRegion, &validBox); if ((validBox.width > 0) && (validBox.height > 0)) { TkImgDitherInstance(instancePtr, validBox.x, validBox.y, validBox.width, validBox.height); @@ -207,10 +207,10 @@ ClientData TkImgPhotoGet( Tk_Window tkwin, /* Window in which the instance will be * used. */ - ClientData masterData) /* Pointer to our master structure for the + ClientData modelData) /* Pointer to our model structure for the * image. */ { - PhotoModel *masterPtr = masterData; + PhotoModel *modelPtr = modelData; PhotoInstance *instancePtr; Colormap colormap; int mono, nRed, nGreen, nBlue, numVisuals; @@ -247,7 +247,7 @@ TkImgPhotoGet( */ colormap = Tk_Colormap(tkwin); - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { if ((colormap == instancePtr->colormap) && (Tk_Display(tkwin) == instancePtr->display)) { @@ -277,7 +277,7 @@ TkImgPhotoGet( */ instancePtr = ckalloc(sizeof(PhotoInstance)); - instancePtr->masterPtr = masterPtr; + instancePtr->masterPtr = modelPtr; instancePtr->display = Tk_Display(tkwin); instancePtr->colormap = Tk_Colormap(tkwin); Tk_PreserveColormap(instancePtr->display, instancePtr->colormap); @@ -288,8 +288,8 @@ TkImgPhotoGet( instancePtr->width = 0; instancePtr->height = 0; instancePtr->imagePtr = 0; - instancePtr->nextPtr = masterPtr->instancePtr; - masterPtr->instancePtr = instancePtr; + instancePtr->nextPtr = modelPtr->instancePtr; + modelPtr->instancePtr = instancePtr; /* * Obtain information about the visual and decide on the default palette. @@ -349,8 +349,8 @@ TkImgPhotoGet( * Make a GC with background = black and foreground = white. */ - white = Tk_GetColor(masterPtr->interp, tkwin, "white"); - black = Tk_GetColor(masterPtr->interp, tkwin, "black"); + white = Tk_GetColor(modelPtr->interp, tkwin, "white"); + black = Tk_GetColor(modelPtr->interp, tkwin, "black"); gcValues.foreground = (white != NULL)? white->pixel: WhitePixelOfScreen(Tk_Screen(tkwin)); gcValues.background = (black != NULL)? black->pixel: @@ -373,8 +373,8 @@ TkImgPhotoGet( */ if (instancePtr->nextPtr == NULL) { - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, - masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, + modelPtr->width, modelPtr->height); } return instancePtr; @@ -434,7 +434,7 @@ BlendComplexAlpha( { int x, y, line; unsigned long pixel; - unsigned char r, g, b, alpha, unalpha, *masterPtr; + unsigned char r, g, b, alpha, unalpha, *modelPtr; unsigned char *alphaAr = iPtr->masterPtr->pix32; /* @@ -494,8 +494,8 @@ BlendComplexAlpha( for (y = 0; y < height; y++) { line = (y + yOffset) * iPtr->masterPtr->width; for (x = 0; x < width; x++) { - masterPtr = alphaAr + ((line + x + xOffset) * 4); - alpha = masterPtr[3]; + modelPtr = alphaAr + ((line + x + xOffset) * 4); + alpha = modelPtr[3]; /* * Ignore pixels that are fully transparent @@ -507,9 +507,9 @@ BlendComplexAlpha( * 24 and 32 bit displays, but this seems "fast enough". */ - r = masterPtr[0]; - g = masterPtr[1]; - b = masterPtr[2]; + r = modelPtr[0]; + g = modelPtr[1]; + b = modelPtr[2]; if (alpha != 255) { /* * Only blend pixels that have some transparency @@ -537,8 +537,8 @@ BlendComplexAlpha( for (y = 0; y < height; y++) { line = (y + yOffset) * iPtr->masterPtr->width; for (x = 0; x < width; x++) { - masterPtr = alphaAr + ((line + x + xOffset) * 4); - alpha = masterPtr[3]; + modelPtr = alphaAr + ((line + x + xOffset) * 4); + alpha = modelPtr[3]; /* * Ignore pixels that are fully transparent @@ -550,9 +550,9 @@ BlendComplexAlpha( * and 32 bit displays, but this seems "fast enough". */ - r = masterPtr[0]; - g = masterPtr[1]; - b = masterPtr[2]; + r = modelPtr[0]; + g = modelPtr[1]; + b = modelPtr[2]; if (alpha != 255) { /* * Only blend pixels that have some transparency @@ -679,7 +679,7 @@ TkImgPhotoDisplay( Tk_DeleteErrorHandler(handler); } else { /* - * masterPtr->region describes which parts of the image contain valid + * modelPtr->region describes which parts of the image contain valid * data. We set this region as the clip mask for the gc, setting its * origin appropriately, and use it when drawing the image. */ @@ -768,23 +768,23 @@ void TkImgPhotoInstanceSetSize( PhotoInstance *instancePtr) /* Instance whose size is to be changed. */ { - PhotoModel *masterPtr; + PhotoModel *modelPtr; schar *newError, *errSrcPtr, *errDestPtr; int h, offset; XRectangle validBox; Pixmap newPixmap; - masterPtr = instancePtr->masterPtr; - TkClipBox(masterPtr->validRegion, &validBox); + modelPtr = instancePtr->masterPtr; + TkClipBox(modelPtr->validRegion, &validBox); - if ((instancePtr->width != masterPtr->width) - || (instancePtr->height != masterPtr->height) + if ((instancePtr->width != modelPtr->width) + || (instancePtr->height != modelPtr->height) || (instancePtr->pixels == None)) { newPixmap = Tk_GetPixmap(instancePtr->display, RootWindow(instancePtr->display, instancePtr->visualInfo.screen), - (masterPtr->width > 0) ? masterPtr->width: 1, - (masterPtr->height > 0) ? masterPtr->height: 1, + (modelPtr->width > 0) ? modelPtr->width: 1, + (modelPtr->height > 0) ? modelPtr->height: 1, instancePtr->visualInfo.depth); if (!newPixmap) { Tcl_Panic("Fail to create pixmap with Tk_GetPixmap in TkImgPhotoInstanceSetSize"); @@ -814,17 +814,17 @@ TkImgPhotoInstanceSetSize( instancePtr->pixels = newPixmap; } - if ((instancePtr->width != masterPtr->width) - || (instancePtr->height != masterPtr->height) + if ((instancePtr->width != modelPtr->width) + || (instancePtr->height != modelPtr->height) || (instancePtr->error == NULL)) { - if (masterPtr->height > 0 && masterPtr->width > 0) { + if (modelPtr->height > 0 && modelPtr->width > 0) { /* * TODO: use attemptckalloc() here once there is a strategy that * will allow us to recover from failure. Right now, there's no * such possibility. */ - newError = ckalloc(masterPtr->height * masterPtr->width + newError = ckalloc(modelPtr->height * modelPtr->width * 3 * sizeof(schar)); /* @@ -833,21 +833,21 @@ TkImgPhotoInstanceSetSize( */ if ((instancePtr->error != NULL) - && ((instancePtr->width == masterPtr->width) - || (validBox.width == masterPtr->width))) { + && ((instancePtr->width == modelPtr->width) + || (validBox.width == modelPtr->width))) { if (validBox.y > 0) { memset(newError, 0, (size_t) - validBox.y * masterPtr->width * 3 * sizeof(schar)); + validBox.y * modelPtr->width * 3 * sizeof(schar)); } h = validBox.y + validBox.height; - if (h < masterPtr->height) { - memset(newError + h*masterPtr->width*3, 0, - (size_t) (masterPtr->height - h) - * masterPtr->width * 3 * sizeof(schar)); + if (h < modelPtr->height) { + memset(newError + h*modelPtr->width*3, 0, + (size_t) (modelPtr->height - h) + * modelPtr->width * 3 * sizeof(schar)); } } else { memset(newError, 0, (size_t) - masterPtr->height * masterPtr->width *3*sizeof(schar)); + modelPtr->height * modelPtr->width *3*sizeof(schar)); } } else { newError = NULL; @@ -859,22 +859,22 @@ TkImgPhotoInstanceSetSize( * array. */ - if (masterPtr->width == instancePtr->width) { - offset = validBox.y * masterPtr->width * 3; + if (modelPtr->width == instancePtr->width) { + offset = validBox.y * modelPtr->width * 3; memcpy(newError + offset, instancePtr->error + offset, (size_t) (validBox.height - * masterPtr->width * 3 * sizeof(schar))); + * modelPtr->width * 3 * sizeof(schar))); } else if (validBox.width > 0 && validBox.height > 0) { errDestPtr = newError + - (validBox.y * masterPtr->width + validBox.x) * 3; + (validBox.y * modelPtr->width + validBox.x) * 3; errSrcPtr = instancePtr->error + (validBox.y * instancePtr->width + validBox.x) * 3; for (h = validBox.height; h > 0; --h) { memcpy(errDestPtr, errSrcPtr, validBox.width * 3 * sizeof(schar)); - errDestPtr += masterPtr->width * 3; + errDestPtr += modelPtr->width * 3; errSrcPtr += instancePtr->width * 3; } } @@ -884,8 +884,8 @@ TkImgPhotoInstanceSetSize( instancePtr->error = newError; } - instancePtr->width = masterPtr->width; - instancePtr->height = masterPtr->height; + instancePtr->width = modelPtr->width; + instancePtr->height = modelPtr->height; } /* @@ -1617,7 +1617,7 @@ TkImgDisposeInstance( * TkImgDitherInstance -- * * This function is called to update an area of an instance's pixmap by - * dithering the corresponding area of the master. + * dithering the corresponding area of the model. * * Results: * None. @@ -1635,7 +1635,7 @@ TkImgDitherInstance( * block to be dithered. */ int width, int height) /* Dimensions of the block to be dithered. */ { - PhotoModel *masterPtr = instancePtr->masterPtr; + PhotoModel *modelPtr = instancePtr->masterPtr; ColorTable *colorPtr = instancePtr->colorTablePtr; XImage *imagePtr; int nLines, bigEndian, i, c, x, y, xEnd, doDithering = 1; @@ -1693,8 +1693,8 @@ TkImgDitherInstance( bigEndian = imagePtr->bitmap_bit_order == MSBFirst; firstBit = bigEndian? (1 << (imagePtr->bitmap_unit - 1)): 1; - lineLength = masterPtr->width * 3; - srcLinePtr = masterPtr->pix32 + (yStart * masterPtr->width + xStart) * 4; + lineLength = modelPtr->width * 3; + srcLinePtr = modelPtr->pix32 + (yStart * modelPtr->width + xStart) * 4; errLinePtr = instancePtr->error + yStart * lineLength + xStart * 3; xEnd = xStart + width; @@ -1749,7 +1749,7 @@ TkImgDitherInstance( c += errPtr[-lineLength-3]; } c += errPtr[-lineLength] * 5; - if ((x + 1) < masterPtr->width) { + if ((x + 1) < modelPtr->width) { c += errPtr[-lineLength+3] * 3; } } @@ -1820,7 +1820,7 @@ TkImgDitherInstance( /* * Multibit monochrome window. The operation here is similar * to the color window case above, except that there is only - * one component. If the master image is in color, use the + * one component. If the model image is in color, use the * luminance computed as * 0.344 * red + 0.5 * green + 0.156 * blue. */ @@ -1832,13 +1832,13 @@ TkImgDitherInstance( c += errPtr[-lineLength-1]; } c += errPtr[-lineLength] * 5; - if (x + 1 < masterPtr->width) { + if (x + 1 < modelPtr->width) { c += errPtr[-lineLength+1] * 3; } } c = ((c + 2056) >> 4) - 128; - if (masterPtr->flags & COLOR_IMAGE) { + if (modelPtr->flags & COLOR_IMAGE) { c += (unsigned) (srcPtr[0] * 11 + srcPtr[1] * 16 + srcPtr[2] * 5 + 16) >> 5; } else { @@ -1905,13 +1905,13 @@ TkImgDitherInstance( c += errPtr[-lineLength-1]; } c += errPtr[-lineLength] * 5; - if (x + 1 < masterPtr->width) { + if (x + 1 < modelPtr->width) { c += errPtr[-lineLength+1] * 3; } } c = ((c + 2056) >> 4) - 128; - if (masterPtr->flags & COLOR_IMAGE) { + if (modelPtr->flags & COLOR_IMAGE) { c += (unsigned)(srcPtr[0] * 11 + srcPtr[1] * 16 + srcPtr[2] * 5 + 16) >> 5; } else { @@ -1934,7 +1934,7 @@ TkImgDitherInstance( } *destLongPtr = word; } - srcLinePtr += masterPtr->width * 4; + srcLinePtr += modelPtr->width * 4; errLinePtr += lineLength; dstLinePtr += bytesPerLine; } diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 395fc9d..afbf7b0 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -176,7 +176,7 @@ static int ParseSubcommandOptions( Tcl_Interp *interp, int allowedOptions, int *indexPtr, int objc, Tcl_Obj *const objv[]); static void ImgPhotoCmdDeletedProc(ClientData clientData); -static int ImgPhotoConfigureMaster(Tcl_Interp *interp, +static int ImgPhotoConfigureModel(Tcl_Interp *interp, PhotoModel *modelPtr, int objc, Tcl_Obj *const objv[], int flags); static int ToggleComplexAlphaIfNeeded(PhotoModel *mPtr); @@ -339,7 +339,7 @@ ImgPhotoCreate( PhotoModel *modelPtr; /* - * Allocate and initialize the photo image master record. + * Allocate and initialize the photo image model record. */ modelPtr = ckalloc(sizeof(PhotoModel)); @@ -357,7 +357,7 @@ ImgPhotoCreate( * Process configuration options given in the image create command. */ - if (ImgPhotoConfigureMaster(interp, modelPtr, objc, objv, 0) != TCL_OK) { + if (ImgPhotoConfigureModel(interp, modelPtr, objc, objv, 0) != TCL_OK) { ImgPhotoDelete(modelPtr); return TCL_ERROR; } @@ -386,7 +386,7 @@ ImgPhotoCreate( static int ImgPhotoCmd( - ClientData clientData, /* Information about photo master. */ + ClientData clientData, /* Information about photo model. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -532,7 +532,7 @@ ImgPhotoCmd( configSpecs, (char *) modelPtr, arg, 0); } } else { - return ImgPhotoConfigureMaster(interp, modelPtr, objc-2, objv+2, + return ImgPhotoConfigureModel(interp, modelPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); } @@ -1759,7 +1759,7 @@ ParseSubcommandOptions( /* *---------------------------------------------------------------------- * - * ImgPhotoConfigureMaster -- + * ImgPhotoConfigureModel -- * * This function is called when a photo image is created or reconfigured. * It processes configuration options and resets any instances of the @@ -1777,7 +1777,7 @@ ParseSubcommandOptions( */ static int -ImgPhotoConfigureMaster( +ImgPhotoConfigureModel( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ PhotoModel *modelPtr, /* Pointer to data structure describing * overall photo image to (re)configure. */ @@ -2083,7 +2083,7 @@ ImgPhotoConfigureMaster( * None. * * Side effects: - * (Re)sets COMPLEX_ALPHA flag of master. + * (Re)sets COMPLEX_ALPHA flag of model. * *---------------------------------------------------------------------- */ @@ -2121,7 +2121,7 @@ ToggleComplexAlphaIfNeeded( * * ImgPhotoDelete -- * - * This function is called by the image code to delete the master + * This function is called by the image code to delete the model * structure for an image. * * Results: @@ -2135,10 +2135,10 @@ ToggleComplexAlphaIfNeeded( static void ImgPhotoDelete( - ClientData masterData) /* Pointer to PhotoModel structure for image. + ClientData modelData) /* Pointer to PhotoModel structure for image. * Must not have any more instances. */ { - PhotoModel *modelPtr = masterData; + PhotoModel *modelPtr = modelData; PhotoInstance *instancePtr; while ((instancePtr = modelPtr->instancePtr) != NULL) { @@ -2212,7 +2212,7 @@ ImgPhotoCmdDeletedProc( * with memory allocation.) * * Side effects: - * Storage gets reallocated, for the master and all its instances. + * Storage gets reallocated, for the model and all its instances. * *---------------------------------------------------------------------- */ @@ -3486,7 +3486,7 @@ Tk_PhotoPutZoomedBlock( * Tk_DitherPhoto -- * * This function is called to update an area of each instance's pixmap by - * dithering the corresponding area of the image master. + * dithering the corresponding area of the image model. * * Results: * None. @@ -3501,7 +3501,7 @@ Tk_PhotoPutZoomedBlock( void Tk_DitherPhoto( - Tk_PhotoHandle photo, /* Image master whose instances are to be + Tk_PhotoHandle photo, /* Image model whose instances are to be * updated. */ int x, int y, /* Coordinates of the top-left pixel in the * area to be dithered. */ diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h index 90705e9..994fa40 100644 --- a/generic/tkImgPhoto.h +++ b/generic/tkImgPhoto.h @@ -27,11 +27,11 @@ * Forward declarations of the structures we define. */ -#define PhotoMaster PhotoModel +#define PhotoModel PhotoMaster typedef struct ColorTableId ColorTableId; typedef struct ColorTable ColorTable; typedef struct PhotoInstance PhotoInstance; -typedef struct PhotoModel PhotoModel; +typedef struct PhotoMaster PhotoMaster; /* * A signed 8-bit integral type. If chars are unsigned and the compiler isn't @@ -138,11 +138,11 @@ struct ColorTable { #define MAP_COLORS 8 /* - * Definition of the data associated with each photo image master. + * Definition of the data associated with each photo image model. */ -struct PhotoModel { - Tk_ImageModel tkMaster; /* Tk's token for image model. NULL means the +struct PhotoMaster { + Tk_ImageMaster tkMaster; /* Tk's token for image model. NULL means the * image is being deleted. */ Tcl_Interp *interp; /* Interpreter associated with the application * using this image. */ @@ -165,11 +165,11 @@ struct PhotoModel { TkRegion validRegion; /* Tk region indicating which parts of the * image have valid image data. */ PhotoInstance *instancePtr; /* First in the list of instances associated - * with this master. */ + * with this model. */ }; /* - * Bit definitions for the flags field of a PhotoModel. + * Bit definitions for the flags field of a PhotoMaster. * COLOR_IMAGE: 1 means that the image has different color * components. * IMAGE_CHANGED: 1 means that the instances of this image need @@ -196,17 +196,17 @@ struct PhotoModel { */ struct PhotoInstance { - PhotoModel *masterPtr; /* Pointer to master for image. */ + PhotoMaster *masterPtr; /* Pointer to model for image. */ Display *display; /* Display for windows using this instance. */ Colormap colormap; /* The image may only be used in windows with * this particular colormap. */ PhotoInstance *nextPtr; /* Pointer to the next instance in the list of - * instances associated with this master. */ + * instances associated with this model. */ int refCount; /* Number of instances using this structure. */ Tk_Uid palette; /* Palette for these particular instances. */ double gamma; /* Gamma value for these instances. */ Tk_Uid defaultPalette; /* Default palette to use if a palette is not - * specified for the master. */ + * specified for the model. */ ColorTable *colorTablePtr; /* Pointer to information about colors * allocated for image display in windows like * this one. */ diff --git a/generic/tkInt.decls b/generic/tkInt.decls index a160541..2faf410 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -636,10 +636,10 @@ declare 184 { } # Support for aqua's inability to draw outside [NSView drawRect:] -declare 185 aqua { +declare 185 macosx { void TkpRedrawWidget(Tk_Window tkwin) } -declare 186 aqua { +declare 186 macosx { int TkpWillDrawWidget(Tk_Window tkwin) } @@ -956,9 +956,10 @@ declare 24 aqua { declare 25 aqua { void TkMacOSXMenuClick(void) } -declare 26 aqua { - void TkMacOSXRegisterOffScreenWindow(Window window, void *portPtr) -} +# The corresponding Unregister was not a stub, and this should be static. +#declare 26 aqua { +# void TkMacOSXRegisterOffScreenWindow(Window window, void *portPtr) +#} declare 27 aqua { int TkMacOSXResizable(TkWindow *winPtr) } @@ -977,9 +978,10 @@ declare 31 aqua { declare 32 aqua { void TkMacOSXUpdateClipRgn(TkWindow *winPtr) } -declare 33 aqua { - void TkMacOSXUnregisterMacWindow(void *portPtr) -} +# This was not implemented. Perhaps meant to be OffScreen ? +#declare 33 aqua { +# void TkMacOSXUnregisterMacWindow(void *portPtr) +#} declare 34 aqua { int TkMacOSXUseMenuID(short macID) } @@ -1849,7 +1851,7 @@ declare 112 aqua { declare 114 aqua { VisualID XVisualIDFromVisual(Visual *visual) } -declare 120 macosx { +declare 120 aqua { int XOffsetRegion(void *rgn, int dx, int dy) } declare 129 aqua { @@ -1872,7 +1874,7 @@ declare 146 aqua { unsigned int ui1, unsigned int ui2, XColor _Xconst *x1, XColor _Xconst *x2) } -declare 157 macosx { +declare 157 aqua { KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, int i) } declare 158 aqua { diff --git a/generic/tkInt.h b/generic/tkInt.h index b700be7..530638a 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -861,9 +861,9 @@ typedef struct TkWindow { #endif /* TK_USE_INPUT_METHODS */ char *geomMgrName; /* Records the name of the geometry manager. */ struct TkWindow *maintainerPtr; - /* The geometry master for this window. The - * value is NULL if the window has no master or - * if its master is its parent. */ + /* The geometry container for this window. The + * value is NULL if the window has no container or + * if its container is its parent. */ } TkWindow; /* @@ -1221,10 +1221,12 @@ MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp, MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); -MODULE_SCOPE int TkSetGeometryMaster(Tcl_Interp *interp, - Tk_Window tkwin, const char *master); -MODULE_SCOPE void TkFreeGeometryMaster(Tk_Window tkwin, - const char *master); +#define TkSetGeometryContainer TkSetGeometryMaster +MODULE_SCOPE int TkSetGeometryContainer(Tcl_Interp *interp, + Tk_Window tkwin, const char *name); +#define TkFreeGeometryContainer TkFreeGeometryMaster +MODULE_SCOPE void TkFreeGeometryContainer(Tk_Window tkwin, + const char *name); MODULE_SCOPE void TkEventInit(void); MODULE_SCOPE void TkRegisterObjTypes(void); diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index 1344cc6..7057411 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -550,14 +550,14 @@ EXTERN void TkDrawAngledChars(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); -#ifdef MAC_OSX_TK /* AQUA */ +#ifdef MAC_OSX_TCL /* MACOSX */ /* 185 */ EXTERN void TkpRedrawWidget(Tk_Window tkwin); -#endif /* AQUA */ -#ifdef MAC_OSX_TK /* AQUA */ +#endif /* MACOSX */ +#ifdef MAC_OSX_TCL /* MACOSX */ /* 186 */ EXTERN int TkpWillDrawWidget(Tk_Window tkwin); -#endif /* AQUA */ +#endif /* MACOSX */ typedef struct TkIntStubs { int magic; @@ -775,26 +775,24 @@ typedef struct TkIntStubs { void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */ int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */ void (*tkDrawAngledChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); /* 184 */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ void (*reserved185)(void); -#endif /* X11 */ +#endif /* UNIX */ #if defined(_WIN32) /* WIN */ void (*reserved185)(void); #endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - void (*reserved185)(void); /* Dummy entry for stubs table backwards compatibility */ +#ifdef MAC_OSX_TCL /* MACOSX */ void (*tkpRedrawWidget) (Tk_Window tkwin); /* 185 */ -#endif /* AQUA */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ +#endif /* MACOSX */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ void (*reserved186)(void); -#endif /* X11 */ +#endif /* UNIX */ #if defined(_WIN32) /* WIN */ void (*reserved186)(void); #endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - void (*reserved186)(void); /* Dummy entry for stubs table backwards compatibility */ +#ifdef MAC_OSX_TCL /* MACOSX */ int (*tkpWillDrawWidget) (Tk_Window tkwin); /* 186 */ -#endif /* AQUA */ +#endif /* MACOSX */ } TkIntStubs; extern const TkIntStubs *tkIntStubsPtr; @@ -1167,14 +1165,14 @@ extern const TkIntStubs *tkIntStubsPtr; (tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */ #define TkDrawAngledChars \ (tkIntStubsPtr->tkDrawAngledChars) /* 184 */ -#ifdef MAC_OSX_TK /* AQUA */ +#ifdef MAC_OSX_TCL /* MACOSX */ #define TkpRedrawWidget \ (tkIntStubsPtr->tkpRedrawWidget) /* 185 */ -#endif /* AQUA */ -#ifdef MAC_OSX_TK /* AQUA */ +#endif /* MACOSX */ +#ifdef MAC_OSX_TCL /* MACOSX */ #define TkpWillDrawWidget \ (tkIntStubsPtr->tkpWillDrawWidget) /* 186 */ -#endif /* AQUA */ +#endif /* MACOSX */ #endif /* defined(USE_TK_STUBS) */ @@ -1219,5 +1217,12 @@ extern const TkIntStubs *tkIntStubsPtr; #endif /* UNIX */ +#if !defined(MAC_OSX_TK) +# undef TkpWillDrawWidget +# undef TkpRedrawWidget +# define TkpWillDrawWidget(w) 0 +# define TkpRedrawWidget(w) +#endif + #endif /* _TKINTDECLS */ diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 02bb9ae..a785392 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -199,9 +199,7 @@ EXTERN void TkMacOSXMakeRealWindowExist(TkWindow *winPtr); EXTERN void * TkMacOSXMakeStippleMap(Drawable d1, Drawable d2); /* 25 */ EXTERN void TkMacOSXMenuClick(void); -/* 26 */ -EXTERN void TkMacOSXRegisterOffScreenWindow(Window window, - void *portPtr); +/* Slot 26 is reserved */ /* 27 */ EXTERN int TkMacOSXResizable(TkWindow *winPtr); /* 28 */ @@ -214,8 +212,7 @@ EXTERN void TkMacOSXSetUpClippingRgn(Drawable drawable); EXTERN void TkMacOSXSetUpGraphicsPort(GC gc, void *destPort); /* 32 */ EXTERN void TkMacOSXUpdateClipRgn(TkWindow *winPtr); -/* 33 */ -EXTERN void TkMacOSXUnregisterMacWindow(void *portPtr); +/* Slot 33 is reserved */ /* 34 */ EXTERN int TkMacOSXUseMenuID(short macID); /* 35 */ @@ -420,14 +417,14 @@ typedef struct TkIntPlatStubs { void (*tkMacOSXMakeRealWindowExist) (TkWindow *winPtr); /* 23 */ void * (*tkMacOSXMakeStippleMap) (Drawable d1, Drawable d2); /* 24 */ void (*tkMacOSXMenuClick) (void); /* 25 */ - void (*tkMacOSXRegisterOffScreenWindow) (Window window, void *portPtr); /* 26 */ + void (*reserved26)(void); int (*tkMacOSXResizable) (TkWindow *winPtr); /* 27 */ void (*tkMacOSXSetHelpMenuItemCount) (void); /* 28 */ void (*tkMacOSXSetScrollbarGrow) (TkWindow *winPtr, int flag); /* 29 */ void (*tkMacOSXSetUpClippingRgn) (Drawable drawable); /* 30 */ void (*tkMacOSXSetUpGraphicsPort) (GC gc, void *destPort); /* 31 */ void (*tkMacOSXUpdateClipRgn) (TkWindow *winPtr); /* 32 */ - void (*tkMacOSXUnregisterMacWindow) (void *portPtr); /* 33 */ + void (*reserved33)(void); int (*tkMacOSXUseMenuID) (short macID); /* 34 */ TkRegion (*tkMacOSXVisableClipRgn) (TkWindow *winPtr); /* 35 */ void (*tkMacOSXWinBounds) (TkWindow *winPtr, void *geometry); /* 36 */ @@ -657,8 +654,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkMacOSXMakeStippleMap) /* 24 */ #define TkMacOSXMenuClick \ (tkIntPlatStubsPtr->tkMacOSXMenuClick) /* 25 */ -#define TkMacOSXRegisterOffScreenWindow \ - (tkIntPlatStubsPtr->tkMacOSXRegisterOffScreenWindow) /* 26 */ +/* Slot 26 is reserved */ #define TkMacOSXResizable \ (tkIntPlatStubsPtr->tkMacOSXResizable) /* 27 */ #define TkMacOSXSetHelpMenuItemCount \ @@ -671,8 +667,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkMacOSXSetUpGraphicsPort) /* 31 */ #define TkMacOSXUpdateClipRgn \ (tkIntPlatStubsPtr->tkMacOSXUpdateClipRgn) /* 32 */ -#define TkMacOSXUnregisterMacWindow \ - (tkIntPlatStubsPtr->tkMacOSXUnregisterMacWindow) /* 33 */ +/* Slot 33 is reserved */ #define TkMacOSXUseMenuID \ (tkIntPlatStubsPtr->tkMacOSXUseMenuID) /* 34 */ #define TkMacOSXVisableClipRgn \ diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index f20f38f..d05a2c7 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -1104,7 +1104,7 @@ GetCachedSpecs( /* * Now allocate our working copy's space and copy over the contents - * from the master copy. + * from the origin. */ cachedSpecs = ckalloc(entrySpace); diff --git a/generic/tkPack.c b/generic/tkPack.c index 245c6a4..28ae74b 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -20,7 +20,7 @@ static const char *const sideNames[] = { /* * For each window that the packer cares about (either because the window is - * managed by the packer or because the window has slaves that are managed by + * managed by the packer or because the window has content managed by * the packer), there is a structure of the following type: */ @@ -29,15 +29,15 @@ typedef struct Packer { * window has been deleted, but the packet * hasn't had a chance to clean up yet because * the structure is still in use. */ - struct Packer *masterPtr; /* Master window within which this window is + struct Packer *containerPtr; /* Container window within which this window is * packed (NULL means this window isn't * managed by the packer). */ - struct Packer *nextPtr; /* Next window packed within same master. List + struct Packer *nextPtr; /* Next window packed within same container. List * is priority-ordered: first on list gets * packed first. */ - struct Packer *slavePtr; /* First in list of slaves packed inside this - * window (NULL means no packed slaves). */ - Side side; /* Side of master against which this window is + struct Packer *contentPtr; /* First in list of content packed inside this + * window (NULL means no packed content). */ + Side side; /* Side of container against which this window is * packed. */ Tk_Anchor anchor; /* If frame allocated for window is larger * than window needs, this indicates how where @@ -55,13 +55,13 @@ typedef struct Packer { * each side). */ int doubleBw; /* Twice the window's last known border width. * If this changes, the window must be - * repacked within its master. */ + * repacked within its container. */ int *abortPtr; /* If non-NULL, it means that there is a * nested call to ArrangePacking already * working on this window. *abortPtr may be * set to 1 to abort that nested call. This * happens, for example, if tkwin or any of - * its slaves is deleted. */ + * its content is deleted. */ int flags; /* Miscellaneous flags; see below for * definitions. */ } Packer; @@ -70,7 +70,7 @@ typedef struct Packer { * Flag values for Packer structures: * * REQUESTED_REPACK: 1 means a Tcl_DoWhenIdle request has already - * been made to repack all the slaves of this + * been made to repack all the content of this * window. * FILLX: 1 means if frame allocated for window is wider * than window needs, expand window to fill @@ -78,17 +78,17 @@ typedef struct Packer { * than needed. * FILLY: Same as FILLX, except for height. * EXPAND: 1 means this window's frame will absorb any - * extra space in the master window. + * extra space in the container window. * OLD_STYLE: 1 means this window is being managed with the * old-style packer algorithms (before Tk version * 3.3). The main difference is that padding and * filling are done differently. * DONT_PROPAGATE: 1 means don't set this window's requested - * size. 0 means if this window is a master then + * size. 0 means if this window is a container then * Tk will set its requested size to fit the - * needs of its slaves. - * ALLOCED_MASTER 1 means that Pack has allocated itself as - * geometry master for this window. + * needs of its content. + * ALLOCED_CONTAINER 1 means that Pack has allocated itself as + * geometry container for this window. */ #define REQUESTED_REPACK 1 @@ -97,20 +97,20 @@ typedef struct Packer { #define EXPAND 8 #define OLD_STYLE 16 #define DONT_PROPAGATE 32 -#define ALLOCED_MASTER 64 +#define ALLOCED_CONTAINER 64 /* * The following structure is the official type record for the packer: */ static void PackReqProc(ClientData clientData, Tk_Window tkwin); -static void PackLostSlaveProc(ClientData clientData, +static void PackLostContentProc(ClientData clientData, Tk_Window tkwin); static const Tk_GeomMgr packerType = { "pack", /* name */ PackReqProc, /* requestProc */ - PackLostSlaveProc, /* lostSlaveProc */ + PackLostContentProc, /* lostContentProc */ }; /* @@ -118,17 +118,17 @@ static const Tk_GeomMgr packerType = { */ static void ArrangePacking(ClientData clientData); -static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin, +static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, int objc, Tcl_Obj *const objv[]); static void DestroyPacker(void *memPtr); static Packer * GetPacker(Tk_Window tkwin); static int PackAfter(Tcl_Interp *interp, Packer *prevPtr, - Packer *masterPtr, int objc,Tcl_Obj *const objv[]); + Packer *containerPtr, int objc,Tcl_Obj *const objv[]); static void PackStructureProc(ClientData clientData, XEvent *eventPtr); static void Unlink(Packer *packPtr); -static int XExpansion(Packer *slavePtr, int cavityWidth); -static int YExpansion(Packer *slavePtr, int cavityHeight); +static int XExpansion(Packer *contentPtr, int cavityWidth); +static int YExpansion(Packer *contentPtr, int cavityHeight); /* *------------------------------------------------------------------------ @@ -194,7 +194,7 @@ Tk_PackObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; const char *argv2; static const char *const optionStrings[] = { /* after, append, before and unpack are deprecated */ @@ -209,7 +209,7 @@ Tk_PackObjCmd( const char *string = Tcl_GetString(objv[1]); if (string[0] == '.') { - return ConfigureSlaves(interp, tkwin, objc-1, objv+1); + return ConfigureContent(interp, tkwin, objc-1, objv+1); } } if (objc < 3) { @@ -241,48 +241,48 @@ Tk_PackObjCmd( return TCL_ERROR; } prevPtr = GetPacker(tkwin2); - if (prevPtr->masterPtr == NULL) { + 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->masterPtr, objc-3, objv+3); + return PackAfter(interp, prevPtr, prevPtr->containerPtr, objc-3, objv+3); } case PACK_APPEND: { - Packer *masterPtr; - register Packer *prevPtr; + Packer *containerPtr; + Packer *prevPtr; Tk_Window tkwin2; if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetPacker(tkwin2); - prevPtr = masterPtr->slavePtr; + containerPtr = GetPacker(tkwin2); + prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { prevPtr = prevPtr->nextPtr; } } - return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3); + return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3); } case PACK_BEFORE: { - Packer *packPtr, *masterPtr; - register Packer *prevPtr; + 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->masterPtr == NULL) { + 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; } - masterPtr = packPtr->masterPtr; - prevPtr = masterPtr->slavePtr; + containerPtr = packPtr->containerPtr; + prevPtr = containerPtr->contentPtr; if (prevPtr == packPtr) { prevPtr = NULL; } else { @@ -295,7 +295,7 @@ Tk_PackObjCmd( } } } - return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3); + return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3); } case PACK_CONFIGURE: if (argv2[0] != '.') { @@ -304,43 +304,43 @@ Tk_PackObjCmd( Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return TCL_ERROR; } - return ConfigureSlaves(interp, tkwin, objc-2, objv+2); + return ConfigureContent(interp, tkwin, objc-2, objv+2); case PACK_FORGET: { - Tk_Window slave; - Packer *slavePtr; + Tk_Window content; + Packer *contentPtr; int i; for (i = 2; i < objc; i++) { - if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) { continue; } - slavePtr = GetPacker(slave); - if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) { - Tk_ManageGeometry(slave, NULL, NULL); - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->masterPtr->tkwin); + contentPtr = GetPacker(content); + if ((contentPtr != NULL) && (contentPtr->containerPtr != NULL)) { + Tk_ManageGeometry(content, NULL, NULL); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, + contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } } break; } case PACK_INFO: { - register Packer *slavePtr; - Tk_Window slave; + Packer *contentPtr; + Tk_Window content; Tcl_Obj *infoObj; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) { return TCL_ERROR; } - slavePtr = GetPacker(slave); - if (slavePtr->masterPtr == NULL) { + contentPtr = GetPacker(content); + if (contentPtr->containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL); @@ -349,12 +349,12 @@ Tk_PackObjCmd( infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), - TkNewWindowObj(slavePtr->masterPtr->tkwin)); + TkNewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", -1), - Tcl_NewStringObj(Tk_NameOfAnchor(slavePtr->anchor), -1)); + Tcl_NewStringObj(Tk_NameOfAnchor(contentPtr->anchor), -1)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", -1), - Tcl_NewBooleanObj(slavePtr->flags & EXPAND)); - switch (slavePtr->flags & (FILLX|FILLY)) { + Tcl_NewBooleanObj(contentPtr->flags & EXPAND)); + switch (contentPtr->flags & (FILLX|FILLY)) { case 0: Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", -1), Tcl_NewStringObj("none", -1)); @@ -372,31 +372,31 @@ Tk_PackObjCmd( Tcl_NewStringObj("both", -1)); break; } - TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX); - TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY); - TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft,slavePtr->padX); - TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY); + 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("-side", -1), - Tcl_NewStringObj(sideNames[slavePtr->side], -1)); + Tcl_NewStringObj(sideNames[contentPtr->side], -1)); Tcl_SetObjResult(interp, infoObj); break; } case PACK_PROPAGATE: { - Tk_Window master; - Packer *masterPtr; + Tk_Window container; + Packer *containerPtr; int propagate; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetPacker(master); + containerPtr = GetPacker(container); if (objc == 3) { Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(!(masterPtr->flags & DONT_PROPAGATE))); + Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE))); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) { @@ -404,57 +404,57 @@ Tk_PackObjCmd( } if (propagate) { /* - * If we have slaves, we need to register as geometry master. + * If we have content windows, we need to register as geometry container. */ - if (masterPtr->slavePtr != NULL) { - if (TkSetGeometryMaster(interp, master, "pack") != TCL_OK) { + if (containerPtr->contentPtr != NULL) { + if (TkSetGeometryContainer(interp, container, "pack") != TCL_OK) { return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } - masterPtr->flags &= ~DONT_PROPAGATE; + containerPtr->flags &= ~DONT_PROPAGATE; /* - * Repack the master to allow new geometry information to - * propagate upwards to the master's master. + * Repack the container to allow new geometry information to + * propagate upwards to the container's container. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_REPACK)) { - masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, masterPtr); + if (!(containerPtr->flags & REQUESTED_REPACK)) { + containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, containerPtr); } } else { - if (masterPtr->flags & ALLOCED_MASTER) { - TkFreeGeometryMaster(master, "pack"); - masterPtr->flags &= ~ALLOCED_MASTER; + if (containerPtr->flags & ALLOCED_CONTAINER) { + TkFreeGeometryContainer(container, "pack"); + containerPtr->flags &= ~ALLOCED_CONTAINER; } - masterPtr->flags |= DONT_PROPAGATE; + containerPtr->flags |= DONT_PROPAGATE; } break; } case PACK_CONTENT: case PACK_SLAVES: { - Tk_Window master; - Packer *masterPtr, *slavePtr; + Tk_Window container; + Packer *containerPtr, *contentPtr; Tcl_Obj *resultObj; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } resultObj = Tcl_NewObj(); - masterPtr = GetPacker(master); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { + containerPtr = GetPacker(container); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, - TkNewWindowObj(slavePtr->tkwin)); + TkNewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, resultObj); break; @@ -471,11 +471,11 @@ Tk_PackObjCmd( return TCL_ERROR; } packPtr = GetPacker(tkwin2); - if ((packPtr != NULL) && (packPtr->masterPtr != NULL)) { + if ((packPtr != NULL) && (packPtr->containerPtr != NULL)) { Tk_ManageGeometry(tkwin2, NULL, NULL); - if (packPtr->masterPtr->tkwin != Tk_Parent(packPtr->tkwin)) { + if (packPtr->containerPtr->tkwin != Tk_Parent(packPtr->tkwin)) { Tk_UnmaintainGeometry(packPtr->tkwin, - packPtr->masterPtr->tkwin); + packPtr->containerPtr->tkwin); } Unlink(packPtr); Tk_UnmapWindow(packPtr->tkwin); @@ -505,17 +505,16 @@ Tk_PackObjCmd( *------------------------------------------------------------------------ */ - /* ARGSUSED */ static void PackReqProc( ClientData clientData, /* Packer's information about window that got * new preferred geometry. */ - Tk_Window tkwin) /* Other Tk-related information about the + TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ { - register Packer *packPtr = clientData; + Packer *packPtr = (Packer *)clientData; - packPtr = packPtr->masterPtr; + packPtr = packPtr->containerPtr; if (!(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; Tcl_DoWhenIdle(ArrangePacking, packPtr); @@ -525,34 +524,33 @@ PackReqProc( /* *------------------------------------------------------------------------ * - * PackLostSlaveProc -- + * PackLostContentProc -- * * This function is invoked by Tk whenever some other geometry claims - * control over a slave that used to be managed by us. + * control over a content window that used to be managed by us. * * Results: * None. * * Side effects: - * Forgets all packer-related information about the slave. + * Forgets all packer-related information about the content. * *------------------------------------------------------------------------ */ - /* ARGSUSED */ static void -PackLostSlaveProc( - ClientData clientData, /* Packer structure for slave window that was +PackLostContentProc( + void *clientData, /* Packer structure for content window that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */ { - register Packer *slavePtr = clientData; + Packer *contentPtr = (Packer *)clientData; - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } /* @@ -569,22 +567,22 @@ PackLostSlaveProc( * None. * * Side effects: - * The packed slaves of masterPtr may get resized or moved. + * The packed content of containerPtr may get resized or moved. * *------------------------------------------------------------------------ */ static void ArrangePacking( - ClientData clientData) /* Structure describing master whose slaves + ClientData clientData) /* Structure describing container whose content * are to be re-layed out. */ { - register Packer *masterPtr = clientData; - register Packer *slavePtr; + Packer *containerPtr = (Packer *)clientData; + Packer *contentPtr; int cavityX, cavityY, cavityWidth, cavityHeight; /* These variables keep track of the * as-yet-unallocated space remaining in the - * middle of the master window. */ + * middle of the container window. */ int frameX, frameY, frameWidth, frameHeight; /* These variables keep track of the frame * allocated to the current window. */ @@ -597,14 +595,15 @@ ArrangePacking( int borderLeft, borderRight; int maxWidth, maxHeight, tmp; - masterPtr->flags &= ~REQUESTED_REPACK; + containerPtr->flags &= ~REQUESTED_REPACK; /* - * If the master has no slaves anymore, then don't do anything at all: - * just leave the master's size as-is. + * If the container has no content anymore, then leave the container size as-is. + * Otherwise there is no way to "relinquish" control over the container + * so another geometry manager can take over. */ - if (masterPtr->slavePtr == NULL) { + if (containerPtr->contentPtr == NULL) { return; } @@ -614,52 +613,52 @@ ArrangePacking( * necessary. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - masterPtr->abortPtr = &abort; + containerPtr->abortPtr = &abort; abort = 0; - Tcl_Preserve(masterPtr); + Tcl_Preserve(containerPtr); /* - * Pass #1: scan all the slaves to figure out the total amount of space + * Pass #1: scan all the content to figure out the total amount of space * needed. Two separate width and height values are computed: * * width - Holds the sum of the widths (plus padding) of all the - * slaves seen so far that were packed LEFT or RIGHT. + * content seen so far that were packed LEFT or RIGHT. * height - Holds the sum of the heights (plus padding) of all the - * slaves seen so far that were packed TOP or BOTTOM. + * content seen so far that were packed TOP or BOTTOM. * - * maxWidth - Gradually builds up the width needed by the master to - * just barely satisfy all the slave's needs. For each - * slave, the code computes the width needed for all the - * slaves so far and updates maxWidth if the new value is + * maxWidth - Gradually builds up the width needed by the container to + * just barely satisfy all the content's needs. For each + * content, the code computes the width needed for all the + * content so far and updates maxWidth if the new value is * greater. * maxHeight - Same as maxWidth, except keeps height info. */ - width = maxWidth = Tk_InternalBorderLeft(masterPtr->tkwin) + - Tk_InternalBorderRight(masterPtr->tkwin); - height = maxHeight = Tk_InternalBorderTop(masterPtr->tkwin) + - Tk_InternalBorderBottom(masterPtr->tkwin); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) { - tmp = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padX + slavePtr->iPadX + width; + width = maxWidth = Tk_InternalBorderLeft(containerPtr->tkwin) + + Tk_InternalBorderRight(containerPtr->tkwin); + height = maxHeight = Tk_InternalBorderTop(containerPtr->tkwin) + + Tk_InternalBorderBottom(containerPtr->tkwin); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) { + tmp = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX + width; if (tmp > maxWidth) { maxWidth = tmp; } - height += Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY; + height += Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY; } else { - tmp = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY + height; + tmp = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY + height; if (tmp > maxHeight) { maxHeight = tmp; } - width += Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padX + slavePtr->iPadX; + width += Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX; } } if (width > maxWidth) { @@ -669,31 +668,31 @@ ArrangePacking( maxHeight = height; } - if (maxWidth < Tk_MinReqWidth(masterPtr->tkwin)) { - maxWidth = Tk_MinReqWidth(masterPtr->tkwin); + if (maxWidth < Tk_MinReqWidth(containerPtr->tkwin)) { + maxWidth = Tk_MinReqWidth(containerPtr->tkwin); } - if (maxHeight < Tk_MinReqHeight(masterPtr->tkwin)) { - maxHeight = Tk_MinReqHeight(masterPtr->tkwin); + if (maxHeight < Tk_MinReqHeight(containerPtr->tkwin)) { + maxHeight = Tk_MinReqHeight(containerPtr->tkwin); } /* - * If the total amount of space needed in the master window has changed, + * If the total amount of space needed in the container window has changed, * and if we're propagating geometry information, then notify the next * geometry manager up and requeue ourselves to start again after the - * master has had a chance to resize us. + * container has had a chance to resize us. */ - if (((maxWidth != Tk_ReqWidth(masterPtr->tkwin)) - || (maxHeight != Tk_ReqHeight(masterPtr->tkwin))) - && !(masterPtr->flags & DONT_PROPAGATE)) { - Tk_GeometryRequest(masterPtr->tkwin, maxWidth, maxHeight); - masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, masterPtr); + if (((maxWidth != Tk_ReqWidth(containerPtr->tkwin)) + || (maxHeight != Tk_ReqHeight(containerPtr->tkwin))) + && !(containerPtr->flags & DONT_PROPAGATE)) { + Tk_GeometryRequest(containerPtr->tkwin, maxWidth, maxHeight); + containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, containerPtr); goto done; } /* - * Pass #2: scan the slaves a second time assigning new sizes. The + * Pass #2: scan the content a second time assigning new sizes. The * "cavity" variables keep track of the unclaimed space in the cavity of * the window; this shrinks inward as we allocate windows around the * edges. The "frame" variables keep track of the space allocated to the @@ -701,22 +700,22 @@ ArrangePacking( * somewhere inside the frame, depending on anchor. */ - cavityX = x = Tk_InternalBorderLeft(masterPtr->tkwin); - cavityY = y = Tk_InternalBorderTop(masterPtr->tkwin); - cavityWidth = Tk_Width(masterPtr->tkwin) - - Tk_InternalBorderLeft(masterPtr->tkwin) - - Tk_InternalBorderRight(masterPtr->tkwin); - cavityHeight = Tk_Height(masterPtr->tkwin) - - Tk_InternalBorderTop(masterPtr->tkwin) - - Tk_InternalBorderBottom(masterPtr->tkwin); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) { + cavityX = x = Tk_InternalBorderLeft(containerPtr->tkwin); + cavityY = y = Tk_InternalBorderTop(containerPtr->tkwin); + cavityWidth = Tk_Width(containerPtr->tkwin) - + Tk_InternalBorderLeft(containerPtr->tkwin) - + Tk_InternalBorderRight(containerPtr->tkwin); + cavityHeight = Tk_Height(containerPtr->tkwin) - + Tk_InternalBorderTop(containerPtr->tkwin) - + Tk_InternalBorderBottom(containerPtr->tkwin); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) { frameWidth = cavityWidth; - frameHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY; - if (slavePtr->flags & EXPAND) { - frameHeight += YExpansion(slavePtr, cavityHeight); + frameHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY; + if (contentPtr->flags & EXPAND) { + frameHeight += YExpansion(contentPtr, cavityHeight); } cavityHeight -= frameHeight; if (cavityHeight < 0) { @@ -724,7 +723,7 @@ ArrangePacking( cavityHeight = 0; } frameX = cavityX; - if (slavePtr->side == TOP) { + if (contentPtr->side == TOP) { frameY = cavityY; cavityY += frameHeight; } else { @@ -732,10 +731,10 @@ ArrangePacking( } } else { frameHeight = cavityHeight; - frameWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padX + slavePtr->iPadX; - if (slavePtr->flags & EXPAND) { - frameWidth += XExpansion(slavePtr, cavityWidth); + frameWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX; + if (contentPtr->flags & EXPAND) { + frameWidth += XExpansion(contentPtr, cavityWidth); } cavityWidth -= frameWidth; if (cavityWidth < 0) { @@ -743,7 +742,7 @@ ArrangePacking( cavityWidth = 0; } frameY = cavityY; - if (slavePtr->side == LEFT) { + if (contentPtr->side == LEFT) { frameX = cavityX; cavityX += frameWidth; } else { @@ -760,31 +759,31 @@ ArrangePacking( * completely ignored except when computing frame size). */ - if (slavePtr->flags & OLD_STYLE) { + if (contentPtr->flags & OLD_STYLE) { borderX = borderY = 0; borderTop = borderBtm = 0; borderLeft = borderRight = 0; } else { - borderX = slavePtr->padX; - borderY = slavePtr->padY; - borderLeft = slavePtr->padLeft; + borderX = contentPtr->padX; + borderY = contentPtr->padY; + borderLeft = contentPtr->padLeft; borderRight = borderX - borderLeft; - borderTop = slavePtr->padTop; + borderTop = contentPtr->padTop; borderBtm = borderY - borderTop; } - width = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->iPadX; - if ((slavePtr->flags & FILLX) + width = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->iPadX; + if ((contentPtr->flags & FILLX) || (width > (frameWidth - borderX))) { width = frameWidth - borderX; } - height = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->iPadY; - if ((slavePtr->flags & FILLY) + height = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->iPadY; + if ((contentPtr->flags & FILLY) || (height > (frameHeight - borderY))) { height = frameHeight - borderY; } - switch (slavePtr->anchor) { + switch (contentPtr->anchor) { case TK_ANCHOR_N: x = frameX + (borderLeft + frameWidth - width - borderRight)/2; y = frameY + borderTop; @@ -824,44 +823,44 @@ ArrangePacking( default: Tcl_Panic("bad frame factor in ArrangePacking"); } - width -= slavePtr->doubleBw; - height -= slavePtr->doubleBw; + width -= contentPtr->doubleBw; + height -= contentPtr->doubleBw; /* * The final step is to set the position, size, and mapped/unmapped - * state of the slave. If the slave is a child of the master, then do + * state of the content. If the content is a child of the container, then do * this here. Otherwise let Tk_MaintainGeometry do the work. */ - if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { + if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) { if ((width <= 0) || (height <= 0)) { - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - if ((x != Tk_X(slavePtr->tkwin)) - || (y != Tk_Y(slavePtr->tkwin)) - || (width != Tk_Width(slavePtr->tkwin)) - || (height != Tk_Height(slavePtr->tkwin))) { - Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height); + if ((x != Tk_X(contentPtr->tkwin)) + || (y != Tk_Y(contentPtr->tkwin)) + || (width != Tk_Width(contentPtr->tkwin)) + || (height != Tk_Height(contentPtr->tkwin))) { + Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height); } if (abort) { goto done; } /* - * Don't map the slave if the master isn't mapped: wait until - * the master gets mapped later. + * Don't map the content if the container isn't mapped: wait until + * the container gets mapped later. */ - if (Tk_IsMapped(masterPtr->tkwin)) { - Tk_MapWindow(slavePtr->tkwin); + if (Tk_IsMapped(containerPtr->tkwin)) { + Tk_MapWindow(contentPtr->tkwin); } } } else { if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin); - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, + Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y, width, height); } } @@ -878,8 +877,8 @@ ArrangePacking( } done: - masterPtr->abortPtr = NULL; - Tcl_Release(masterPtr); + containerPtr->abortPtr = NULL; + Tcl_Release(containerPtr); } /* @@ -887,7 +886,7 @@ ArrangePacking( * * XExpansion -- * - * Given a list of packed slaves, the first of which is packed on the + * Given a list of packed content, the first of which is packed on the * left or right and is expandable, compute how much to expand the child. * * Results: @@ -902,9 +901,9 @@ ArrangePacking( static int XExpansion( - register Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *contentPtr, /* First in list of remaining content. */ int cavityWidth) /* Horizontal space left for all remaining - * slaves. */ + * content. */ { int numExpand, minExpand, curExpand; int childWidth; @@ -922,10 +921,10 @@ XExpansion( minExpand = cavityWidth; numExpand = 0; - for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { - childWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padX + slavePtr->iPadX; - if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) { + for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) { + childWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX; + if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) { if (numExpand) { curExpand = (cavityWidth - childWidth)/numExpand; if (curExpand < minExpand) { @@ -934,7 +933,7 @@ XExpansion( } } else { cavityWidth -= childWidth; - if (slavePtr->flags & EXPAND) { + if (contentPtr->flags & EXPAND) { numExpand++; } } @@ -953,7 +952,7 @@ XExpansion( * * YExpansion -- * - * Given a list of packed slaves, the first of which is packed on the top + * Given a list of packed content, the first of which is packed on the top * or bottom and is expandable, compute how much to expand the child. * * Results: @@ -968,9 +967,9 @@ XExpansion( static int YExpansion( - register Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *contentPtr, /* First in list of remaining content. */ int cavityHeight) /* Vertical space left for all remaining - * slaves. */ + * content. */ { int numExpand, minExpand, curExpand; int childHeight; @@ -981,10 +980,10 @@ YExpansion( minExpand = cavityHeight; numExpand = 0; - for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { - childHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY; - if ((slavePtr->side == LEFT) || (slavePtr->side == RIGHT)) { + for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) { + childHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY; + if ((contentPtr->side == LEFT) || (contentPtr->side == RIGHT)) { if (numExpand) { curExpand = (cavityHeight - childHeight)/numExpand; if (curExpand < minExpand) { @@ -993,7 +992,7 @@ YExpansion( } } else { cavityHeight -= childHeight; - if (slavePtr->flags & EXPAND) { + if (contentPtr->flags & EXPAND) { numExpand++; } } @@ -1031,7 +1030,7 @@ GetPacker( Tk_Window tkwin) /* Token for window for which packer structure * is desired. */ { - register Packer *packPtr; + Packer *packPtr; Tcl_HashEntry *hPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -1049,13 +1048,13 @@ GetPacker( hPtr = Tcl_CreateHashEntry(&dispPtr->packerHashTable, (char *) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Packer *)Tcl_GetHashValue(hPtr); } - packPtr = ckalloc(sizeof(Packer)); + packPtr = (Packer *)ckalloc(sizeof(Packer)); packPtr->tkwin = tkwin; - packPtr->masterPtr = NULL; + packPtr->containerPtr = NULL; packPtr->nextPtr = NULL; - packPtr->slavePtr = NULL; + packPtr->contentPtr = NULL; packPtr->side = TOP; packPtr->anchor = TK_ANCHOR_CENTER; packPtr->padX = packPtr->padY = 0; @@ -1076,7 +1075,7 @@ GetPacker( * PackAfter -- * * This function does most of the real work of adding one or more windows - * into the packing order for its master. + * into the packing order for its container. * * Results: * A standard Tcl return value. @@ -1093,14 +1092,14 @@ 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 - * masterPtr. */ - Packer *masterPtr, /* Master in which to pack windows. */ + * 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. */ { - register Packer *packPtr; + Packer *packPtr; Tk_Window tkwin, ancestor, parent; Tcl_Obj **options; int index, optionCount, c; @@ -1126,13 +1125,13 @@ PackAfter( * its parent. */ - if (TkGetWindowFromObj(interp, masterPtr->tkwin, objv[0], &tkwin) + if (TkGetWindowFromObj(interp, containerPtr->tkwin, objv[0], &tkwin) != TCL_OK) { return TCL_ERROR; } parent = Tk_Parent(tkwin); - for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { + for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { if (ancestor == parent) { break; } @@ -1140,7 +1139,7 @@ PackAfter( badWindow: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack %s inside %s", Tcl_GetString(objv[0]), - Tk_PathName(masterPtr->tkwin))); + Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); return TCL_ERROR; } @@ -1148,7 +1147,7 @@ PackAfter( if (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) { goto badWindow; } - if (tkwin == masterPtr->tkwin) { + if (tkwin == containerPtr->tkwin) { goto badWindow; } packPtr = GetPacker(tkwin); @@ -1170,8 +1169,8 @@ PackAfter( packPtr->flags |= OLD_STYLE; for (index = 0 ; index < optionCount; index++) { Tcl_Obj *curOptPtr = options[index]; - const char *curOpt = Tcl_GetString(curOptPtr); - size_t length = curOptPtr->length; + int length; + const char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length); c = curOpt[0]; @@ -1228,7 +1227,7 @@ PackAfter( packPtr->iPadY = 0; index++; } else if ((c == 'f') && (length > 1) - && (strncmp(curOpt, "frame", (size_t) length) == 0)) { + && (strncmp(curOpt, "frame", length) == 0)) { if (optionCount < (index+2)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "wrong # args: \"frame\"" @@ -1258,53 +1257,53 @@ PackAfter( * Unpack this window if it's currently packed. */ - if (packPtr->masterPtr != NULL) { - if ((packPtr->masterPtr != masterPtr) && - (packPtr->masterPtr->tkwin + if (packPtr->containerPtr != NULL) { + if ((packPtr->containerPtr != containerPtr) && + (packPtr->containerPtr->tkwin != Tk_Parent(packPtr->tkwin))) { Tk_UnmaintainGeometry(packPtr->tkwin, - packPtr->masterPtr->tkwin); + packPtr->containerPtr->tkwin); } Unlink(packPtr); } /* - * Add the window in the correct place in its master's packing + * Add the window in the correct place in its container's packing * order, then make sure that the window is managed by us. */ - packPtr->masterPtr = masterPtr; + packPtr->containerPtr = containerPtr; if (prevPtr == NULL) { - packPtr->nextPtr = masterPtr->slavePtr; - masterPtr->slavePtr = packPtr; + packPtr->nextPtr = containerPtr->contentPtr; + containerPtr->contentPtr = packPtr; } else { packPtr->nextPtr = prevPtr->nextPtr; prevPtr->nextPtr = packPtr; } Tk_ManageGeometry(tkwin, &packerType, packPtr); - if (!(masterPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryMaster(interp, masterPtr->tkwin, "pack") + if (!(containerPtr->flags & DONT_PROPAGATE)) { + if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack") != TCL_OK) { Tk_ManageGeometry(tkwin, NULL, NULL); Unlink(packPtr); return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } } } /* - * Arrange for the master to be re-packed at the first idle moment. + * Arrange for the container to be re-packed at the first idle moment. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_REPACK)) { - masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, masterPtr); + if (!(containerPtr->flags & REQUESTED_REPACK)) { + containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, containerPtr); } return TCL_OK; } @@ -1314,31 +1313,31 @@ PackAfter( * * Unlink -- * - * Remove a packer from its master's list of slaves. + * Remove a packer from its container's list of content. * * Results: * None. * * Side effects: - * The master will be scheduled for repacking. + * The container will be scheduled for repacking. * *---------------------------------------------------------------------- */ static void Unlink( - register Packer *packPtr) /* Window to unlink. */ + Packer *packPtr) /* Window to unlink. */ { - register Packer *masterPtr, *packPtr2; + Packer *containerPtr, *packPtr2; - masterPtr = packPtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = packPtr->containerPtr; + if (containerPtr == NULL) { return; } - if (masterPtr->slavePtr == packPtr) { - masterPtr->slavePtr = packPtr->nextPtr; + if (containerPtr->contentPtr == packPtr) { + containerPtr->contentPtr = packPtr->nextPtr; } else { - for (packPtr2 = masterPtr->slavePtr; ; packPtr2 = packPtr2->nextPtr) { + for (packPtr2 = containerPtr->contentPtr; ; packPtr2 = packPtr2->nextPtr) { if (packPtr2 == NULL) { Tcl_Panic("Unlink couldn't find previous window"); } @@ -1348,24 +1347,24 @@ Unlink( } } } - if (!(masterPtr->flags & REQUESTED_REPACK)) { - masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, masterPtr); + if (!(containerPtr->flags & REQUESTED_REPACK)) { + containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, containerPtr); } - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - packPtr->masterPtr = NULL; + packPtr->containerPtr = NULL; /* - * If we have emptied this master from slaves it means we are no longer + * If we have emptied this container from content it means we are no longer * handling it and should mark it as free. */ - if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { - TkFreeGeometryMaster(masterPtr->tkwin, "pack"); - masterPtr->flags &= ~ALLOCED_MASTER; + if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { + TkFreeGeometryContainer(containerPtr->tkwin, "pack"); + containerPtr->flags &= ~ALLOCED_CONTAINER; } } @@ -1393,7 +1392,7 @@ DestroyPacker( void *memPtr) /* Info about packed window that is now * dead. */ { - register Packer *packPtr = memPtr; + Packer *packPtr = (Packer *)memPtr; ckfree(packPtr); } @@ -1411,7 +1410,7 @@ DestroyPacker( * * Side effects: * If a window was just deleted, clean up all its packer-related - * information. If it was just resized, repack its slaves, if any. + * information. If it was just resized, repack its content, if any. * *---------------------------------------------------------------------- */ @@ -1422,42 +1421,42 @@ PackStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Packer *packPtr = clientData; + Packer *packPtr = (Packer *)clientData; if (eventPtr->type == ConfigureNotify) { - if ((packPtr->slavePtr != NULL) + if ((packPtr->contentPtr != NULL) && !(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; Tcl_DoWhenIdle(ArrangePacking, packPtr); } - if ((packPtr->masterPtr != NULL) + if ((packPtr->containerPtr != NULL) && (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width)) { - if (!(packPtr->masterPtr->flags & REQUESTED_REPACK)) { + if (!(packPtr->containerPtr->flags & REQUESTED_REPACK)) { packPtr->doubleBw = 2*Tk_Changes(packPtr->tkwin)->border_width; - packPtr->masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, packPtr->masterPtr); + packPtr->containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, packPtr->containerPtr); } } } else if (eventPtr->type == DestroyNotify) { - register Packer *slavePtr, *nextPtr; + Packer *contentPtr, *nextPtr; - if (packPtr->masterPtr != NULL) { + if (packPtr->containerPtr != NULL) { Unlink(packPtr); } - for (slavePtr = packPtr->slavePtr; slavePtr != NULL; - slavePtr = nextPtr) { - Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL); - Tk_UnmapWindow(slavePtr->tkwin); - slavePtr->masterPtr = NULL; - nextPtr = slavePtr->nextPtr; - slavePtr->nextPtr = NULL; + for (contentPtr = packPtr->contentPtr; contentPtr != NULL; + contentPtr = nextPtr) { + Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL); + Tk_UnmapWindow(contentPtr->tkwin); + contentPtr->containerPtr = NULL; + nextPtr = contentPtr->nextPtr; + contentPtr->nextPtr = NULL; } if (packPtr->tkwin != NULL) { TkDisplay *dispPtr = ((TkWindow *) packPtr->tkwin)->dispPtr; Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->packerHashTable, - (char *) packPtr->tkwin)); + (void *)packPtr->tkwin)); } if (packPtr->flags & REQUESTED_REPACK) { @@ -1467,24 +1466,24 @@ PackStructureProc( Tcl_EventuallyFree(packPtr, (Tcl_FreeProc *) DestroyPacker); } else if (eventPtr->type == MapNotify) { /* - * When a master gets mapped, must redo the geometry computation so - * that all of its slaves get remapped. + * When a container gets mapped, must redo the geometry computation so + * that all of its content get remapped. */ - if ((packPtr->slavePtr != NULL) + if ((packPtr->contentPtr != NULL) && !(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; Tcl_DoWhenIdle(ArrangePacking, packPtr); } } else if (eventPtr->type == UnmapNotify) { - register Packer *packPtr2; + Packer *packPtr2; /* - * Unmap all of the slaves when the master gets unmapped, so that they + * Unmap all of the content when the container gets unmapped, so that they * don't bother to keep redisplaying themselves. */ - for (packPtr2 = packPtr->slavePtr; packPtr2 != NULL; + for (packPtr2 = packPtr->contentPtr; packPtr2 != NULL; packPtr2 = packPtr2->nextPtr) { Tk_UnmapWindow(packPtr2->tkwin); } @@ -1494,36 +1493,36 @@ PackStructureProc( /* *---------------------------------------------------------------------- * - * ConfigureSlaves -- + * ConfigureContent -- * * This implements the guts of the "pack configure" command. Given a list - * of slaves and configuration options, it arranges for the packer to - * manage the slaves and sets the specified options. + * of content and configuration options, it arranges for the packer to + * manage the content and sets the specified options. * * Results: * TCL_OK is returned if all went well. Otherwise, TCL_ERROR is returned * and the interp's result is set to contain an error message. * * Side effects: - * Slave windows get taken over by the packer. + * Content windows get taken over by the packer. * *---------------------------------------------------------------------- */ static int -ConfigureSlaves( +ConfigureContent( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Any window in application containing - * slaves. Used to look up slave names. */ + * content. Used to look up content names. */ int 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 * that there is at least one window name. */ { - Packer *masterPtr, *slavePtr, *prevPtr, *otherPtr; - Tk_Window other, slave, parent, ancestor; - TkWindow *master; + Packer *containerPtr, *contentPtr, *prevPtr, *otherPtr; + Tk_Window other, content, parent, ancestor; + TkWindow *container; int i, j, numWindows, tmp, positionGiven; const char *string; static const char *const optionStrings[] = { @@ -1546,45 +1545,45 @@ ConfigureSlaves( } /* - * Iterate over all of the slave windows, parsing the configuration - * options for each slave. It's a bit wasteful to re-parse the options for - * each slave, but things get too messy if we try to parse the arguments - * just once at the beginning. For example, if a slave already is packed + * Iterate over all of the content windows, parsing the configuration + * options for each content. It's a bit wasteful to re-parse the options for + * each content, but things get too messy if we try to parse the arguments + * just once at the beginning. For example, if a content already is packed * we want to just change a few existing values without resetting * everything. If there are multiple windows, the -after, -before, and -in * options only get processed for the first window. */ - masterPtr = NULL; + containerPtr = NULL; prevPtr = NULL; positionGiven = 0; for (j = 0; j < numWindows; j++) { - if (TkGetWindowFromObj(interp, tkwin, objv[j], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[j], &content) != TCL_OK) { return TCL_ERROR; } - if (Tk_TopWinHierarchy(slave)) { + if (Tk_TopWinHierarchy(content)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack \"%s\": it's a top-level window", Tcl_GetString(objv[j]))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL); return TCL_ERROR; } - slavePtr = GetPacker(slave); - slavePtr->flags &= ~OLD_STYLE; + contentPtr = GetPacker(content); + contentPtr->flags &= ~OLD_STYLE; /* - * If the slave isn't currently packed, reset all of its configuration + * If the content isn't currently packed, reset all of its configuration * information to default values (there could be old values left from * a previous packing). */ - if (slavePtr->masterPtr == NULL) { - slavePtr->side = TOP; - slavePtr->anchor = TK_ANCHOR_CENTER; - slavePtr->padX = slavePtr->padY = 0; - slavePtr->padLeft = slavePtr->padTop = 0; - slavePtr->iPadX = slavePtr->iPadY = 0; - slavePtr->flags &= ~(FILLX|FILLY|EXPAND); + if (contentPtr->containerPtr == NULL) { + contentPtr->side = TOP; + contentPtr->anchor = TK_ANCHOR_CENTER; + contentPtr->padX = contentPtr->padY = 0; + contentPtr->padLeft = contentPtr->padTop = 0; + contentPtr->iPadX = contentPtr->iPadY = 0; + contentPtr->flags &= ~(FILLX|FILLY|EXPAND); } for (i = numWindows; i < objc; i+=2) { @@ -1608,7 +1607,7 @@ ConfigureSlaves( return TCL_ERROR; } prevPtr = GetPacker(other); - if (prevPtr->masterPtr == NULL) { + if (prevPtr->containerPtr == NULL) { notPacked: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", @@ -1617,12 +1616,12 @@ ConfigureSlaves( NULL); return TCL_ERROR; } - masterPtr = prevPtr->masterPtr; + containerPtr = prevPtr->containerPtr; positionGiven = 1; } break; case CONF_ANCHOR: - if (Tk_GetAnchorFromObj(interp, objv[i+1], &slavePtr->anchor) + if (Tk_GetAnchorFromObj(interp, objv[i+1], &contentPtr->anchor) != TCL_OK) { return TCL_ERROR; } @@ -1634,11 +1633,11 @@ ConfigureSlaves( return TCL_ERROR; } otherPtr = GetPacker(other); - if (otherPtr->masterPtr == NULL) { + if (otherPtr->containerPtr == NULL) { goto notPacked; } - masterPtr = otherPtr->masterPtr; - prevPtr = masterPtr->slavePtr; + containerPtr = otherPtr->containerPtr; + prevPtr = containerPtr->contentPtr; if (prevPtr == otherPtr) { prevPtr = NULL; } else { @@ -1653,21 +1652,21 @@ ConfigureSlaves( if (Tcl_GetBooleanFromObj(interp, objv[i+1], &tmp) != TCL_OK) { return TCL_ERROR; } - slavePtr->flags &= ~EXPAND; + contentPtr->flags &= ~EXPAND; if (tmp) { - slavePtr->flags |= EXPAND; + contentPtr->flags |= EXPAND; } break; case CONF_FILL: string = Tcl_GetString(objv[i+1]); if (strcmp(string, "none") == 0) { - slavePtr->flags &= ~(FILLX|FILLY); + contentPtr->flags &= ~(FILLX|FILLY); } else if (strcmp(string, "x") == 0) { - slavePtr->flags = (slavePtr->flags & ~FILLY) | FILLX; + contentPtr->flags = (contentPtr->flags & ~FILLY) | FILLX; } else if (strcmp(string, "y") == 0) { - slavePtr->flags = (slavePtr->flags & ~FILLX) | FILLY; + contentPtr->flags = (contentPtr->flags & ~FILLX) | FILLY; } else if (strcmp(string, "both") == 0) { - slavePtr->flags |= FILLX|FILLY; + contentPtr->flags |= FILLX|FILLY; } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad fill style \"%s\": must be " @@ -1682,8 +1681,8 @@ ConfigureSlaves( != TCL_OK) { return TCL_ERROR; } - masterPtr = GetPacker(other); - prevPtr = masterPtr->slavePtr; + containerPtr = GetPacker(other); + prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { prevPtr = prevPtr->nextPtr; @@ -1693,7 +1692,7 @@ ConfigureSlaves( } break; case CONF_IPADX: - if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp) + if ((Tk_GetPixelsFromObj(interp, content, objv[i+1], &tmp) != TCL_OK) || (tmp < 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipadx value \"%s\": must be positive screen" @@ -1701,10 +1700,10 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadX = tmp * 2; + contentPtr->iPadX = tmp * 2; break; case CONF_IPADY: - if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp) + if ((Tk_GetPixelsFromObj(interp, content, objv[i+1], &tmp) != TCL_OK) || (tmp < 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipady value \"%s\": must be positive screen" @@ -1712,17 +1711,17 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadY = tmp * 2; + contentPtr->iPadY = tmp * 2; break; case CONF_PADX: - if (TkParsePadAmount(interp, slave, objv[i+1], - &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) { + if (TkParsePadAmount(interp, content, objv[i+1], + &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) { return TCL_ERROR; } break; case CONF_PADY: - if (TkParsePadAmount(interp, slave, objv[i+1], - &slavePtr->padTop, &slavePtr->padY) != TCL_OK) { + if (TkParsePadAmount(interp, content, objv[i+1], + &contentPtr->padTop, &contentPtr->padY) != TCL_OK) { return TCL_ERROR; } break; @@ -1731,42 +1730,42 @@ ConfigureSlaves( sizeof(char *), "side", TCL_EXACT, &side) != TCL_OK) { return TCL_ERROR; } - slavePtr->side = (Side) side; + contentPtr->side = (Side) side; break; } } /* - * If no position in a packing list was specified and the slave is + * If no position in a packing list was specified and the content is * already packed, then leave it in its current location in its * current packing list. */ - if (!positionGiven && (slavePtr->masterPtr != NULL)) { - masterPtr = slavePtr->masterPtr; + if (!positionGiven && (contentPtr->containerPtr != NULL)) { + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } /* - * If the slave is going to be put back after itself or the same -in + * If the content is going to be put back after itself or the same -in * window is passed in again, then just skip the whole operation, * since it won't work anyway. */ - if (prevPtr == slavePtr) { - masterPtr = slavePtr->masterPtr; + if (prevPtr == contentPtr) { + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } /* * If none of the "-in", "-before", or "-after" options has been - * specified, arrange for the slave to go at the end of the order for + * specified, arrange for the content to go at the end of the order for * its parent. */ if (!positionGiven) { - masterPtr = GetPacker(Tk_Parent(slave)); - prevPtr = masterPtr->slavePtr; + containerPtr = GetPacker(Tk_Parent(content)); + prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { prevPtr = prevPtr->nextPtr; @@ -1775,25 +1774,25 @@ ConfigureSlaves( } /* - * Make sure that the slave's parent is either the master or an - * ancestor of the master, and that the master and slave aren't the + * Make sure that the content's parent is either the container or an + * ancestor of the container, and that the container and content aren't the * same. */ - parent = Tk_Parent(slave); - for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { + parent = Tk_Parent(content); + for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { if (ancestor == parent) { break; } if (Tk_TopWinHierarchy(ancestor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack %s inside %s", Tcl_GetString(objv[j]), - Tk_PathName(masterPtr->tkwin))); + Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); return TCL_ERROR; } } - if (slave == masterPtr->tkwin) { + if (content == containerPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack %s inside itself", Tcl_GetString(objv[j]))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); @@ -1804,67 +1803,67 @@ ConfigureSlaves( * Check for management loops. */ - for (master = (TkWindow *)masterPtr->tkwin; master != NULL; - master = (TkWindow *)TkGetGeomMaster(master)) { - if (master == (TkWindow *)slave) { + for (container = (TkWindow *)containerPtr->tkwin; container != NULL; + container = (TkWindow *)TkGetGeomMaster(container)) { + if (container == (TkWindow *)content) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", - Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin))); + Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); return TCL_ERROR; } } - if (masterPtr->tkwin != Tk_Parent(slave)) { - ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin; + if (containerPtr->tkwin != Tk_Parent(content)) { + ((TkWindow *)content)->maintainerPtr = (TkWindow *)containerPtr->tkwin; } /* - * Unpack the slave if it's currently packed, then position it after + * Unpack the content if it's currently packed, then position it after * prevPtr. */ - if (slavePtr->masterPtr != NULL) { - if ((slavePtr->masterPtr != masterPtr) && - (slavePtr->masterPtr->tkwin - != Tk_Parent(slavePtr->tkwin))) { - Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->masterPtr->tkwin); + if (contentPtr->containerPtr != NULL) { + if ((contentPtr->containerPtr != containerPtr) && + (contentPtr->containerPtr->tkwin + != Tk_Parent(contentPtr->tkwin))) { + Tk_UnmaintainGeometry(contentPtr->tkwin, + contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); + Unlink(contentPtr); } - slavePtr->masterPtr = masterPtr; + contentPtr->containerPtr = containerPtr; if (prevPtr == NULL) { - slavePtr->nextPtr = masterPtr->slavePtr; - masterPtr->slavePtr = slavePtr; + contentPtr->nextPtr = containerPtr->contentPtr; + containerPtr->contentPtr = contentPtr; } else { - slavePtr->nextPtr = prevPtr->nextPtr; - prevPtr->nextPtr = slavePtr; + contentPtr->nextPtr = prevPtr->nextPtr; + prevPtr->nextPtr = contentPtr; } - Tk_ManageGeometry(slave, &packerType, slavePtr); - prevPtr = slavePtr; + Tk_ManageGeometry(content, &packerType, contentPtr); + prevPtr = contentPtr; - if (!(masterPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryMaster(interp, masterPtr->tkwin, "pack") + if (!(containerPtr->flags & DONT_PROPAGATE)) { + if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack") != TCL_OK) { - Tk_ManageGeometry(slave, NULL, NULL); - Unlink(slavePtr); + Tk_ManageGeometry(content, NULL, NULL); + Unlink(contentPtr); return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } /* - * Arrange for the master to be re-packed at the first idle moment. + * Arrange for the container to be re-packed at the first idle moment. */ scheduleLayout: - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_REPACK)) { - masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, masterPtr); + if (!(containerPtr->flags & REQUESTED_REPACK)) { + containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, containerPtr); } } return TCL_OK; diff --git a/generic/tkPlace.c b/generic/tkPlace.c index f5afa38..615eb9e 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -17,10 +17,10 @@ * Border modes for relative placement: * * BM_INSIDE: relative distances computed using area inside all - * borders of master window. + * borders of container window. * BM_OUTSIDE: relative distances computed using outside area that - * includes all borders of master. - * BM_IGNORE: border issues are ignored: place relative to master's + * includes all borders of container. + * BM_IGNORE: border issues are ignored: place relative to container's * actual window size. */ @@ -35,16 +35,16 @@ typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode; * structure of the following type: */ -typedef struct Slave { +typedef struct Content { Tk_Window tkwin; /* Tk's token for window. */ Tk_Window inTkwin; /* Token for the -in window. */ - struct Master *masterPtr; /* Pointer to information for window relative + struct Container *containerPtr; /* Pointer to information for window relative * to which tkwin is placed. This isn't * necessarily the logical parent of tkwin. - * NULL means the master was deleted or never + * NULL means the container was deleted or never * assigned. */ - struct Slave *nextPtr; /* Next in list of windows placed relative to - * same master (NULL for end of list). */ + struct Content *nextPtr; /* Next in list of windows placed relative to + * same container (NULL for end of list). */ Tk_OptionTable optionTable; /* Table that defines configuration options * available for this command. */ /* @@ -57,22 +57,22 @@ typedef struct Slave { Tcl_Obj *xPtr, *yPtr; /* Tcl_Obj rep's of x, y coords, to keep pixel * spec. information. */ double relX, relY; /* X and Y coordinates relative to size of - * master. */ + * container. */ int width, height; /* Absolute dimensions for tkwin. */ Tcl_Obj *widthPtr; /* Tcl_Obj rep of width, to keep pixel * spec. */ Tcl_Obj *heightPtr; /* Tcl_Obj rep of height, to keep pixel * spec. */ double relWidth, relHeight; /* Dimensions for tkwin relative to size of - * master. */ + * container. */ Tcl_Obj *relWidthPtr; Tcl_Obj *relHeightPtr; Tk_Anchor anchor; /* Which point on tkwin is placed at the given * position. */ - BorderMode borderMode; /* How to treat borders of master window. */ + BorderMode borderMode; /* How to treat borders of container window. */ int flags; /* Various flags; see below for bit * definitions. */ -} Slave; +} Content; /* * Type masks for options: @@ -82,34 +82,34 @@ typedef struct Slave { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", -1, - Tk_Offset(Slave, anchor), 0, 0, 0}, + Tk_Offset(Content, anchor), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", -1, - Tk_Offset(Slave, borderMode), 0, borderModeStrings, 0}, - {TK_OPTION_PIXELS, "-height", NULL, NULL, "", Tk_Offset(Slave, heightPtr), - Tk_Offset(Slave, height), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_WINDOW, "-in", NULL, NULL, "", -1, Tk_Offset(Slave, inTkwin), + Tk_Offset(Content, borderMode), 0, borderModeStrings, 0}, + {TK_OPTION_PIXELS, "-height", NULL, NULL, "", Tk_Offset(Content, heightPtr), + Tk_Offset(Content, height), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_WINDOW, "-in", NULL, NULL, "", -1, Tk_Offset(Content, inTkwin), 0, 0, IN_MASK}, {TK_OPTION_DOUBLE, "-relheight", NULL, NULL, "", - Tk_Offset(Slave, relHeightPtr), Tk_Offset(Slave, relHeight), + Tk_Offset(Content, relHeightPtr), Tk_Offset(Content, relHeight), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, "", - Tk_Offset(Slave, relWidthPtr), Tk_Offset(Slave, relWidth), + Tk_Offset(Content, relWidthPtr), Tk_Offset(Content, relWidth), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0", -1, - Tk_Offset(Slave, relX), 0, 0, 0}, + Tk_Offset(Content, relX), 0, 0, 0}, {TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0", -1, - Tk_Offset(Slave, relY), 0, 0, 0}, - {TK_OPTION_PIXELS, "-width", NULL, NULL, "", Tk_Offset(Slave, widthPtr), - Tk_Offset(Slave, width), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", Tk_Offset(Slave, xPtr), - Tk_Offset(Slave, x), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", Tk_Offset(Slave, yPtr), - Tk_Offset(Slave, y), TK_OPTION_NULL_OK, 0, 0}, + Tk_Offset(Content, relY), 0, 0, 0}, + {TK_OPTION_PIXELS, "-width", NULL, NULL, "", Tk_Offset(Content, widthPtr), + Tk_Offset(Content, width), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", Tk_Offset(Content, xPtr), + Tk_Offset(Content, x), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", Tk_Offset(Content, yPtr), + Tk_Offset(Content, y), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; /* - * Flag definitions for Slave structures: + * Flag definitions for Content structures: * * CHILD_WIDTH - 1 means -width was specified; * CHILD_REL_WIDTH - 1 means -relwidth was specified. @@ -123,25 +123,25 @@ static const Tk_OptionSpec optionSpecs[] = { #define CHILD_REL_HEIGHT 8 /* - * For each master window that has a slave managed by the placer there is a + * For each container window that has a content managed by the placer there is a * structure of the following form: */ -typedef struct Master { - Tk_Window tkwin; /* Tk's token for master window. */ - struct Slave *slavePtr; /* First in linked list of slaves placed - * relative to this master. */ +typedef struct Container { + Tk_Window tkwin; /* Tk's token for container window. */ + struct Content *contentPtr; /* First in linked list of content placed + * relative to this container. */ int *abortPtr; /* If non-NULL, it means that there is a nested * call to RecomputePlacement already working on * this window. *abortPtr may be set to 1 to * abort that nested call. This happens, for - * example, if tkwin or any of its slaves + * example, if tkwin or any of its content * is deleted. */ int flags; /* See below for bit definitions. */ -} Master; +} Container; /* - * Flag definitions for masters: + * Flag definitions for containers: * * PARENT_RECONFIG_PENDING - 1 means that a call to RecomputePlacement is * already pending via a Do_When_Idle handler. @@ -155,34 +155,34 @@ typedef struct Master { static void PlaceRequestProc(ClientData clientData, Tk_Window tkwin); -static void PlaceLostSlaveProc(ClientData clientData, +static void PlaceLostContentProc(ClientData clientData, Tk_Window tkwin); static const Tk_GeomMgr placerType = { "place", /* name */ PlaceRequestProc, /* requestProc */ - PlaceLostSlaveProc, /* lostSlaveProc */ + PlaceLostContentProc, /* lostContentProc */ }; /* * Forward declarations for functions defined later in this file: */ -static void SlaveStructureProc(ClientData clientData, +static void ContentStructureProc(ClientData clientData, XEvent *eventPtr); -static int ConfigureSlave(Tcl_Interp *interp, Tk_Window tkwin, +static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, Tk_OptionTable table, int objc, Tcl_Obj *const objv[]); static int PlaceInfoCommand(Tcl_Interp *interp, Tk_Window tkwin); -static Slave * CreateSlave(Tk_Window tkwin, Tk_OptionTable table); -static void FreeSlave(Slave *slavePtr); -static Slave * FindSlave(Tk_Window tkwin); -static Master * CreateMaster(Tk_Window tkwin); -static Master * FindMaster(Tk_Window tkwin); -static void MasterStructureProc(ClientData clientData, +static Content * CreateContent(Tk_Window tkwin, Tk_OptionTable table); +static void FreeContent(Content *contentPtr); +static Content * FindContent(Tk_Window tkwin); +static Container * CreateContainer(Tk_Window tkwin); +static Container * FindContainer(Tk_Window tkwin); +static void PlaceStructureProc(ClientData clientData, XEvent *eventPtr); static void RecomputePlacement(ClientData clientData); -static void UnlinkSlave(Slave *slavePtr); +static void UnlinkContent(Content *contentPtr); /* *-------------------------------------------------------------- @@ -208,9 +208,9 @@ Tk_PlaceObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window main_win = clientData; + Tk_Window main_win = (Tk_Window)clientData; Tk_Window tkwin; - Slave *slavePtr; + Content *contentPtr; TkDisplay *dispPtr; Tk_OptionTable optionTable; static const char *const optionStrings[] = { @@ -252,7 +252,7 @@ Tk_PlaceObjCmd( dispPtr->placeInit = 1; } - return ConfigureSlave(interp, tkwin, optionTable, objc-2, objv+2); + return ConfigureContent(interp, tkwin, optionTable, objc-2, objv+2); } /* @@ -286,11 +286,11 @@ Tk_PlaceObjCmd( if (objc == 3 || objc == 4) { Tcl_Obj *objPtr; - slavePtr = FindSlave(tkwin); - if (slavePtr == NULL) { + contentPtr = FindContent(tkwin); + if (contentPtr == NULL) { return TCL_OK; } - objPtr = Tk_GetOptionInfo(interp, (char *) slavePtr, optionTable, + objPtr = Tk_GetOptionInfo(interp, (char *)contentPtr, optionTable, (objc == 4) ? objv[3] : NULL, tkwin); if (objPtr == NULL) { return TCL_ERROR; @@ -298,29 +298,29 @@ Tk_PlaceObjCmd( Tcl_SetObjResult(interp, objPtr); return TCL_OK; } - return ConfigureSlave(interp, tkwin, optionTable, objc-3, objv+3); + return ConfigureContent(interp, tkwin, optionTable, objc-3, objv+3); case PLACE_FORGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pathName"); return TCL_ERROR; } - slavePtr = FindSlave(tkwin); - if (slavePtr == NULL) { + contentPtr = FindContent(tkwin); + if (contentPtr == NULL) { return TCL_OK; } - if ((slavePtr->masterPtr != NULL) && - (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if ((contentPtr->containerPtr != NULL) && + (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - UnlinkSlave(slavePtr); + UnlinkContent(contentPtr); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, - (char *) tkwin)); - Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, - slavePtr); + (void *)tkwin)); + Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc, + contentPtr); Tk_ManageGeometry(tkwin, NULL, NULL); Tk_UnmapWindow(tkwin); - FreeSlave(slavePtr); + FreeContent(contentPtr); break; case PLACE_INFO: @@ -332,20 +332,20 @@ Tk_PlaceObjCmd( case PLACE_CONTENT: case PLACE_SLAVES: { - Master *masterPtr; + Container *containerPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pathName"); return TCL_ERROR; } - masterPtr = FindMaster(tkwin); - if (masterPtr != NULL) { + containerPtr = FindContainer(tkwin); + if (containerPtr != NULL) { Tcl_Obj *listPtr = Tcl_NewObj(); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { Tcl_ListObjAppendElement(NULL, listPtr, - TkNewWindowObj(slavePtr->tkwin)); + TkNewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, listPtr); } @@ -359,59 +359,59 @@ Tk_PlaceObjCmd( /* *---------------------------------------------------------------------- * - * CreateSlave -- + * CreateContent -- * - * Given a Tk_Window token, find the Slave structure corresponding to + * Given a Tk_Window token, find the Content structure corresponding to * that token, creating a new one if necessary. * * Results: - * Pointer to the Slave structure. + * Pointer to the Content structure. * * Side effects: - * A new Slave structure may be created. + * A new Content structure may be created. * *---------------------------------------------------------------------- */ -static Slave * -CreateSlave( - Tk_Window tkwin, /* Token for desired slave. */ +static Content * +CreateContent( + Tk_Window tkwin, /* Token for desired content. */ Tk_OptionTable table) { Tcl_HashEntry *hPtr; - register Slave *slavePtr; + Content *contentPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Content *)Tcl_GetHashValue(hPtr); } /* - * No preexisting slave structure for that window, so make a new one and + * No preexisting content structure for that window, so make a new one and * populate it with some default values. */ - slavePtr = ckalloc(sizeof(Slave)); - memset(slavePtr, 0, sizeof(Slave)); - slavePtr->tkwin = tkwin; - slavePtr->inTkwin = NULL; - slavePtr->anchor = TK_ANCHOR_NW; - slavePtr->borderMode = BM_INSIDE; - slavePtr->optionTable = table; - Tcl_SetHashValue(hPtr, slavePtr); - Tk_CreateEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, - slavePtr); - return slavePtr; + contentPtr = (Content *)ckalloc(sizeof(Content)); + memset(contentPtr, 0, sizeof(Content)); + contentPtr->tkwin = tkwin; + contentPtr->inTkwin = NULL; + contentPtr->anchor = TK_ANCHOR_NW; + contentPtr->borderMode = BM_INSIDE; + contentPtr->optionTable = table; + Tcl_SetHashValue(hPtr, contentPtr); + Tk_CreateEventHandler(tkwin, StructureNotifyMask, ContentStructureProc, + contentPtr); + return contentPtr; } /* *---------------------------------------------------------------------- * - * FreeSlave -- + * FreeContent -- * - * Frees the resources held by a Slave structure. + * Frees the resources held by a Content structure. * * Results: * None @@ -423,25 +423,25 @@ CreateSlave( */ static void -FreeSlave( - Slave *slavePtr) +FreeContent( + Content *contentPtr) { - Tk_FreeConfigOptions((char *) slavePtr, slavePtr->optionTable, - slavePtr->tkwin); - ckfree(slavePtr); + Tk_FreeConfigOptions((char *) contentPtr, contentPtr->optionTable, + contentPtr->tkwin); + ckfree(contentPtr); } /* *---------------------------------------------------------------------- * - * FindSlave -- + * FindContent -- * - * Given a Tk_Window token, find the Slave structure corresponding to + * Given a Tk_Window token, find the Content structure corresponding to * that token. This is purely a lookup function; it will not create a * record if one does not yet exist. * * Results: - * Pointer to Slave structure; NULL if none exists. + * Pointer to Content structure; NULL if none exists. * * Side effects: * None. @@ -449,121 +449,121 @@ FreeSlave( *---------------------------------------------------------------------- */ -static Slave * -FindSlave( - Tk_Window tkwin) /* Token for desired slave. */ +static Content * +FindContent( + Tk_Window tkwin) /* Token for desired content. */ { - register Tcl_HashEntry *hPtr; + Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, (char *) tkwin); if (hPtr == NULL) { return NULL; } - return Tcl_GetHashValue(hPtr); + return (Content *)Tcl_GetHashValue(hPtr); } /* *---------------------------------------------------------------------- * - * UnlinkSlave -- + * UnlinkContent -- * - * This function removes a slave window from the chain of slaves in its - * master. + * This function removes a content window from the chain of content in its + * container. * * Results: * None. * * Side effects: - * The slave list of slavePtr's master changes. + * The content list of contentPtr's container changes. * *---------------------------------------------------------------------- */ static void -UnlinkSlave( - Slave *slavePtr) /* Slave structure to be unlinked. */ +UnlinkContent( + Content *contentPtr) /* Content structure to be unlinked. */ { - register Master *masterPtr; - register Slave *prevPtr; + Container *containerPtr; + Content *prevPtr; - masterPtr = slavePtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = contentPtr->containerPtr; + if (containerPtr == NULL) { return; } - if (masterPtr->slavePtr == slavePtr) { - masterPtr->slavePtr = slavePtr->nextPtr; + if (containerPtr->contentPtr == contentPtr) { + containerPtr->contentPtr = contentPtr->nextPtr; } else { - for (prevPtr = masterPtr->slavePtr; ; prevPtr = prevPtr->nextPtr) { + for (prevPtr = containerPtr->contentPtr; ; prevPtr = prevPtr->nextPtr) { if (prevPtr == NULL) { - Tcl_Panic("UnlinkSlave couldn't find slave to unlink"); + Tcl_Panic("UnlinkContent couldn't find slave to unlink"); } - if (prevPtr->nextPtr == slavePtr) { - prevPtr->nextPtr = slavePtr->nextPtr; + if (prevPtr->nextPtr == contentPtr) { + prevPtr->nextPtr = contentPtr->nextPtr; break; } } } - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - slavePtr->masterPtr = NULL; + contentPtr->containerPtr = NULL; } /* *---------------------------------------------------------------------- * - * CreateMaster -- + * CreateContainer -- * - * Given a Tk_Window token, find the Master structure corresponding to + * Given a Tk_Window token, find the Container structure corresponding to * that token, creating a new one if necessary. * * Results: - * Pointer to the Master structure. + * Pointer to the Container structure. * * Side effects: - * A new Master structure may be created. + * A new Container structure may be created. * *---------------------------------------------------------------------- */ -static Master * -CreateMaster( - Tk_Window tkwin) /* Token for desired master. */ +static Container * +CreateContainer( + Tk_Window tkwin) /* Token for desired container. */ { Tcl_HashEntry *hPtr; - register Master *masterPtr; + Container *containerPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew); + hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *)tkwin, &isNew); if (isNew) { - masterPtr = ckalloc(sizeof(Master)); - masterPtr->tkwin = tkwin; - masterPtr->slavePtr = NULL; - masterPtr->abortPtr = NULL; - masterPtr->flags = 0; - Tcl_SetHashValue(hPtr, masterPtr); - Tk_CreateEventHandler(masterPtr->tkwin, StructureNotifyMask, - MasterStructureProc, masterPtr); + containerPtr = (Container *)ckalloc(sizeof(Container)); + containerPtr->tkwin = tkwin; + containerPtr->contentPtr = NULL; + containerPtr->abortPtr = NULL; + containerPtr->flags = 0; + Tcl_SetHashValue(hPtr, containerPtr); + Tk_CreateEventHandler(containerPtr->tkwin, StructureNotifyMask, + PlaceStructureProc, containerPtr); } else { - masterPtr = Tcl_GetHashValue(hPtr); + containerPtr = (Container *)Tcl_GetHashValue(hPtr); } - return masterPtr; + return containerPtr; } /* *---------------------------------------------------------------------- * - * FindMaster -- + * FindContainer -- * - * Given a Tk_Window token, find the Master structure corresponding to + * Given a Tk_Window token, find the Container structure corresponding to * that token. This is simply a lookup function; a new record will not be * created if one does not already exist. * * Results: - * Pointer to the Master structure; NULL if one does not exist for the + * Pointer to the Container structure; NULL if one does not exist for the * given Tk_Window token. * * Side effects: @@ -572,24 +572,24 @@ CreateMaster( *---------------------------------------------------------------------- */ -static Master * -FindMaster( - Tk_Window tkwin) /* Token for desired master. */ +static Container * +FindContainer( + Tk_Window tkwin) /* Token for desired container. */ { - register Tcl_HashEntry *hPtr; + Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, (char *) tkwin); if (hPtr == NULL) { return NULL; } - return Tcl_GetHashValue(hPtr); + return (Container *)Tcl_GetHashValue(hPtr); } /* *---------------------------------------------------------------------- * - * ConfigureSlave -- + * ConfigureContent -- * * This function is called to process an argv/argc list to reconfigure * the placement of a window. @@ -599,26 +599,26 @@ FindMaster( * the interp's result. * * Side effects: - * Information in slavePtr may change, and slavePtr's master is scheduled + * Information in contentPtr may change, and contentPtr's container is scheduled * for reconfiguration. * *---------------------------------------------------------------------- */ static int -ConfigureSlave( +ConfigureContent( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Window tkwin, /* Token for the window to manipulate. */ Tk_OptionTable table, /* Token for option table. */ int objc, /* Number of config arguments. */ Tcl_Obj *const objv[]) /* Object values for arguments. */ { - register Master *masterPtr; + Container *containerPtr; Tk_SavedOptions savedOptions; int mask; - Slave *slavePtr; - Tk_Window masterWin = NULL; - TkWindow *master; + Content *contentPtr; + Tk_Window containerWin = NULL; + TkWindow *container; if (Tk_TopWinHierarchy(tkwin)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -628,71 +628,71 @@ ConfigureSlave( return TCL_ERROR; } - slavePtr = CreateSlave(tkwin, table); + contentPtr = CreateContent(tkwin, table); - if (Tk_SetOptions(interp, (char *) slavePtr, table, objc, objv, - slavePtr->tkwin, &savedOptions, &mask) != TCL_OK) { + if (Tk_SetOptions(interp, (char *)contentPtr, table, objc, objv, + contentPtr->tkwin, &savedOptions, &mask) != TCL_OK) { goto error; } /* - * Set slave flags. First clear the field, then add bits as needed. + * Set content flags. First clear the field, then add bits as needed. */ - slavePtr->flags = 0; - if (slavePtr->heightPtr) { - slavePtr->flags |= CHILD_HEIGHT; + contentPtr->flags = 0; + if (contentPtr->heightPtr) { + contentPtr->flags |= CHILD_HEIGHT; } - if (slavePtr->relHeightPtr) { - slavePtr->flags |= CHILD_REL_HEIGHT; + if (contentPtr->relHeightPtr) { + contentPtr->flags |= CHILD_REL_HEIGHT; } - if (slavePtr->relWidthPtr) { - slavePtr->flags |= CHILD_REL_WIDTH; + if (contentPtr->relWidthPtr) { + contentPtr->flags |= CHILD_REL_WIDTH; } - if (slavePtr->widthPtr) { - slavePtr->flags |= CHILD_WIDTH; + if (contentPtr->widthPtr) { + contentPtr->flags |= CHILD_WIDTH; } - if (!(mask & IN_MASK) && (slavePtr->masterPtr != NULL)) { + if (!(mask & IN_MASK) && (contentPtr->containerPtr != NULL)) { /* - * If no -in option was passed and the slave is already placed then + * If no -in option was passed and the content is already placed then * just recompute the placement. */ - masterPtr = slavePtr->masterPtr; + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } else if (mask & IN_MASK) { /* -in changed */ Tk_Window tkwin; Tk_Window ancestor; - tkwin = slavePtr->inTkwin; + tkwin = contentPtr->inTkwin; /* - * Make sure that the new master is either the logical parent of the - * slave or a descendant of that window, and that the master and slave + * Make sure that the new container is either the logical parent of the + * content or a descendant of that window, and that the container and content * aren't the same. */ for (ancestor = tkwin; ; ancestor = Tk_Parent(ancestor)) { - if (ancestor == Tk_Parent(slavePtr->tkwin)) { + if (ancestor == Tk_Parent(contentPtr->tkwin)) { break; } if (Tk_TopWinHierarchy(ancestor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place %s relative to %s", - Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin))); + Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); goto error; } } - if (slavePtr->tkwin == tkwin) { + if (contentPtr->tkwin == tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place %s relative to itself", - Tk_PathName(slavePtr->tkwin))); + Tk_PathName(contentPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } @@ -701,66 +701,66 @@ ConfigureSlave( * Check for management loops. */ - for (master = (TkWindow *)tkwin; master != NULL; - master = (TkWindow *)TkGetGeomMaster(master)) { - if (master == (TkWindow *)slavePtr->tkwin) { + for (container = (TkWindow *)tkwin; container != NULL; + container = (TkWindow *)TkGetGeomMaster(container)) { + if (container == (TkWindow *)contentPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", - Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin))); + Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } } - if (tkwin != Tk_Parent(slavePtr->tkwin)) { - ((TkWindow *)slavePtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; + if (tkwin != Tk_Parent(contentPtr->tkwin)) { + ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; } - if ((slavePtr->masterPtr != NULL) - && (slavePtr->masterPtr->tkwin == tkwin)) { + if ((contentPtr->containerPtr != NULL) + && (contentPtr->containerPtr->tkwin == tkwin)) { /* - * Re-using same old master. Nothing to do. + * Re-using same old container. Nothing to do. */ - masterPtr = slavePtr->masterPtr; + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } - if ((slavePtr->masterPtr != NULL) && - (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if ((contentPtr->containerPtr != NULL) && + (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - UnlinkSlave(slavePtr); - masterWin = tkwin; + UnlinkContent(contentPtr); + containerWin = tkwin; } /* - * If there's no master specified for this slave, use its Tk_Parent. + * If there's no container specified for this content, use its Tk_Parent. */ - if (masterWin == NULL) { - masterWin = Tk_Parent(slavePtr->tkwin); - slavePtr->inTkwin = masterWin; + if (containerWin == NULL) { + containerWin = Tk_Parent(contentPtr->tkwin); + contentPtr->inTkwin = containerWin; } /* - * Manage the slave window in this master. + * Manage the content window in this container. */ - masterPtr = CreateMaster(masterWin); - slavePtr->masterPtr = masterPtr; - slavePtr->nextPtr = masterPtr->slavePtr; - masterPtr->slavePtr = slavePtr; - Tk_ManageGeometry(slavePtr->tkwin, &placerType, slavePtr); + containerPtr = CreateContainer(containerWin); + contentPtr->containerPtr = containerPtr; + contentPtr->nextPtr = containerPtr->contentPtr; + containerPtr->contentPtr = contentPtr; + Tk_ManageGeometry(contentPtr->tkwin, &placerType, contentPtr); /* - * Arrange for the master to be re-arranged at the first idle moment. + * Arrange for the container to be re-arranged at the first idle moment. */ scheduleLayout: Tk_FreeSavedOptions(&savedOptions); - if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) { - masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, masterPtr); + if (!(containerPtr->flags & PARENT_RECONFIG_PENDING)) { + containerPtr->flags |= PARENT_RECONFIG_PENDING; + Tcl_DoWhenIdle(RecomputePlacement, containerPtr); } return TCL_OK; @@ -796,49 +796,49 @@ PlaceInfoCommand( Tcl_Interp *interp, /* Interp into which to place result. */ Tk_Window tkwin) /* Token for the window to get info on. */ { - Slave *slavePtr; + Content *contentPtr; Tcl_Obj *infoObj; - slavePtr = FindSlave(tkwin); - if (slavePtr == NULL) { + contentPtr = FindContent(tkwin); + if (contentPtr == NULL) { return TCL_OK; } infoObj = Tcl_NewObj(); - if (slavePtr->masterPtr != NULL) { + if (contentPtr->containerPtr != NULL) { Tcl_AppendToObj(infoObj, "-in", -1); Tcl_ListObjAppendElement(NULL, infoObj, - TkNewWindowObj(slavePtr->masterPtr->tkwin)); + TkNewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_AppendToObj(infoObj, " ", -1); } Tcl_AppendPrintfToObj(infoObj, "-x %d -relx %.4g -y %d -rely %.4g", - slavePtr->x, slavePtr->relX, slavePtr->y, slavePtr->relY); - if (slavePtr->flags & CHILD_WIDTH) { - Tcl_AppendPrintfToObj(infoObj, " -width %d", slavePtr->width); + contentPtr->x, contentPtr->relX, contentPtr->y, contentPtr->relY); + if (contentPtr->flags & CHILD_WIDTH) { + Tcl_AppendPrintfToObj(infoObj, " -width %d", contentPtr->width); } else { Tcl_AppendToObj(infoObj, " -width {}", -1); } - if (slavePtr->flags & CHILD_REL_WIDTH) { + if (contentPtr->flags & CHILD_REL_WIDTH) { Tcl_AppendPrintfToObj(infoObj, - " -relwidth %.4g", slavePtr->relWidth); + " -relwidth %.4g", contentPtr->relWidth); } else { Tcl_AppendToObj(infoObj, " -relwidth {}", -1); } - if (slavePtr->flags & CHILD_HEIGHT) { - Tcl_AppendPrintfToObj(infoObj, " -height %d", slavePtr->height); + if (contentPtr->flags & CHILD_HEIGHT) { + Tcl_AppendPrintfToObj(infoObj, " -height %d", contentPtr->height); } else { Tcl_AppendToObj(infoObj, " -height {}", -1); } - if (slavePtr->flags & CHILD_REL_HEIGHT) { + if (contentPtr->flags & CHILD_REL_HEIGHT) { Tcl_AppendPrintfToObj(infoObj, - " -relheight %.4g", slavePtr->relHeight); + " -relheight %.4g", contentPtr->relHeight); } else { Tcl_AppendToObj(infoObj, " -relheight {}", -1); } Tcl_AppendPrintfToObj(infoObj, " -anchor %s -bordermode %s", - Tk_NameOfAnchor(slavePtr->anchor), - borderModeStrings[slavePtr->borderMode]); + Tk_NameOfAnchor(contentPtr->anchor), + borderModeStrings[contentPtr->borderMode]); Tcl_SetObjResult(interp, infoObj); return TCL_OK; } @@ -849,7 +849,7 @@ PlaceInfoCommand( * RecomputePlacement -- * * This function is called as a when-idle handler. It recomputes the - * geometries of all the slaves of a given master. + * geometries of all the content of a given container. * * Results: * None. @@ -862,17 +862,17 @@ PlaceInfoCommand( static void RecomputePlacement( - ClientData clientData) /* Pointer to Master record. */ + ClientData clientData) /* Pointer to Container record. */ { - register Master *masterPtr = clientData; - register Slave *slavePtr; + Container *containerPtr = (Container *)clientData; + Content *contentPtr; int x, y, width, height, tmp; - int masterWidth, masterHeight, masterX, masterY; + int containerWidth, containerHeight, containerX, containerY; double x1, y1, x2, y2; int abort; /* May get set to non-zero to abort this * placement operation. */ - masterPtr->flags &= ~PARENT_RECONFIG_PENDING; + containerPtr->flags &= ~PARENT_RECONFIG_PENDING; /* * Abort any nested call to RecomputePlacement for this window, since @@ -880,57 +880,57 @@ RecomputePlacement( * aborted if necessary. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - masterPtr->abortPtr = &abort; + containerPtr->abortPtr = &abort; abort = 0; - Tcl_Preserve(masterPtr); + Tcl_Preserve(containerPtr); /* - * Iterate over all the slaves for the master. Each slave's geometry can - * be computed independently of the other slaves. Changes to the window's + * Iterate over all the content for the container. Each content's geometry can + * be computed independently of the other content. Changes to the window's * structure could cause almost anything to happen, including deleting the * parent or child. If this happens, we'll be told to abort. */ - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort; - slavePtr = slavePtr->nextPtr) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort; + contentPtr = contentPtr->nextPtr) { /* - * Step 1: compute size and borderwidth of master, taking into account + * Step 1: compute size and borderwidth of container, taking into account * desired border mode. */ - masterX = masterY = 0; - masterWidth = Tk_Width(masterPtr->tkwin); - masterHeight = Tk_Height(masterPtr->tkwin); - if (slavePtr->borderMode == BM_INSIDE) { - masterX = Tk_InternalBorderLeft(masterPtr->tkwin); - masterY = Tk_InternalBorderTop(masterPtr->tkwin); - masterWidth -= masterX + Tk_InternalBorderRight(masterPtr->tkwin); - masterHeight -= masterY + - Tk_InternalBorderBottom(masterPtr->tkwin); - } else if (slavePtr->borderMode == BM_OUTSIDE) { - masterX = masterY = -Tk_Changes(masterPtr->tkwin)->border_width; - masterWidth -= 2 * masterX; - masterHeight -= 2 * masterY; + containerX = containerY = 0; + containerWidth = Tk_Width(containerPtr->tkwin); + containerHeight = Tk_Height(containerPtr->tkwin); + if (contentPtr->borderMode == BM_INSIDE) { + containerX = Tk_InternalBorderLeft(containerPtr->tkwin); + containerY = Tk_InternalBorderTop(containerPtr->tkwin); + containerWidth -= containerX + Tk_InternalBorderRight(containerPtr->tkwin); + containerHeight -= containerY + + Tk_InternalBorderBottom(containerPtr->tkwin); + } else if (contentPtr->borderMode == BM_OUTSIDE) { + containerX = containerY = -Tk_Changes(containerPtr->tkwin)->border_width; + containerWidth -= 2 * containerX; + containerHeight -= 2 * containerY; } /* - * Step 2: compute size of slave (outside dimensions including border) - * and location of anchor point within master. + * Step 2: compute size of content (outside dimensions including border) + * and location of anchor point within container. */ - x1 = slavePtr->x + masterX + (slavePtr->relX*masterWidth); + x1 = contentPtr->x + containerX + (contentPtr->relX*containerWidth); x = (int) (x1 + ((x1 > 0) ? 0.5 : -0.5)); - y1 = slavePtr->y + masterY + (slavePtr->relY*masterHeight); + y1 = contentPtr->y + containerY + (contentPtr->relY*containerHeight); y = (int) (y1 + ((y1 > 0) ? 0.5 : -0.5)); - if (slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) { + if (contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) { width = 0; - if (slavePtr->flags & CHILD_WIDTH) { - width += slavePtr->width; + if (contentPtr->flags & CHILD_WIDTH) { + width += contentPtr->width; } - if (slavePtr->flags & CHILD_REL_WIDTH) { + if (contentPtr->flags & CHILD_REL_WIDTH) { /* * The code below is a bit tricky. In order to round correctly * when both relX and relWidth are specified, compute the @@ -939,40 +939,40 @@ RecomputePlacement( * errors in relX and relWidth accumulate. */ - x2 = x1 + (slavePtr->relWidth*masterWidth); + x2 = x1 + (contentPtr->relWidth*containerWidth); tmp = (int) (x2 + ((x2 > 0) ? 0.5 : -0.5)); width += tmp - x; } } else { - width = Tk_ReqWidth(slavePtr->tkwin) - + 2*Tk_Changes(slavePtr->tkwin)->border_width; + width = Tk_ReqWidth(contentPtr->tkwin) + + 2*Tk_Changes(contentPtr->tkwin)->border_width; } - if (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) { + if (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) { height = 0; - if (slavePtr->flags & CHILD_HEIGHT) { - height += slavePtr->height; + if (contentPtr->flags & CHILD_HEIGHT) { + height += contentPtr->height; } - if (slavePtr->flags & CHILD_REL_HEIGHT) { + if (contentPtr->flags & CHILD_REL_HEIGHT) { /* * See note above for rounding errors in width computation. */ - y2 = y1 + (slavePtr->relHeight*masterHeight); + y2 = y1 + (contentPtr->relHeight*containerHeight); tmp = (int) (y2 + ((y2 > 0) ? 0.5 : -0.5)); height += tmp - y; } } else { - height = Tk_ReqHeight(slavePtr->tkwin) - + 2*Tk_Changes(slavePtr->tkwin)->border_width; + height = Tk_ReqHeight(contentPtr->tkwin) + + 2*Tk_Changes(contentPtr->tkwin)->border_width; } /* * Step 3: adjust the x and y positions so that the desired anchor - * point on the slave appears at that position. Also adjust for the - * border mode and master's border. + * point on the content appears at that position. Also adjust for the + * border mode and container's border. */ - switch (slavePtr->anchor) { + switch (contentPtr->anchor) { case TK_ANCHOR_N: x -= width/2; break; @@ -1011,8 +1011,8 @@ RecomputePlacement( * height aren't zero. */ - width -= 2*Tk_Changes(slavePtr->tkwin)->border_width; - height -= 2*Tk_Changes(slavePtr->tkwin)->border_width; + width -= 2*Tk_Changes(contentPtr->tkwin)->border_width; + height -= 2*Tk_Changes(contentPtr->tkwin)->border_width; if (width <= 0) { width = 1; } @@ -1021,121 +1021,121 @@ RecomputePlacement( } /* - * Step 5: reconfigure the window and map it if needed. If the slave - * is a child of the master, we do this ourselves. If the slave isn't - * a child of the master, let Tk_MaintainGeometry do the work (it will + * Step 5: reconfigure the window and map it if needed. If the content + * is a child of the container, we do this ourselves. If the content isn't + * a child of the container, let Tk_MaintainGeometry do the work (it will * re-adjust things as relevant windows map, unmap, and move). */ - if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { - if ((x != Tk_X(slavePtr->tkwin)) - || (y != Tk_Y(slavePtr->tkwin)) - || (width != Tk_Width(slavePtr->tkwin)) - || (height != Tk_Height(slavePtr->tkwin))) { - Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height); + if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) { + if ((x != Tk_X(contentPtr->tkwin)) + || (y != Tk_Y(contentPtr->tkwin)) + || (width != Tk_Width(contentPtr->tkwin)) + || (height != Tk_Height(contentPtr->tkwin))) { + Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height); } if (abort) { break; } /* - * Don't map the slave unless the master is mapped: the slave will - * get mapped later, when the master is mapped. + * Don't map the content unless the container is mapped: the content will + * get mapped later, when the container is mapped. */ - if (Tk_IsMapped(masterPtr->tkwin)) { - Tk_MapWindow(slavePtr->tkwin); + if (Tk_IsMapped(containerPtr->tkwin)) { + Tk_MapWindow(contentPtr->tkwin); } } else { if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin); - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, + Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y, width, height); } } } - masterPtr->abortPtr = NULL; - Tcl_Release(masterPtr); + containerPtr->abortPtr = NULL; + Tcl_Release(containerPtr); } /* *---------------------------------------------------------------------- * - * MasterStructureProc -- + * PlaceStructureProc -- * * This function is invoked by the Tk event handler when StructureNotify - * events occur for a master window. + * events occur for a container window. * * Results: * None. * * Side effects: * Structures get cleaned up if the window was deleted. If the window was - * resized then slave geometries get recomputed. + * resized then content geometries get recomputed. * *---------------------------------------------------------------------- */ static void -MasterStructureProc( - ClientData clientData, /* Pointer to Master structure for window +PlaceStructureProc( + ClientData clientData, /* Pointer to Container structure for window * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Master *masterPtr = clientData; - register Slave *slavePtr, *nextPtr; - TkDisplay *dispPtr = ((TkWindow *) masterPtr->tkwin)->dispPtr; + Container *containerPtr = (Container *)clientData; + Content *contentPtr, *nextPtr; + TkDisplay *dispPtr = ((TkWindow *) containerPtr->tkwin)->dispPtr; switch (eventPtr->type) { case ConfigureNotify: - if ((masterPtr->slavePtr != NULL) - && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) { - masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, masterPtr); + if ((containerPtr->contentPtr != NULL) + && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) { + containerPtr->flags |= PARENT_RECONFIG_PENDING; + Tcl_DoWhenIdle(RecomputePlacement, containerPtr); } return; case DestroyNotify: - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = nextPtr) { - slavePtr->masterPtr = NULL; - nextPtr = slavePtr->nextPtr; - slavePtr->nextPtr = NULL; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = nextPtr) { + contentPtr->containerPtr = NULL; + nextPtr = contentPtr->nextPtr; + contentPtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable, - (char *) masterPtr->tkwin)); - if (masterPtr->flags & PARENT_RECONFIG_PENDING) { - Tcl_CancelIdleCall(RecomputePlacement, masterPtr); + (char *) containerPtr->tkwin)); + if (containerPtr->flags & PARENT_RECONFIG_PENDING) { + Tcl_CancelIdleCall(RecomputePlacement, containerPtr); } - masterPtr->tkwin = NULL; - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + containerPtr->tkwin = NULL; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - Tcl_EventuallyFree(masterPtr, TCL_DYNAMIC); + Tcl_EventuallyFree(containerPtr, TCL_DYNAMIC); return; case MapNotify: /* - * When a master gets mapped, must redo the geometry computation so - * that all of its slaves get remapped. + * When a container gets mapped, must redo the geometry computation so + * that all of its content get remapped. */ - if ((masterPtr->slavePtr != NULL) - && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) { - masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, masterPtr); + if ((containerPtr->contentPtr != NULL) + && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) { + containerPtr->flags |= PARENT_RECONFIG_PENDING; + Tcl_DoWhenIdle(RecomputePlacement, containerPtr); } return; case UnmapNotify: /* - * Unmap all of the slaves when the master gets unmapped, so that they + * Unmap all of the content when the container gets unmapped, so that they * don't keep redisplaying themselves. */ - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - Tk_UnmapWindow(slavePtr->tkwin); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + Tk_UnmapWindow(contentPtr->tkwin); } return; } @@ -1144,10 +1144,10 @@ MasterStructureProc( /* *---------------------------------------------------------------------- * - * SlaveStructureProc -- + * ContentStructureProc -- * * This function is invoked by the Tk event handler when StructureNotify - * events occur for a slave window. + * events occur for a content window. * * Results: * None. @@ -1159,21 +1159,21 @@ MasterStructureProc( */ static void -SlaveStructureProc( - ClientData clientData, /* Pointer to Slave structure for window +ContentStructureProc( + ClientData clientData, /* Pointer to Content structure for window * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Slave *slavePtr = clientData; - TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; + Content *contentPtr = (Content *)clientData; + TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr; if (eventPtr->type == DestroyNotify) { - if (slavePtr->masterPtr != NULL) { - UnlinkSlave(slavePtr); + if (contentPtr->containerPtr != NULL) { + UnlinkContent(contentPtr); } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, - (char *) slavePtr->tkwin)); - FreeSlave(slavePtr); + (char *) contentPtr->tkwin)); + FreeContent(contentPtr); } } @@ -1182,7 +1182,7 @@ SlaveStructureProc( * * PlaceRequestProc -- * - * This function is invoked by Tk whenever a slave managed by us changes + * This function is invoked by Tk whenever a content managed by us changes * its requested geometry. * * Results: @@ -1195,72 +1195,70 @@ SlaveStructureProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void PlaceRequestProc( - ClientData clientData, /* Pointer to our record for slave. */ - Tk_Window tkwin) /* Window that changed its desired size. */ + ClientData clientData, /* Pointer to our record for content. */ + TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { - Slave *slavePtr = clientData; - Master *masterPtr; + Content *contentPtr = (Content *)clientData; + Container *containerPtr; - if ((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) - && (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) { + if ((contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) + && (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) { /* * Send a ConfigureNotify to indicate that the size change * request was rejected. */ - TkDoConfigureNotify((TkWindow *)(slavePtr->tkwin)); + TkDoConfigureNotify((TkWindow *)(contentPtr->tkwin)); return; } - masterPtr = slavePtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = contentPtr->containerPtr; + if (containerPtr == NULL) { return; } - if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) { - masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, masterPtr); + if (!(containerPtr->flags & PARENT_RECONFIG_PENDING)) { + containerPtr->flags |= PARENT_RECONFIG_PENDING; + Tcl_DoWhenIdle(RecomputePlacement, containerPtr); } } /* *-------------------------------------------------------------- * - * PlaceLostSlaveProc -- + * PlaceLostContentProc -- * * This function is invoked by Tk whenever some other geometry claims - * control over a slave that used to be managed by us. + * control over a content window that used to be managed by us. * * Results: * None. * * Side effects: - * Forgets all placer-related information about the slave. + * Forgets all placer-related information about the content window. * *-------------------------------------------------------------- */ - /* ARGSUSED */ static void -PlaceLostSlaveProc( - ClientData clientData, /* Slave structure for slave window that was +PlaceLostContentProc( + ClientData clientData, /* Content structure for content window that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + Tk_Window tkwin) /* Tk's handle for the content window. */ { - register Slave *slavePtr = clientData; - TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; + Content *contentPtr = (Content *)clientData; + TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr; - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } Tk_UnmapWindow(tkwin); - UnlinkSlave(slavePtr); + UnlinkContent(contentPtr); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, (char *) tkwin)); - Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, - slavePtr); - FreeSlave(slavePtr); + Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc, + contentPtr); + FreeContent(contentPtr); } /* diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h index ed8b1f5..bad633f 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -82,9 +82,12 @@ EXTERN void * TkMacOSXGetRootControl(Drawable drawable); EXTERN void Tk_MacOSXSetupTkNotifier(void); /* 10 */ EXTERN int Tk_MacOSXIsAppInFront(void); -/* Slot 11 is reserved */ -/* Slot 12 is reserved */ -/* Slot 13 is reserved */ +/* 11 */ +EXTERN Tk_Window Tk_MacOSXGetTkWindow(void *w); +/* 12 */ +EXTERN void * Tk_MacOSXGetCGContextForDrawable(Drawable drawable); +/* 13 */ +EXTERN void * Tk_MacOSXGetNSWindowForDrawable(Drawable drawable); /* Slot 14 is reserved */ /* Slot 15 is reserved */ /* 16 */ @@ -116,9 +119,9 @@ typedef struct TkPlatStubs { void * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */ void (*tk_MacOSXSetupTkNotifier) (void); /* 9 */ int (*tk_MacOSXIsAppInFront) (void); /* 10 */ - void (*reserved11)(void); - void (*reserved12)(void); - void (*reserved13)(void); + Tk_Window (*tk_MacOSXGetTkWindow) (void *w); /* 11 */ + void * (*tk_MacOSXGetCGContextForDrawable) (Drawable drawable); /* 12 */ + void * (*tk_MacOSXGetNSWindowForDrawable) (Drawable drawable); /* 13 */ void (*reserved14)(void); void (*reserved15)(void); void (*tkGenWMConfigureEvent_) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 16 */ @@ -174,9 +177,12 @@ extern const TkPlatStubs *tkPlatStubsPtr; (tkPlatStubsPtr->tk_MacOSXSetupTkNotifier) /* 9 */ #define Tk_MacOSXIsAppInFront \ (tkPlatStubsPtr->tk_MacOSXIsAppInFront) /* 10 */ -/* Slot 11 is reserved */ -/* Slot 12 is reserved */ -/* Slot 13 is reserved */ +#define Tk_MacOSXGetTkWindow \ + (tkPlatStubsPtr->tk_MacOSXGetTkWindow) /* 11 */ +#define Tk_MacOSXGetCGContextForDrawable \ + (tkPlatStubsPtr->tk_MacOSXGetCGContextForDrawable) /* 12 */ +#define Tk_MacOSXGetNSWindowForDrawable \ + (tkPlatStubsPtr->tk_MacOSXGetNSWindowForDrawable) /* 13 */ /* Slot 14 is reserved */ /* Slot 15 is reserved */ #define TkGenWMConfigureEvent_ \ @@ -187,8 +193,6 @@ extern const TkPlatStubs *tkPlatStubsPtr; /* !END!: Do not edit above this line. */ -#undef TkGenWMConfigureEvent_ - #ifdef __cplusplus } #endif @@ -196,4 +200,7 @@ extern const TkPlatStubs *tkPlatStubsPtr; #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT +#undef TkGenWMConfigureEvent_ +#define Tk_MacOSXGetNSViewForDrawable TkMacOSXGetRootControl + #endif /* _TKPLATDECLS */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index c69ecac..e637f8e 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -24,6 +24,7 @@ #if defined(MAC_OSX_TK) /* we could have used _TKMACINT */ #include "tkMacOSXInt.h" +#include "tkMacOSXPrivate.h" #endif /* TODO: These ought to come in some other way */ @@ -58,6 +59,27 @@ MODULE_SCOPE const TkStubs tkStubs; #define TkGenWMConfigureEvent_ TkGenWMConfigureEvent #define TkGenerateActivateEvents_ TkGenerateActivateEvents +#if !defined(MAC_OSX_TK) && defined(MAC_OSX_TCL) +# undef TkpWillDrawWidget +# undef TkpRedrawWidget +static int +doNothing(void) +{ + /* dummy implementation, no need to do anything */ + return 0; +} +# define TkpWillDrawWidget ((int (*)(Tk_Window))(void *)doNothing) +# define TkpRedrawWidget ((void (*)(Tk_Window))(void *)doNothing) +#endif + +#if defined(MAC_OSX_TK) +# define Tk_MacOSXGetNSWindowForDrawable TkMacOSXDrawable +# define Tk_MacOSXGetCGContextForDrawable GetCGContextForDrawable +static void *GetCGContextForDrawable(Drawable d) { + return TkMacOSXGetCGContextForDrawable(d); +} +#endif + #ifdef _WIN32 int @@ -480,26 +502,24 @@ static const TkIntStubs tkIntStubs = { TkUnderlineAngledTextLayout, /* 182 */ TkIntersectAngledTextLayout, /* 183 */ TkDrawAngledChars, /* 184 */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ 0, /* 185 */ -#endif /* X11 */ +#endif /* UNIX */ #if defined(_WIN32) /* WIN */ 0, /* 185 */ #endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - 0, /* 185 */ /* Dummy entry for stubs table backwards compatibility */ +#ifdef MAC_OSX_TCL /* MACOSX */ TkpRedrawWidget, /* 185 */ -#endif /* AQUA */ -#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */ +#endif /* MACOSX */ +#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */ 0, /* 186 */ -#endif /* X11 */ +#endif /* UNIX */ #if defined(_WIN32) /* WIN */ 0, /* 186 */ #endif /* WIN */ -#ifdef MAC_OSX_TK /* AQUA */ - 0, /* 186 */ /* Dummy entry for stubs table backwards compatibility */ +#ifdef MAC_OSX_TCL /* MACOSX */ TkpWillDrawWidget, /* 186 */ -#endif /* AQUA */ +#endif /* MACOSX */ }; static const TkIntPlatStubs tkIntPlatStubs = { @@ -582,14 +602,14 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkMacOSXMakeRealWindowExist, /* 23 */ TkMacOSXMakeStippleMap, /* 24 */ TkMacOSXMenuClick, /* 25 */ - TkMacOSXRegisterOffScreenWindow, /* 26 */ + 0, /* 26 */ TkMacOSXResizable, /* 27 */ TkMacOSXSetHelpMenuItemCount, /* 28 */ TkMacOSXSetScrollbarGrow, /* 29 */ TkMacOSXSetUpClippingRgn, /* 30 */ TkMacOSXSetUpGraphicsPort, /* 31 */ TkMacOSXUpdateClipRgn, /* 32 */ - TkMacOSXUnregisterMacWindow, /* 33 */ + 0, /* 33 */ TkMacOSXUseMenuID, /* 34 */ TkMacOSXVisableClipRgn, /* 35 */ TkMacOSXWinBounds, /* 36 */ @@ -1013,9 +1033,9 @@ static const TkPlatStubs tkPlatStubs = { TkMacOSXGetRootControl, /* 8 */ Tk_MacOSXSetupTkNotifier, /* 9 */ Tk_MacOSXIsAppInFront, /* 10 */ - 0, /* 11 */ - 0, /* 12 */ - 0, /* 13 */ + Tk_MacOSXGetTkWindow, /* 11 */ + Tk_MacOSXGetCGContextForDrawable, /* 12 */ + Tk_MacOSXGetNSWindowForDrawable, /* 13 */ 0, /* 14 */ 0, /* 15 */ TkGenWMConfigureEvent_, /* 16 */ @@ -1306,6 +1326,13 @@ const TkStubs tkStubs = { Tk_Interp, /* 271 */ Tk_CreateOldImageType, /* 272 */ Tk_CreateOldPhotoImageFormat, /* 273 */ + 0, /* 274 */ + 0, /* 275 */ + 0, /* 276 */ + 0, /* 277 */ + 0, /* 278 */ + 0, /* 279 */ + TkUnusedStubEntry, /* 280 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tkTest.c b/generic/tkTest.c index bb7bde5..3c17407 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -1062,14 +1062,14 @@ TestobjconfigObjCmd( } case TWO_WINDOWS: { - typedef struct SlaveRecord { + typedef struct ContentRecord { TrivialCommandHeader header; Tcl_Obj *windowPtr; - } SlaveRecord; - SlaveRecord *recordPtr; - static const Tk_OptionSpec slaveSpecs[] = { + } ContentRecord; + ContentRecord *recordPtr; + static const Tk_OptionSpec contentSpecs[] = { {TK_OPTION_WINDOW, "-window", "window", "Window", ".bar", - Tk_Offset(SlaveRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0}, + Tk_Offset(ContentRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_Window tkwin = Tk_CreateWindowFromPath(interp, @@ -1080,10 +1080,10 @@ TestobjconfigObjCmd( } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(SlaveRecord)); + recordPtr = ckalloc(sizeof(ContentRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = Tk_CreateOptionTable(interp, - slaveSpecs); + contentSpecs); tables[index] = recordPtr->header.optionTable; recordPtr->header.tkwin = tkwin; recordPtr->windowPtr = NULL; diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index c9fc20f..a0e7089 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -22,13 +22,13 @@ static void EmbWinRequestProc(ClientData clientData, Tk_Window tkwin); -static void EmbWinLostSlaveProc(ClientData clientData, +static void EmbWinLostContentProc(ClientData clientData, Tk_Window tkwin); static const Tk_GeomMgr textGeomType = { "text", /* name */ EmbWinRequestProc, /* requestProc */ - EmbWinLostSlaveProc, /* lostSlaveProc */ + EmbWinLostContentProc, /* lostSlaveProc */ }; /* @@ -443,7 +443,7 @@ EmbWinConfigure( break; } if (Tk_TopWinHierarchy(ancestor)) { - badMaster: + badContainer: Tcl_SetObjResult(textPtr->interp, Tcl_ObjPrintf( "can't embed %s in %s", Tk_PathName(ewPtr->body.ew.tkwin), @@ -459,7 +459,7 @@ EmbWinConfigure( } if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin) || (ewPtr->body.ew.tkwin == textPtr->tkwin)) { - goto badMaster; + goto badContainer; } if (client == NULL) { @@ -594,9 +594,9 @@ EmbWinRequestProc( /* *-------------------------------------------------------------- * - * EmbWinLostSlaveProc -- + * EmbWinLostContentProc -- * - * This function is invoked by the Tk geometry manager when a slave + * This function is invoked by the Tk geometry manager when a content * window managed by a text widget is claimed away by another geometry * manager. * @@ -611,7 +611,7 @@ EmbWinRequestProc( */ static void -EmbWinLostSlaveProc( +EmbWinLostContentProc( ClientData clientData, /* Pointer to record describing window item. */ Tk_Window tkwin) /* Window that was claimed away by another * geometry manager. */ @@ -936,12 +936,12 @@ EmbWinLayoutProc( break; } if (Tk_TopWinHierarchy(ancestor)) { - goto badMaster; + goto badContainer; } } if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin) || (textPtr->tkwin == ewPtr->body.ew.tkwin)) { - badMaster: + badContainer: Tcl_SetObjResult(textPtr->interp, Tcl_ObjPrintf( "can't embed %s relative to %s", Tk_PathName(ewPtr->body.ew.tkwin), diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c index 706a871..a7d4a9a 100644 --- a/generic/ttk/ttkBlink.c +++ b/generic/ttk/ttkBlink.c @@ -14,7 +14,7 @@ * Add script-level access to configure application-wide blink rate. */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -57,7 +57,7 @@ static CursorManager *GetCursorManager(Tcl_Interp *interp) cm->owner = 0; cm->onTime = DEF_CURSOR_ON_TIME; cm->offTime = DEF_CURSOR_OFF_TIME; - Tcl_SetAssocData(interp,cm_key,CursorManagerDeleteProc,(ClientData)cm); + Tcl_SetAssocData(interp, cm_key, CursorManagerDeleteProc, cm); } return cm; } diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index 43855b2..f4ef7bc 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -4,8 +4,7 @@ * label, button, checkbutton, radiobutton, and menubutton widgets. */ -#include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -81,9 +80,9 @@ static Tk_OptionSpec BaseOptionSpecs[] = * Compound base/image options */ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", - NULL, Tk_Offset(Base,base.compoundObj), -1, - TK_OPTION_NULL_OK,(ClientData)ttkCompoundStrings, - GEOMETRY_CHANGED }, + NULL, Tk_Offset(Base,base.compoundObj), -1, + TK_OPTION_NULL_OK, (void *)ttkCompoundStrings, + GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, Tk_Offset(Base,base.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED}, @@ -820,7 +819,7 @@ static Tk_OptionSpec MenubuttonOptionSpecs[] = "", Tk_Offset(Menubutton, menubutton.menuObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction", "below", Tk_Offset(Menubutton, menubutton.directionObj), -1, - 0,(ClientData)directionStrings,GEOMETRY_CHANGED}, + 0, (void *)directionStrings, GEOMETRY_CHANGED}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c index 0ae2372..e7f885f 100644 --- a/generic/ttk/ttkCache.c +++ b/generic/ttk/ttkCache.c @@ -29,7 +29,7 @@ */ #include <stdio.h> /* for sprintf */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" struct Ttk_ResourceCache_ { diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index 41a8f6d..733a391 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -4,7 +4,7 @@ * "clam" theme; inspired by the XFCE family of Gnome themes. */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" /* diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 5c95dba..c4469dc 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -5,8 +5,7 @@ * */ -#include <tcl.h> -#include <tk.h> +#include "tkInt.h" #include <string.h> #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index 8a15e5b..b8b3477 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -4,8 +4,7 @@ * ttk::frame and ttk::labelframe widgets. */ -#include <tk.h> - +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" #include "ttkManager.h" @@ -89,9 +88,12 @@ static Ttk_Padding FrameMargins(Frame *framePtr) * The frame doesn't request a size of its own by default, * but it does have an internal border. See also <<NOTE-SIZE>> */ -static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr) +static int FrameSize( + void *recordPtr, + TCL_UNUSED(int *), + TCL_UNUSED(int *)) { - Frame *framePtr = recordPtr; + Frame *framePtr = (Frame *)recordPtr; Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr)); return 0; } @@ -112,7 +114,7 @@ static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr) static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Frame *framePtr = recordPtr; + Frame *framePtr = (Frame *)recordPtr; int width, height; /* @@ -338,9 +340,12 @@ LabelframeLabelSize(Labelframe *lframePtr, int *widthPtr, int *heightPtr) * Like the frame, this doesn't request a size of its own * but it does have internal padding and a minimum size. */ -static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr) +static int LabelframeSize( + void *recordPtr, + TCL_UNUSED(int *), + TCL_UNUSED(int *)) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; WidgetCore *corePtr = &lframePtr->core; Ttk_Padding margins; LabelframeStyle style; @@ -385,7 +390,7 @@ static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr) static Ttk_Layout LabelframeGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Labelframe *lf = recordPtr; + Labelframe *lf = (Labelframe *)recordPtr; Ttk_Layout frameLayout = TtkWidgetGetLayout(interp, theme, recordPtr); Ttk_Layout labelLayout; @@ -416,7 +421,7 @@ static Ttk_Layout LabelframeGetLayout( static void LabelframeDoLayout(void *recordPtr) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; WidgetCore *corePtr = &lframePtr->core; int lw, lh; /* Label width and height */ LabelframeStyle style; @@ -456,13 +461,13 @@ static void LabelframeDoLayout(void *recordPtr) Ttk_PlaceLayout( lframePtr->label.labelLayout, corePtr->state, labelParcel); } - /* labelWidget placed in LabelframePlaceSlaves GM hook */ + /* labelWidget placed in LabelframePlaceContent GM hook */ lframePtr->label.labelParcel = labelParcel; } static void LabelframeDisplay(void *recordPtr, Drawable d) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; Ttk_DrawLayout(lframePtr->core.layout, lframePtr->core.state, d); if (lframePtr->label.labelLayout) { Ttk_DrawLayout(lframePtr->label.labelLayout, lframePtr->core.state, d); @@ -472,23 +477,27 @@ static void LabelframeDisplay(void *recordPtr, Drawable d) /* +++ Labelframe geometry manager hooks. */ -/* LabelframePlaceSlaves -- +/* LabelframePlaceContent -- * Sets the position and size of the labelwidget. */ -static void LabelframePlaceSlaves(void *recordPtr) +static void LabelframePlaceContent(void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; - if (Ttk_NumberSlaves(lframe->label.mgr) == 1) { + if (Ttk_NumberContent(lframe->label.mgr) == 1) { Ttk_Box b; LabelframeDoLayout(recordPtr); b = lframe->label.labelParcel; - /* ASSERT: slave #0 is lframe->label.labelWidget */ - Ttk_PlaceSlave(lframe->label.mgr, 0, b.x,b.y,b.width,b.height); + /* ASSERT: content #0 is lframe->label.labelWidget */ + Ttk_PlaceContent(lframe->label.mgr, 0, b.x,b.y,b.width,b.height); } } -static int LabelRequest(void *managerData, int index, int width, int height) +static int LabelRequest( + TCL_UNUSED(void *), + TCL_UNUSED(int), + TCL_UNUSED(int), + TCL_UNUSED(int)) { return 1; } @@ -498,18 +507,21 @@ static int LabelRequest(void *managerData, int index, int width, int height) * * <<NOTE-LABELREMOVED>>: * This routine is also called when the widget voluntarily forgets - * the slave in LabelframeConfigure. + * the window in LabelframeConfigure. */ -static void LabelRemoved(void *managerData, int slaveIndex) +static void LabelRemoved( + void *managerData, + TCL_UNUSED(int)) { - Labelframe *lframe = managerData; + Labelframe *lframe = (Labelframe *)managerData; + lframe->label.labelWidget = 0; } static Ttk_ManagerSpec LabelframeManagerSpec = { - { "labelframe", Ttk_GeometryRequestProc, Ttk_LostSlaveProc }, + { "labelframe", Ttk_GeometryRequestProc, Ttk_LostContentProc }, LabelframeSize, - LabelframePlaceSlaves, + LabelframePlaceContent, LabelRequest, LabelRemoved }; @@ -517,9 +529,11 @@ static Ttk_ManagerSpec LabelframeManagerSpec = { /* LabelframeInitialize -- * Initialization hook. */ -static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) +static void LabelframeInitialize( + TCL_UNUSED(Tcl_Interp *), + void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; lframe->label.mgr = Ttk_CreateManager( &LabelframeManagerSpec, lframe, lframe->core.tkwin); @@ -533,7 +547,7 @@ static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) */ static void LabelframeCleanup(void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; Ttk_DeleteManager(lframe->label.mgr); if (lframe->label.labelLayout) { Ttk_FreeLayout(lframe->label.labelLayout); @@ -564,7 +578,7 @@ static void RaiseLabelWidget(Labelframe *lframe) */ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; Tk_Window labelWidget = lframePtr->label.labelWidget; Ttk_PositionSpec unused; @@ -591,15 +605,15 @@ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask) /* Update -labelwidget changes, if any: */ if (mask & LABELWIDGET_CHANGED) { - if (Ttk_NumberSlaves(lframePtr->label.mgr) == 1) { - Ttk_ForgetSlave(lframePtr->label.mgr, 0); + if (Ttk_NumberContent(lframePtr->label.mgr) == 1) { + Ttk_ForgetContent(lframePtr->label.mgr, 0); /* Restore labelWidget field (see <<NOTE-LABELREMOVED>>) */ lframePtr->label.labelWidget = labelWidget; } if (labelWidget) { - Ttk_InsertSlave(lframePtr->label.mgr, 0, labelWidget, NULL); + Ttk_InsertContent(lframePtr->label.mgr, 0, labelWidget, NULL); RaiseLabelWidget(lframePtr); } } diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl index 8047e3f..6aabd61 100644 --- a/generic/ttk/ttkGenStubs.tcl +++ b/generic/ttk/ttkGenStubs.tcl @@ -284,18 +284,26 @@ proc genStubs::rewriteFile {file text} { # Results: # Returns the original text inside an appropriate #ifdef. -proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} { +proc genStubs::addPlatformGuard {plat iftxt {eltxt {}} {withCygwin 0}} { set text "" switch $plat { win { - append text "#ifdef _WIN32 /* WIN */\n${iftxt}" + append text "#if defined(_WIN32)" + if {$withCygwin} { + append text " || defined(__CYGWIN__)" + } + append text " /* WIN */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* WIN */\n${eltxt}" } append text "#endif /* WIN */\n" } unix { - append text "#if !defined(_WIN32) && !defined(MAC_OSX_TCL)\ + append text "#if !defined(_WIN32)" + if {$withCygwin} { + append text " && !defined(__CYGWIN__)" + } + append text " && !defined(MAC_OSX_TCL)\ /* UNIX */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* UNIX */\n${eltxt}" @@ -317,7 +325,11 @@ proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} { append text "#endif /* AQUA */\n" } x11 { - append text "#if !(defined(_WIN32) || defined(MAC_OSX_TK))\ + append text "#if !(defined(_WIN32)" + if {$withCygwin} { + append text " || defined(__CYGWIN__)" + } + append text " || defined(MAC_OSX_TK))\ /* X11 */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* X11 */\n${eltxt}" @@ -450,12 +462,23 @@ proc genStubs::parseArg {arg} { proc genStubs::makeDecl {name decl index} { variable scspec + variable stubs + variable libraryName lassign $decl rtype fname args append text "/* $index */\n" - set line "$scspec $rtype" + if {[info exists stubs($name,deprecated,$index)]} { + append text "[string toupper $libraryName]_DEPRECATED(\"$stubs($name,deprecated,$index)\")\n" + set line "$rtype" + } elseif {[string range $rtype end-5 end] eq "MP_WUR"} { + set line "$scspec [string trim [string range $rtype 0 end-6]]" + } else { + set line "$scspec $rtype" + } set count [expr {2 - ([string length $line] / 8)}] - append line [string range "\t\t\t" 0 $count] + if {$count >= 0} { + append line [string range "\t\t\t" 0 $count] + } set pad [expr {24 - [string length $line]}] if {$pad <= 0} { append line " " @@ -494,6 +517,9 @@ proc genStubs::makeDecl {name decl index} { set sep ", " } append line ", ...)" + if {[lindex $args end] eq "{const char *} format"} { + append line " TCL_FORMAT_PRINTF(" [expr {[llength $args] - 1}] ", " [llength $args] ")" + } } default { set sep "(" @@ -517,6 +543,9 @@ proc genStubs::makeDecl {name decl index} { append line ")" } } + if {[string range $rtype end-5 end] eq "MP_WUR"} { + append line " MP_WUR" + } return "$text$line;\n" } @@ -561,17 +590,27 @@ proc genStubs::makeMacro {name decl index} { proc genStubs::makeSlot {name decl index} { lassign $decl rtype fname args + variable stubs set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] set text " " + if {[info exists stubs($name,deprecated,$index)]} { + append text "TCL_DEPRECATED_API(\"$stubs($name,deprecated,$index)\") " + } elseif {[info exists stubs($name,nostub,$index)]} { + append text "TCL_DEPRECATED_API(\"$stubs($name,nostub,$index)\") " + } if {$args eq ""} { append text $rtype " *" $lfname "; /* $index */\n" return $text } if {[string range $rtype end-8 end] eq "__stdcall"} { append text [string trim [string range $rtype 0 end-9]] " (__stdcall *" $lfname ") " + } elseif {[string range $rtype 0 11] eq "TCL_NORETURN"} { + append text "TCL_NORETURN1 " [string trim [string range $rtype 12 end]] " (*" $lfname ") " + } elseif {[string range $rtype end-5 end] eq "MP_WUR"} { + append text [string trim [string range $rtype 0 end-6]] " (*" $lfname ") " } else { append text $rtype " (*" $lfname ") " } @@ -591,6 +630,9 @@ proc genStubs::makeSlot {name decl index} { set sep ", " } append text ", ...)" + if {[lindex $args end] eq "{const char *} format"} { + append text " TCL_FORMAT_PRINTF(" [expr {[llength $args] - 1}] ", " [llength $args] ")" + } } default { set sep "(" @@ -606,6 +648,9 @@ proc genStubs::makeSlot {name decl index} { } } + if {[string range $rtype end-5 end] eq "MP_WUR"} { + append text " MP_WUR" + } append text "; /* $index */\n" return $text } @@ -837,7 +882,7 @@ proc genStubs::emitInit {name textVar} { } foreach intf [array names interfaces] { if {[info exists hooks($intf)]} { - if {[lsearch -exact $hooks($intf) $name] >= 0} { + if {$name in $hooks($intf)} { set root 0 break } diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index e403e2d..5c2a55f 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -11,7 +11,7 @@ */ #include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #define MIN(a,b) ((a) < (b) ? (a) : (b)) diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index 01a393a..f1b6e26 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -5,7 +5,7 @@ */ #include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -275,7 +275,7 @@ Ttk_Init(Tcl_Interp *interp) Ttk_PlatformInit(interp); - Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (ClientData)&ttkStubs); + Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs); return TCL_OK; } diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index c396f63..8cad58c 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -5,65 +5,65 @@ */ #include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkManager.h" /*------------------------------------------------------------------------ * +++ The Geometry Propagation Dance. * - * When a slave window requests a new size or some other parameter changes, - * the manager recomputes the required size for the master window and calls + * When a content window requests a new size or some other parameter changes, + * the manager recomputes the required size for the container window and calls * Tk_GeometryRequest(). This is scheduled as an idle handler so multiple * updates can be processed as a single batch. * - * If all goes well, the master's manager will process the request - * (and so on up the chain to the toplevel window), and the master + * If all goes well, the container's manager will process the request + * (and so on up the chain to the toplevel window), and the container * window will eventually receive a <Configure> event. At this point - * it recomputes the size and position of all slaves and places them. + * it recomputes the size and position of all content windows and places them. * - * If all does not go well, however, the master's request may be ignored + * If all does not go well, however, the container's request may be ignored * (typically because the top-level window has a fixed, user-specified size). * Tk doesn't provide any notification when this happens; to account for this, * we also schedule an idle handler to call the layout procedure * after making a geometry request. * - * +++ Slave removal <<NOTE-LOSTSLAVE>>. + * +++ Content window removal <<NOTE-LOSTCONTENT>>. * - * There are three conditions under which a slave is removed: + * There are three conditions under which a content window is removed: * * (1) Another GM claims control * (2) Manager voluntarily relinquishes control - * (3) Slave is destroyed + * (3) Content window is destroyed * * In case (1), Tk calls the manager's lostSlaveProc. - * Case (2) is performed by calling Tk_ManageGeometry(slave,NULL,0); - * in this case Tk does _not_ call the LostSlaveProc (documented behavior). + * Case (2) is performed by calling Tk_ManageGeometry(window,NULL,0); + * in this case Tk does _not_ call the lostSlaveProc (documented behavior). * Tk doesn't handle case (3) either; to account for that we - * register an event handler on the slave widget to track <Destroy> events. + * register an event handler on the content window to track <Destroy> events. */ /* ++ Data structures. */ typedef struct { - Tk_Window slaveWindow; + Tk_Window window; Ttk_Manager *manager; - void *slaveData; + void *data; unsigned flags; -} Ttk_Slave; +} Ttk_Content; -/* slave->flags bits: +/* content->flags bits: */ -#define SLAVE_MAPPED 0x1 /* slave to be mapped when master is */ +#define CONTENT_MAPPED 0x1 /* content windows to be mapped when container is */ struct TtkManager_ { Ttk_ManagerSpec *managerSpec; void *managerData; - Tk_Window masterWindow; + Tk_Window window; unsigned flags; - int nSlaves; - Ttk_Slave **slaves; + int nContent; + Ttk_Content **content; }; /* manager->flags bits: @@ -88,7 +88,7 @@ static void ScheduleUpdate(Ttk_Manager *mgr, unsigned flags) } /* ++ RecomputeSize -- - * Recomputes the required size of the master window, + * Recomputes the required size of the container window, * makes geometry request. */ static void RecomputeSize(Ttk_Manager *mgr) @@ -96,14 +96,14 @@ static void RecomputeSize(Ttk_Manager *mgr) int width = 1, height = 1; if (mgr->managerSpec->RequestedSize(mgr->managerData, &width, &height)) { - Tk_GeometryRequest(mgr->masterWindow, width, height); + Tk_GeometryRequest(mgr->window, width, height); ScheduleUpdate(mgr, MGR_RELAYOUT_REQUIRED); } mgr->flags &= ~MGR_RESIZE_REQUIRED; } /* ++ RecomputeLayout -- - * Recompute geometry of all slaves. + * Recompute geometry of all content windows. */ static void RecomputeLayout(Ttk_Manager *mgr) { @@ -136,8 +136,8 @@ static void ManagerIdleProc(ClientData clientData) */ /* ++ ManagerEventHandler -- - * Recompute slave layout when master widget is resized. - * Keep the slave's map state in sync with the master's. + * Recompute content layout when container widget is resized. + * Keep the content's map state in sync with the container's. */ static const int ManagerEventMask = StructureNotifyMask; static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) @@ -151,56 +151,55 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) RecomputeLayout(mgr); break; case MapNotify: - for (i = 0; i < mgr->nSlaves; ++i) { - Ttk_Slave *slave = mgr->slaves[i]; - if (slave->flags & SLAVE_MAPPED) { - Tk_MapWindow(slave->slaveWindow); + for (i = 0; i < mgr->nContent; ++i) { + Ttk_Content *content = mgr->content[i]; + if (content->flags & CONTENT_MAPPED) { + Tk_MapWindow(content->window); } } break; case UnmapNotify: - for (i = 0; i < mgr->nSlaves; ++i) { - Ttk_Slave *slave = mgr->slaves[i]; - Tk_UnmapWindow(slave->slaveWindow); + for (i = 0; i < mgr->nContent; ++i) { + Ttk_Content *content = mgr->content[i]; + Tk_UnmapWindow(content->window); } break; } } -/* ++ SlaveEventHandler -- - * Notifies manager when a slave is destroyed - * (see <<NOTE-LOSTSLAVE>>). +/* ++ ContentLostEventHandler -- + * Notifies manager when a content window is destroyed + * (see <<NOTE-LOSTCONTENT>>). */ -static const unsigned SlaveEventMask = StructureNotifyMask; -static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr) +static void ContentLostEventHandler(void *clientData, XEvent *eventPtr) { - Ttk_Slave *slave = (Ttk_Slave *)clientData; + Ttk_Content *content = (Ttk_Content *)clientData; if (eventPtr->type == DestroyNotify) { - slave->manager->managerSpec->tkGeomMgr.lostSlaveProc( - slave->manager, slave->slaveWindow); + content->manager->managerSpec->tkGeomMgr.lostSlaveProc( + content->manager, content->window); } } /*------------------------------------------------------------------------ - * +++ Slave initialization and cleanup. + * +++ Content initialization and cleanup. */ -static Ttk_Slave *NewSlave( - Ttk_Manager *mgr, Tk_Window slaveWindow, void *slaveData) +static Ttk_Content *NewContent( + Ttk_Manager *mgr, Tk_Window window, void *data) { - Ttk_Slave *slave = (Ttk_Slave *)ckalloc(sizeof(*slave)); + Ttk_Content *content = (Ttk_Content *)ckalloc(sizeof(Ttk_Content)); - slave->slaveWindow = slaveWindow; - slave->manager = mgr; - slave->flags = 0; - slave->slaveData = slaveData; + content->window = window; + content->manager = mgr; + content->flags = 0; + content->data = data; - return slave; + return content; } -static void DeleteSlave(Ttk_Slave *slave) +static void DeleteContent(Ttk_Content *content) { - ckfree(slave); + ckfree(content); } /*------------------------------------------------------------------------ @@ -208,19 +207,19 @@ static void DeleteSlave(Ttk_Slave *slave) */ Ttk_Manager *Ttk_CreateManager( - Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow) + Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)ckalloc(sizeof(*mgr)); mgr->managerSpec = managerSpec; mgr->managerData = managerData; - mgr->masterWindow = masterWindow; - mgr->nSlaves = 0; - mgr->slaves = NULL; + mgr->window = window; + mgr->nContent = 0; + mgr->content = NULL; mgr->flags = 0; Tk_CreateEventHandler( - mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr); + mgr->window, ManagerEventMask, ManagerEventHandler, mgr); return mgr; } @@ -228,13 +227,13 @@ Ttk_Manager *Ttk_CreateManager( void Ttk_DeleteManager(Ttk_Manager *mgr) { Tk_DeleteEventHandler( - mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr); + mgr->window, ManagerEventMask, ManagerEventHandler, mgr); - while (mgr->nSlaves > 0) { - Ttk_ForgetSlave(mgr, mgr->nSlaves - 1); + while (mgr->nContent > 0) { + Ttk_ForgetContent(mgr, mgr->nContent - 1); } - if (mgr->slaves) { - ckfree(mgr->slaves); + if (mgr->content) { + ckfree(mgr->content); } Tcl_CancelIdleCall(ManagerIdleProc, mgr); @@ -243,44 +242,44 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) } /*------------------------------------------------------------------------ - * +++ Slave management. + * +++ Content window management. */ -/* ++ InsertSlave -- - * Adds slave to the list of managed windows. +/* ++ InsertContent -- + * Adds content to the list of managed windows. */ -static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, int index) +static void InsertContent(Ttk_Manager *mgr, Ttk_Content *content, int index) { - int endIndex = mgr->nSlaves++; - mgr->slaves = (Ttk_Slave **)ckrealloc(mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *)); + int endIndex = mgr->nContent++; + mgr->content = (Ttk_Content **)ckrealloc(mgr->content, mgr->nContent * sizeof(Ttk_Content *)); while (endIndex > index) { - mgr->slaves[endIndex] = mgr->slaves[endIndex - 1]; + mgr->content[endIndex] = mgr->content[endIndex - 1]; --endIndex; } - mgr->slaves[index] = slave; + mgr->content[index] = content; - Tk_ManageGeometry(slave->slaveWindow, - &mgr->managerSpec->tkGeomMgr, (ClientData)mgr); + Tk_ManageGeometry(content->window, + &mgr->managerSpec->tkGeomMgr, mgr); - Tk_CreateEventHandler(slave->slaveWindow, - SlaveEventMask, SlaveEventHandler, (ClientData)slave); + Tk_CreateEventHandler(content->window, + StructureNotifyMask, ContentLostEventHandler, content); ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } -/* RemoveSlave -- - * Unmanage and delete the slave. +/* RemoveContent -- + * Unmanage and delete the content window. * * NOTES/ASSUMPTIONS: * * [1] It's safe to call Tk_UnmapWindow / Tk_UnmaintainGeometry even if this - * routine is called from the slave's DestroyNotify event handler. + * routine is called from the content window's DestroyNotify event handler. */ -static void RemoveSlave(Ttk_Manager *mgr, int index) +static void RemoveContent(Ttk_Manager *mgr, int index) { - Ttk_Slave *slave = mgr->slaves[index]; + Ttk_Content *content = mgr->content[index]; int i; /* Notify manager: @@ -289,21 +288,21 @@ static void RemoveSlave(Ttk_Manager *mgr, int index) /* Remove from array: */ - --mgr->nSlaves; - for (i = index ; i < mgr->nSlaves; ++i) { - mgr->slaves[i] = mgr->slaves[i+1]; + --mgr->nContent; + for (i = index ; i < mgr->nContent; ++i) { + mgr->content[i] = mgr->content[i+1]; } /* Clean up: */ Tk_DeleteEventHandler( - slave->slaveWindow, SlaveEventMask, SlaveEventHandler, slave); + content->window, StructureNotifyMask, ContentLostEventHandler, content); /* Note [1] */ - Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow); - Tk_UnmapWindow(slave->slaveWindow); + Tk_UnmaintainGeometry(content->window, mgr->window); + Tk_UnmapWindow(content->window); - DeleteSlave(slave); + DeleteContent(content); ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } @@ -312,83 +311,83 @@ static void RemoveSlave(Ttk_Manager *mgr, int index) * +++ Tk_GeomMgr hooks. */ -void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow) +void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; - int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow); - int reqWidth = Tk_ReqWidth(slaveWindow); - int reqHeight= Tk_ReqHeight(slaveWindow); + int index = Ttk_ContentIndex(mgr, window); + int reqWidth = Tk_ReqWidth(window); + int reqHeight= Tk_ReqHeight(window); if (mgr->managerSpec->SlaveRequest( - mgr->managerData, slaveIndex, reqWidth, reqHeight)) + mgr->managerData, index, reqWidth, reqHeight)) { ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } } -void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow) +void Ttk_LostContentProc(ClientData clientData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; - int index = Ttk_SlaveIndex(mgr, slaveWindow); + int index = Ttk_ContentIndex(mgr, window); /* ASSERT: index >= 0 */ - RemoveSlave(mgr, index); + RemoveContent(mgr, index); } /*------------------------------------------------------------------------ * +++ Public API. */ -/* ++ Ttk_InsertSlave -- - * Add a new slave window at the specified index. +/* ++ Ttk_InsertContent -- + * Add a new content window at the specified index. */ -void Ttk_InsertSlave( - Ttk_Manager *mgr, int index, Tk_Window tkwin, void *slaveData) +void Ttk_InsertContent( + Ttk_Manager *mgr, int index, Tk_Window tkwin, void *data) { - Ttk_Slave *slave = NewSlave(mgr, tkwin, slaveData); - InsertSlave(mgr, slave, index); + Ttk_Content *content = NewContent(mgr, tkwin, data); + InsertContent(mgr, content, index); } -/* ++ Ttk_ForgetSlave -- - * Unmanage the specified slave. +/* ++ Ttk_ForgetContent -- + * Unmanage the specified content window. */ -void Ttk_ForgetSlave(Ttk_Manager *mgr, int slaveIndex) +void Ttk_ForgetContent(Ttk_Manager *mgr, int index) { - Tk_Window slaveWindow = mgr->slaves[slaveIndex]->slaveWindow; - RemoveSlave(mgr, slaveIndex); - Tk_ManageGeometry(slaveWindow, NULL, 0); + Tk_Window window = mgr->content[index]->window; + RemoveContent(mgr, index); + Tk_ManageGeometry(window, NULL, 0); } -/* ++ Ttk_PlaceSlave -- - * Set the position and size of the specified slave window. +/* ++ Ttk_PlaceContent -- + * Set the position and size of the specified content window. * * NOTES: * Contrary to documentation, Tk_MaintainGeometry doesn't always - * map the slave. + * map the content window. */ -void Ttk_PlaceSlave( - Ttk_Manager *mgr, int slaveIndex, int x, int y, int width, int height) +void Ttk_PlaceContent( + Ttk_Manager *mgr, int index, int x, int y, int width, int height) { - Ttk_Slave *slave = mgr->slaves[slaveIndex]; - Tk_MaintainGeometry(slave->slaveWindow,mgr->masterWindow,x,y,width,height); - slave->flags |= SLAVE_MAPPED; - if (Tk_IsMapped(mgr->masterWindow)) { - Tk_MapWindow(slave->slaveWindow); + Ttk_Content *content = mgr->content[index]; + Tk_MaintainGeometry(content->window,mgr->window,x,y,width,height); + content->flags |= CONTENT_MAPPED; + if (Tk_IsMapped(mgr->window)) { + Tk_MapWindow(content->window); } } -/* ++ Ttk_UnmapSlave -- - * Unmap the specified slave, but leave it managed. +/* ++ Ttk_UnmapContent -- + * Unmap the specified content window, but leave it managed. */ -void Ttk_UnmapSlave(Ttk_Manager *mgr, int slaveIndex) +void Ttk_UnmapContent(Ttk_Manager *mgr, int index) { - Ttk_Slave *slave = mgr->slaves[slaveIndex]; - Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow); - slave->flags &= ~SLAVE_MAPPED; + Ttk_Content *content = mgr->content[index]; + Tk_UnmaintainGeometry(content->window, mgr->window); + content->flags &= ~CONTENT_MAPPED; /* Contrary to documentation, Tk_UnmaintainGeometry doesn't always - * unmap the slave: + * unmap the content window: */ - Tk_UnmapWindow(slave->slaveWindow); + Tk_UnmapWindow(content->window); } /* LayoutChanged, SizeChanged -- @@ -406,77 +405,77 @@ void Ttk_ManagerSizeChanged(Ttk_Manager *mgr) /* +++ Accessors. */ -int Ttk_NumberSlaves(Ttk_Manager *mgr) +int Ttk_NumberContent(Ttk_Manager *mgr) { - return mgr->nSlaves; + return mgr->nContent; } -void *Ttk_SlaveData(Ttk_Manager *mgr, int slaveIndex) +void *Ttk_ContentData(Ttk_Manager *mgr, int index) { - return mgr->slaves[slaveIndex]->slaveData; + return mgr->content[index]->data; } -Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, int slaveIndex) +Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, int index) { - return mgr->slaves[slaveIndex]->slaveWindow; + return mgr->content[index]->window; } /*------------------------------------------------------------------------ * +++ Utility routines. */ -/* ++ Ttk_SlaveIndex -- - * Returns the index of specified slave window, -1 if not found. +/* ++ Ttk_ContentIndex -- + * Returns the index of specified content window, -1 if not found. */ -int Ttk_SlaveIndex(Ttk_Manager *mgr, Tk_Window slaveWindow) +int Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window) { int index; - for (index = 0; index < mgr->nSlaves; ++index) - if (mgr->slaves[index]->slaveWindow == slaveWindow) + for (index = 0; index < mgr->nContent; ++index) + if (mgr->content[index]->window == window) return index; return -1; } -/* ++ Ttk_GetSlaveIndexFromObj(interp, mgr, objPtr, indexPtr) -- - * Return the index of the slave specified by objPtr. - * Slaves may be specified as an integer index or +/* ++ Ttk_GetContentIndexFromObj(interp, mgr, objPtr, indexPtr) -- + * Return the index of the content window specified by objPtr. + * Content windows may be specified as an integer index or * as the name of the managed window. * * Returns: * Standard Tcl completion code. Leaves an error message in case of error. */ -int Ttk_GetSlaveIndexFromObj( +int Ttk_GetContentIndexFromObj( Tcl_Interp *interp, Ttk_Manager *mgr, Tcl_Obj *objPtr, int *indexPtr) { const char *string = Tcl_GetString(objPtr); - int slaveIndex = 0; + int index = 0; Tk_Window tkwin; /* Try interpreting as an integer first: */ - if (Tcl_GetIntFromObj(NULL, objPtr, &slaveIndex) == TCL_OK) { - if (slaveIndex < 0 || slaveIndex >= mgr->nSlaves) { + if (Tcl_GetIntFromObj(NULL, objPtr, &index) == TCL_OK) { + if (index < 0 || index >= mgr->nContent) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "Slave index %d out of bounds", slaveIndex)); + "Slave index %d out of bounds", index)); Tcl_SetErrorCode(interp, "TTK", "SLAVE", "INDEX", NULL); return TCL_ERROR; } - *indexPtr = slaveIndex; + *indexPtr = index; return TCL_OK; } - /* Try interpreting as a slave window name; + /* Try interpreting as a window name; */ if ((*string == '.') && - (tkwin = Tk_NameToWindow(interp, string, mgr->masterWindow))) { - slaveIndex = Ttk_SlaveIndex(mgr, tkwin); - if (slaveIndex < 0) { + (tkwin = Tk_NameToWindow(interp, string, mgr->window))) { + index = Ttk_ContentIndex(mgr, tkwin); + if (index < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s is not managed by %s", string, - Tk_PathName(mgr->masterWindow))); + Tk_PathName(mgr->window))); Tcl_SetErrorCode(interp, "TTK", "SLAVE", "MANAGER", NULL); return TCL_ERROR; } - *indexPtr = slaveIndex; + *indexPtr = index; return TCL_OK; } @@ -486,48 +485,48 @@ int Ttk_GetSlaveIndexFromObj( return TCL_ERROR; } -/* ++ Ttk_ReorderSlave(mgr, fromIndex, toIndex) -- - * Change slave order. +/* ++ Ttk_ReorderContent(mgr, fromIndex, toIndex) -- + * Change content window order. */ -void Ttk_ReorderSlave(Ttk_Manager *mgr, int fromIndex, int toIndex) +void Ttk_ReorderContent(Ttk_Manager *mgr, int fromIndex, int toIndex) { - Ttk_Slave *moved = mgr->slaves[fromIndex]; + Ttk_Content *moved = mgr->content[fromIndex]; /* Shuffle down: */ while (fromIndex > toIndex) { - mgr->slaves[fromIndex] = mgr->slaves[fromIndex - 1]; + mgr->content[fromIndex] = mgr->content[fromIndex - 1]; --fromIndex; } /* Or, shuffle up: */ while (fromIndex < toIndex) { - mgr->slaves[fromIndex] = mgr->slaves[fromIndex + 1]; + mgr->content[fromIndex] = mgr->content[fromIndex + 1]; ++fromIndex; } /* ASSERT: fromIndex == toIndex */ - mgr->slaves[fromIndex] = moved; + mgr->content[fromIndex] = moved; - /* Schedule a relayout. In general, rearranging slaves + /* Schedule a relayout. In general, rearranging content * may also change the size: */ ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } -/* ++ Ttk_Maintainable(interp, slave, master) -- - * Utility routine. Verifies that 'master' may be used to maintain - * the geometry of 'slave' via Tk_MaintainGeometry: +/* ++ Ttk_Maintainable(interp, window, container) -- + * Utility routine. Verifies that 'container' may be used to maintain + * the geometry of 'window' via Tk_MaintainGeometry: * - * + 'master' is either 'slave's parent -OR- - * + 'master is a descendant of 'slave's parent. - * + 'slave' is not a toplevel window - * + 'slave' belongs to the same toplevel as 'master' + * + 'container' is either 'window's parent -OR- + * + 'container is a descendant of 'window's parent. + * + 'window' is not a toplevel window + * + 'window' belongs to the same toplevel as 'container' * * Returns: 1 if OK; otherwise 0, leaving an error message in 'interp'. */ -int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master) +int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window window, Tk_Window container) { - Tk_Window ancestor = master, parent = Tk_Parent(slave); + Tk_Window ancestor = container, parent = Tk_Parent(window); - if (Tk_IsTopLevel(slave) || slave == master) { + if (Tk_IsTopLevel(window) || window == container) { goto badWindow; } @@ -542,7 +541,7 @@ int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master) badWindow: Tcl_SetObjResult(interp, Tcl_ObjPrintf("can't add %s as slave of %s", - Tk_PathName(slave), Tk_PathName(master))); + Tk_PathName(window), Tk_PathName(container))); Tcl_SetErrorCode(interp, "TTK", "GEOMETRY", "MAINTAINABLE", NULL); return 0; } diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h index 07fcea1..d487dea 100644 --- a/generic/ttk/ttkManager.h +++ b/generic/ttk/ttkManager.h @@ -14,16 +14,16 @@ typedef struct TtkManager_ Ttk_Manager; /* * Geometry manager specification record: * - * RequestedSize computes the requested size of the master window. + * RequestedSize computes the requested size of the container window. * - * PlaceSlaves sets the position and size of all managed slaves - * by calling Ttk_PlaceSlave(). + * PlaceSlaves sets the position and size of all managed content windows + * by calling Ttk_PlaceContent(). * - * SlaveRemoved() is called immediately before a slave is removed. - * NB: the associated slave window may have been destroyed when this + * SlaveRemoved() is called immediately before a content window is removed. + * NB: the associated content window may have been destroyed when this * routine is called. * - * SlaveRequest() is called when a slave requests a size change. + * SlaveRequest() is called when a content window requests a size change. * It should return 1 if the request should propagate, 0 otherwise. */ typedef struct { /* Manager hooks */ @@ -31,37 +31,43 @@ typedef struct { /* Manager hooks */ int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr); void (*PlaceSlaves)(void *managerData); - int (*SlaveRequest)(void *managerData, int slaveIndex, int w, int h); - void (*SlaveRemoved)(void *managerData, int slaveIndex); + int (*SlaveRequest)(void *managerData, int index, int w, int h); + void (*SlaveRemoved)(void *managerData, int index); } Ttk_ManagerSpec; /* * Default implementations for Tk_GeomMgr hooks: */ -MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window slave); -MODULE_SCOPE void Ttk_LostSlaveProc(ClientData, Tk_Window slave); +#define Ttk_LostContentProc Ttk_LostSlaveProc +MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window window); +MODULE_SCOPE void Ttk_LostContentProc(ClientData, Tk_Window window); /* * Public API: */ MODULE_SCOPE Ttk_Manager *Ttk_CreateManager( - Ttk_ManagerSpec *, void *managerData, Tk_Window masterWindow); + Ttk_ManagerSpec *, void *managerData, Tk_Window window); MODULE_SCOPE void Ttk_DeleteManager(Ttk_Manager *); -MODULE_SCOPE void Ttk_InsertSlave( - Ttk_Manager *, int position, Tk_Window, void *slaveData); +#define Ttk_InsertContent Ttk_InsertSlave +MODULE_SCOPE void Ttk_InsertContent( + Ttk_Manager *, int position, Tk_Window, void *data); -MODULE_SCOPE void Ttk_ForgetSlave(Ttk_Manager *, int slaveIndex); +#define Ttk_ForgetContent Ttk_ForgetSlave +MODULE_SCOPE void Ttk_ForgetContent(Ttk_Manager *, int index); -MODULE_SCOPE void Ttk_ReorderSlave(Ttk_Manager *, int fromIndex, int toIndex); - /* Rearrange slave positions */ +#define Ttk_ReorderContent Ttk_ReorderSlave +MODULE_SCOPE void Ttk_ReorderContent(Ttk_Manager *, int fromIndex, int toIndex); + /* Rearrange content window positions */ -MODULE_SCOPE void Ttk_PlaceSlave( - Ttk_Manager *, int slaveIndex, int x, int y, int width, int height); - /* Position and map the slave */ +#define Ttk_PlaceContent Ttk_PlaceSlave +MODULE_SCOPE void Ttk_PlaceContent( + Ttk_Manager *, int index, int x, int y, int width, int height); + /* Position and map the content window */ -MODULE_SCOPE void Ttk_UnmapSlave(Ttk_Manager *, int slaveIndex); - /* Unmap the slave */ +#define Ttk_UnmapContent Ttk_UnmapSlave +MODULE_SCOPE void Ttk_UnmapContent(Ttk_Manager *, int index); + /* Unmap the content window */ MODULE_SCOPE void Ttk_ManagerSizeChanged(Ttk_Manager *); MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *); @@ -69,24 +75,29 @@ MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *); /* Utilities: */ -MODULE_SCOPE int Ttk_SlaveIndex(Ttk_Manager *, Tk_Window); - /* Returns: index in slave array of specified window, -1 if not found */ +#define Ttk_ContentIndex Ttk_SlaveIndex +MODULE_SCOPE int Ttk_ContentIndex(Ttk_Manager *, Tk_Window); + /* Returns: index in content array of specified window, -1 if not found */ -MODULE_SCOPE int Ttk_GetSlaveIndexFromObj( +#define Ttk_GetContentIndexFromObj Ttk_GetSlaveIndexFromObj +MODULE_SCOPE int Ttk_GetContentIndexFromObj( Tcl_Interp *, Ttk_Manager *, Tcl_Obj *, int *indexPtr); /* Accessor functions: */ -MODULE_SCOPE int Ttk_NumberSlaves(Ttk_Manager *); - /* Returns: number of managed slaves */ +#define Ttk_NumberContent Ttk_NumberSlaves +MODULE_SCOPE int Ttk_NumberContent(Ttk_Manager *); + /* Returns: number of managed content windows */ -MODULE_SCOPE void *Ttk_SlaveData(Ttk_Manager *, int slaveIndex); - /* Returns: client data associated with slave */ +#define Ttk_ContentData Ttk_SlaveData +MODULE_SCOPE void *Ttk_ContentData(Ttk_Manager *, int index); + /* Returns: client data associated with content window */ -MODULE_SCOPE Tk_Window Ttk_SlaveWindow(Ttk_Manager *, int slaveIndex); - /* Returns: slave window */ +#define Ttk_ContentWindow Ttk_SlaveWindow +MODULE_SCOPE Tk_Window Ttk_ContentWindow(Ttk_Manager *, int index); + /* Returns: content window */ -MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window slave, Tk_Window master); - /* Returns: 1 if master can manage slave; 0 otherwise leaving error msg */ +MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window content, Tk_Window container); + /* Returns: 1 if container can manage content; 0 otherwise leaving error msg */ #endif /* _TTKMANAGER */ diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 39ed6aa..bd7c7ba 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -5,7 +5,7 @@ #include <string.h> #include <ctype.h> #include <stdio.h> -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -57,20 +57,20 @@ typedef struct * relevant to the tab. * * PaneOptionSpecs includes additional options for child window placement - * and is used to configure the slave. + * and is used to configure the content window. */ static Tk_OptionSpec TabOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-state", "", "", "normal", -1,Tk_Offset(Tab,state), - 0,(ClientData)TabStateStrings,0 }, + 0, (void *)TabStateStrings, 0 }, {TK_OPTION_STRING, "-text", "text", "Text", "", Tk_Offset(Tab,textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/, Tk_Offset(Tab,imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", NULL, Tk_Offset(Tab,compoundObj), -1, - TK_OPTION_NULL_OK,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED }, + TK_OPTION_NULL_OK, (void *)ttkCompoundStrings, GEOMETRY_CHANGED }, {TK_OPTION_INT, "-underline", "underline", "Underline", "-1", Tk_Offset(Tab,underlineObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 } @@ -102,7 +102,7 @@ typedef struct int activeIndex; /* index of currently active tab */ Ttk_Layout tabLayout; /* Sublayout for tabs */ - Ttk_Box clientArea; /* Where to pack slave widgets */ + Ttk_Box clientArea; /* Where to pack content widgets */ } NotebookPart; typedef struct @@ -191,13 +191,13 @@ static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle) * +++ Tab management. */ -static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window slaveWindow) +static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window window) { Tk_OptionTable optionTable = nb->notebook.paneOptionTable; - void *record = ckalloc(sizeof(Tab)); + Tab *record = (Tab *)ckalloc(sizeof(Tab)); memset(record, 0, sizeof(Tab)); - if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) { + if (Tk_InitOptions(interp, (char *)record, optionTable, window) != TCL_OK) { ckfree(record); return NULL; } @@ -213,7 +213,7 @@ static void DestroyTab(Notebook *nb, Tab *tab) } static int ConfigureTab( - Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window slaveWindow, + Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window window, int objc, Tcl_Obj *const objv[]) { Ttk_Sticky sticky = tab->sticky; @@ -221,8 +221,8 @@ static int ConfigureTab( Tk_SavedOptions savedOptions; int mask = 0; - if (Tk_SetOptions(interp, (ClientData)tab, nb->notebook.paneOptionTable, - objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) + if (Tk_SetOptions(interp, (void *)tab, nb->notebook.paneOptionTable, + objc, objv, window, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } @@ -234,7 +234,7 @@ static int ConfigureTab( { goto error; } - if (Ttk_GetPaddingFromObj(interp, slaveWindow, tab->paddingObj, &padding) + if (Ttk_GetPaddingFromObj(interp, window, tab->paddingObj, &padding) != TCL_OK) { goto error; @@ -261,8 +261,8 @@ error: static int IdentifyTab(Notebook *nb, int x, int y) { int index; - for (index = 0; index < Ttk_NumberSlaves(nb->notebook.mgr); ++index) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index); + for (index = 0; index < Ttk_NumberContent(nb->notebook.mgr); ++index) { + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,index); if ( tab->state != TAB_STATE_HIDDEN && Ttk_BoxContains(tab->parcel, x,y)) { @@ -294,7 +294,7 @@ static void ActivateTab(Notebook *nb, int index) static Ttk_State TabState(Notebook *nb, int index) { Ttk_State state = nb->core.state; - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); int i = 0; if (index == nb->notebook.currentIndex) { @@ -306,8 +306,8 @@ static Ttk_State TabState(Notebook *nb, int index) if (index == nb->notebook.activeIndex) { state |= TTK_STATE_ACTIVE; } - for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } @@ -316,8 +316,8 @@ static Ttk_State TabState(Notebook *nb, int index) } break; } - for (i = Ttk_NumberSlaves(nb->notebook.mgr) - 1; i >= 0; --i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + for (i = Ttk_NumberContent(nb->notebook.mgr) - 1; i != -1; --i) { + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } @@ -357,8 +357,8 @@ static void TabrowSize( int tabrowWidth = 0, tabrowHeight = 0; int i; - for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb,i); Ttk_RebindSublayout(tabLayout, tab); @@ -382,13 +382,13 @@ static void TabrowSize( * * Total height is tab height + client area height + pane internal padding * Total width is max(client width, tab width) + pane internal padding - * Client area size determined by max size of slaves, + * Client area size determined by max size of content windows, * overridden by -width and/or -height if nonzero. */ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; NotebookStyle nbstyle; Ttk_Padding padding; Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client"); @@ -399,18 +399,18 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) NotebookStyleOptions(nb, &nbstyle); - /* Compute max requested size of all slaves: + /* Compute max requested size of all content windows: */ - for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { - Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, i); - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); - int slaveWidth - = Tk_ReqWidth(slaveWindow) + Ttk_PaddingWidth(tab->padding); - int slaveHeight - = Tk_ReqHeight(slaveWindow) + Ttk_PaddingHeight(tab->padding); + for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { + Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); + int width + = Tk_ReqWidth(window) + Ttk_PaddingWidth(tab->padding); + int height + = Tk_ReqHeight(window) + Ttk_PaddingHeight(tab->padding); - clientWidth = MAX(clientWidth, slaveWidth); - clientHeight = MAX(clientHeight, slaveHeight); + clientWidth = MAX(clientWidth, width); + clientHeight = MAX(clientHeight, height); } /* Client width/height overridable by widget options: @@ -465,7 +465,7 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) static void SqueezeTabs( Notebook *nb, int needed, int available) { - int nTabs = Ttk_NumberSlaves(nb->notebook.mgr); + int nTabs = Ttk_NumberContent(nb->notebook.mgr); if (nTabs > 0) { int difference = available - needed; @@ -474,7 +474,7 @@ static void SqueezeTabs( int i; for (i = 0; i < nTabs; ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr,i); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,i); double ad = slack + tab->width * delta; tab->width += (int)ad; slack = ad - (int)ad; @@ -489,11 +489,11 @@ static void PlaceTabs( Notebook *nb, Ttk_Box tabrowBox, Ttk_PositionSpec tabPlacement) { Ttk_Layout tabLayout = nb->notebook.tabLayout; - int nTabs = Ttk_NumberSlaves(nb->notebook.mgr); + int nTabs = Ttk_NumberContent(nb->notebook.mgr); int i; for (i = 0; i < nTabs; ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb, i); if (tab->state != TAB_STATE_HIDDEN) { @@ -517,11 +517,11 @@ static void PlaceTabs( * Computes notebook layout and places tabs. * * Side effects: - * Sets clientArea, used to place slave panes. + * Sets clientArea, used to place panes. */ static void NotebookDoLayout(void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Tk_Window nbwin = nb->core.tkwin; Ttk_Box cavity = Ttk_WinBox(nbwin); int tabrowWidth = 0, tabrowHeight = 0; @@ -571,32 +571,32 @@ static void NotebookDoLayout(void *recordPtr) } /* - * NotebookPlaceSlave -- + * NotebookPlaceContent -- * Set the position and size of a child widget - * based on the current client area and slave options: + * based on the current client area and content window options: */ -static void NotebookPlaceSlave(Notebook *nb, int slaveIndex) +static void NotebookPlaceContent(Notebook *nb, int index) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex); - Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, slaveIndex); - Ttk_Box slaveBox = + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); + Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, index); + Ttk_Box box = Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding), - Tk_ReqWidth(slaveWindow), Tk_ReqHeight(slaveWindow),tab->sticky); + Tk_ReqWidth(window), Tk_ReqHeight(window),tab->sticky); - Ttk_PlaceSlave(nb->notebook.mgr, slaveIndex, - slaveBox.x, slaveBox.y, slaveBox.width, slaveBox.height); + Ttk_PlaceContent(nb->notebook.mgr, index, + box.x, box.y, box.width, box.height); } -/* NotebookPlaceSlaves -- +/* NotebookPlaceContents -- * Geometry manager hook. */ -static void NotebookPlaceSlaves(void *recordPtr) +static void NotebookPlaceContents(void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int currentIndex = nb->notebook.currentIndex; if (currentIndex >= 0) { NotebookDoLayout(nb); - NotebookPlaceSlave(nb, currentIndex); + NotebookPlaceContent(nb, currentIndex); } } @@ -606,7 +606,7 @@ static void NotebookPlaceSlaves(void *recordPtr) */ static void SelectTab(Notebook *nb, int index) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); int currentIndex = nb->notebook.currentIndex; if (index == currentIndex) { @@ -624,15 +624,15 @@ static void SelectTab(Notebook *nb, int index) } if (currentIndex >= 0) { - Ttk_UnmapSlave(nb->notebook.mgr, currentIndex); + Ttk_UnmapContent(nb->notebook.mgr, currentIndex); } - /* Must be set before calling NotebookPlaceSlave(), otherwise it may - * happen that NotebookPlaceSlaves(), triggered by an interveaning + /* Must be set before calling NotebookPlaceContent(), otherwise it may + * happen that NotebookPlaceContents(), triggered by an interveaning * geometry request, will swap to old index. */ nb->notebook.currentIndex = index; - NotebookPlaceSlave(nb, index); + NotebookPlaceContent(nb, index); TtkRedisplayWidget(&nb->core); TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged"); @@ -645,13 +645,13 @@ static void SelectTab(Notebook *nb, int index) */ static int NextTab(Notebook *nb, int index) { - int nTabs = Ttk_NumberSlaves(nb->notebook.mgr); + int nTabs = Ttk_NumberContent(nb->notebook.mgr); int nextIndex; /* Scan forward for following usable tab: */ for (nextIndex = index + 1; nextIndex < nTabs; ++nextIndex) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } @@ -660,7 +660,7 @@ static int NextTab(Notebook *nb, int index) /* Not found -- scan backwards. */ for (nextIndex = index - 1; nextIndex >= 0; --nextIndex) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } @@ -684,7 +684,7 @@ static void SelectNearestTab(Notebook *nb) int nextIndex = NextTab(nb, currentIndex); if (currentIndex >= 0) { - Ttk_UnmapSlave(nb->notebook.mgr, currentIndex); + Ttk_UnmapContent(nb->notebook.mgr, currentIndex); } if (currentIndex != nextIndex) { TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged"); @@ -695,14 +695,14 @@ static void SelectNearestTab(Notebook *nb) TtkRedisplayWidget(&nb->core); } -/* TabRemoved -- GM SlaveRemoved hook. +/* TabRemoved -- GM TabRemoved hook. * Select the next tab if the current one is being removed. - * Adjust currentIndex to account for removed slave. + * Adjust currentIndex to account for removed content window. */ static void TabRemoved(void *managerData, int index) { - Notebook *nb = managerData; - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); + Notebook *nb = (Notebook *)managerData; + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -717,7 +717,11 @@ static void TabRemoved(void *managerData, int index) TtkRedisplayWidget(&nb->core); } -static int TabRequest(void *managerData, int index, int width, int height) +static int TabRequest( + TCL_UNUSED(void *), + TCL_UNUSED(int), + TCL_UNUSED(int), + TCL_UNUSED(int)) { return 1; } @@ -727,17 +731,17 @@ static int TabRequest(void *managerData, int index, int width, int height) */ static int AddTab( Tcl_Interp *interp, Notebook *nb, - int destIndex, Tk_Window slaveWindow, + int destIndex, Tk_Window window, int objc, Tcl_Obj *const objv[]) { Tab *tab; - if (!Ttk_Maintainable(interp, slaveWindow, nb->core.tkwin)) { + if (!Ttk_Maintainable(interp, window, nb->core.tkwin)) { return TCL_ERROR; } #if 0 /* can't happen */ - if (Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow) >= 0) { + if (Ttk_ContentIndex(nb->notebook.mgr, window) >= 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s already added", - Tk_PathName(slaveWindow))); + Tk_PathName(window))); Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "PRESENT", NULL); return TCL_ERROR; } @@ -745,16 +749,16 @@ static int AddTab( /* Create and insert tab. */ - tab = CreateTab(interp, nb, slaveWindow); + tab = CreateTab(interp, nb, window); if (!tab) { return TCL_ERROR; } - if (ConfigureTab(interp, nb, tab, slaveWindow, objc, objv) != TCL_OK) { + if (ConfigureTab(interp, nb, tab, window, objc, objv) != TCL_OK) { DestroyTab(nb, tab); return TCL_ERROR; } - Ttk_InsertSlave(nb->notebook.mgr, destIndex, slaveWindow, tab); + Ttk_InsertContent(nb->notebook.mgr, destIndex, window, tab); /* Adjust indices and/or autoselect first tab: */ @@ -768,9 +772,9 @@ static int AddTab( } static Ttk_ManagerSpec NotebookManagerSpec = { - { "notebook", Ttk_GeometryRequestProc, Ttk_LostSlaveProc }, + { "notebook", Ttk_GeometryRequestProc, Ttk_LostContentProc }, NotebookSize, - NotebookPlaceSlaves, + NotebookPlaceContents, TabRequest, TabRemoved }; @@ -789,7 +793,7 @@ static const int NotebookEventMask ; static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; if (eventPtr->type == DestroyNotify) { /* Remove self */ Tk_DeleteEventHandler(nb->core.tkwin, @@ -813,7 +817,7 @@ static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr) * + positional specifications @x,y, * + "current", * + numeric indices [0..nTabs], - * + slave window names + * + content window names * * Stores index of specified tab in *index_rtn, -1 if not found. * @@ -844,15 +848,15 @@ static int FindTabIndex( return TCL_OK; } - /* ... or integer index or slave window name: + /* ... or integer index or content window name: */ - if (Ttk_GetSlaveIndexFromObj( + if (Ttk_GetContentIndexFromObj( interp, nb->notebook.mgr, objPtr, index_rtn) == TCL_OK) { return TCL_OK; } - /* Nothing matched; Ttk_GetSlaveIndexFromObj will have left error message. + /* Nothing matched; Ttk_GetContentIndexFromObj will have left error message. */ return TCL_ERROR; } @@ -885,10 +889,9 @@ static int GetTabIndex( static int NotebookAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; - int index = Ttk_NumberSlaves(nb->notebook.mgr); - Tk_Window slaveWindow; - int slaveIndex; + Notebook *nb = (Notebook *)recordPtr; + Tk_Window window; + int index; Tab *tab; if (objc <= 2 || objc % 2 != 1) { @@ -896,21 +899,21 @@ static int NotebookAddCommand( return TCL_ERROR; } - slaveWindow = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin); - if (!slaveWindow) { + window = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin); + if (!window) { return TCL_ERROR; } - slaveIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow); + index = Ttk_ContentIndex(nb->notebook.mgr, window); - if (slaveIndex < 0) { /* New tab */ - return AddTab(interp, nb, index, slaveWindow, objc-3,objv+3); + if (index < 0) { /* New tab */ + return AddTab(interp, nb, Ttk_NumberContent(nb->notebook.mgr), window, objc-3,objv+3); } - tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex); + tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); if (tab->state == TAB_STATE_HIDDEN) { tab->state = TAB_STATE_NORMAL; } - if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) { + if (ConfigureTab(interp, nb, tab, window, objc-3,objv+3) != TCL_OK) { return TCL_ERROR; } @@ -925,9 +928,9 @@ static int NotebookAddCommand( static int NotebookInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int current = nb->notebook.currentIndex; - int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr); + int nContent = Ttk_NumberContent(nb->notebook.mgr); int srcIndex, destIndex; if (objc < 4) { @@ -936,46 +939,46 @@ static int NotebookInsertCommand( } if (!strcmp(Tcl_GetString(objv[2]), "end")) { - destIndex = Ttk_NumberSlaves(nb->notebook.mgr); - } else if (TCL_OK != Ttk_GetSlaveIndexFromObj( + destIndex = Ttk_NumberContent(nb->notebook.mgr); + } else if (TCL_OK != Ttk_GetContentIndexFromObj( interp, nb->notebook.mgr, objv[2], &destIndex)) { return TCL_ERROR; } if (Tcl_GetString(objv[3])[0] == '.') { - /* Window name -- could be new or existing slave. + /* Window name -- could be new or existing content window. */ - Tk_Window slaveWindow = + Tk_Window window = Tk_NameToWindow(interp,Tcl_GetString(objv[3]),nb->core.tkwin); - if (!slaveWindow) { + if (!window) { return TCL_ERROR; } - srcIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow); - if (srcIndex < 0) { /* New slave */ - return AddTab(interp, nb, destIndex, slaveWindow, objc-4,objv+4); + srcIndex = Ttk_ContentIndex(nb->notebook.mgr, window); + if (srcIndex < 0) { /* New content window */ + return AddTab(interp, nb, destIndex, window, objc-4,objv+4); } - } else if (Ttk_GetSlaveIndexFromObj( + } else if (Ttk_GetContentIndexFromObj( interp, nb->notebook.mgr, objv[3], &srcIndex) != TCL_OK) { return TCL_ERROR; } - /* Move existing slave: + /* Move existing content window: */ if (ConfigureTab(interp, nb, - Ttk_SlaveData(nb->notebook.mgr,srcIndex), - Ttk_SlaveWindow(nb->notebook.mgr,srcIndex), + (Tab *)Ttk_ContentData(nb->notebook.mgr,srcIndex), + Ttk_ContentWindow(nb->notebook.mgr,srcIndex), objc-4,objv+4) != TCL_OK) { return TCL_ERROR; } - if (destIndex >= nSlaves) { - destIndex = nSlaves - 1; + if (destIndex >= nContent) { + destIndex = nContent - 1; } - Ttk_ReorderSlave(nb->notebook.mgr, srcIndex, destIndex); + Ttk_ReorderContent(nb->notebook.mgr, srcIndex, destIndex); /* Adjust internal indexes: */ @@ -999,7 +1002,7 @@ static int NotebookInsertCommand( static int NotebookForgetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index; if (objc != 3) { @@ -1011,7 +1014,7 @@ static int NotebookForgetCommand( return TCL_ERROR; } - Ttk_ForgetSlave(nb->notebook.mgr, index); + Ttk_ForgetContent(nb->notebook.mgr, index); TtkRedisplayWidget(&nb->core); return TCL_OK; @@ -1023,7 +1026,7 @@ static int NotebookForgetCommand( static int NotebookHideCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index; Tab *tab; @@ -1036,7 +1039,7 @@ static int NotebookHideCommand( return TCL_ERROR; } - tab = Ttk_SlaveData(nb->notebook.mgr, index); + tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); tab->state = TAB_STATE_HIDDEN; if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -1056,16 +1059,17 @@ static int NotebookIdentifyCommand( static const char *whatTable[] = { "element", "tab", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_TAB }; int what = IDENTIFY_ELEMENT; - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Element element = NULL; - int x, y, tabIndex; + int x, y; + int tabIndex; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 2,objv, "?what? x y"); return TCL_ERROR; } - if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK + if (Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK || (objc == 5 && Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable, sizeof(char *), "option", 0, &what) != TCL_OK) @@ -1075,7 +1079,7 @@ static int NotebookIdentifyCommand( tabIndex = IdentifyTab(nb, x, y); if (tabIndex >= 0) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, tabIndex); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, tabIndex); Ttk_State state = TabState(nb, tabIndex); Ttk_Layout tabLayout = nb->notebook.tabLayout; @@ -1110,8 +1114,9 @@ static int NotebookIdentifyCommand( static int NotebookIndexCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; - int index, status; + Notebook *nb = (Notebook *)recordPtr; + int index; + int status; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "tab"); @@ -1122,8 +1127,8 @@ static int NotebookIndexCommand( * Special-case for "end": */ if (!strcmp("end", Tcl_GetString(objv[2]))) { - int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr); - Tcl_SetObjResult(interp, Tcl_NewIntObj(nSlaves)); + int nContent = Ttk_NumberContent(nb->notebook.mgr); + Tcl_SetObjResult(interp, Tcl_NewIntObj(nContent)); return TCL_OK; } @@ -1142,11 +1147,11 @@ static int NotebookIndexCommand( static int NotebookSelectCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; if (objc == 2) { if (nb->notebook.currentIndex >= 0) { - Tk_Window pane = Ttk_SlaveWindow( + Tk_Window pane = Ttk_ContentWindow( nb->notebook.mgr, nb->notebook.currentIndex); Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(pane), -1)); } @@ -1168,7 +1173,7 @@ static int NotebookSelectCommand( static int NotebookTabsCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; Tcl_Obj *result; int i; @@ -1179,8 +1184,8 @@ static int NotebookTabsCommand( } result = Tcl_NewListObj(0, NULL); - for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) { - const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i)); + for (i = 0; i < Ttk_NumberContent(mgr); ++i) { + const char *pathName = Tk_PathName(Ttk_ContentWindow(mgr,i)); Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(pathName,-1)); } @@ -1193,10 +1198,10 @@ static int NotebookTabsCommand( static int NotebookTabCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; int index; - Tk_Window slaveWindow; + Tk_Window window; Tab *tab; if (objc < 3) { @@ -1208,18 +1213,18 @@ static int NotebookTabCommand( return TCL_ERROR; } - tab = Ttk_SlaveData(mgr, index); - slaveWindow = Ttk_SlaveWindow(mgr, index); + tab = (Tab *)Ttk_ContentData(mgr, index); + window = Ttk_ContentWindow(mgr, index); if (objc == 3) { return TtkEnumerateOptions(interp, tab, - PaneOptionSpecs, nb->notebook.paneOptionTable, slaveWindow); + PaneOptionSpecs, nb->notebook.paneOptionTable, window); } else if (objc == 4) { return TtkGetOptionValue(interp, tab, objv[3], - nb->notebook.paneOptionTable, slaveWindow); + nb->notebook.paneOptionTable, window); } /* else */ - if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) { + if (ConfigureTab(interp, nb, tab, window, objc-3,objv+3) != TCL_OK) { return TCL_ERROR; } @@ -1258,7 +1263,7 @@ static const Ttk_Ensemble NotebookCommands[] = { static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; nb->notebook.mgr = Ttk_CreateManager( &NotebookManagerSpec, recordPtr, nb->core.tkwin); @@ -1278,7 +1283,7 @@ static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr) static void NotebookCleanup(void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_DeleteManager(nb->notebook.mgr); if (nb->notebook.tabLayout) @@ -1287,7 +1292,7 @@ static void NotebookCleanup(void *recordPtr) static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; /* * Error-checks: @@ -1311,7 +1316,7 @@ static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask) static Ttk_Layout NotebookGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Layout notebookLayout = TtkWidgetGetLayout(interp, theme, recordPtr); Ttk_Layout tabLayout; @@ -1339,7 +1344,7 @@ static Ttk_Layout NotebookGetLayout( static void DisplayTab(Notebook *nb, int index, Drawable d) { Ttk_Layout tabLayout = nb->notebook.tabLayout; - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); Ttk_State state = TabState(nb, index); if (tab->state != TAB_STATE_HIDDEN) { @@ -1351,8 +1356,8 @@ static void DisplayTab(Notebook *nb, int index, Drawable d) static void NotebookDisplay(void *clientData, Drawable d) { - Notebook *nb = clientData; - int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr); + Notebook *nb = (Notebook *)clientData; + int nContent = Ttk_NumberContent(nb->notebook.mgr); int index; /* Draw notebook background (base layout): @@ -1362,7 +1367,7 @@ static void NotebookDisplay(void *clientData, Drawable d) /* Draw tabs from left to right, but draw the current tab last * so it will overwrite its neighbors. */ - for (index = 0; index < nSlaves; ++index) { + for (index = 0; index < nContent; ++index) { if (index != nb->notebook.currentIndex) { DisplayTab(nb, index, d); } diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index adc2aef..fa0d5c8 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -7,7 +7,7 @@ */ #include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkManager.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -29,7 +29,7 @@ * gives the same result as changing the size by X+Y pixels * in one step). * - * The request size is initially set to the slave window's requested size. + * The request size is initially set to the content window's requested size. * When the user drags a sash, each pane's request size is set to its * actual size. This ensures that panes "stay put" on the next resize. * @@ -78,20 +78,20 @@ typedef struct { static Tk_OptionSpec PanedOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", Tk_Offset(Paned,paned.orientObj), Tk_Offset(Paned,paned.orient), - 0,(ClientData)ttkOrientStrings,READONLY_OPTION|STYLE_CHANGED }, + 0, (void *)ttkOrientStrings, READONLY_OPTION|STYLE_CHANGED }, {TK_OPTION_INT, "-width", "width", "Width", "0", -1,Tk_Offset(Paned,paned.width), - 0,0,GEOMETRY_CHANGED }, + 0, 0, GEOMETRY_CHANGED }, {TK_OPTION_INT, "-height", "height", "Height", "0", -1,Tk_Offset(Paned,paned.height), - 0,0,GEOMETRY_CHANGED }, + 0, 0, GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ - * +++ Slave pane record. + * +++ Pane record. */ typedef struct { int reqSize; /* Pane request size */ @@ -108,21 +108,21 @@ static Tk_OptionSpec PaneOptionSpecs[] = { /* CreatePane -- * Create a new pane record. */ -static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window slaveWindow) +static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window window) { Tk_OptionTable optionTable = pw->paned.paneOptionTable; void *record = ckalloc(sizeof(Pane)); - Pane *pane = record; + Pane *pane = (Pane *)record; memset(record, 0, sizeof(Pane)); - if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) { + if (Tk_InitOptions(interp, record, optionTable, window) != TCL_OK) { ckfree(record); return NULL; } pane->reqSize = pw->paned.orient == TTK_ORIENT_HORIZONTAL - ? Tk_ReqWidth(slaveWindow) : Tk_ReqHeight(slaveWindow); + ? Tk_ReqWidth(window) : Tk_ReqHeight(window); return pane; } @@ -141,7 +141,7 @@ static void DestroyPane(Paned *pw, Pane *pane) * Set pane options. */ static int ConfigurePane( - Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window slaveWindow, + Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window window, int objc, Tcl_Obj *const objv[]) { Ttk_Manager *mgr = pw->paned.mgr; @@ -149,7 +149,7 @@ static int ConfigurePane( int mask = 0; if (Tk_SetOptions(interp, (void*)pane, pw->paned.paneOptionTable, - objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) + objc, objv, window, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } @@ -189,14 +189,14 @@ error: static int ShoveUp(Paned *pw, int i, int pos) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, i); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, i); int sashThickness = pw->paned.sashThickness; if (i == 0) { if (pos < 0) pos = 0; } else { - Pane *prevPane = Ttk_SlaveData(pw->paned.mgr, i-1); + Pane *prevPane = (Pane *)Ttk_ContentData(pw->paned.mgr, i-1); if (pos < prevPane->sashPos + sashThickness) pos = ShoveUp(pw, i-1, pos - sashThickness) + sashThickness; } @@ -209,13 +209,13 @@ static int ShoveUp(Paned *pw, int i, int pos) */ static int ShoveDown(Paned *pw, int i, int pos) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr,i); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr,i); int sashThickness = pw->paned.sashThickness; - if (i == Ttk_NumberSlaves(pw->paned.mgr) - 1) { - pos = pane->sashPos; /* Sentinel value == master window size */ + if (i == Ttk_NumberContent(pw->paned.mgr) - 1) { + pos = pane->sashPos; /* Sentinel value == container window size */ } else { - Pane *nextPane = Ttk_SlaveData(pw->paned.mgr,i+1); + Pane *nextPane = (Pane *)Ttk_ContentData(pw->paned.mgr,i+1); if (pos + sashThickness > nextPane->sashPos) pos = ShoveDown(pw, i+1, pos + sashThickness) - sashThickness; } @@ -230,8 +230,8 @@ static int ShoveDown(Paned *pw, int i, int pos) */ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) { - Paned *pw = recordPtr; - int nPanes = Ttk_NumberSlaves(pw->paned.mgr); + Paned *pw = (Paned *)recordPtr; + int nPanes = Ttk_NumberContent(pw->paned.mgr); int nSashes = nPanes - 1; int sashThickness = pw->paned.sashThickness; int width = 0, height = 0; @@ -239,21 +239,21 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) if (pw->paned.orient == TTK_ORIENT_HORIZONTAL) { for (index = 0; index < nPanes; ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); + Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index); - if (height < Tk_ReqHeight(slaveWindow)) - height = Tk_ReqHeight(slaveWindow); + if (height < Tk_ReqHeight(window)) + height = Tk_ReqHeight(window); width += pane->reqSize; } width += nSashes * sashThickness; } else { for (index = 0; index < nPanes; ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); + Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index); - if (width < Tk_ReqWidth(slaveWindow)) - width = Tk_ReqWidth(slaveWindow); + if (width < Tk_ReqWidth(window)) + width = Tk_ReqWidth(window); height += pane->reqSize; } height += nSashes * sashThickness; @@ -278,8 +278,8 @@ static void AdjustPanes(Paned *pw) int pos = 0; int index; - for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) { + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); int size = pane->sashPos - pos; pane->reqSize = size >= 0 ? size : 0; pos = pane->sashPos + sashThickness; @@ -305,7 +305,7 @@ static void AdjustPanes(Paned *pw) static void PlaceSashes(Paned *pw, int width, int height) { Ttk_Manager *mgr = pw->paned.mgr; - int nPanes = Ttk_NumberSlaves(mgr); + int nPanes = Ttk_NumberContent(mgr); int sashThickness = pw->paned.sashThickness; int available = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? width : height; int reqSize = 0, totalWeight = 0; @@ -317,7 +317,7 @@ static void PlaceSashes(Paned *pw, int width, int height) /* Compute total required size and total available weight: */ for (i = 0; i < nPanes; ++i) { - Pane *pane = Ttk_SlaveData(mgr, i); + Pane *pane = (Pane *)Ttk_ContentData(mgr, i); reqSize += pane->reqSize; totalWeight += pane->weight * (pane->reqSize != 0); } @@ -341,7 +341,7 @@ static void PlaceSashes(Paned *pw, int width, int height) */ pos = 0; for (i = 0; i < nPanes; ++i) { - Pane *pane = Ttk_SlaveData(mgr, i); + Pane *pane = (Pane *)Ttk_ContentData(mgr, i); int weight = pane->weight * (pane->reqSize != 0); int size = pane->reqSize + delta * weight; @@ -365,7 +365,7 @@ static void PlaceSashes(Paned *pw, int width, int height) } /* PlacePanes -- - * Places slave panes based on sash positions. + * Places panes based on sash positions. */ static void PlacePanes(Paned *pw) { @@ -375,18 +375,18 @@ static void PlacePanes(Paned *pw) int pos = 0; int index; - for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) { + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); int size = pane->sashPos - pos; if (size > 0) { if (horizontal) { - Ttk_PlaceSlave(pw->paned.mgr, index, pos, 0, size, height); + Ttk_PlaceContent(pw->paned.mgr, index, pos, 0, size, height); } else { - Ttk_PlaceSlave(pw->paned.mgr, index, 0, pos, width, size); + Ttk_PlaceContent(pw->paned.mgr, index, 0, pos, width, size); } } else { - Ttk_UnmapSlave(pw->paned.mgr, index); + Ttk_UnmapContent(pw->paned.mgr, index); } pos = pane->sashPos + sashThickness; @@ -397,72 +397,72 @@ static void PlacePanes(Paned *pw) * +++ Manager specification. */ -static void PanedPlaceSlaves(void *managerData) +static void PanedPlaceContent(void *managerData) { - Paned *pw = managerData; + Paned *pw = (Paned *)managerData; PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin)); PlacePanes(pw); } static void PaneRemoved(void *managerData, int index) { - Paned *pw = managerData; - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Paned *pw = (Paned *)managerData; + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); DestroyPane(pw, pane); } static int AddPane( Tcl_Interp *interp, Paned *pw, - int destIndex, Tk_Window slaveWindow, + int destIndex, Tk_Window window, int objc, Tcl_Obj *const objv[]) { Pane *pane; - if (!Ttk_Maintainable(interp, slaveWindow, pw->core.tkwin)) { + if (!Ttk_Maintainable(interp, window, pw->core.tkwin)) { return TCL_ERROR; } - if (Ttk_SlaveIndex(pw->paned.mgr, slaveWindow) >= 0) { + if (Ttk_ContentIndex(pw->paned.mgr, window) >= 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "%s already added", Tk_PathName(slaveWindow))); + "%s already added", Tk_PathName(window))); Tcl_SetErrorCode(interp, "TTK", "PANE", "PRESENT", NULL); return TCL_ERROR; } - pane = CreatePane(interp, pw, slaveWindow); + pane = CreatePane(interp, pw, window); if (!pane) { return TCL_ERROR; } - if (ConfigurePane(interp, pw, pane, slaveWindow, objc, objv) != TCL_OK) { + if (ConfigurePane(interp, pw, pane, window, objc, objv) != TCL_OK) { DestroyPane(pw, pane); return TCL_ERROR; } - Ttk_InsertSlave(pw->paned.mgr, destIndex, slaveWindow, pane); + Ttk_InsertContent(pw->paned.mgr, destIndex, window, pane); return TCL_OK; } /* PaneRequest -- - * Only update pane request size if slave is currently unmapped. - * Geometry requests from mapped slaves are not directly honored + * Only update pane request size if pane is currently unmapped. + * Geometry requests from mapped panes are not directly honored * in order to avoid unexpected pane resizes (esp. while the * user is dragging a sash [#1325286]). */ static int PaneRequest(void *managerData, int index, int width, int height) { - Paned *pw = managerData; - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); + Paned *pw = (Paned *)managerData; + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); + Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index); int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; - if (!Tk_IsMapped(slaveWindow)) { + if (!Tk_IsMapped(window)) { pane->reqSize = horizontal ? width : height; } return 1; } static Ttk_ManagerSpec PanedManagerSpec = { - { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostSlaveProc }, + { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostContentProc }, PanedSize, - PanedPlaceSlaves, + PanedPlaceContent, PaneRequest, PaneRemoved }; @@ -483,7 +483,7 @@ static Ttk_ManagerSpec PanedManagerSpec = { static const unsigned PanedEventMask = LeaveWindowMask; static void PanedEventProc(ClientData clientData, XEvent *eventPtr) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; if ( eventPtr->type == LeaveNotify && eventPtr->xcrossing.detail == NotifyInferior) { @@ -497,7 +497,7 @@ static void PanedEventProc(ClientData clientData, XEvent *eventPtr) static void PanedInitialize(Tcl_Interp *interp, void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Tk_CreateEventHandler(pw->core.tkwin, PanedEventMask, PanedEventProc, recordPtr); @@ -509,7 +509,7 @@ static void PanedInitialize(Tcl_Interp *interp, void *recordPtr) static void PanedCleanup(void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; if (pw->paned.sashLayout) Ttk_FreeLayout(pw->paned.sashLayout); @@ -520,9 +520,12 @@ static void PanedCleanup(void *recordPtr) /* Post-configuration hook. */ -static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask) +static int PanedPostConfigure( + TCL_UNUSED(Tcl_Interp *), + void *clientData, + int mask) { - Paned *pw = clientData; + Paned *pw = (Paned *)clientData; if (mask & GEOMETRY_CHANGED) { /* User has changed -width or -height. @@ -543,7 +546,7 @@ static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask) static Ttk_Layout PanedGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Ttk_Layout panedLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); if (panedLayout) { @@ -581,7 +584,7 @@ static Ttk_Layout PanedGetLayout( */ static Ttk_Layout SashLayout(Paned *pw, int index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); int thickness = pw->paned.sashThickness, height = Tk_Height(pw->core.tkwin), width = Tk_Width(pw->core.tkwin), @@ -603,8 +606,8 @@ static void DrawSash(Paned *pw, int index, Drawable d) static void PanedDisplay(void *recordPtr, Drawable d) { - Paned *pw = recordPtr; - int i, nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1; + Paned *pw = (Paned *)recordPtr; + int i, nSashes = Ttk_NumberContent(pw->paned.mgr) - 1; TtkWidgetDisplay(recordPtr, d); for (i = 0; i < nSashes; ++i) { @@ -621,69 +624,69 @@ static void PanedDisplay(void *recordPtr, Drawable d) static int PanedAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; - Tk_Window slaveWindow; + Paned *pw = (Paned *)recordPtr; + Tk_Window window; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - slaveWindow = Tk_NameToWindow( + window = Tk_NameToWindow( interp, Tcl_GetString(objv[2]), pw->core.tkwin); - if (!slaveWindow) { + if (!window) { return TCL_ERROR; } - return AddPane(interp, pw, Ttk_NumberSlaves(pw->paned.mgr), slaveWindow, + return AddPane(interp, pw, Ttk_NumberContent(pw->paned.mgr), window, objc - 3, objv + 3); } -/* $pw insert $index $slave ?-option value ...? - * Insert new slave, or move existing one. +/* $pw insert $index $window ?-option value ...? + * Insert new content window, or move existing one. */ static int PanedInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; - int nSlaves = Ttk_NumberSlaves(pw->paned.mgr); + Paned *pw = (Paned *)recordPtr; + int nContent = Ttk_NumberContent(pw->paned.mgr); int srcIndex, destIndex; - Tk_Window slaveWindow; + Tk_Window window; if (objc < 4) { Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?"); return TCL_ERROR; } - slaveWindow = Tk_NameToWindow( + window = Tk_NameToWindow( interp, Tcl_GetString(objv[3]), pw->core.tkwin); - if (!slaveWindow) { + if (!window) { return TCL_ERROR; } if (!strcmp(Tcl_GetString(objv[2]), "end")) { - destIndex = Ttk_NumberSlaves(pw->paned.mgr); - } else if (TCL_OK != Ttk_GetSlaveIndexFromObj( - interp,pw->paned.mgr,objv[2],&destIndex)) + destIndex = Ttk_NumberContent(pw->paned.mgr); + } else if (TCL_OK != Ttk_GetContentIndexFromObj( + interp,pw->paned.mgr, objv[2], &destIndex)) { return TCL_ERROR; } - srcIndex = Ttk_SlaveIndex(pw->paned.mgr, slaveWindow); - if (srcIndex < 0) { /* New slave: */ - return AddPane(interp, pw, destIndex, slaveWindow, objc-4, objv+4); - } /* else -- move existing slave: */ + srcIndex = Ttk_ContentIndex(pw->paned.mgr, window); + if (srcIndex < 0) { /* New content: */ + return AddPane(interp, pw, destIndex, window, objc-4, objv+4); + } /* else -- move existing content: */ - if (destIndex >= nSlaves) - destIndex = nSlaves - 1; - Ttk_ReorderSlave(pw->paned.mgr, srcIndex, destIndex); + if (destIndex >= nContent) + destIndex = nContent - 1; + Ttk_ReorderContent(pw->paned.mgr, srcIndex, destIndex); return objc == 4 ? TCL_OK : ConfigurePane(interp, pw, - Ttk_SlaveData(pw->paned.mgr, destIndex), - Ttk_SlaveWindow(pw->paned.mgr, destIndex), - objc-4,objv+4); + (Pane *)Ttk_ContentData(pw->paned.mgr, destIndex), + Ttk_ContentWindow(pw->paned.mgr, destIndex), + objc-4, objv+4); } /* $pw forget $pane @@ -691,7 +694,7 @@ static int PanedInsertCommand( static int PanedForgetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int paneIndex; if (objc != 3) { @@ -699,12 +702,12 @@ static int PanedForgetCommand( return TCL_ERROR; } - if (TCL_OK != Ttk_GetSlaveIndexFromObj( + if (TCL_OK != Ttk_GetContentIndexFromObj( interp, pw->paned.mgr, objv[2], &paneIndex)) { return TCL_ERROR; } - Ttk_ForgetSlave(pw->paned.mgr, paneIndex); + Ttk_ForgetContent(pw->paned.mgr, paneIndex); return TCL_OK; } @@ -718,9 +721,9 @@ static int PanedIdentifyCommand( static const char *whatTable[] = { "element", "sash", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_SASH }; int what = IDENTIFY_SASH; - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int sashThickness = pw->paned.sashThickness; - int nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1; + int nSashes = Ttk_NumberContent(pw->paned.mgr) - 1; int x, y, pos; int index; @@ -739,7 +742,7 @@ static int PanedIdentifyCommand( pos = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? x : y; for (index = 0; index < nSashes; ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); if (pane->sashPos <= pos && pos <= pane->sashPos + sashThickness) { /* Found it. */ switch (what) { @@ -769,9 +772,9 @@ static int PanedIdentifyCommand( static int PanedPaneCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int paneIndex; - Tk_Window slaveWindow; + Tk_Window window; Pane *pane; if (objc < 3) { @@ -779,24 +782,24 @@ static int PanedPaneCommand( return TCL_ERROR; } - if (TCL_OK != Ttk_GetSlaveIndexFromObj( - interp,pw->paned.mgr,objv[2],&paneIndex)) + if (TCL_OK != Ttk_GetContentIndexFromObj( + interp,pw->paned.mgr, objv[2], &paneIndex)) { return TCL_ERROR; } - pane = Ttk_SlaveData(pw->paned.mgr, paneIndex); - slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, paneIndex); + pane = (Pane *)Ttk_ContentData(pw->paned.mgr, paneIndex); + window = Ttk_ContentWindow(pw->paned.mgr, paneIndex); switch (objc) { case 3: return TtkEnumerateOptions(interp, pane, PaneOptionSpecs, - pw->paned.paneOptionTable, slaveWindow); + pw->paned.paneOptionTable, window); case 4: return TtkGetOptionValue(interp, pane, objv[3], - pw->paned.paneOptionTable, slaveWindow); + pw->paned.paneOptionTable, window); default: - return ConfigurePane(interp, pw, pane, slaveWindow, objc-3,objv+3); + return ConfigurePane(interp, pw, pane, window, objc-3,objv+3); } } @@ -806,7 +809,7 @@ static int PanedPaneCommand( static int PanedPanesCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Ttk_Manager *mgr = pw->paned.mgr; Tcl_Obj *panes; int i; @@ -817,8 +820,8 @@ static int PanedPanesCommand( } panes = Tcl_NewListObj(0, NULL); - for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) { - const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i)); + for (i = 0; i < Ttk_NumberContent(mgr); ++i) { + const char *pathName = Tk_PathName(Ttk_ContentWindow(mgr,i)); Tcl_ListObjAppendElement(interp, panes, Tcl_NewStringObj(pathName,-1)); } Tcl_SetObjResult(interp, panes); @@ -833,7 +836,7 @@ static int PanedPanesCommand( static int PanedSashposCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int sashIndex, position = -1; Pane *pane; @@ -844,14 +847,14 @@ static int PanedSashposCommand( if (Tcl_GetIntFromObj(interp, objv[2], &sashIndex) != TCL_OK) { return TCL_ERROR; } - if (sashIndex < 0 || sashIndex >= Ttk_NumberSlaves(pw->paned.mgr) - 1) { + if (sashIndex < 0 || sashIndex >= Ttk_NumberContent(pw->paned.mgr) - 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "sash index %d out of range", sashIndex)); Tcl_SetErrorCode(interp, "TTK", "PANE", "SASH_INDEX", NULL); return TCL_ERROR; } - pane = Ttk_SlaveData(pw->paned.mgr, sashIndex); + pane = (Pane *)Ttk_ContentData(pw->paned.mgr, sashIndex); if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos)); @@ -924,15 +927,20 @@ typedef struct { static Ttk_ElementOptionSpec SashElementOptions[] = { { "-sashthickness", TK_OPTION_INT, Tk_Offset(SashElement,thicknessObj), "5" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SashElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, - int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) + TCL_UNUSED(void *), + void *elementRecord, + TCL_UNUSED(Tk_Window), + int *widthPtr, + int *heightPtr, + TCL_UNUSED(Ttk_Padding *)) { - SashElement *sash = elementRecord; + SashElement *sash = (SashElement *)elementRecord; int thickness = DEFAULT_SASH_THICKNESS; + Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness); *widthPtr = *heightPtr = thickness; } diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index eb776ba..ae945ae 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -5,8 +5,7 @@ */ #include <math.h> -#include <tk.h> - +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -48,14 +47,14 @@ static Tk_OptionSpec ProgressbarOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Progressbar,progress.orientObj), -1, - 0, (ClientData)ttkOrientStrings, STYLE_CHANGED }, + 0, (void *)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_PROGRESSBAR_LENGTH, Tk_Offset(Progressbar,progress.lengthObj), -1, 0, 0, GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-mode", "mode", "ProgressMode", "determinate", Tk_Offset(Progressbar,progress.modeObj), Tk_Offset(Progressbar,progress.mode), - 0, (ClientData)ProgressbarModeStrings, 0 }, + 0, (void *)ProgressbarModeStrings, 0 }, {TK_OPTION_DOUBLE, "-maximum", "maximum", "Maximum", "100", Tk_Offset(Progressbar,progress.maximumObj), -1, 0, 0, 0 }, diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c index 8348fb5..4d05f97 100644 --- a/generic/ttk/ttkScale.c +++ b/generic/ttk/ttkScale.c @@ -4,9 +4,9 @@ * ttk::scale widget. */ -#include <tk.h> #include <string.h> #include <stdio.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -63,7 +63,7 @@ static Tk_OptionSpec ScaleOptionSpecs[] = {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Scale,scale.orientObj), Tk_Offset(Scale,scale.orient), 0, - (ClientData)ttkOrientStrings, STYLE_CHANGED }, + (void *)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_DOUBLE, "-from", "from", "From", "0", Tk_Offset(Scale,scale.fromObj), -1, 0, 0, 0}, diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index 2c8d195..5ffd671 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -4,8 +4,7 @@ * ttk::scrollbar widget. */ -#include <tk.h> - +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -40,7 +39,7 @@ static Tk_OptionSpec ScrollbarOptionSpecs[] = {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", Tk_Offset(Scrollbar,scrollbar.orientObj), Tk_Offset(Scrollbar,scrollbar.orient), - 0,(ClientData)ttkOrientStrings,STYLE_CHANGED }, + 0, (void *)ttkOrientStrings, STYLE_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c index b52e6f4..a0ae596 100644 --- a/generic/ttk/ttkSeparator.c +++ b/generic/ttk/ttkSeparator.c @@ -4,8 +4,7 @@ * ttk::separator and ttk::sizegrip widgets. */ -#include <tk.h> - +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -27,7 +26,7 @@ static Tk_OptionSpec SeparatorOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", Tk_Offset(Separator,separator.orientObj), Tk_Offset(Separator,separator.orient), - 0,(ClientData)ttkOrientStrings,STYLE_CHANGED }, + 0, (void *)ttkOrientStrings, STYLE_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c index b5bf6f9..bd2a8c7 100644 --- a/generic/ttk/ttkSquare.c +++ b/generic/ttk/ttkSquare.c @@ -3,7 +3,7 @@ * Minimal sample ttk widget. */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c index 5b62f3c..d37f7f6 100644 --- a/generic/ttk/ttkState.c +++ b/generic/ttk/ttkState.c @@ -6,8 +6,7 @@ */ #include <string.h> - -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" /* diff --git a/generic/ttk/ttkStubInit.c b/generic/ttk/ttkStubInit.c index 87b33dc..0039585 100644 --- a/generic/ttk/ttkStubInit.c +++ b/generic/ttk/ttkStubInit.c @@ -3,7 +3,7 @@ * It is compiled and linked in with the ttk package proper. */ -#include "tk.h" +#include "tkInt.h" #include "ttkTheme.h" MODULE_SCOPE const TtkStubs ttkStubs; diff --git a/generic/ttk/ttkStubLib.c b/generic/ttk/ttkStubLib.c index 5675416..faeabe8 100644 --- a/generic/ttk/ttkStubLib.c +++ b/generic/ttk/ttkStubLib.c @@ -6,7 +6,7 @@ #undef USE_TCL_STUBS #define USE_TCL_STUBS -#include "tk.h" +#include "tkInt.h" #define USE_TTK_STUBS 1 #include "ttkTheme.h" diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c index 07aee76..fc026cb 100644 --- a/generic/ttk/ttkTagSet.c +++ b/generic/ttk/ttkTagSet.c @@ -5,8 +5,7 @@ */ #include <string.h> /* for memset() */ -#include <tcl.h> -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 7bde80e..00cb50b 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -37,7 +37,7 @@ typedef struct Ttk_Style_ static Style *NewStyle(void) { - Style *stylePtr = ckalloc(sizeof(Style)); + Style *stylePtr = (Style *)ckalloc(sizeof(Style)); stylePtr->styleName = NULL; stylePtr->parentStyle = NULL; @@ -56,7 +56,7 @@ static void FreeStyle(Style *stylePtr) entryPtr = Tcl_FirstHashEntry(&stylePtr->settingsTable, &search); while (entryPtr != NULL) { - Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr); + Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(stateMap); entryPtr = Tcl_NextHashEntry(&search); } @@ -64,7 +64,7 @@ static void FreeStyle(Style *stylePtr) entryPtr = Tcl_FirstHashEntry(&stylePtr->defaultsTable, &search); while (entryPtr != NULL) { - Tcl_Obj *defaultValue = Tcl_GetHashValue(entryPtr); + Tcl_Obj *defaultValue = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(defaultValue); entryPtr = Tcl_NextHashEntry(&search); } @@ -85,7 +85,7 @@ Tcl_Obj *Ttk_StyleMap(Ttk_Style style, const char *optionName, Ttk_State state) Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&style->settingsTable, optionName); if (entryPtr) { - Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr); + Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr); return Ttk_StateMapLookup(NULL, stateMap, state); } style = style->parentStyle; @@ -103,7 +103,7 @@ Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName) Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&style->defaultsTable, optionName); if (entryPtr) - return Tcl_GetHashValue(entryPtr); + return (Tcl_Obj *)Tcl_GetHashValue(entryPtr); style= style->parentStyle; } return 0; @@ -176,7 +176,7 @@ static const Tk_OptionSpec *TTKGetOptionSpec( static OptionMap BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) { - OptionMap optionMap = ckalloc( + OptionMap optionMap = (OptionMap)ckalloc( sizeof(const Tk_OptionSpec) * elementClass->nResources + 1); int i; @@ -204,7 +204,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) optionMap = BuildOptionMap(elementClass, optionTable); Tcl_SetHashValue(entryPtr, optionMap); } else { - optionMap = Tcl_GetHashValue(entryPtr); + optionMap = (OptionMap)Tcl_GetHashValue(entryPtr); } return optionMap; @@ -218,7 +218,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) static Ttk_ElementClass * NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) { - Ttk_ElementClass *elementClass = ckalloc(sizeof(Ttk_ElementClass)); + Ttk_ElementClass *elementClass = (Ttk_ElementClass *)ckalloc(sizeof(Ttk_ElementClass)); int i; elementClass->name = name; @@ -234,7 +234,7 @@ NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) /* Initialize default values: */ - elementClass->defaultValues = + elementClass->defaultValues = (Tcl_Obj **) ckalloc(elementClass->nResources * sizeof(Tcl_Obj *) + 1); for (i=0; i < elementClass->nResources; ++i) { const char *defaultValue = specPtr->options[i].defaultValue; @@ -291,8 +291,13 @@ static void FreeElementClass(Ttk_ElementClass *elementClass) * +++ Themes. */ -static int ThemeEnabled(Ttk_Theme theme, void *clientData) { return 1; } +static int ThemeEnabled( + TCL_UNUSED(Ttk_Theme), + TCL_UNUSED(void *)) +{ /* Default ThemeEnabledProc -- always return true */ + return 1; +} typedef struct Ttk_Theme_ { @@ -307,7 +312,7 @@ typedef struct Ttk_Theme_ static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) { - Theme *themePtr = ckalloc(sizeof(Theme)); + Theme *themePtr = (Theme *)ckalloc(sizeof(Theme)); Tcl_HashEntry *entryPtr; int unused; @@ -324,7 +329,7 @@ static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) entryPtr = Tcl_CreateHashEntry(&themePtr->styleTable, ".", &unused); themePtr->rootStyle = NewStyle(); themePtr->rootStyle->styleName = - Tcl_GetHashKey(&themePtr->styleTable, entryPtr); + (const char *)Tcl_GetHashKey(&themePtr->styleTable, entryPtr); themePtr->rootStyle->cache = themePtr->cache; Tcl_SetHashValue(entryPtr, themePtr->rootStyle); @@ -341,7 +346,7 @@ static void FreeTheme(Theme *themePtr) */ entryPtr = Tcl_FirstHashEntry(&themePtr->elementTable, &search); while (entryPtr != NULL) { - Ttk_ElementClass *elementClass = Tcl_GetHashValue(entryPtr); + Ttk_ElementClass *elementClass = (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); FreeElementClass(elementClass); entryPtr = Tcl_NextHashEntry(&search); } @@ -352,7 +357,7 @@ static void FreeTheme(Theme *themePtr) */ entryPtr = Tcl_FirstHashEntry(&themePtr->styleTable, &search); while (entryPtr != NULL) { - Style *stylePtr = Tcl_GetHashValue(entryPtr); + Style *stylePtr = (Style *)Tcl_GetHashValue(entryPtr); FreeStyle(stylePtr); entryPtr = Tcl_NextHashEntry(&search); } @@ -384,7 +389,7 @@ typedef struct CleanupStruct { } Cleanup; /*------------------------------------------------------------------------ - * +++ Master style package data structure. + * +++ Style package data structure. */ typedef struct { @@ -398,14 +403,16 @@ typedef struct int themeChangePending; /* scheduled ThemeChangedProc call? */ } StylePackageData; -static void ThemeChangedProc(ClientData); /* Forward */ +static void ThemeChangedProc(void *); /* Forward */ /* Ttk_StylePkgFree -- * Cleanup procedure for StylePackageData. */ -static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) +static void Ttk_StylePkgFree( + ClientData clientData, + TCL_UNUSED(Tcl_Interp *)) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr; Cleanup *cleanup; @@ -422,7 +429,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) */ entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search); while (entryPtr != NULL) { - Theme *themePtr = Tcl_GetHashValue(entryPtr); + Theme *themePtr = (Theme *)Tcl_GetHashValue(entryPtr); FreeTheme(themePtr); entryPtr = Tcl_NextHashEntry(&search); } @@ -464,7 +471,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) static StylePackageData *GetStylePackageData(Tcl_Interp *interp) { - return Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL); + return (StylePackageData *)Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL); } /* @@ -479,8 +486,8 @@ static StylePackageData *GetStylePackageData(Tcl_Interp *interp) void Ttk_RegisterCleanup( Tcl_Interp *interp, ClientData clientData, Ttk_CleanupProc *cleanupProc) { - StylePackageData *pkgPtr = GetStylePackageData(interp); - Cleanup *cleanup = ckalloc(sizeof(*cleanup)); + StylePackageData *pkgPtr = (StylePackageData *)GetStylePackageData(interp); + Cleanup *cleanup = (Cleanup *)ckalloc(sizeof(*cleanup)); cleanup->clientData = clientData; cleanup->cleanupProc = cleanupProc; @@ -503,7 +510,7 @@ void Ttk_RegisterCleanup( static void ThemeChangedProc(ClientData clientData) { static char ThemeChangedScript[] = "ttk::ThemeChanged"; - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; int code = Tcl_EvalEx(pkgPtr->interp, ThemeChangedScript, -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { @@ -583,7 +590,7 @@ void Ttk_SetThemeEnabledProc( static Ttk_Theme LookupTheme( Tcl_Interp *interp, /* where to leave error messages */ - StylePackageData *pkgPtr, /* style package master record */ + StylePackageData *pkgPtr, /* style package record */ const char *name) /* theme name */ { Tcl_HashEntry *entryPtr; @@ -596,7 +603,7 @@ static Ttk_Theme LookupTheme( return NULL; } - return Tcl_GetHashValue(entryPtr); + return (Ttk_Theme)Tcl_GetHashValue(entryPtr); } /* @@ -704,12 +711,12 @@ Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName) stylePtr->parentStyle = themePtr->rootStyle; } - stylePtr->styleName = Tcl_GetHashKey(&themePtr->styleTable, entryPtr); + stylePtr->styleName = (const char *)Tcl_GetHashKey(&themePtr->styleTable, entryPtr); stylePtr->cache = stylePtr->parentStyle->cache; Tcl_SetHashValue(entryPtr, stylePtr); return stylePtr; } - return Tcl_GetHashValue(entryPtr); + return (Ttk_Style)Tcl_GetHashValue(entryPtr); } /* FindLayoutTemplate -- @@ -755,7 +762,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) */ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, elementName); if (entryPtr) { - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } /* @@ -766,7 +773,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, dot); } if (entryPtr) { - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } /* @@ -782,7 +789,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) */ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, ""); /* ASSERT: entryPtr != 0 */ - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } const char *Ttk_ElementClassName(Ttk_ElementClass *elementClass) @@ -799,7 +806,7 @@ int Ttk_RegisterElementFactory( Ttk_ElementFactory factory, void *clientData) { StylePackageData *pkgPtr = GetStylePackageData(interp); - FactoryRec *recPtr = ckalloc(sizeof(*recPtr)); + FactoryRec *recPtr = (FactoryRec *)ckalloc(sizeof(*recPtr)); Tcl_HashEntry *entryPtr; int newEntry; @@ -820,7 +827,7 @@ int Ttk_RegisterElementFactory( * (style element create $name) "from" $theme ?$element? */ static int Ttk_CloneElement( - Tcl_Interp *interp, void *clientData, + Tcl_Interp *interp, TCL_UNUSED(void *), Ttk_Theme theme, const char *elementName, int objc, Tcl_Obj *const objv[]) { @@ -895,7 +902,7 @@ Ttk_ElementClass *Ttk_RegisterElement( return 0; } - name = Tcl_GetHashKey(&theme->elementTable, entryPtr); + name = (char *)Tcl_GetHashKey(&theme->elementTable, entryPtr); elementClass = NewElementClass(name, specPtr, clientData); Tcl_SetHashValue(entryPtr, elementClass); @@ -984,7 +991,7 @@ int InitializeElementRecord( int i; for (i=0; i<nResources; ++i, ++elementOption) { Tcl_Obj **dest = (Tcl_Obj **) - (elementRecord + elementOption->offset); + ((char *)elementRecord + elementOption->offset); const char *optionName = elementOption->optionName; Tcl_Obj *dynamicSetting = Ttk_StyleMap(style, optionName, state); Tcl_Obj *widgetValue = 0; @@ -992,7 +999,7 @@ int InitializeElementRecord( if (optionMap[i]) { widgetValue = *(Tcl_Obj **) - (widgetRecord + optionMap[i]->objOffset); + ((char *)widgetRecord + optionMap[i]->objOffset); } if (widgetValue) { @@ -1134,7 +1141,7 @@ int TtkEnumerateHashTable(Tcl_Interp *interp, Tcl_HashTable *ht) Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { - Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1); + Tcl_Obj *nameObj = Tcl_NewStringObj((const char *)Tcl_GetHashKey(ht, entryPtr),-1); Tcl_ListObjAppendElement(interp, result, nameObj); entryPtr = Tcl_NextHashEntry(&search); } @@ -1154,8 +1161,8 @@ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht) Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { - Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1); - Tcl_Obj *valueObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *nameObj = Tcl_NewStringObj((const char *)Tcl_GetHashKey(ht, entryPtr),-1); + Tcl_Obj *valueObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_ListObjAppendElement(NULL, result, nameObj); Tcl_ListObjAppendElement(NULL, result, valueObj); entryPtr = Tcl_NextHashEntry(&search); @@ -1171,12 +1178,12 @@ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht) */ static int StyleMapCmd( - ClientData clientData, /* Master StylePackageData pointer */ + ClientData clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; @@ -1240,7 +1247,7 @@ usage: static int StyleConfigureCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; @@ -1295,7 +1302,7 @@ usage: static int StyleLookupCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; Ttk_Style style = NULL; const char *optionName; @@ -1337,7 +1344,7 @@ static int StyleLookupCmd( static int StyleThemeCurrentCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr = NULL; const char *name = NULL; @@ -1349,9 +1356,9 @@ static int StyleThemeCurrentCmd( entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search); while (entryPtr != NULL) { - Theme *ptr = Tcl_GetHashValue(entryPtr); + Theme *ptr = (Theme *)Tcl_GetHashValue(entryPtr); if (ptr == pkgPtr->currentTheme) { - name = Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr); + name = (char *)Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr); break; } entryPtr = Tcl_NextHashEntry(&search); @@ -1373,7 +1380,7 @@ static int StyleThemeCurrentCmd( static int StyleThemeCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; static const char *optStrings[] = { "-parent", "-settings", NULL }; enum { OP_PARENT, OP_SETTINGS }; @@ -1435,9 +1442,13 @@ static int StyleThemeCreateCmd( * Return list of registered themes. */ static int StyleThemeNamesCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) + ClientData clientData, + Tcl_Interp *interp, + TCL_UNUSED(int), + TCL_UNUSED(Tcl_Obj *const *)) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; + return TtkEnumerateHashTable(interp, &pkgPtr->themeTable); } @@ -1448,12 +1459,12 @@ static int StyleThemeNamesCmd( */ static int StyleThemeSettingsCmd( - ClientData clientData, /* Master StylePackageData pointer */ + ClientData clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme oldTheme = pkgPtr->currentTheme; Ttk_Theme newTheme; int status; @@ -1479,7 +1490,7 @@ StyleThemeSettingsCmd( static int StyleElementCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName, *factoryName; Tcl_HashEntry *entryPtr; @@ -1502,7 +1513,7 @@ static int StyleElementCreateCmd( return TCL_ERROR; } - recPtr = Tcl_GetHashValue(entryPtr); + recPtr = (FactoryRec *)Tcl_GetHashValue(entryPtr); return recPtr->factory(interp, recPtr->clientData, theme, elementName, objc - 5, objv + 5); @@ -1514,7 +1525,7 @@ static int StyleElementCreateCmd( static int StyleElementNamesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; if (objc != 3) { @@ -1530,7 +1541,7 @@ static int StyleElementNamesCmd( static int StyleElementOptionsCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName; Ttk_ElementClass *elementClass; @@ -1568,7 +1579,7 @@ static int StyleElementOptionsCmd( static int StyleLayoutCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *layoutName; Ttk_LayoutTemplate layoutTemplate; @@ -1606,12 +1617,12 @@ static int StyleLayoutCmd( */ static int StyleThemeUseCmd( - ClientData clientData, /* Master StylePackageData pointer */ + ClientData clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme; if (objc < 3 || objc > 4) { @@ -1663,7 +1674,7 @@ static const Ttk_Ensemble StyleEnsemble[] = { static int StyleObjCmd( - ClientData clientData, /* Master StylePackageData pointer */ + ClientData clientData, /* StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -1706,7 +1717,7 @@ void Ttk_StylePkgInit(Tcl_Interp *interp) { Tcl_Namespace *nsPtr; - StylePackageData *pkgPtr = ckalloc(sizeof(StylePackageData)); + StylePackageData *pkgPtr = (StylePackageData *)ckalloc(sizeof(StylePackageData)); pkgPtr->interp = interp; Tcl_InitHashTable(&pkgPtr->themeTable, TCL_STRING_KEYS); diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c index 919f25a..d086c02 100644 --- a/generic/ttk/ttkTrace.c +++ b/generic/ttk/ttkTrace.c @@ -7,7 +7,7 @@ * from other errors (which are not). */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -53,7 +53,7 @@ VarTraceProc( */ if (tracePtr->interp == NULL) { Tcl_DecrRefCount(tracePtr->varnameObj); - ckfree((ClientData)tracePtr); + ckfree(tracePtr); return NULL; } Tcl_TraceVar2(interp, name, NULL, @@ -98,7 +98,7 @@ Ttk_TraceHandle *Ttk_TraceVariable( status = Tcl_TraceVar2(interp, Tcl_GetString(varnameObj), NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - VarTraceProc, (ClientData)h); + VarTraceProc, h); if (status != TCL_OK) { Tcl_DecrRefCount(h->varnameObj); @@ -139,7 +139,7 @@ void Ttk_UntraceVariable(Ttk_TraceHandle *h) */ while ((cd = Tcl_VarTraceInfo(h->interp, Tcl_GetString(h->varnameObj), TCL_GLOBAL_ONLY, VarTraceProc, cd)) != NULL) { - if (cd == (ClientData) h) { + if (cd == h) { break; } } @@ -154,7 +154,7 @@ void Ttk_UntraceVariable(Ttk_TraceHandle *h) } Tcl_UntraceVar2(h->interp, Tcl_GetString(h->varnameObj), NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - VarTraceProc, (ClientData)h); + VarTraceProc, h); Tcl_DecrRefCount(h->varnameObj); ckfree(h); } diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c index 396b073..fa2a7e0 100644 --- a/generic/ttk/ttkTrack.c +++ b/generic/ttk/ttkTrack.c @@ -23,7 +23,7 @@ * TODO: Handle "chords" properly (e.g., <B1-ButtonPress-2>) */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" |