diff options
Diffstat (limited to 'generic')
33 files changed, 486 insertions, 475 deletions
diff --git a/generic/tk.h b/generic/tk.h index 4905aae..ede97ac 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -615,8 +615,9 @@ 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 @@ -625,7 +626,7 @@ typedef struct Tk_GeomMgr { Tk_GeomRequestProc *requestProc; /* Procedure to invoke when a slave's * requested geometry changes. */ - Tk_GeomLostSlaveProc *lostSlaveProc; + Tk_GeomLostContentProc *lostSlaveProc; /* Procedure to invoke when a slave is taken * away from one geometry manager by another. * NULL means geometry manager doesn't care diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 870c1f3..a8c3f2b 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -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; @@ -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 = 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); @@ -419,7 +419,7 @@ Tk_MaintainGeometry( { Tcl_HashEntry *hPtr; MaintainMaster *masterPtr; - register MaintainSlave *slavePtr; + MaintainSlave *slavePtr; int isNew, map; Tk_Window ancestor, parent; TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr; @@ -568,7 +568,7 @@ Tk_UnmaintainGeometry( { Tcl_HashEntry *hPtr; MaintainMaster *masterPtr; - register MaintainSlave *slavePtr, *prevPtr; + MaintainSlave *slavePtr, *prevPtr; Tk_Window ancestor; TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr; diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 41f5213..9f08b02 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -260,7 +260,7 @@ static int AdjustOffsets(int width, int elements, static void ArrangeGrid(ClientData clientData); 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); @@ -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); @@ -721,7 +721,7 @@ GridInfoCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Gridder *slavePtr; + Gridder *slavePtr; Tk_Window slave; Tcl_Obj *infoObj; @@ -786,7 +786,7 @@ GridLocationCommand( Tk_Window container; Gridder *containerPtr; /* Master grid record. */ GridMaster *gridPtr; /* Pointer to grid data. */ - register SlotInfo *slotPtr; + 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. */ @@ -910,7 +910,7 @@ GridPropagateCommand( */ if (containerPtr->slavePtr != NULL) { - if (TkSetGeometryMaster(interp, container, "grid") != TCL_OK) { + if (TkSetGeometryContainer(interp, container, "grid") != TCL_OK) { return TCL_ERROR; } containerPtr->flags |= ALLOCED_CONTAINER; @@ -918,7 +918,7 @@ GridPropagateCommand( containerPtr->flags &= ~DONT_PROPAGATE; } else { if (containerPtr->flags & ALLOCED_CONTAINER) { - TkFreeGeometryMaster(container, "grid"); + TkFreeGeometryContainer(container, "grid"); containerPtr->flags &= ~ALLOCED_CONTAINER; } containerPtr->flags |= DONT_PROPAGATE; @@ -1432,7 +1432,7 @@ GridReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - register Gridder *gridPtr = clientData; + Gridder *gridPtr = clientData; gridPtr = gridPtr->containerPtr; if (gridPtr && !(gridPtr->flags & REQUESTED_RELAYOUT)) { @@ -1464,7 +1464,7 @@ GridLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Gridder *slavePtr = clientData; + Gridder *slavePtr = clientData; if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->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. */ @@ -1722,8 +1722,8 @@ ArrangeGrid( ClientData clientData) /* Structure describing container whose slaves * are to be re-layed out. */ { - register Gridder *containerPtr = clientData; - register Gridder *slavePtr; + Gridder *containerPtr = clientData; + Gridder *slavePtr; GridMaster *slotPtr = containerPtr->containerDataPtr; int abort; int width, height; /* Requested size of layout, in pixels. */ @@ -1904,8 +1904,8 @@ ResolveConstraints( 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 *slavePtr; /* List of slave windows in this grid. */ int constraintCount; /* Count of rows or columns that have * constraints. */ int slotCount; /* Last occupied row or column. */ @@ -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; @@ -2496,7 +2496,7 @@ static void SetGridSize( Gridder *containerPtr) /* The geometry container for this grid. */ { - register Gridder *slavePtr; /* Current slave window. */ + Gridder *slavePtr; /* Current slave window. */ int maxX = 0, maxY = 0; for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; @@ -2742,9 +2742,9 @@ InitMasterData( static void Unlink( - register Gridder *slavePtr) /* Window to unlink. */ + Gridder *slavePtr) /* Window to unlink. */ { - register Gridder *containerPtr, *slavePtr2; + Gridder *containerPtr, *slavePtr2; containerPtr = slavePtr->containerPtr; if (containerPtr == NULL) { @@ -2781,7 +2781,7 @@ Unlink( */ if ((containerPtr->slavePtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { - TkFreeGeometryMaster(containerPtr->tkwin, "grid"); + TkFreeGeometryContainer(containerPtr->tkwin, "grid"); containerPtr->flags &= ~ALLOCED_CONTAINER; } } @@ -2810,7 +2810,7 @@ static void DestroyGrid( void *memPtr) /* Info about window that is now dead. */ { - register Gridder *gridPtr = memPtr; + Gridder *gridPtr = memPtr; if (gridPtr->containerDataPtr != NULL) { if (gridPtr->containerDataPtr->rowPtr != NULL) { @@ -2851,7 +2851,7 @@ GridStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Gridder *gridPtr = clientData; + Gridder *gridPtr = clientData; TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr; if (eventPtr->type == ConfigureNotify) { @@ -2869,7 +2869,7 @@ GridStructureProc( } } } else if (eventPtr->type == DestroyNotify) { - register Gridder *slavePtr, *nextPtr; + Gridder *slavePtr, *nextPtr; if (gridPtr->containerPtr != NULL) { Unlink(gridPtr); @@ -2896,7 +2896,7 @@ GridStructureProc( Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } } else if (eventPtr->type == UnmapNotify) { - register Gridder *slavePtr; + Gridder *slavePtr; for (slavePtr = gridPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { @@ -2908,7 +2908,7 @@ 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 @@ -2926,7 +2926,7 @@ GridStructureProc( */ 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. */ @@ -3375,7 +3375,7 @@ ConfigureSlaves( Tk_ManageGeometry(slave, &gridMgrType, slavePtr); if (!(containerPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryMaster(interp, containerPtr->tkwin, "grid") + if (TkSetGeometryContainer(interp, containerPtr->tkwin, "grid") != TCL_OK) { Tk_ManageGeometry(slave, NULL, NULL); Unlink(slavePtr); @@ -3520,7 +3520,7 @@ ConfigureSlaves( */ if (containerPtr->slavePtr == NULL && containerPtr->flags & ALLOCED_CONTAINER) { - TkFreeGeometryMaster(containerPtr->tkwin, "grid"); + TkFreeGeometryContainer(containerPtr->tkwin, "grid"); containerPtr->flags &= ~ALLOCED_CONTAINER; } diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index a5c21bb..8d51671 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -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. */ @@ -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: diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 395fc9d..765b8a2 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); @@ -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; } @@ -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. */ diff --git a/generic/tkInt.h b/generic/tkInt.h index 9c61c20..f4bb23f 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -860,9 +860,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; /* @@ -1220,10 +1220,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/tkPack.c b/generic/tkPack.c index 50cd3b8..0272e5b 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -88,7 +88,7 @@ typedef struct Packer { * Tk will set its requested size to fit the * needs of its slaves. * ALLOCED_CONTAINER 1 means that Pack has allocated itself as - * geometry master for this window. + * geometry container for this window. */ #define REQUESTED_REPACK 1 @@ -104,13 +104,13 @@ typedef struct 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, /* lostSlaveProc */ }; /* @@ -118,7 +118,7 @@ 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); @@ -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) { @@ -251,7 +251,7 @@ Tk_PackObjCmd( } case PACK_APPEND: { Packer *containerPtr; - register Packer *prevPtr; + Packer *prevPtr; Tk_Window tkwin2; if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { @@ -268,7 +268,7 @@ Tk_PackObjCmd( } case PACK_BEFORE: { Packer *packPtr, *containerPtr; - register Packer *prevPtr; + Packer *prevPtr; Tk_Window tkwin2; if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { @@ -304,7 +304,7 @@ 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; @@ -328,7 +328,7 @@ Tk_PackObjCmd( break; } case PACK_INFO: { - register Packer *slavePtr; + Packer *slavePtr; Tk_Window slave; Tcl_Obj *infoObj; @@ -404,11 +404,11 @@ 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 (containerPtr->slavePtr != NULL) { - if (TkSetGeometryMaster(interp, master, "pack") != TCL_OK) { + if (TkSetGeometryContainer(interp, master, "pack") != TCL_OK) { return TCL_ERROR; } containerPtr->flags |= ALLOCED_CONTAINER; @@ -429,7 +429,7 @@ Tk_PackObjCmd( } } else { if (containerPtr->flags & ALLOCED_CONTAINER) { - TkFreeGeometryMaster(master, "pack"); + TkFreeGeometryContainer(master, "pack"); containerPtr->flags &= ~ALLOCED_CONTAINER; } containerPtr->flags |= DONT_PROPAGATE; @@ -513,7 +513,7 @@ PackReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - register Packer *packPtr = clientData; + Packer *packPtr = clientData; packPtr = packPtr->containerPtr; if (!(packPtr->flags & REQUESTED_REPACK)) { @@ -525,10 +525,10 @@ 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. @@ -541,12 +541,12 @@ PackReqProc( /* ARGSUSED */ static void -PackLostSlaveProc( +PackLostContentProc( ClientData clientData, /* Packer structure for slave window that was * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Packer *slavePtr = clientData; + Packer *slavePtr = clientData; if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); @@ -579,8 +579,8 @@ ArrangePacking( ClientData clientData) /* Structure describing master whose slaves * are to be re-layed out. */ { - register Packer *containerPtr = clientData; - register Packer *slavePtr; + Packer *containerPtr = clientData; + Packer *slavePtr; int cavityX, cavityY, cavityWidth, cavityHeight; /* These variables keep track of the * as-yet-unallocated space remaining in the @@ -902,7 +902,7 @@ ArrangePacking( static int XExpansion( - register Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *slavePtr, /* First in list of remaining slaves. */ int cavityWidth) /* Horizontal space left for all remaining * slaves. */ { @@ -968,7 +968,7 @@ XExpansion( static int YExpansion( - register Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *slavePtr, /* First in list of remaining slaves. */ int cavityHeight) /* Vertical space left for all remaining * slaves. */ { @@ -1031,7 +1031,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; @@ -1100,7 +1100,7 @@ PackAfter( * 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; @@ -1284,7 +1284,7 @@ PackAfter( Tk_ManageGeometry(tkwin, &packerType, packPtr); if (!(containerPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryMaster(interp, containerPtr->tkwin, "pack") + if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack") != TCL_OK) { Tk_ManageGeometry(tkwin, NULL, NULL); Unlink(packPtr); @@ -1327,9 +1327,9 @@ PackAfter( static void Unlink( - register Packer *packPtr) /* Window to unlink. */ + Packer *packPtr) /* Window to unlink. */ { - register Packer *containerPtr, *packPtr2; + Packer *containerPtr, *packPtr2; containerPtr = packPtr->containerPtr; if (containerPtr == NULL) { @@ -1364,7 +1364,7 @@ Unlink( */ if ((containerPtr->slavePtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { - TkFreeGeometryMaster(containerPtr->tkwin, "pack"); + TkFreeGeometryContainer(containerPtr->tkwin, "pack"); containerPtr->flags &= ~ALLOCED_CONTAINER; } @@ -1393,7 +1393,7 @@ DestroyPacker( void *memPtr) /* Info about packed window that is now * dead. */ { - register Packer *packPtr = memPtr; + Packer *packPtr = memPtr; ckfree(packPtr); } @@ -1422,7 +1422,7 @@ PackStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Packer *packPtr = clientData; + Packer *packPtr = clientData; if (eventPtr->type == ConfigureNotify) { if ((packPtr->slavePtr != NULL) @@ -1439,7 +1439,7 @@ PackStructureProc( } } } else if (eventPtr->type == DestroyNotify) { - register Packer *slavePtr, *nextPtr; + Packer *slavePtr, *nextPtr; if (packPtr->containerPtr != NULL) { Unlink(packPtr); @@ -1477,7 +1477,7 @@ PackStructureProc( 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 @@ -1494,7 +1494,7 @@ 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 @@ -1511,7 +1511,7 @@ PackStructureProc( */ 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. */ @@ -1845,7 +1845,7 @@ ConfigureSlaves( prevPtr = slavePtr; if (!(containerPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryMaster(interp, containerPtr->tkwin, "pack") + if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack") != TCL_OK) { Tk_ManageGeometry(slave, NULL, NULL); Unlink(slavePtr); diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 271b92a..d044fa9 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -155,13 +155,13 @@ 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, /* lostSlaveProc */ }; /* @@ -170,7 +170,7 @@ static const Tk_GeomMgr placerType = { static void SlaveStructureProc(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); @@ -179,7 +179,7 @@ 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 void PlaceStructureProc(ClientData clientData, XEvent *eventPtr); static void RecomputePlacement(ClientData clientData); static void UnlinkSlave(Slave *slavePtr); @@ -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); } /* @@ -298,7 +298,7 @@ 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) { @@ -379,7 +379,7 @@ CreateSlave( Tk_OptionTable table) { Tcl_HashEntry *hPtr; - register Slave *slavePtr; + Slave *slavePtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -453,7 +453,7 @@ static Slave * FindSlave( Tk_Window tkwin) /* Token for desired slave. */ { - register Tcl_HashEntry *hPtr; + Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, (char *) tkwin); @@ -484,8 +484,8 @@ static void UnlinkSlave( Slave *slavePtr) /* Slave structure to be unlinked. */ { - register Master *containerPtr; - register Slave *prevPtr; + Master *containerPtr; + Slave *prevPtr; containerPtr = slavePtr->containerPtr; if (containerPtr == NULL) { @@ -533,7 +533,7 @@ CreateMaster( Tk_Window tkwin) /* Token for desired container. */ { Tcl_HashEntry *hPtr; - register Master *containerPtr; + Master *containerPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -546,7 +546,7 @@ CreateMaster( containerPtr->flags = 0; Tcl_SetHashValue(hPtr, containerPtr); Tk_CreateEventHandler(containerPtr->tkwin, StructureNotifyMask, - MasterStructureProc, containerPtr); + PlaceStructureProc, containerPtr); } else { containerPtr = Tcl_GetHashValue(hPtr); } @@ -576,7 +576,7 @@ static Master * FindMaster( 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); @@ -589,7 +589,7 @@ FindMaster( /* *---------------------------------------------------------------------- * - * ConfigureSlave -- + * ConfigureContent -- * * This function is called to process an argv/argc list to reconfigure * the placement of a window. @@ -606,14 +606,14 @@ FindMaster( */ 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 *containerPtr; + Master *containerPtr; Tk_SavedOptions savedOptions; int mask; Slave *slavePtr; @@ -864,8 +864,8 @@ static void RecomputePlacement( ClientData clientData) /* Pointer to Master record. */ { - register Master *containerPtr = clientData; - register Slave *slavePtr; + Master *containerPtr = clientData; + Slave *slavePtr; int x, y, width, height, tmp; int containerWidth, containerHeight, containerX, containerY; double x1, y1, x2, y2; @@ -1064,7 +1064,7 @@ RecomputePlacement( /* *---------------------------------------------------------------------- * - * MasterStructureProc -- + * PlaceStructureProc -- * * This function is invoked by the Tk event handler when StructureNotify * events occur for a container window. @@ -1080,13 +1080,13 @@ RecomputePlacement( */ static void -MasterStructureProc( +PlaceStructureProc( ClientData clientData, /* Pointer to Master structure for window * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Master *containerPtr = clientData; - register Slave *slavePtr, *nextPtr; + Master *containerPtr = clientData; + Slave *slavePtr, *nextPtr; TkDisplay *dispPtr = ((TkWindow *) containerPtr->tkwin)->dispPtr; switch (eventPtr->type) { @@ -1164,7 +1164,7 @@ SlaveStructureProc( * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Slave *slavePtr = clientData; + Slave *slavePtr = clientData; TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; if (eventPtr->type == DestroyNotify) { @@ -1227,28 +1227,28 @@ PlaceRequestProc( /* *-------------------------------------------------------------- * - * 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( +PlaceLostContentProc( ClientData clientData, /* Slave structure for slave window that was * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Slave *slavePtr = clientData; + Slave *slavePtr = clientData; TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index dd9e0ea..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 */ }; /* @@ -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. */ 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..931c037 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" @@ -456,7 +455,7 @@ 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; } @@ -472,23 +471,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; - 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); + 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( + void *managerData, + int index, + int width, + int height) { return 1; } @@ -500,16 +503,18 @@ static int LabelRequest(void *managerData, int index, int width, int height) * This routine is also called when the widget voluntarily forgets * the slave in LabelframeConfigure. */ -static void LabelRemoved(void *managerData, int slaveIndex) +static void LabelRemoved( + void *managerData, + TCL_UNUSED(int)) { Labelframe *lframe = managerData; lframe->label.labelWidget = 0; } static Ttk_ManagerSpec LabelframeManagerSpec = { - { "labelframe", Ttk_GeometryRequestProc, Ttk_LostSlaveProc }, + { "labelframe", Ttk_GeometryRequestProc, Ttk_LostContentProc }, LabelframeSize, - LabelframePlaceSlaves, + LabelframePlaceContent, LabelRequest, LabelRemoved }; @@ -591,15 +596,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/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 3621186..8fa7860 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -5,7 +5,7 @@ */ #include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkManager.h" /*------------------------------------------------------------------------ @@ -27,13 +27,13 @@ * 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); @@ -46,15 +46,15 @@ */ typedef struct { - Tk_Window slaveWindow; + Tk_Window contentWindow; Ttk_Manager *manager; - void *slaveData; + void *data; unsigned flags; -} Ttk_Slave; +} Ttk_Content; /* slave->flags bits: */ -#define SLAVE_MAPPED 0x1 /* slave to be mapped when container is */ +#define CONTENT_MAPPED 0x1 /* content windows to be mapped when container is */ struct TtkManager_ { @@ -62,8 +62,8 @@ struct TtkManager_ void *managerData; Tk_Window containerWindow; unsigned flags; - int nSlaves; - Ttk_Slave **slaves; + int nContent; + Ttk_Content **content; }; /* manager->flags bits: @@ -151,33 +151,33 @@ 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 *slave = mgr->content[i]; + if (slave->flags & CONTENT_MAPPED) { + Tk_MapWindow(slave->contentWindow); } } 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 *slave = mgr->content[i]; + Tk_UnmapWindow(slave->contentWindow); } break; } } -/* ++ SlaveEventHandler -- +/* ++ LostContentEventHandler -- * Notifies manager when a slave is destroyed - * (see <<NOTE-LOSTSLAVE>>). + * (see <<NOTE-LOSTCONTENT>>). */ static const unsigned SlaveEventMask = StructureNotifyMask; -static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr) +static void LostContentEventHandler(ClientData clientData, XEvent *eventPtr) { - Ttk_Slave *slave = (Ttk_Slave *)clientData; + Ttk_Content *slave = (Ttk_Content *)clientData; if (eventPtr->type == DestroyNotify) { slave->manager->managerSpec->tkGeomMgr.lostSlaveProc( - slave->manager, slave->slaveWindow); + slave->manager, slave->contentWindow); } } @@ -185,22 +185,22 @@ static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr) * +++ Slave initialization and cleanup. */ -static Ttk_Slave *NewSlave( - Ttk_Manager *mgr, Tk_Window slaveWindow, void *slaveData) +static Ttk_Content *NewContent( + Ttk_Manager *mgr, Tk_Window contentWindow, 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->contentWindow = contentWindow; + content->manager = mgr; + content->flags = 0; + content->data = data; - return slave; + return content; } -static void DeleteSlave(Ttk_Slave *slave) +static void DeleteSlave(Ttk_Content *content) { - ckfree(slave); + ckfree(content); } /*------------------------------------------------------------------------ @@ -215,8 +215,8 @@ Ttk_Manager *Ttk_CreateManager( mgr->managerSpec = managerSpec; mgr->managerData = managerData; mgr->containerWindow = containerWindow; - mgr->nSlaves = 0; - mgr->slaves = NULL; + mgr->nContent = 0; + mgr->content = NULL; mgr->flags = 0; Tk_CreateEventHandler( @@ -230,11 +230,11 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) Tk_DeleteEventHandler( mgr->containerWindow, 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); @@ -246,26 +246,26 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) * +++ Slave 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->contentWindow, + &mgr->managerSpec->tkGeomMgr, mgr); - Tk_CreateEventHandler(slave->slaveWindow, - SlaveEventMask, SlaveEventHandler, (ClientData)slave); + Tk_CreateEventHandler(content->contentWindow, + SlaveEventMask, LostContentEventHandler, content); ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } @@ -280,7 +280,7 @@ static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, int index) */ static void RemoveSlave(Ttk_Manager *mgr, int index) { - Ttk_Slave *slave = mgr->slaves[index]; + Ttk_Content *slave = mgr->content[index]; int i; /* Notify manager: @@ -289,19 +289,19 @@ 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); + slave->contentWindow, SlaveEventMask, LostContentEventHandler, slave); /* Note [1] */ - Tk_UnmaintainGeometry(slave->slaveWindow, mgr->containerWindow); - Tk_UnmapWindow(slave->slaveWindow); + Tk_UnmaintainGeometry(slave->contentWindow, mgr->containerWindow); + Tk_UnmapWindow(slave->contentWindow); DeleteSlave(slave); @@ -312,24 +312,24 @@ 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 contentWindow) { 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, contentWindow); + int reqWidth = Tk_ReqWidth(contentWindow); + int reqHeight= Tk_ReqHeight(contentWindow); 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 contentWindow) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; - int index = Ttk_SlaveIndex(mgr, slaveWindow); + int index = Ttk_ContentIndex(mgr, contentWindow); /* ASSERT: index >= 0 */ RemoveSlave(mgr, index); @@ -339,56 +339,56 @@ void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow) * +++ 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 *slave = NewContent(mgr, tkwin, data); + InsertContent(mgr, slave, 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 contentWindow = mgr->content[index]->contentWindow; + RemoveSlave(mgr, index); + Tk_ManageGeometry(contentWindow, 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->containerWindow,x,y,width,height); - slave->flags |= SLAVE_MAPPED; + Ttk_Content *slave = mgr->content[index]; + Tk_MaintainGeometry(slave->contentWindow,mgr->containerWindow,x,y,width,height); + slave->flags |= CONTENT_MAPPED; if (Tk_IsMapped(mgr->containerWindow)) { - Tk_MapWindow(slave->slaveWindow); + Tk_MapWindow(slave->contentWindow); } } -/* ++ 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->containerWindow); - slave->flags &= ~SLAVE_MAPPED; + Ttk_Content *slave = mgr->content[index]; + Tk_UnmaintainGeometry(slave->contentWindow, mgr->containerWindow); + slave->flags &= ~CONTENT_MAPPED; /* Contrary to documentation, Tk_UnmaintainGeometry doesn't always - * unmap the slave: + * unmap the content window: */ - Tk_UnmapWindow(slave->slaveWindow); + Tk_UnmapWindow(slave->contentWindow); } /* LayoutChanged, SizeChanged -- @@ -406,61 +406,61 @@ 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]->contentWindow; } /*------------------------------------------------------------------------ * +++ 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 contentWindow) { 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]->contentWindow == contentWindow) 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; } @@ -468,15 +468,15 @@ int Ttk_GetSlaveIndexFromObj( */ if ((*string == '.') && (tkwin = Tk_NameToWindow(interp, string, mgr->containerWindow))) { - slaveIndex = Ttk_SlaveIndex(mgr, tkwin); - if (slaveIndex < 0) { + index = Ttk_ContentIndex(mgr, tkwin); + if (index < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s is not managed by %s", string, Tk_PathName(mgr->containerWindow))); Tcl_SetErrorCode(interp, "TTK", "SLAVE", "MANAGER", NULL); return TCL_ERROR; } - *indexPtr = slaveIndex; + *indexPtr = index; return TCL_OK; } @@ -486,25 +486,25 @@ 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 * may also change the size: diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h index 0a66ada..c4c46ed 100644 --- a/generic/ttk/ttkManager.h +++ b/generic/ttk/ttkManager.h @@ -17,7 +17,7 @@ typedef struct TtkManager_ Ttk_Manager; * RequestedSize computes the requested size of the container window. * * PlaceSlaves sets the position and size of all managed slaves - * by calling Ttk_PlaceSlave(). + * by calling Ttk_PlaceContent(). * * SlaveRemoved() is called immediately before a slave is removed. * NB: the associated slave window may have been destroyed when this @@ -31,15 +31,16 @@ 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: */ +#define Ttk_LostContentProc Ttk_LostSlaveProc MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window slave); -MODULE_SCOPE void Ttk_LostSlaveProc(ClientData, Tk_Window slave); +MODULE_SCOPE void Ttk_LostContentProc(ClientData, Tk_Window slave); /* * Public API: @@ -48,20 +49,25 @@ MODULE_SCOPE Ttk_Manager *Ttk_CreateManager( 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,22 +75,27 @@ MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *); /* Utilities: */ -MODULE_SCOPE int Ttk_SlaveIndex(Ttk_Manager *, Tk_Window); +#define Ttk_ContentIndex Ttk_SlaveIndex +MODULE_SCOPE int Ttk_ContentIndex(Ttk_Manager *, Tk_Window); /* Returns: index in slave 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 content, Tk_Window container); /* Returns: 1 if container can manage content; 0 otherwise leaving error msg */ diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 39ed6aa..d94b4ed 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" @@ -63,14 +63,14 @@ 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 } @@ -221,7 +221,7 @@ static int ConfigureTab( Tk_SavedOptions savedOptions; int mask = 0; - if (Tk_SetOptions(interp, (ClientData)tab, nb->notebook.paneOptionTable, + if (Tk_SetOptions(interp, (void *)tab, nb->notebook.paneOptionTable, objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) { return TCL_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 = 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 = 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 = 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 >= 0; --i) { + 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 = Ttk_ContentData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb,i); Ttk_RebindSublayout(tabLayout, tab); @@ -401,9 +401,9 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) /* Compute max requested size of all slaves: */ - 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); + for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { + Tk_Window slaveWindow = Ttk_ContentWindow(nb->notebook.mgr, i); + Tab *tab = Ttk_ContentData(nb->notebook.mgr, i); int slaveWidth = Tk_ReqWidth(slaveWindow) + Ttk_PaddingWidth(tab->padding); int slaveHeight @@ -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 = 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 = Ttk_ContentData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb, i); if (tab->state != TAB_STATE_HIDDEN) { @@ -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); + Tab *tab = Ttk_ContentData(nb->notebook.mgr, index); + Tk_Window slaveWindow = Ttk_ContentWindow(nb->notebook.mgr, index); Ttk_Box slaveBox = Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding), Tk_ReqWidth(slaveWindow), Tk_ReqHeight(slaveWindow),tab->sticky); - Ttk_PlaceSlave(nb->notebook.mgr, slaveIndex, + Ttk_PlaceContent(nb->notebook.mgr, index, slaveBox.x, slaveBox.y, slaveBox.width, slaveBox.height); } -/* NotebookPlaceSlaves -- +/* NotebookPlaceContents -- * Geometry manager hook. */ -static void NotebookPlaceSlaves(void *recordPtr) +static void NotebookPlaceContents(void *recordPtr) { Notebook *nb = 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 = 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 = 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 = 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. */ static void TabRemoved(void *managerData, int index) { Notebook *nb = managerData; - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); + Tab *tab = Ttk_ContentData(nb->notebook.mgr, index); if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -735,7 +735,7 @@ static int AddTab( return TCL_ERROR; } #if 0 /* can't happen */ - if (Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow) >= 0) { + if (Ttk_ContentIndex(nb->notebook.mgr, slaveWindow) >= 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s already added", Tk_PathName(slaveWindow))); Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "PRESENT", NULL); @@ -754,7 +754,7 @@ static int AddTab( return TCL_ERROR; } - Ttk_InsertSlave(nb->notebook.mgr, destIndex, slaveWindow, tab); + Ttk_InsertContent(nb->notebook.mgr, destIndex, slaveWindow, tab); /* Adjust indices and/or autoselect first tab: */ @@ -768,9 +768,9 @@ static int AddTab( } static Ttk_ManagerSpec NotebookManagerSpec = { - { "notebook", Ttk_GeometryRequestProc, Ttk_LostSlaveProc }, + { "notebook", Ttk_GeometryRequestProc, Ttk_LostContentProc }, NotebookSize, - NotebookPlaceSlaves, + NotebookPlaceContents, TabRequest, TabRemoved }; @@ -844,15 +844,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; } @@ -886,9 +886,8 @@ 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; + int index; Tab *tab; if (objc <= 2 || objc % 2 != 1) { @@ -900,13 +899,13 @@ static int NotebookAddCommand( if (!slaveWindow) { return TCL_ERROR; } - slaveIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow); + index = Ttk_ContentIndex(nb->notebook.mgr, slaveWindow); - 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), slaveWindow, objc-3,objv+3); } - tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex); + tab = Ttk_ContentData(nb->notebook.mgr, index); if (tab->state == TAB_STATE_HIDDEN) { tab->state = TAB_STATE_NORMAL; } @@ -927,7 +926,7 @@ static int NotebookInsertCommand( { Notebook *nb = 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,8 +935,8 @@ 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; } @@ -952,11 +951,11 @@ static int NotebookInsertCommand( return TCL_ERROR; } - srcIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow); + srcIndex = Ttk_ContentIndex(nb->notebook.mgr, slaveWindow); if (srcIndex < 0) { /* New slave */ return AddTab(interp, nb, destIndex, slaveWindow, objc-4,objv+4); } - } else if (Ttk_GetSlaveIndexFromObj( + } else if (Ttk_GetContentIndexFromObj( interp, nb->notebook.mgr, objv[3], &srcIndex) != TCL_OK) { return TCL_ERROR; @@ -965,17 +964,17 @@ static int NotebookInsertCommand( /* Move existing slave: */ if (ConfigureTab(interp, nb, - Ttk_SlaveData(nb->notebook.mgr,srcIndex), - Ttk_SlaveWindow(nb->notebook.mgr,srcIndex), + 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: */ @@ -1011,7 +1010,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; @@ -1036,7 +1035,7 @@ static int NotebookHideCommand( return TCL_ERROR; } - tab = Ttk_SlaveData(nb->notebook.mgr, index); + tab = Ttk_ContentData(nb->notebook.mgr, index); tab->state = TAB_STATE_HIDDEN; if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -1075,7 +1074,7 @@ static int NotebookIdentifyCommand( tabIndex = IdentifyTab(nb, x, y); if (tabIndex >= 0) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, tabIndex); + Tab *tab = Ttk_ContentData(nb->notebook.mgr, tabIndex); Ttk_State state = TabState(nb, tabIndex); Ttk_Layout tabLayout = nb->notebook.tabLayout; @@ -1122,8 +1121,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; } @@ -1146,7 +1145,7 @@ static int NotebookSelectCommand( 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)); } @@ -1179,8 +1178,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)); } @@ -1208,8 +1207,8 @@ static int NotebookTabCommand( return TCL_ERROR; } - tab = Ttk_SlaveData(mgr, index); - slaveWindow = Ttk_SlaveWindow(mgr, index); + tab = Ttk_ContentData(mgr, index); + slaveWindow = Ttk_ContentWindow(mgr, index); if (objc == 3) { return TtkEnumerateOptions(interp, tab, @@ -1339,7 +1338,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 = Ttk_ContentData(nb->notebook.mgr, index); Ttk_State state = TabState(nb, index); if (tab->state != TAB_STATE_HIDDEN) { @@ -1352,7 +1351,7 @@ 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); + int nContent = Ttk_NumberContent(nb->notebook.mgr); int index; /* Draw notebook background (base layout): @@ -1362,7 +1361,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 704e90c..85f0b26 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" @@ -78,7 +78,7 @@ 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 }, @@ -91,7 +91,7 @@ static Tk_OptionSpec PanedOptionSpecs[] = { }; /*------------------------------------------------------------------------ - * +++ Slave pane record. + * +++ Pane record. */ typedef struct { int reqSize; /* Pane request size */ @@ -189,14 +189,14 @@ error: static int ShoveUp(Paned *pw, int i, int pos) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, i); + 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 = 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 = Ttk_ContentData(pw->paned.mgr,i); int sashThickness = pw->paned.sashThickness; - if (i == Ttk_NumberSlaves(pw->paned.mgr) - 1) { + 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 = Ttk_ContentData(pw->paned.mgr,i+1); if (pos + sashThickness > nextPane->sashPos) pos = ShoveDown(pw, i+1, pos + sashThickness) - sashThickness; } @@ -231,7 +231,7 @@ 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); + int nPanes = Ttk_NumberContent(pw->paned.mgr); int nSashes = nPanes - 1; int sashThickness = pw->paned.sashThickness; int width = 0, height = 0; @@ -239,8 +239,8 @@ 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 = Ttk_ContentData(pw->paned.mgr, index); + Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); if (height < Tk_ReqHeight(slaveWindow)) height = Tk_ReqHeight(slaveWindow); @@ -249,8 +249,8 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) 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 = Ttk_ContentData(pw->paned.mgr, index); + Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); if (width < Tk_ReqWidth(slaveWindow)) width = Tk_ReqWidth(slaveWindow); @@ -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 = 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 = 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 = Ttk_ContentData(mgr, i); int weight = pane->weight * (pane->reqSize != 0); int size = pane->reqSize + delta * weight; @@ -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 = 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,7 +397,7 @@ static void PlacePanes(Paned *pw) * +++ Manager specification. */ -static void PanedPlaceSlaves(void *managerData) +static void PanedPlaceContent(void *managerData) { Paned *pw = managerData; PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin)); @@ -407,7 +407,7 @@ static void PanedPlaceSlaves(void *managerData) static void PaneRemoved(void *managerData, int index) { Paned *pw = managerData; - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = Ttk_ContentData(pw->paned.mgr, index); DestroyPane(pw, pane); } @@ -420,7 +420,7 @@ static int AddPane( if (!Ttk_Maintainable(interp, slaveWindow, pw->core.tkwin)) { return TCL_ERROR; } - if (Ttk_SlaveIndex(pw->paned.mgr, slaveWindow) >= 0) { + if (Ttk_ContentIndex(pw->paned.mgr, slaveWindow) >= 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s already added", Tk_PathName(slaveWindow))); Tcl_SetErrorCode(interp, "TTK", "PANE", "PRESENT", NULL); @@ -436,7 +436,7 @@ static int AddPane( return TCL_ERROR; } - Ttk_InsertSlave(pw->paned.mgr, destIndex, slaveWindow, pane); + Ttk_InsertContent(pw->paned.mgr, destIndex, slaveWindow, pane); return TCL_OK; } @@ -449,8 +449,8 @@ static int AddPane( 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); + Pane *pane = Ttk_ContentData(pw->paned.mgr, index); + Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; if (!Tk_IsMapped(slaveWindow)) { @@ -460,9 +460,9 @@ static int PaneRequest(void *managerData, int index, int width, int height) } static Ttk_ManagerSpec PanedManagerSpec = { - { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostSlaveProc }, + { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostContentProc }, PanedSize, - PanedPlaceSlaves, + PanedPlaceContent, PaneRequest, PaneRemoved }; @@ -581,7 +581,7 @@ static Ttk_Layout PanedGetLayout( */ static Ttk_Layout SashLayout(Paned *pw, int index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + 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), @@ -604,7 +604,7 @@ 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; + int i, nSashes = Ttk_NumberContent(pw->paned.mgr) - 1; TtkWidgetDisplay(recordPtr, d); for (i = 0; i < nSashes; ++i) { @@ -636,7 +636,7 @@ static int PanedAddCommand( return TCL_ERROR; } - return AddPane(interp, pw, Ttk_NumberSlaves(pw->paned.mgr), slaveWindow, + return AddPane(interp, pw, Ttk_NumberContent(pw->paned.mgr), slaveWindow, objc - 3, objv + 3); } @@ -647,7 +647,7 @@ static int PanedInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Paned *pw = recordPtr; - int nSlaves = Ttk_NumberSlaves(pw->paned.mgr); + int nContent = Ttk_NumberContent(pw->paned.mgr); int srcIndex, destIndex; Tk_Window slaveWindow; @@ -663,26 +663,26 @@ static int PanedInsertCommand( } if (!strcmp(Tcl_GetString(objv[2]), "end")) { - destIndex = Ttk_NumberSlaves(pw->paned.mgr); - } else if (TCL_OK != Ttk_GetSlaveIndexFromObj( + 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); + srcIndex = Ttk_ContentIndex(pw->paned.mgr, slaveWindow); if (srcIndex < 0) { /* New slave: */ return AddPane(interp, pw, destIndex, slaveWindow, objc-4, objv+4); } /* else -- move existing slave: */ - 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), + Ttk_ContentData(pw->paned.mgr, destIndex), + Ttk_ContentWindow(pw->paned.mgr, destIndex), objc-4,objv+4); } @@ -699,12 +699,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; } @@ -720,7 +720,7 @@ static int PanedIdentifyCommand( int what = IDENTIFY_SASH; Paned *pw = 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 +739,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 = Ttk_ContentData(pw->paned.mgr, index); if (pane->sashPos <= pos && pos <= pane->sashPos + sashThickness) { /* Found it. */ switch (what) { @@ -779,14 +779,14 @@ static int PanedPaneCommand( return TCL_ERROR; } - if (TCL_OK != Ttk_GetSlaveIndexFromObj( + 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 = Ttk_ContentData(pw->paned.mgr, paneIndex); + slaveWindow = Ttk_ContentWindow(pw->paned.mgr, paneIndex); switch (objc) { case 3: @@ -817,8 +817,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); @@ -844,14 +844,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 = Ttk_ContentData(pw->paned.mgr, sashIndex); if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos)); 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..8723b94 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -384,7 +384,7 @@ typedef struct CleanupStruct { } Cleanup; /*------------------------------------------------------------------------ - * +++ Master style package data structure. + * +++ Style package data structure. */ typedef struct { @@ -398,7 +398,7 @@ typedef struct int themeChangePending; /* scheduled ThemeChangedProc call? */ } StylePackageData; -static void ThemeChangedProc(ClientData); /* Forward */ +static void ThemeChangedProc(void *); /* Forward */ /* Ttk_StylePkgFree -- * Cleanup procedure for StylePackageData. @@ -1171,7 +1171,7 @@ 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 */ @@ -1448,7 +1448,7 @@ 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 */ @@ -1606,7 +1606,7 @@ 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 */ @@ -1663,7 +1663,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 */ 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" |