diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-04 19:36:12 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-04 19:36:12 (GMT) |
commit | 887b542d5ebff4576ba8b29c562853a003eaa65e (patch) | |
tree | 4841df45e108b91c15963946deecaea03969d842 /generic | |
parent | f535cf0342e434c63dee4ac17b18e376942dbedb (diff) | |
parent | 158d93761d58b9a91d24a5a56c6cda2cddd22878 (diff) | |
download | tk-887b542d5ebff4576ba8b29c562853a003eaa65e.zip tk-887b542d5ebff4576ba8b29c562853a003eaa65e.tar.gz tk-887b542d5ebff4576ba8b29c562853a003eaa65e.tar.bz2 |
Merge 8.6. Minor simplification: no need for separate stub entry for Tk_MacOSXGetNSViewForDrawable()
Diffstat (limited to 'generic')
45 files changed, 2795 insertions, 2787 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index b0ad8d5..d99aae9 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -1146,12 +1146,8 @@ declare 11 aqua { declare 12 aqua { void *Tk_MacOSXGetCGContextForDrawable(Drawable drawable) } -# Replaces TkMacOSXGetRootControl -declare 13 aqua { - void *Tk_MacOSXGetNSViewForDrawable(Drawable drawable) -} # Replaces TkMacOSXDrawable -declare 14 aqua { +declare 13 aqua { void *Tk_MacOSXGetNSWindowForDrawable(Drawable drawable) } declare 16 aqua { diff --git a/generic/tk.h b/generic/tk.h index 01f3657..50195b9 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -122,6 +122,7 @@ extern "C" { * Dummy types that are used by clients: */ +#define Tk_ImageModel Tk_ImageMaster typedef struct Tk_BindingTable_ *Tk_BindingTable; typedef struct Tk_Canvas_ *Tk_Canvas; typedef struct Tk_Cursor_ *Tk_Cursor; @@ -614,21 +615,22 @@ typedef struct Tk_ClassProcs { * the geometry manager to carry out certain functions. */ +#define Tk_GeomLostContentProc Tk_GeomLostSlaveProc typedef void (Tk_GeomRequestProc) (ClientData clientData, Tk_Window tkwin); -typedef void (Tk_GeomLostSlaveProc) (ClientData clientData, Tk_Window tkwin); +typedef void (Tk_GeomLostContentProc) (ClientData clientData, Tk_Window tkwin); typedef struct Tk_GeomMgr { const char *name; /* Name of the geometry manager (command used * to invoke it, or name of widget class that * allows embedded widgets). */ Tk_GeomRequestProc *requestProc; - /* Procedure to invoke when a slave's + /* Procedure to invoke when a content's * requested geometry changes. */ - Tk_GeomLostSlaveProc *lostSlaveProc; - /* Procedure to invoke when a slave is taken + Tk_GeomLostContentProc *lostSlaveProc; + /* Procedure to invoke when content is taken * away from one geometry manager by another. * NULL means geometry manager doesn't care - * when slaves are lost. */ + * when content lost. */ } Tk_GeomMgr; /* @@ -1228,19 +1230,19 @@ typedef struct Tk_Outline { typedef struct Tk_ImageType Tk_ImageType; #ifdef USE_OLD_IMAGE typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc, - char **argv, Tk_ImageType *typePtr, Tk_ImageMaster master, - ClientData *masterDataPtr); + char **argv, Tk_ImageType *typePtr, Tk_ImageMaster model, + ClientData *clientDataPtr); #else typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, CONST86 char *name, int objc, - Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageMaster master, - ClientData *masterDataPtr); + Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageMaster model, + ClientData *clientDataPtr); #endif /* USE_OLD_IMAGE */ -typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData masterData); -typedef void (Tk_ImageDisplayProc) (ClientData instanceData, Display *display, +typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData clientData); +typedef void (Tk_ImageDisplayProc) (ClientData clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); -typedef void (Tk_ImageFreeProc) (ClientData instanceData, Display *display); -typedef void (Tk_ImageDeleteProc) (ClientData masterData); +typedef void (Tk_ImageFreeProc) (ClientData clientData, Display *display); +typedef void (Tk_ImageDeleteProc) (ClientData clientData); typedef void (Tk_ImageChangedProc) (ClientData clientData, int x, int y, int width, int height, int imageWidth, int imageHeight); typedef int (Tk_ImagePostscriptProc) (ClientData clientData, diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 44af1ea..a752674 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -67,7 +67,7 @@ typedef struct TkOption { * monochrome displays. */ struct TkOption *synonymPtr; /* For synonym options, this points to the - * master entry. */ + * original entry. */ const struct Tk_ObjCustomOption *custom; /* For TK_OPTION_CUSTOM. */ } extra; @@ -237,8 +237,8 @@ Tk_CreateOptionTable( if (specPtr->type == TK_OPTION_SYNONYM) { /* - * This is a synonym option; find the master option that it refers - * to and create a pointer from the synonym to the master. + * This is a synonym option; find the original option that it refers + * to and create a pointer from the synonym to the origin. */ for (specPtr2 = templatePtr, i = 0; ; specPtr2++, i++) { diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 64c32cd..b02f286 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -1720,6 +1720,7 @@ extern const TkStubs *tkStubsPtr; #undef Tk_Init #undef Tk_SafeInit #undef Tk_CreateConsoleWindow +#define Tk_GetImageModelData Tk_GetImageMasterData #if defined(_WIN32) && defined(UNICODE) # define Tk_MainEx Tk_MainExW 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 be15c14..75ce1a9 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -66,7 +66,7 @@ #define GRID_DEFAULT_ANCHOR TK_ANCHOR_NW /* - * Structure to hold information for grid masters. A slot is either a row or + * Structure to hold information for grid containers. A slot is either a row or * column. */ @@ -80,7 +80,7 @@ typedef struct SlotInfo { * inproportion to their weights. */ int pad; /* Extra padding, in pixels, required for this * slot. This amount is "added" to the largest - * slave in the slot. */ + * content in the slot. */ Tk_Uid uniform; /* Value of -uniform option. It is used to * group slots that should have the same * size. */ @@ -99,13 +99,13 @@ typedef struct SlotInfo { */ typedef struct GridLayout { - struct Gridder *binNextPtr; /* The next slave window in this bin. Each bin - * contains a list of all slaves whose spans + struct Gridder *binNextPtr; /* The next content window in this bin. Each bin + * contains a list of all content whose spans * are >1 and whose right edges fall in this * slot. */ int minSize; /* Minimum size needed for this slot, in * pixels. This is the space required to hold - * any slaves contained entirely in this slot, + * any content contained entirely in this slot, * adjusted for any slot constrants, such as * size or padding. */ int pad; /* Padding needed for this slot */ @@ -124,31 +124,31 @@ typedef struct GridLayout { } GridLayout; /* - * Keep one of these for each geometry master. + * Keep one of these for each geometry container. */ typedef struct { SlotInfo *columnPtr; /* Pointer to array of column constraints. */ SlotInfo *rowPtr; /* Pointer to array of row constraints. */ - int columnEnd; /* The last column occupied by any slave. */ + int columnEnd; /* The last column occupied by any content. */ int columnMax; /* The number of columns with constraints. */ int columnSpace; /* The number of slots currently allocated for * column constraints. */ - int rowEnd; /* The last row occupied by any slave. */ + int rowEnd; /* The last row occupied by any content. */ int rowMax; /* The number of rows with constraints. */ int rowSpace; /* The number of slots currently allocated for * row constraints. */ int startX; /* Pixel offset of this layout within its - * master. */ + * container. */ int startY; /* Pixel offset of this layout within its - * master. */ + * container. */ Tk_Anchor anchor; /* Value of anchor option: specifies where a * grid without weight should be placed. */ -} GridMaster; +} GridContainer; /* * For each window that the grid cares about (either because the window is - * managed by the grid or because the window has slaves that are managed by + * managed by the grid or because the window has content that are managed by * the grid), there is a structure of the following type: */ @@ -157,18 +157,18 @@ typedef struct Gridder { * window has been deleted, but the gridder * hasn't had a chance to clean up yet because * the structure is still in use. */ - struct Gridder *masterPtr; /* Master window within which this window is + struct Gridder *containerPtr; /* Container window within which this window is * managed (NULL means this window isn't * managed by the gridder). */ - struct Gridder *nextPtr; /* Next window managed within same master. + struct Gridder *nextPtr; /* Next window managed within same container. * List order doesn't matter. */ - struct Gridder *slavePtr; /* First in list of slaves managed inside this - * window (NULL means no grid slaves). */ - GridMaster *masterDataPtr; /* Additional data for geometry master. */ - Tcl_Obj *in; /* Store master name when removed. */ + struct Gridder *contentPtr; /* First in list of content managed inside this + * window (NULL means no grid content). */ + GridContainer *containerDataPtr; /* Additional data for geometry container. */ + Tcl_Obj *in; /* Store container name when removed. */ int column, row; /* Location in the grid (starting from * zero). */ - int numCols, numRows; /* Number of columns or rows this slave spans. + int numCols, numRows; /* Number of columns or rows this content spans. * Should be at least 1. */ int padX, padY; /* Total additional pixels to leave around the * window. Some is of this space is on each @@ -185,12 +185,12 @@ typedef struct Gridder { * sticks to. See below for definitions */ int doubleBw; /* Twice the window's last known border width. * If this changes, the window must be - * re-arranged within its master. */ + * re-arranged within its container. */ int *abortPtr; /* If non-NULL, it means that there is a * nested call to ArrangeGrid already working * on this window. *abortPtr may be set to 1 * to abort that nested call. This happens, - * for example, if tkwin or any of its slaves + * for example, if tkwin or any of its content * is deleted. */ int flags; /* Miscellaneous flags; see below for * definitions. */ @@ -199,9 +199,9 @@ typedef struct Gridder { * These fields are used temporarily for layout calculations only. */ - struct Gridder *binNextPtr; /* Link to next span>1 slave in this bin. */ + struct Gridder *binNextPtr; /* Link to next span>1 content in this bin. */ int size; /* Nominal size (width or height) in pixels of - * the slave. This includes the padding. */ + * the content. This includes the padding. */ } Gridder; /* @@ -235,32 +235,32 @@ typedef struct UniformGroup { * Flag values for Grid structures: * * REQUESTED_RELAYOUT 1 means a Tcl_DoWhenIdle request has already - * been made to re-arrange all the slaves of this + * been made to re-arrange all the content of this * window. * DONT_PROPAGATE 1 means don't set this window's requested - * size. 0 means if this window is a master then + * size. 0 means if this window is a container then * Tk will set its requested size to fit the - * needs of its slaves. - * ALLOCED_MASTER 1 means that Grid has allocated itself as - * geometry master for this window. + * needs of its content. + * ALLOCED_CONTAINER 1 means that Grid has allocated itself as + * geometry container for this window. */ #define REQUESTED_RELAYOUT 1 #define DONT_PROPAGATE 2 -#define ALLOCED_MASTER 4 +#define ALLOCED_CONTAINER 4 /* * Prototypes for procedures used only in this file: */ -static void AdjustForSticky(Gridder *slavePtr, int *xPtr, +static void AdjustForSticky(Gridder *contentPtr, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); static int AdjustOffsets(int width, int elements, SlotInfo *slotPtr); static void ArrangeGrid(ClientData clientData); -static int CheckSlotData(Gridder *masterPtr, int slot, +static int CheckSlotData(Gridder *containerPtr, int slot, int slotType, int checkOnly); -static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin, +static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, int objc, Tcl_Obj *const objv[]); static void DestroyGrid(void *memPtr); static Gridder * GetGrid(Tk_Window tkwin); @@ -284,22 +284,22 @@ static int GridRowColumnConfigureCommand(Tk_Window tkwin, Tcl_Obj *const objv[]); static int GridSizeCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int GridSlavesCommand(Tk_Window tkwin, Tcl_Interp *interp, +static int GridContentCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void GridStructureProc(ClientData clientData, XEvent *eventPtr); -static void GridLostSlaveProc(ClientData clientData, +static void GridLostContentProc(ClientData clientData, Tk_Window tkwin); static void GridReqProc(ClientData clientData, Tk_Window tkwin); -static void InitMasterData(Gridder *masterPtr); +static void InitContainerData(Gridder *containerPtr); static Tcl_Obj * NewPairObj(int, int); static Tcl_Obj * NewQuadObj(int, int, int, int); static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn, int maxOffset); static void SetGridSize(Gridder *gridPtr); -static int SetSlaveColumn(Tcl_Interp *interp, Gridder *slavePtr, +static int SetContentColumn(Tcl_Interp *interp, Gridder *contentPtr, int column, int numCols); -static int SetSlaveRow(Tcl_Interp *interp, Gridder *slavePtr, +static int SetContentRow(Tcl_Interp *interp, Gridder *contentPtr, int row, int numRows); static Tcl_Obj * StickyToObj(int flags); static int StringToSticky(const char *string); @@ -308,7 +308,7 @@ static void Unlink(Gridder *gridPtr); static const Tk_GeomMgr gridMgrType = { "grid", /* name */ GridReqProc, /* requestProc */ - GridLostSlaveProc, /* lostSlaveProc */ + GridLostContentProc, /* lostSlaveProc */ }; /* @@ -335,16 +335,16 @@ Tk_GridObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "anchor", "bbox", "columnconfigure", "configure", - "forget", "info", "location", "propagate", "remove", - "rowconfigure", "size", "slaves", NULL + "content", "forget", "info", "location", "propagate", + "remove", "rowconfigure", "size", "slaves", NULL }; enum options { GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE, - GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, GRID_REMOVE, - GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES + GRID_CONTENT, GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, + GRID_REMOVE, GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES }; int index; @@ -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); @@ -384,16 +384,17 @@ Tk_GridObjCmd( return GridPropagateCommand(tkwin, interp, objc, objv); case GRID_SIZE: return GridSizeCommand(tkwin, interp, objc, objv); + case GRID_CONTENT: case GRID_SLAVES: - return GridSlavesCommand(tkwin, interp, objc, objv); + return GridContentCommand(tkwin, interp, objc, objv); /* * Sample argument combinations: - * grid columnconfigure <master> <index> -option - * grid columnconfigure <master> <index> -option value -option value - * grid rowconfigure <master> <index> - * grid rowconfigure <master> <index> -option - * grid rowconfigure <master> <index> -option value -option value. + * grid columnconfigure <container> <index> -option + * grid columnconfigure <container> <index> -option value -option value + * grid rowconfigure <container> <index> + * grid rowconfigure <container> <index> -option + * grid rowconfigure <container> <index> -option value -option value. */ case GRID_COLUMNCONFIGURE: @@ -431,9 +432,9 @@ GridAnchorCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; - GridMaster *gridPtr; + Tk_Window container; + Gridder *containerPtr; + GridContainer *gridPtr; Tk_Anchor old; if (objc > 4) { @@ -441,21 +442,21 @@ GridAnchorCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); if (objc == 3) { - gridPtr = masterPtr->masterDataPtr; + gridPtr = containerPtr->containerDataPtr; Tcl_SetObjResult(interp, Tcl_NewStringObj( Tk_NameOfAnchor(gridPtr?gridPtr->anchor:GRID_DEFAULT_ANCHOR), -1)); return TCL_OK; } - InitMasterData(masterPtr); - gridPtr = masterPtr->masterDataPtr; + InitContainerData(containerPtr); + gridPtr = containerPtr->containerDataPtr; old = gridPtr->anchor; if (Tk_GetAnchorFromObj(interp, objv[3], &gridPtr->anchor) != TCL_OK) { return TCL_ERROR; @@ -466,12 +467,12 @@ GridAnchorCommand( */ if (old != gridPtr->anchor) { - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } } return TCL_OK; @@ -500,9 +501,9 @@ GridBboxCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; /* master grid record */ - GridMaster *gridPtr; /* pointer to grid data */ + Tk_Window container; + Gridder *containerPtr; /* container grid record */ + GridContainer *gridPtr; /* pointer to grid data */ int row, column; /* origin for bounding box */ int row2, column2; /* end of bounding box */ int endX, endY; /* last column/row in the layout */ @@ -514,10 +515,10 @@ GridBboxCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); if (objc >= 5) { if (Tcl_GetIntFromObj(interp, objv[3], &column) != TCL_OK) { @@ -539,13 +540,13 @@ GridBboxCommand( } } - gridPtr = masterPtr->masterDataPtr; + gridPtr = containerPtr->containerDataPtr; if (gridPtr == NULL) { Tcl_SetObjResult(interp, NewQuadObj(0, 0, 0, 0)); return TCL_OK; } - SetGridSize(masterPtr); + SetGridSize(containerPtr); endX = MAX(gridPtr->columnEnd, gridPtr->columnMax); endY = MAX(gridPtr->rowEnd, gridPtr->rowMax); @@ -630,67 +631,67 @@ GridForgetRemoveCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window slave; - Gridder *slavePtr; + Tk_Window content; + Gridder *contentPtr; int i; const char *string = Tcl_GetString(objv[1]); char c = string[0]; for (i = 2; i < objc; i++) { - if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) { return TCL_ERROR; } - slavePtr = GetGrid(slave); - if (slavePtr->masterPtr != NULL) { + contentPtr = GetGrid(content); + if (contentPtr->containerPtr != NULL) { /* * For "forget", reset all the settings to their defaults */ if (c == 'f') { - slavePtr->column = -1; - slavePtr->row = -1; - slavePtr->numCols = 1; - slavePtr->numRows = 1; - slavePtr->padX = 0; - slavePtr->padY = 0; - slavePtr->padLeft = 0; - slavePtr->padTop = 0; - slavePtr->iPadX = 0; - slavePtr->iPadY = 0; - if (slavePtr->in != NULL) { - Tcl_DecrRefCount(slavePtr->in); - slavePtr->in = NULL; + contentPtr->column = -1; + contentPtr->row = -1; + contentPtr->numCols = 1; + contentPtr->numRows = 1; + contentPtr->padX = 0; + contentPtr->padY = 0; + contentPtr->padLeft = 0; + contentPtr->padTop = 0; + contentPtr->iPadX = 0; + contentPtr->iPadY = 0; + if (contentPtr->in != NULL) { + Tcl_DecrRefCount(contentPtr->in); + contentPtr->in = NULL; } - slavePtr->doubleBw = 2*Tk_Changes(tkwin)->border_width; - if (slavePtr->flags & REQUESTED_RELAYOUT) { - Tcl_CancelIdleCall(ArrangeGrid, slavePtr); + contentPtr->doubleBw = 2*Tk_Changes(tkwin)->border_width; + if (contentPtr->flags & REQUESTED_RELAYOUT) { + Tcl_CancelIdleCall(ArrangeGrid, contentPtr); } - slavePtr->flags = 0; - slavePtr->sticky = 0; + contentPtr->flags = 0; + contentPtr->sticky = 0; } else { /* - * When removing, store name of master to be able to - * restore it later, even if the master is recreated. + * When removing, store name of container to be able to + * restore it later, even if the container is recreated. */ - if (slavePtr->in != NULL) { - Tcl_DecrRefCount(slavePtr->in); - slavePtr->in = NULL; + if (contentPtr->in != NULL) { + Tcl_DecrRefCount(contentPtr->in); + contentPtr->in = NULL; } - if (slavePtr->masterPtr != NULL) { - slavePtr->in = Tcl_NewStringObj( - Tk_PathName(slavePtr->masterPtr->tkwin), -1); - Tcl_IncrRefCount(slavePtr->in); + if (contentPtr->containerPtr != NULL) { + contentPtr->in = Tcl_NewStringObj( + Tk_PathName(contentPtr->containerPtr->tkwin), -1); + Tcl_IncrRefCount(contentPtr->in); } } - Tk_ManageGeometry(slave, NULL, NULL); - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->masterPtr->tkwin); + Tk_ManageGeometry(content, NULL, NULL); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, + contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } } return TCL_OK; @@ -720,40 +721,40 @@ GridInfoCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Gridder *slavePtr; - Tk_Window slave; + Gridder *contentPtr; + Tk_Window content; Tcl_Obj *infoObj; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) { return TCL_ERROR; } - slavePtr = GetGrid(slave); - if (slavePtr->masterPtr == NULL) { + contentPtr = GetGrid(content); + if (contentPtr->containerPtr == NULL) { Tcl_ResetResult(interp); return TCL_OK; } infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), - TkNewWindowObj(slavePtr->masterPtr->tkwin)); + TkNewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1), - Tcl_NewIntObj(slavePtr->column)); + Tcl_NewIntObj(contentPtr->column)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1), - Tcl_NewIntObj(slavePtr->row)); + Tcl_NewIntObj(contentPtr->row)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", -1), - Tcl_NewIntObj(slavePtr->numCols)); + Tcl_NewIntObj(contentPtr->numCols)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", -1), - Tcl_NewIntObj(slavePtr->numRows)); - TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX); - TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY); - TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft, slavePtr->padX); - TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY); + Tcl_NewIntObj(contentPtr->numRows)); + TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX); + TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY); + TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft, contentPtr->padX); + TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-sticky", -1), - StickyToObj(slavePtr->sticky)); + StickyToObj(contentPtr->sticky)); Tcl_SetObjResult(interp, infoObj); return TCL_OK; } @@ -782,11 +783,11 @@ GridLocationCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; /* Master grid record. */ - GridMaster *gridPtr; /* Pointer to grid data. */ - register SlotInfo *slotPtr; - int x, y; /* Offset in pixels, from edge of master. */ + Tk_Window container; + Gridder *containerPtr; /* Container grid record. */ + GridContainer *gridPtr; /* Pointer to grid data. */ + SlotInfo *slotPtr; + int x, y; /* Offset in pixels, from edge of container. */ int i, j; /* Corresponding column and row indeces. */ int endX, endY; /* End of grid. */ @@ -795,23 +796,23 @@ GridLocationCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - if (Tk_GetPixelsFromObj(interp, master, objv[3], &x) != TCL_OK) { + if (Tk_GetPixelsFromObj(interp, container, objv[3], &x) != TCL_OK) { return TCL_ERROR; } - if (Tk_GetPixelsFromObj(interp, master, objv[4], &y) != TCL_OK) { + if (Tk_GetPixelsFromObj(interp, container, objv[4], &y) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); - if (masterPtr->masterDataPtr == NULL) { + containerPtr = GetGrid(container); + if (containerPtr->containerDataPtr == NULL) { Tcl_SetObjResult(interp, NewPairObj(-1, -1)); return TCL_OK; } - gridPtr = masterPtr->masterDataPtr; + gridPtr = containerPtr->containerDataPtr; /* * Update any pending requests. This is not always the steady state value, @@ -819,29 +820,29 @@ GridLocationCommand( * its easy to get. */ - while (masterPtr->flags & REQUESTED_RELAYOUT) { - Tcl_CancelIdleCall(ArrangeGrid, masterPtr); - ArrangeGrid(masterPtr); + while (containerPtr->flags & REQUESTED_RELAYOUT) { + Tcl_CancelIdleCall(ArrangeGrid, containerPtr); + ArrangeGrid(containerPtr); } - SetGridSize(masterPtr); + SetGridSize(containerPtr); endX = MAX(gridPtr->columnEnd, gridPtr->columnMax); endY = MAX(gridPtr->rowEnd, gridPtr->rowMax); - slotPtr = masterPtr->masterDataPtr->columnPtr; - if (x < masterPtr->masterDataPtr->startX) { + slotPtr = containerPtr->containerDataPtr->columnPtr; + if (x < containerPtr->containerDataPtr->startX) { i = -1; } else { - x -= masterPtr->masterDataPtr->startX; + x -= containerPtr->containerDataPtr->startX; for (i = 0; slotPtr[i].offset < x && i < endX; i++) { /* null body */ } } - slotPtr = masterPtr->masterDataPtr->rowPtr; - if (y < masterPtr->masterDataPtr->startY) { + slotPtr = containerPtr->containerDataPtr->rowPtr; + if (y < containerPtr->containerDataPtr->startY) { j = -1; } else { - y -= masterPtr->masterDataPtr->startY; + y -= containerPtr->containerDataPtr->startY; for (j = 0; slotPtr[j].offset < y && j < endY; j++) { /* null body */ } @@ -875,8 +876,8 @@ GridPropagateCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; + Tk_Window container; + Gridder *containerPtr; int propagate, old; if (objc > 4) { @@ -884,13 +885,13 @@ GridPropagateCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); if (objc == 3) { Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(!(masterPtr->flags & DONT_PROPAGATE))); + Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE))); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) { @@ -901,39 +902,39 @@ GridPropagateCommand( * Only request a relayout if the propagation bit changes. */ - old = !(masterPtr->flags & DONT_PROPAGATE); + old = !(containerPtr->flags & DONT_PROPAGATE); if (propagate != old) { if (propagate) { /* - * If we have slaves, we need to register as geometry master. + * If we have content, we need to register as geometry container. */ - if (masterPtr->slavePtr != NULL) { - if (TkSetGeometryMaster(interp, master, "grid") != TCL_OK) { + if (containerPtr->contentPtr != NULL) { + if (TkSetGeometryContainer(interp, container, "grid") != TCL_OK) { return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } - masterPtr->flags &= ~DONT_PROPAGATE; + containerPtr->flags &= ~DONT_PROPAGATE; } else { - if (masterPtr->flags & ALLOCED_MASTER) { - TkFreeGeometryMaster(master, "grid"); - masterPtr->flags &= ~ALLOCED_MASTER; + if (containerPtr->flags & ALLOCED_CONTAINER) { + TkFreeGeometryContainer(container, "grid"); + containerPtr->flags &= ~ALLOCED_CONTAINER; } - masterPtr->flags |= DONT_PROPAGATE; + containerPtr->flags |= DONT_PROPAGATE; } /* - * Re-arrange the master to allow new geometry information to - * propagate upwards to the master's master. + * Re-arrange the container to allow new geometry information to + * propagate upwards to the container's container. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } } return TCL_OK; @@ -963,8 +964,8 @@ GridRowColumnConfigureCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master, slave; - Gridder *masterPtr, *slavePtr; + Tk_Window container, content; + Gridder *containerPtr, *contentPtr; SlotInfo *slotPtr = NULL; int slot; /* the column or row number */ int slotType; /* COLUMN or ROW */ @@ -988,7 +989,7 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } @@ -1009,9 +1010,9 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } - masterPtr = GetGrid(master); - first = 0; /* lint */ - last = 0; /* lint */ + containerPtr = GetGrid(container); + first = 0; + last = 0; if ((objc == 4) || (objc == 5)) { if (lObjc != 1) { @@ -1029,11 +1030,11 @@ GridRowColumnConfigureCommand( Tcl_DecrRefCount(listCopy); return TCL_ERROR; } - ok = CheckSlotData(masterPtr, slot, slotType, /* checkOnly */ 1); + ok = CheckSlotData(containerPtr, slot, slotType, /* checkOnly */ 1); if (ok == TCL_OK) { slotPtr = (slotType == COLUMN) ? - masterPtr->masterDataPtr->columnPtr : - masterPtr->masterDataPtr->rowPtr; + containerPtr->containerDataPtr->columnPtr : + containerPtr->containerDataPtr->rowPtr; } /* @@ -1101,32 +1102,32 @@ GridRowColumnConfigureCommand( } for (j = 0; j < lObjc; j++) { - int allSlaves = 0; + int allContent = 0; if (Tcl_GetIntFromObj(NULL, lObjv[j], &slot) == TCL_OK) { first = slot; last = slot; - slavePtr = NULL; + contentPtr = NULL; } else if (strcmp(Tcl_GetString(lObjv[j]), "all") == 0) { /* - * Make sure master is initialised. + * Make sure container is initialised. */ - InitMasterData(masterPtr); + InitContainerData(containerPtr); - slavePtr = masterPtr->slavePtr; - if (slavePtr == NULL) { + contentPtr = containerPtr->contentPtr; + if (contentPtr == NULL) { continue; } - allSlaves = 1; - } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &slave) + allContent = 1; + } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &content) == TCL_OK) { /* - * Is it gridded in this master? + * Is it gridded in this container? */ - slavePtr = GetGrid(slave); - if (slavePtr->masterPtr != masterPtr) { + contentPtr = GetGrid(content); + if (contentPtr->containerPtr != containerPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the window \"%s\" is not managed by \"%s\"", Tcl_GetString(lObjv[j]), Tcl_GetString(objv[2]))); @@ -1147,15 +1148,15 @@ GridRowColumnConfigureCommand( */ do { - if (slavePtr != NULL) { + if (contentPtr != NULL) { first = (slotType == COLUMN) ? - slavePtr->column : slavePtr->row; + contentPtr->column : contentPtr->row; last = first - 1 + ((slotType == COLUMN) ? - slavePtr->numCols : slavePtr->numRows); + contentPtr->numCols : contentPtr->numRows); } for (slot = first; slot <= last; slot++) { - ok = CheckSlotData(masterPtr, slot, slotType, /*checkOnly*/ 0); + ok = CheckSlotData(containerPtr, slot, slotType, /*checkOnly*/ 0); if (ok != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "\"%s\" is out of range", @@ -1166,8 +1167,8 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } slotPtr = (slotType == COLUMN) ? - masterPtr->masterDataPtr->columnPtr : - masterPtr->masterDataPtr->rowPtr; + containerPtr->containerDataPtr->columnPtr : + containerPtr->containerDataPtr->rowPtr; /* * Loop through each option value pair, setting the values as @@ -1181,7 +1182,7 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } if (index == ROWCOL_MINSIZE) { - if (Tk_GetPixelsFromObj(interp, master, objv[i+1], + if (Tk_GetPixelsFromObj(interp, container, objv[i+1], &size) != TCL_OK) { Tcl_DecrRefCount(listCopy); return TCL_ERROR; @@ -1208,7 +1209,7 @@ GridRowColumnConfigureCommand( slotPtr[slot].uniform = NULL; } } else if (index == ROWCOL_PAD) { - if (Tk_GetPixelsFromObj(interp, master, objv[i+1], + if (Tk_GetPixelsFromObj(interp, container, objv[i+1], &size) != TCL_OK) { Tcl_DecrRefCount(listCopy); return TCL_ERROR; @@ -1221,10 +1222,10 @@ GridRowColumnConfigureCommand( } } } - if (slavePtr != NULL) { - slavePtr = slavePtr->nextPtr; + if (contentPtr != NULL) { + contentPtr = contentPtr->nextPtr; } - } while ((allSlaves == 1) && (slavePtr != NULL)); + } while ((allContent == 1) && (contentPtr != NULL)); } Tcl_DecrRefCount(listCopy); @@ -1235,32 +1236,32 @@ GridRowColumnConfigureCommand( if (slotPtr != NULL) { if (slotType == ROW) { - int last = masterPtr->masterDataPtr->rowMax - 1; + int last = containerPtr->containerDataPtr->rowMax - 1; while ((last >= 0) && (slotPtr[last].weight == 0) && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0) && (slotPtr[last].uniform == NULL)) { last--; } - masterPtr->masterDataPtr->rowMax = last+1; + containerPtr->containerDataPtr->rowMax = last+1; } else { - int last = masterPtr->masterDataPtr->columnMax - 1; + int last = containerPtr->containerDataPtr->columnMax - 1; while ((last >= 0) && (slotPtr[last].weight == 0) && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0) && (slotPtr[last].uniform == NULL)) { last--; } - masterPtr->masterDataPtr->columnMax = last + 1; + containerPtr->containerDataPtr->columnMax = last + 1; } } - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } return TCL_OK; @@ -1296,23 +1297,23 @@ GridSizeCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; - GridMaster *gridPtr; /* pointer to grid data */ + Tk_Window container; + Gridder *containerPtr; + GridContainer *gridPtr; /* pointer to grid data */ if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); - if (masterPtr->masterDataPtr != NULL) { - SetGridSize(masterPtr); - gridPtr = masterPtr->masterDataPtr; + if (containerPtr->containerDataPtr != NULL) { + SetGridSize(containerPtr); + gridPtr = containerPtr->containerDataPtr; Tcl_SetObjResult(interp, NewPairObj( MAX(gridPtr->columnEnd, gridPtr->columnMax), MAX(gridPtr->rowEnd, gridPtr->rowMax))); @@ -1325,37 +1326,37 @@ GridSizeCommand( /* *---------------------------------------------------------------------- * - * GridSlavesCommand -- + * GridContentCommand -- * - * Implementation of the [grid slaves] subcommand. See the user + * Implementation of the [grid content] subcommand. See the user * documentation for details on what it does. * * Results: * Standard Tcl result. * * Side effects: - * Places a list of slaves of the specified window in the interpreter's - * result field. + * Places a list of content windows of the specified window in the + * interpreter's result field. * *---------------------------------------------------------------------- */ static int -GridSlavesCommand( +GridContentCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; /* master grid record */ - Gridder *slavePtr; + Tk_Window container; + Gridder *containerPtr; /* container grid record */ + Gridder *contentPtr; int i, value, index; int row = -1, column = -1; static const char *const optionStrings[] = { "-column", "-row", NULL }; - enum options { SLAVES_COLUMN, SLAVES_ROW }; + enum options { CONTENT_COLUMN, CONTENT_ROW }; Tcl_Obj *res; if ((objc < 3) || ((objc % 2) == 0)) { @@ -1377,30 +1378,30 @@ GridSlavesCommand( Tcl_SetErrorCode(interp, "TK", "GRID", "NEG_INDEX", NULL); return TCL_ERROR; } - if (index == SLAVES_COLUMN) { + if (index == CONTENT_COLUMN) { column = value; } else { row = value; } } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); res = Tcl_NewListObj(0, NULL); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - if ((column >= 0) && (slavePtr->column > column - || slavePtr->column+slavePtr->numCols-1 < column)) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + if ((column >= 0) && (contentPtr->column > column + || contentPtr->column+contentPtr->numCols-1 < column)) { continue; } - if ((row >= 0) && (slavePtr->row > row || - slavePtr->row+slavePtr->numRows-1 < row)) { + if ((row >= 0) && (contentPtr->row > row || + contentPtr->row+contentPtr->numRows-1 < row)) { continue; } - Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(slavePtr->tkwin)); + Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, res); return TCL_OK; @@ -1428,12 +1429,12 @@ static void GridReqProc( ClientData clientData, /* Grid's information about window that got * new preferred geometry. */ - Tk_Window tkwin) /* Other Tk-related information about the + TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ { - register Gridder *gridPtr = clientData; + Gridder *gridPtr = (Gridder *)clientData; - gridPtr = gridPtr->masterPtr; + gridPtr = gridPtr->containerPtr; if (gridPtr && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr); @@ -1443,33 +1444,33 @@ GridReqProc( /* *---------------------------------------------------------------------- * - * GridLostSlaveProc -- + * GridLostContentProc -- * * This procedure is invoked by Tk whenever some other geometry claims - * control over a slave that used to be managed by us. + * control over a content that used to be managed by us. * * Results: * None. * * Side effects: - * Forgets all grid-related information about the slave. + * Forgets all grid-related information about the content. * *---------------------------------------------------------------------- */ static void -GridLostSlaveProc( - ClientData clientData, /* Grid structure for slave window that was +GridLostContentProc( + ClientData clientData, /* Grid structure for content window that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */ { - register Gridder *slavePtr = clientData; + Gridder *contentPtr = (Gridder *)clientData; - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } /* @@ -1496,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. */ @@ -1643,12 +1644,12 @@ AdjustOffsets( * * AdjustForSticky -- * - * This procedure adjusts the size of a slave in its cavity based on its + * This procedure adjusts the size of a content in its cavity based on its * "sticky" flags. * * Results: * The input x, y, width, and height are changed to represent the desired - * coordinates of the slave. + * coordinates of the content. * * Side effects: * None. @@ -1658,29 +1659,29 @@ AdjustOffsets( static void AdjustForSticky( - Gridder *slavePtr, /* Slave window to arrange in its cavity. */ + Gridder *contentPtr, /* Content window to arrange in its cavity. */ int *xPtr, /* Pixel location of the left edge of the cavity. */ int *yPtr, /* Pixel location of the top edge of the cavity. */ int *widthPtr, /* Width of the cavity (in pixels). */ int *heightPtr) /* Height of the cavity (in pixels). */ { - int diffx = 0; /* Cavity width - slave width. */ - int diffy = 0; /* Cavity hight - slave height. */ - int sticky = slavePtr->sticky; + int diffx = 0; /* Cavity width - content width. */ + int diffy = 0; /* Cavity hight - content height. */ + int sticky = contentPtr->sticky; - *xPtr += slavePtr->padLeft; - *widthPtr -= slavePtr->padX; - *yPtr += slavePtr->padTop; - *heightPtr -= slavePtr->padY; + *xPtr += contentPtr->padLeft; + *widthPtr -= contentPtr->padX; + *yPtr += contentPtr->padTop; + *heightPtr -= contentPtr->padY; - if (*widthPtr > (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX)) { - diffx = *widthPtr - (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX); - *widthPtr = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX; + if (*widthPtr > (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX)) { + diffx = *widthPtr - (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX); + *widthPtr = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX; } - if (*heightPtr > (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY)) { - diffy = *heightPtr - (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY); - *heightPtr = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY; + if (*heightPtr > (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY)) { + diffy = *heightPtr - (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY); + *heightPtr = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY; } if (sticky&STICK_EAST && sticky&STICK_WEST) { @@ -1711,38 +1712,38 @@ AdjustForSticky( * None. * * Side effects: - * The slaves of masterPtr may get resized or moved. + * The content of containerPtr may get resized or moved. * *---------------------------------------------------------------------- */ static void ArrangeGrid( - ClientData clientData) /* Structure describing master whose slaves + ClientData clientData) /* Structure describing container whose content * are to be re-layed out. */ { - register Gridder *masterPtr = clientData; - register Gridder *slavePtr; - GridMaster *slotPtr = masterPtr->masterDataPtr; + Gridder *containerPtr = (Gridder *)clientData; + Gridder *contentPtr; + GridContainer *slotPtr = containerPtr->containerDataPtr; int abort; int width, height; /* Requested size of layout, in pixels. */ int realWidth, realHeight; /* Actual size layout should take-up. */ int usedX, usedY; - masterPtr->flags &= ~REQUESTED_RELAYOUT; + containerPtr->flags &= ~REQUESTED_RELAYOUT; /* - * If the master has no slaves anymore, then don't do anything at all: - * just leave the master's size as-is. Otherwise there is no way to - * "relinquish" control over the master so another geometry manager can + * If the container has no content anymore, then don't do anything at all: + * just leave the container's size as-is. Otherwise there is no way to + * "relinquish" control over the container so another geometry manager can * take over. */ - if (masterPtr->slavePtr == NULL) { + if (containerPtr->contentPtr == NULL) { return; } - if (masterPtr->masterDataPtr == NULL) { + if (containerPtr->containerDataPtr == NULL) { return; } @@ -1752,128 +1753,128 @@ ArrangeGrid( * necessary. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - masterPtr->abortPtr = &abort; + containerPtr->abortPtr = &abort; abort = 0; - Tcl_Preserve(masterPtr); + Tcl_Preserve(containerPtr); /* * Call the constraint engine to fill in the row and column offsets. */ - SetGridSize(masterPtr); - width = ResolveConstraints(masterPtr, COLUMN, 0); - height = ResolveConstraints(masterPtr, ROW, 0); - width += Tk_InternalBorderLeft(masterPtr->tkwin) + - Tk_InternalBorderRight(masterPtr->tkwin); - height += Tk_InternalBorderTop(masterPtr->tkwin) + - Tk_InternalBorderBottom(masterPtr->tkwin); + SetGridSize(containerPtr); + width = ResolveConstraints(containerPtr, COLUMN, 0); + height = ResolveConstraints(containerPtr, ROW, 0); + width += Tk_InternalBorderLeft(containerPtr->tkwin) + + Tk_InternalBorderRight(containerPtr->tkwin); + height += Tk_InternalBorderTop(containerPtr->tkwin) + + Tk_InternalBorderBottom(containerPtr->tkwin); - if (width < Tk_MinReqWidth(masterPtr->tkwin)) { - width = Tk_MinReqWidth(masterPtr->tkwin); + if (width < Tk_MinReqWidth(containerPtr->tkwin)) { + width = Tk_MinReqWidth(containerPtr->tkwin); } - if (height < Tk_MinReqHeight(masterPtr->tkwin)) { - height = Tk_MinReqHeight(masterPtr->tkwin); + if (height < Tk_MinReqHeight(containerPtr->tkwin)) { + height = Tk_MinReqHeight(containerPtr->tkwin); } - if (((width != Tk_ReqWidth(masterPtr->tkwin)) - || (height != Tk_ReqHeight(masterPtr->tkwin))) - && !(masterPtr->flags & DONT_PROPAGATE)) { - Tk_GeometryRequest(masterPtr->tkwin, width, height); + if (((width != Tk_ReqWidth(containerPtr->tkwin)) + || (height != Tk_ReqHeight(containerPtr->tkwin))) + && !(containerPtr->flags & DONT_PROPAGATE)) { + Tk_GeometryRequest(containerPtr->tkwin, width, height); if (width>1 && height>1) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } - masterPtr->abortPtr = NULL; - Tcl_Release(masterPtr); + containerPtr->abortPtr = NULL; + Tcl_Release(containerPtr); return; } /* - * If the currently requested layout size doesn't match the master's + * If the currently requested layout size doesn't match the container's * window size, then adjust the slot offsets according to the weights. If * all of the weights are zero, place the layout according to the anchor * value. */ - realWidth = Tk_Width(masterPtr->tkwin) - - Tk_InternalBorderLeft(masterPtr->tkwin) - - Tk_InternalBorderRight(masterPtr->tkwin); - realHeight = Tk_Height(masterPtr->tkwin) - - Tk_InternalBorderTop(masterPtr->tkwin) - - Tk_InternalBorderBottom(masterPtr->tkwin); + realWidth = Tk_Width(containerPtr->tkwin) - + Tk_InternalBorderLeft(containerPtr->tkwin) - + Tk_InternalBorderRight(containerPtr->tkwin); + realHeight = Tk_Height(containerPtr->tkwin) - + Tk_InternalBorderTop(containerPtr->tkwin) - + Tk_InternalBorderBottom(containerPtr->tkwin); usedX = AdjustOffsets(realWidth, MAX(slotPtr->columnEnd, slotPtr->columnMax), slotPtr->columnPtr); usedY = AdjustOffsets(realHeight, MAX(slotPtr->rowEnd, slotPtr->rowMax), slotPtr->rowPtr); - TkComputeAnchor(masterPtr->masterDataPtr->anchor, masterPtr->tkwin, + TkComputeAnchor(containerPtr->containerDataPtr->anchor, containerPtr->tkwin, 0, 0, usedX, usedY, &slotPtr->startX, &slotPtr->startY); /* - * Now adjust the actual size of the slave to its cavity by computing the + * Now adjust the actual size of the content to its cavity by computing the * cavity size, and adjusting the widget according to its stickyness. */ - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort; - slavePtr = slavePtr->nextPtr) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort; + contentPtr = contentPtr->nextPtr) { int x, y; /* Top left coordinate */ - int width, height; /* Slot or slave size */ - int col = slavePtr->column; - int row = slavePtr->row; + int width, height; /* Slot or content size */ + int col = contentPtr->column; + int row = contentPtr->row; x = (col>0) ? slotPtr->columnPtr[col-1].offset : 0; y = (row>0) ? slotPtr->rowPtr[row-1].offset : 0; - width = slotPtr->columnPtr[slavePtr->numCols+col-1].offset - x; - height = slotPtr->rowPtr[slavePtr->numRows+row-1].offset - y; + width = slotPtr->columnPtr[contentPtr->numCols+col-1].offset - x; + height = slotPtr->rowPtr[contentPtr->numRows+row-1].offset - y; x += slotPtr->startX; y += slotPtr->startY; - AdjustForSticky(slavePtr, &x, &y, &width, &height); + AdjustForSticky(contentPtr, &x, &y, &width, &height); /* * Now put the window in the proper spot. (This was taken directly - * from tkPack.c.) If the slave is a child of the master, then do this + * from tkPack.c.) If the content is a child of the container, then do this * here. Otherwise let Tk_MaintainGeometry do the work. */ - if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { + if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) { if ((width <= 0) || (height <= 0)) { - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - if ((x != Tk_X(slavePtr->tkwin)) - || (y != Tk_Y(slavePtr->tkwin)) - || (width != Tk_Width(slavePtr->tkwin)) - || (height != Tk_Height(slavePtr->tkwin))) { - Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height); + if ((x != Tk_X(contentPtr->tkwin)) + || (y != Tk_Y(contentPtr->tkwin)) + || (width != Tk_Width(contentPtr->tkwin)) + || (height != Tk_Height(contentPtr->tkwin))) { + Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height); } if (abort) { break; } /* - * Don't map the slave if the master isn't mapped: wait until - * the master gets mapped later. + * Don't map the content if the container isn't mapped: wait until + * the container gets mapped later. */ - if (Tk_IsMapped(masterPtr->tkwin)) { - Tk_MapWindow(slavePtr->tkwin); + if (Tk_IsMapped(containerPtr->tkwin)) { + Tk_MapWindow(contentPtr->tkwin); } } } else if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin); - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, x, y, + Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y, width, height); } } - masterPtr->abortPtr = NULL; - Tcl_Release(masterPtr); + containerPtr->abortPtr = NULL; + Tcl_Release(containerPtr); } /* @@ -1891,20 +1892,20 @@ ArrangeGrid( * * Side effects: * The slot offsets are copied into the SlotInfo structure for the - * geometry master. + * geometry container. * *---------------------------------------------------------------------- */ static int ResolveConstraints( - Gridder *masterPtr, /* The geometry master for this grid. */ + Gridder *containerPtr, /* The geometry container for this grid. */ int slotType, /* Either ROW or COLUMN. */ int maxOffset) /* The actual maximum size of this layout in * pixels, or 0 (not currently used). */ { - register SlotInfo *slotPtr; /* Pointer to row/col constraints. */ - register Gridder *slavePtr; /* List of slave windows in this grid. */ + SlotInfo *slotPtr; /* Pointer to row/col constraints. */ + Gridder *contentPtr; /* List of content windows in this grid. */ int constraintCount; /* Count of rows or columns that have * constraints. */ int slotCount; /* Last occupied row or column. */ @@ -1913,7 +1914,7 @@ ResolveConstraints( GridLayout *layoutPtr; /* Temporary layout structure. */ int requiredSize; /* The natural size of the grid (pixels). * This is the minimum size needed to - * accommodate all of the slaves at their + * accommodate all of the content at their * requested sizes. */ int offset; /* The pixel offset of the right edge of the * current slot from the beginning of the @@ -1941,13 +1942,13 @@ ResolveConstraints( GridLayout layoutData[TYPICAL_SIZE + 1]; if (slotType == COLUMN) { - constraintCount = masterPtr->masterDataPtr->columnMax; - slotCount = masterPtr->masterDataPtr->columnEnd; - slotPtr = masterPtr->masterDataPtr->columnPtr; + constraintCount = containerPtr->containerDataPtr->columnMax; + slotCount = containerPtr->containerDataPtr->columnEnd; + slotPtr = containerPtr->containerDataPtr->columnPtr; } else { - constraintCount = masterPtr->masterDataPtr->rowMax; - slotCount = masterPtr->masterDataPtr->rowEnd; - slotPtr = masterPtr->masterDataPtr->rowPtr; + constraintCount = containerPtr->containerDataPtr->rowMax; + slotCount = containerPtr->containerDataPtr->rowEnd; + slotPtr = containerPtr->containerDataPtr->rowPtr; } /* @@ -1956,7 +1957,7 @@ ResolveConstraints( gridCount = MAX(constraintCount, slotCount); if (gridCount >= TYPICAL_SIZE) { - layoutPtr = ckalloc(sizeof(GridLayout) * (1+gridCount)); + layoutPtr = (GridLayout *)ckalloc(sizeof(GridLayout) * (1+gridCount)); } else { layoutPtr = layoutData; } @@ -1997,29 +1998,29 @@ ResolveConstraints( /* * Step 2. - * Slaves with a span of 1 are used to determine the minimum size of each - * slot. Slaves whose span is two or more slots don't contribute to the + * Content with a span of 1 are used to determine the minimum size of each + * slot. Content whose span is two or more slots don't contribute to the * minimum size of each slot directly, but can cause slots to grow if * their size exceeds the the sizes of the slots they span. * - * Bin all slaves whose spans are > 1 by their right edges. This allows + * Bin all content whose spans are > 1 by their right edges. This allows * the computation on minimum and maximum possible layout sizes at each - * slot boundary, without the need to re-sort the slaves. + * slot boundary, without the need to re-sort the content. */ switch (slotType) { case COLUMN: - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - int rightEdge = slavePtr->column + slavePtr->numCols - 1; - - slavePtr->size = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->padX - + slavePtr->iPadX + slavePtr->doubleBw; - if (slavePtr->numCols > 1) { - slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; - layoutPtr[rightEdge].binNextPtr = slavePtr; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + int rightEdge = contentPtr->column + contentPtr->numCols - 1; + + contentPtr->size = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->padX + + contentPtr->iPadX + contentPtr->doubleBw; + if (contentPtr->numCols > 1) { + contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; + layoutPtr[rightEdge].binNextPtr = contentPtr; } else if (rightEdge >= 0) { - int size = slavePtr->size + layoutPtr[rightEdge].pad; + int size = contentPtr->size + layoutPtr[rightEdge].pad; if (size > layoutPtr[rightEdge].minSize) { layoutPtr[rightEdge].minSize = size; @@ -2028,17 +2029,17 @@ ResolveConstraints( } break; case ROW: - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - int rightEdge = slavePtr->row + slavePtr->numRows - 1; - - slavePtr->size = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->padY - + slavePtr->iPadY + slavePtr->doubleBw; - if (slavePtr->numRows > 1) { - slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; - layoutPtr[rightEdge].binNextPtr = slavePtr; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + int rightEdge = contentPtr->row + contentPtr->numRows - 1; + + contentPtr->size = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->padY + + contentPtr->iPadY + contentPtr->doubleBw; + if (contentPtr->numRows > 1) { + contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; + layoutPtr[rightEdge].binNextPtr = contentPtr; } else if (rightEdge >= 0) { - int size = slavePtr->size + layoutPtr[rightEdge].pad; + int size = contentPtr->size + layoutPtr[rightEdge].pad; if (size > layoutPtr[rightEdge].minSize) { layoutPtr[rightEdge].minSize = size; @@ -2078,7 +2079,7 @@ ResolveConstraints( * sizeof(UniformGroup); size_t newSize = (uniformGroupsAlloced + UNIFORM_PREALLOC) * sizeof(UniformGroup); - UniformGroup *newUG = ckalloc(newSize); + UniformGroup *newUG = (UniformGroup *)ckalloc(newSize); UniformGroup *oldUG = uniformGroupPtr; memcpy(newUG, oldUG, oldSize); @@ -2129,16 +2130,16 @@ ResolveConstraints( /* * Step 3. * Determine the minimum slot offsets going from left to right that would - * fit all of the slaves. This determines the minimum + * fit all of the content. This determines the minimum */ for (offset=0,slot=0; slot < gridCount; slot++) { layoutPtr[slot].minOffset = layoutPtr[slot].minSize + offset; - for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL; - slavePtr = slavePtr->binNextPtr) { + for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL; + contentPtr = contentPtr->binNextPtr) { int span = (slotType == COLUMN) ? - slavePtr->numCols : slavePtr->numRows; - int required = slavePtr->size + layoutPtr[slot - span].minOffset; + contentPtr->numCols : contentPtr->numRows; + int required = contentPtr->size + layoutPtr[slot - span].minOffset; if (required > layoutPtr[slot].minOffset) { layoutPtr[slot].minOffset = required; @@ -2149,7 +2150,7 @@ ResolveConstraints( /* * At this point, we know the minimum required size of the entire layout. - * It might be prudent to stop here if our "master" will resize itself to + * It might be prudent to stop here if our "container" will resize itself to * this size. */ @@ -2170,11 +2171,11 @@ ResolveConstraints( layoutPtr[slot].maxOffset = offset; } for (slot=gridCount-1; slot > 0;) { - for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL; - slavePtr = slavePtr->binNextPtr) { + for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL; + contentPtr = contentPtr->binNextPtr) { int span = (slotType == COLUMN) ? - slavePtr->numCols : slavePtr->numRows; - int require = offset - slavePtr->size; + contentPtr->numCols : contentPtr->numRows; + int require = offset - contentPtr->size; int startSlot = slot - span; if (startSlot >=0 && require < layoutPtr[startSlot].maxOffset) { @@ -2384,7 +2385,7 @@ ResolveConstraints( /* * Step 6. * All of the space has been apportioned; copy the layout information back - * into the master. + * into the container. */ for (slot=0; slot < gridCount; slot++) { @@ -2422,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; @@ -2439,14 +2440,14 @@ GetGrid( hPtr = Tcl_CreateHashEntry(&dispPtr->gridHashTable, (char*) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Gridder *)Tcl_GetHashValue(hPtr); } - gridPtr = ckalloc(sizeof(Gridder)); + gridPtr = (Gridder *)ckalloc(sizeof(Gridder)); gridPtr->tkwin = tkwin; - gridPtr->masterPtr = NULL; - gridPtr->masterDataPtr = NULL; + gridPtr->containerPtr = NULL; + gridPtr->containerDataPtr = NULL; gridPtr->nextPtr = NULL; - gridPtr->slavePtr = NULL; + gridPtr->contentPtr = NULL; gridPtr->binNextPtr = NULL; gridPtr->column = -1; @@ -2466,7 +2467,7 @@ GetGrid( gridPtr->sticky = 0; gridPtr->size = 0; gridPtr->in = NULL; - gridPtr->masterDataPtr = NULL; + gridPtr->containerDataPtr = NULL; Tcl_SetHashValue(hPtr, gridPtr); Tk_CreateEventHandler(tkwin, StructureNotifyMask, GridStructureProc, gridPtr); @@ -2478,13 +2479,13 @@ GetGrid( * * SetGridSize -- * - * This internal procedure sets the size of the grid occupied by slaves. + * This internal procedure sets the size of the grid occupied by content. * * Results: * None * * Side effects: - * The width and height arguments are filled in the master data + * The width and height arguments are filled in the container data * structure. Additional space is allocated for the constraints to * accommodate the offsets. * @@ -2493,50 +2494,50 @@ GetGrid( static void SetGridSize( - Gridder *masterPtr) /* The geometry master for this grid. */ + Gridder *containerPtr) /* The geometry container for this grid. */ { - register Gridder *slavePtr; /* Current slave window. */ + Gridder *contentPtr; /* Current content window. */ int maxX = 0, maxY = 0; - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - maxX = MAX(maxX, slavePtr->numCols + slavePtr->column); - maxY = MAX(maxY, slavePtr->numRows + slavePtr->row); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + maxX = MAX(maxX, contentPtr->numCols + contentPtr->column); + maxY = MAX(maxY, contentPtr->numRows + contentPtr->row); } - masterPtr->masterDataPtr->columnEnd = maxX; - masterPtr->masterDataPtr->rowEnd = maxY; - CheckSlotData(masterPtr, maxX, COLUMN, CHECK_SPACE); - CheckSlotData(masterPtr, maxY, ROW, CHECK_SPACE); + containerPtr->containerDataPtr->columnEnd = maxX; + containerPtr->containerDataPtr->rowEnd = maxY; + CheckSlotData(containerPtr, maxX, COLUMN, CHECK_SPACE); + CheckSlotData(containerPtr, maxY, ROW, CHECK_SPACE); } /* *---------------------------------------------------------------------- * - * SetSlaveColumn -- + * SetContentColumn -- * - * Update column data for a slave, checking that MAX_ELEMENT bound + * Update column data for a content, checking that MAX_ELEMENT bound * is not passed. * * Results: * TCL_ERROR if out of bounds, TCL_OK otherwise * * Side effects: - * Slave fields are updated. + * Content fields are updated. * *---------------------------------------------------------------------- */ static int -SetSlaveColumn( +SetContentColumn( Tcl_Interp *interp, /* Interp for error message. */ - Gridder *slavePtr, /* Slave to be updated. */ + Gridder *contentPtr, /* Content to be updated. */ int column, /* New column or -1 to be unchanged. */ int numCols) /* New columnspan or -1 to be unchanged. */ { int newColumn, newNumCols, lastCol; - newColumn = (column >= 0) ? column : slavePtr->column; - newNumCols = (numCols >= 1) ? numCols : slavePtr->numCols; + newColumn = (column >= 0) ? column : contentPtr->column; + newNumCols = (numCols >= 1) ? numCols : contentPtr->numCols; lastCol = ((newColumn >= 0) ? newColumn : 0) + newNumCols; if (lastCol >= MAX_ELEMENT) { @@ -2545,39 +2546,39 @@ SetSlaveColumn( return TCL_ERROR; } - slavePtr->column = newColumn; - slavePtr->numCols = newNumCols; + contentPtr->column = newColumn; + contentPtr->numCols = newNumCols; return TCL_OK; } /* *---------------------------------------------------------------------- * - * SetSlaveRow -- + * SetContentRow -- * - * Update row data for a slave, checking that MAX_ELEMENT bound + * Update row data for a content, checking that MAX_ELEMENT bound * is not passed. * * Results: * TCL_ERROR if out of bounds, TCL_OK otherwise * * Side effects: - * Slave fields are updated. + * Content fields are updated. * *---------------------------------------------------------------------- */ static int -SetSlaveRow( +SetContentRow( Tcl_Interp *interp, /* Interp for error message. */ - Gridder *slavePtr, /* Slave to be updated. */ + Gridder *contentPtr, /* Content to be updated. */ int row, /* New row or -1 to be unchanged. */ int numRows) /* New rowspan or -1 to be unchanged. */ { int newRow, newNumRows, lastRow; - newRow = (row >= 0) ? row : slavePtr->row; - newNumRows = (numRows >= 1) ? numRows : slavePtr->numRows; + newRow = (row >= 0) ? row : contentPtr->row; + newNumRows = (numRows >= 1) ? numRows : contentPtr->numRows; lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows; if (lastRow >= MAX_ELEMENT) { @@ -2586,8 +2587,8 @@ SetSlaveRow( return TCL_ERROR; } - slavePtr->row = newRow; - slavePtr->numRows = newNumRows; + contentPtr->row = newRow; + contentPtr->numRows = newNumRows; return TCL_OK; } @@ -2603,7 +2604,7 @@ SetSlaveRow( * TRUE if the index is OK, False otherwise. * * Side effects: - * A new master grid structure may be created. If so, then it is + * A new container grid structure may be created. If so, then it is * initialized. In addition, additional storage for a row or column * constraints may be allocated, and the constraint maximums are * adjusted. @@ -2613,7 +2614,7 @@ SetSlaveRow( static int CheckSlotData( - Gridder *masterPtr, /* The geometry master for this grid. */ + Gridder *containerPtr, /* The geometry container for this grid. */ int slot, /* Which slot to look at. */ int slotType, /* ROW or COLUMN. */ int checkOnly) /* Don't allocate new space if true. */ @@ -2629,7 +2630,7 @@ CheckSlotData( return TCL_ERROR; } - if ((checkOnly == CHECK_ONLY) && (masterPtr->masterDataPtr == NULL)) { + if ((checkOnly == CHECK_ONLY) && (containerPtr->containerDataPtr == NULL)) { return TCL_ERROR; } @@ -2639,39 +2640,39 @@ CheckSlotData( * of the offsets as well. */ - InitMasterData(masterPtr); - end = (slotType == ROW) ? masterPtr->masterDataPtr->rowMax : - masterPtr->masterDataPtr->columnMax; + InitContainerData(containerPtr); + end = (slotType == ROW) ? containerPtr->containerDataPtr->rowMax : + containerPtr->containerDataPtr->columnMax; if (checkOnly == CHECK_ONLY) { return ((end < slot) ? TCL_ERROR : TCL_OK); } else { - numSlot = (slotType == ROW) ? masterPtr->masterDataPtr->rowSpace - : masterPtr->masterDataPtr->columnSpace; + numSlot = (slotType == ROW) ? containerPtr->containerDataPtr->rowSpace + : containerPtr->containerDataPtr->columnSpace; if (slot >= numSlot) { int newNumSlot = slot + PREALLOC; size_t oldSize = numSlot * sizeof(SlotInfo); size_t newSize = newNumSlot * sizeof(SlotInfo); - SlotInfo *newSI = ckalloc(newSize); + SlotInfo *newSI = (SlotInfo *)ckalloc(newSize); SlotInfo *oldSI = (slotType == ROW) - ? masterPtr->masterDataPtr->rowPtr - : masterPtr->masterDataPtr->columnPtr; + ? containerPtr->containerDataPtr->rowPtr + : containerPtr->containerDataPtr->columnPtr; memcpy(newSI, oldSI, oldSize); memset(newSI+numSlot, 0, newSize - oldSize); ckfree(oldSI); if (slotType == ROW) { - masterPtr->masterDataPtr->rowPtr = newSI; - masterPtr->masterDataPtr->rowSpace = newNumSlot; + containerPtr->containerDataPtr->rowPtr = newSI; + containerPtr->containerDataPtr->rowSpace = newNumSlot; } else { - masterPtr->masterDataPtr->columnPtr = newSI; - masterPtr->masterDataPtr->columnSpace = newNumSlot; + containerPtr->containerDataPtr->columnPtr = newSI; + containerPtr->containerDataPtr->columnSpace = newNumSlot; } } if (slot >= end && checkOnly != CHECK_SPACE) { if (slotType == ROW) { - masterPtr->masterDataPtr->rowMax = slot+1; + containerPtr->containerDataPtr->rowMax = slot+1; } else { - masterPtr->masterDataPtr->columnMax = slot+1; + containerPtr->containerDataPtr->columnMax = slot+1; } } return TCL_OK; @@ -2681,37 +2682,37 @@ CheckSlotData( /* *---------------------------------------------------------------------- * - * InitMasterData -- + * InitContainerData -- * * This internal procedure is used to allocate and initialize the data - * for a geometry master, if the data doesn't exist already. + * for a geometry container, if the data doesn't exist already. * * Results: * none * * Side effects: - * A new master grid structure may be created. If so, then it is + * A new container grid structure may be created. If so, then it is * initialized. * *---------------------------------------------------------------------- */ static void -InitMasterData( - Gridder *masterPtr) +InitContainerData( + Gridder *containerPtr) { - if (masterPtr->masterDataPtr == NULL) { - GridMaster *gridPtr = masterPtr->masterDataPtr = - ckalloc(sizeof(GridMaster)); + if (containerPtr->containerDataPtr == NULL) { + GridContainer *gridPtr = containerPtr->containerDataPtr = + ckalloc(sizeof(GridContainer)); size_t size = sizeof(SlotInfo) * TYPICAL_SIZE; gridPtr->columnEnd = 0; gridPtr->columnMax = 0; - gridPtr->columnPtr = ckalloc(size); + gridPtr->columnPtr = (SlotInfo *)ckalloc(size); gridPtr->columnSpace = TYPICAL_SIZE; gridPtr->rowEnd = 0; gridPtr->rowMax = 0; - gridPtr->rowPtr = ckalloc(size); + gridPtr->rowPtr = (SlotInfo *)ckalloc(size); gridPtr->rowSpace = TYPICAL_SIZE; gridPtr->startX = 0; gridPtr->startY = 0; @@ -2727,13 +2728,13 @@ InitMasterData( * * Unlink -- * - * Remove a grid from its master's list of slaves. + * Remove a grid from its container's list of content. * * Results: * None. * * Side effects: - * The master will be scheduled for re-arranging, and the size of the + * The container will be scheduled for re-arranging, and the size of the * grid will be adjusted accordingly * *---------------------------------------------------------------------- @@ -2741,47 +2742,47 @@ InitMasterData( static void Unlink( - register Gridder *slavePtr) /* Window to unlink. */ + Gridder *contentPtr) /* Window to unlink. */ { - register Gridder *masterPtr, *slavePtr2; + Gridder *containerPtr, *contentPtr2; - masterPtr = slavePtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = contentPtr->containerPtr; + if (containerPtr == NULL) { return; } - if (masterPtr->slavePtr == slavePtr) { - masterPtr->slavePtr = slavePtr->nextPtr; + if (containerPtr->contentPtr == contentPtr) { + containerPtr->contentPtr = contentPtr->nextPtr; } else { - for (slavePtr2=masterPtr->slavePtr ; ; slavePtr2=slavePtr2->nextPtr) { - if (slavePtr2 == NULL) { + for (contentPtr2=containerPtr->contentPtr ; ; contentPtr2=contentPtr2->nextPtr) { + if (contentPtr2 == NULL) { Tcl_Panic("Unlink couldn't find previous window"); } - if (slavePtr2->nextPtr == slavePtr) { - slavePtr2->nextPtr = slavePtr->nextPtr; + if (contentPtr2->nextPtr == contentPtr) { + contentPtr2->nextPtr = contentPtr->nextPtr; break; } } } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - SetGridSize(slavePtr->masterPtr); - slavePtr->masterPtr = NULL; + SetGridSize(contentPtr->containerPtr); + contentPtr->containerPtr = NULL; /* - * If we have emptied this master from slaves it means we are no longer + * If we have emptied this container from content it means we are no longer * handling it and should mark it as free. */ - if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { - TkFreeGeometryMaster(masterPtr->tkwin, "grid"); - masterPtr->flags &= ~ALLOCED_MASTER; + if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { + TkFreeGeometryContainer(containerPtr->tkwin, "grid"); + containerPtr->flags &= ~ALLOCED_CONTAINER; } } @@ -2793,7 +2794,7 @@ Unlink( * This procedure is invoked by Tcl_EventuallyFree or Tcl_Release to * clean up the internal structure of a grid at a safe time (when no-one * is using it anymore). Cleaning up the grid involves freeing the main - * structure for all windows and the master structure for geometry + * structure for all windows and the container structure for geometry * managers. * * Results: @@ -2809,16 +2810,16 @@ static void DestroyGrid( void *memPtr) /* Info about window that is now dead. */ { - register Gridder *gridPtr = memPtr; + Gridder *gridPtr = (Gridder *)memPtr; - if (gridPtr->masterDataPtr != NULL) { - if (gridPtr->masterDataPtr->rowPtr != NULL) { - ckfree(gridPtr->masterDataPtr -> rowPtr); + if (gridPtr->containerDataPtr != NULL) { + if (gridPtr->containerDataPtr->rowPtr != NULL) { + ckfree(gridPtr->containerDataPtr -> rowPtr); } - if (gridPtr->masterDataPtr->columnPtr != NULL) { - ckfree(gridPtr->masterDataPtr -> columnPtr); + if (gridPtr->containerDataPtr->columnPtr != NULL) { + ckfree(gridPtr->containerDataPtr -> columnPtr); } - ckfree(gridPtr->masterDataPtr); + ckfree(gridPtr->containerDataPtr); } if (gridPtr->in != NULL) { Tcl_DecrRefCount(gridPtr->in); @@ -2839,7 +2840,7 @@ DestroyGrid( * * Side effects: * If a window was just deleted, clean up all its grid-related - * information. If it was just resized, re-configure its slaves, if any. + * information. If it was just resized, re-configure its content, if any. * *---------------------------------------------------------------------- */ @@ -2850,56 +2851,56 @@ GridStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Gridder *gridPtr = clientData; + Gridder *gridPtr = (Gridder *)clientData; TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr; if (eventPtr->type == ConfigureNotify) { - if ((gridPtr->slavePtr != NULL) + if ((gridPtr->contentPtr != NULL) && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } - if ((gridPtr->masterPtr != NULL) && + if ((gridPtr->containerPtr != NULL) && (gridPtr->doubleBw != 2*Tk_Changes(gridPtr->tkwin)->border_width)) { - if (!(gridPtr->masterPtr->flags & REQUESTED_RELAYOUT)) { + if (!(gridPtr->containerPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->doubleBw = 2*Tk_Changes(gridPtr->tkwin)->border_width; - gridPtr->masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, gridPtr->masterPtr); + gridPtr->containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, gridPtr->containerPtr); } } } else if (eventPtr->type == DestroyNotify) { - register Gridder *slavePtr, *nextPtr; + Gridder *contentPtr, *nextPtr; - if (gridPtr->masterPtr != NULL) { + if (gridPtr->containerPtr != NULL) { Unlink(gridPtr); } - for (slavePtr = gridPtr->slavePtr; slavePtr != NULL; - slavePtr = nextPtr) { - Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL); - Tk_UnmapWindow(slavePtr->tkwin); - slavePtr->masterPtr = NULL; - nextPtr = slavePtr->nextPtr; - slavePtr->nextPtr = NULL; + for (contentPtr = gridPtr->contentPtr; contentPtr != NULL; + contentPtr = nextPtr) { + Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL); + Tk_UnmapWindow(contentPtr->tkwin); + contentPtr->containerPtr = NULL; + nextPtr = contentPtr->nextPtr; + contentPtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable, - (char *) gridPtr->tkwin)); + (char *)gridPtr->tkwin)); if (gridPtr->flags & REQUESTED_RELAYOUT) { Tcl_CancelIdleCall(ArrangeGrid, gridPtr); } gridPtr->tkwin = NULL; Tcl_EventuallyFree(gridPtr, (Tcl_FreeProc *)DestroyGrid); } else if (eventPtr->type == MapNotify) { - if ((gridPtr->slavePtr != NULL) + if ((gridPtr->contentPtr != NULL) && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } } else if (eventPtr->type == UnmapNotify) { - register Gridder *slavePtr; + Gridder *contentPtr; - for (slavePtr = gridPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - Tk_UnmapWindow(slavePtr->tkwin); + for (contentPtr = gridPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + Tk_UnmapWindow(contentPtr->tkwin); } } } @@ -2907,11 +2908,11 @@ GridStructureProc( /* *---------------------------------------------------------------------- * - * ConfigureSlaves -- + * ConfigureContent -- * * This implements the guts of the "grid configure" command. Given a list - * of slaves and configuration options, it arranges for the grid to - * manage the slaves and sets the specified options. Arguments consist + * of content and configuration options, it arranges for the grid to + * manage the content and sets the specified options. Arguments consist * of windows or window shortcuts followed by "-option value" pairs. * * Results: @@ -2919,26 +2920,26 @@ GridStructureProc( * and the interp's result is set to contain an error message. * * Side effects: - * Slave windows get taken over by the grid. + * Content windows get taken over by the grid. * *---------------------------------------------------------------------- */ static int -ConfigureSlaves( +ConfigureContent( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Any window in application containing - * slaves. Used to look up slave names. */ + * content. Used to look up content names. */ int objc, /* Number of elements in argv. */ Tcl_Obj *const objv[]) /* Argument objects: contains one or more * window names followed by any number of * "option value" pairs. Caller must make sure * that there is at least one window name. */ { - Gridder *masterPtr = NULL; - Gridder *slavePtr; - Tk_Window other, slave, parent, ancestor; - TkWindow *master; + Gridder *containerPtr = NULL; + Gridder *contentPtr; + Tk_Window other, content, parent, ancestor; + TkWindow *container; int i, j, tmp; int numWindows; int width; @@ -2974,34 +2975,34 @@ ConfigureSlaves( if (firstChar == '.') { /* - * Check that windows are valid, and locate the first slave's + * Check that windows are valid, and locate the first content's * parent window (default for -in). */ - if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) { return TCL_ERROR; } - if (masterPtr == NULL) { + if (containerPtr == NULL) { /* - * Is there any saved -in from a removed slave? + * Is there any saved -in from a removed content? * If there is, it becomes default for -in. - * If the stored master does not exist, just ignore it. + * If the stored container does not exist, just ignore it. */ - struct Gridder *slavePtr = GetGrid(slave); - if (slavePtr->in != NULL) { - if (TkGetWindowFromObj(interp, slave, slavePtr->in, &parent) + struct Gridder *contentPtr = GetGrid(content); + if (contentPtr->in != NULL) { + if (TkGetWindowFromObj(interp, content, contentPtr->in, &parent) == TCL_OK) { - masterPtr = GetGrid(parent); - InitMasterData(masterPtr); + containerPtr = GetGrid(parent); + InitContainerData(containerPtr); } } } - if (masterPtr == NULL) { - parent = Tk_Parent(slave); + if (containerPtr == NULL) { + parent = Tk_Parent(content); if (parent != NULL) { - masterPtr = GetGrid(parent); - InitMasterData(masterPtr); + containerPtr = GetGrid(parent); + InitContainerData(containerPtr); } } numWindows++; @@ -3069,8 +3070,8 @@ ConfigureSlaves( TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(other); - InitMasterData(masterPtr); + containerPtr = GetGrid(other); + InitContainerData(containerPtr); } else if (index == CONF_ROW) { if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK || tmp < 0) { @@ -3086,23 +3087,23 @@ ConfigureSlaves( /* * If no -row is given, use the next row after the highest occupied row - * of the master. + * of the container. */ if (defaultRow < 0) { - if (masterPtr != NULL && masterPtr->masterDataPtr != NULL) { - SetGridSize(masterPtr); - defaultRow = masterPtr->masterDataPtr->rowEnd; + if (containerPtr != NULL && containerPtr->containerDataPtr != NULL) { + SetGridSize(containerPtr); + defaultRow = containerPtr->containerDataPtr->rowEnd; } else { defaultRow = 0; } } /* - * Iterate over all of the slave windows and short-cuts, parsing options - * for each slave. It's a bit wasteful to re-parse the options for each - * slave, but things get too messy if we try to parse the arguments just - * once at the beginning. For example, if a slave already is managed we + * Iterate over all of the content windows and short-cuts, parsing options + * for each content. It's a bit wasteful to re-parse the options for each + * content, but things get too messy if we try to parse the arguments just + * once at the beginning. For example, if a content already is managed we * want to just change a few existing values without resetting everything. * If there are multiple windows, the -in option only gets processed for * the first window. @@ -3115,7 +3116,7 @@ ConfigureSlaves( /* * '^' and 'x' cause us to skip a column. '-' is processed as part of - * its preceeding slave. + * its preceeding content. */ if ((firstChar == REL_VERT) || (firstChar == REL_SKIP)) { @@ -3135,27 +3136,27 @@ ConfigureSlaves( } } - if (TkGetWindowFromObj(interp, tkwin, objv[j], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[j], &content) != TCL_OK) { return TCL_ERROR; } - if (Tk_TopWinHierarchy(slave)) { + if (Tk_TopWinHierarchy(content)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't manage \"%s\": it's a top-level window", Tcl_GetString(objv[j]))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL); return TCL_ERROR; } - slavePtr = GetGrid(slave); + contentPtr = GetGrid(content); /* * The following statement is taken from tkPack.c: * - * "If the slave isn't currently managed, reset all of its + * "If the content isn't currently managed, reset all of its * configuration information to default values (there could be old * values left from a previous packer)." * - * I [D.S.] disagree with this statement. If a slave is disabled + * I [D.S.] disagree with this statement. If a content is disabled * (using "forget") and then re-enabled, I submit that 90% of the time * the programmer will want it to retain its old configuration * information. If the programmer doesn't want this behavior, then the @@ -3176,7 +3177,7 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL); return TCL_ERROR; } - if (SetSlaveColumn(interp, slavePtr, tmp, -1) != TCL_OK) { + if (SetContentColumn(interp, contentPtr, tmp, -1) != TCL_OK) { return TCL_ERROR; } break; @@ -3189,7 +3190,7 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL); return TCL_ERROR; } - if (SetSlaveColumn(interp, slavePtr, -1, tmp) != TCL_OK) { + if (SetContentColumn(interp, contentPtr, -1, tmp) != TCL_OK) { return TCL_ERROR; } break; @@ -3198,15 +3199,15 @@ ConfigureSlaves( &other) != TCL_OK) { return TCL_ERROR; } - if (other == slave) { + if (other == content) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "window can't be managed in itself", -1)); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); return TCL_ERROR; } positionGiven = 1; - masterPtr = GetGrid(other); - InitMasterData(masterPtr); + containerPtr = GetGrid(other); + InitContainerData(containerPtr); break; case CONF_STICKY: { int sticky = StringToSticky(Tcl_GetString(objv[i+1])); @@ -3219,11 +3220,11 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "STICKY", NULL); return TCL_ERROR; } - slavePtr->sticky = sticky; + contentPtr->sticky = sticky; break; } case CONF_IPADX: - if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1], + if ((Tk_GetPixelsFromObj(NULL, content, objv[i+1], &tmp) != TCL_OK) || (tmp < 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipadx value \"%s\": must be positive screen distance", @@ -3231,10 +3232,10 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadX = tmp * 2; + contentPtr->iPadX = tmp * 2; break; case CONF_IPADY: - if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1], + if ((Tk_GetPixelsFromObj(NULL, content, objv[i+1], &tmp) != TCL_OK) || (tmp < 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipady value \"%s\": must be positive screen distance", @@ -3242,17 +3243,17 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadY = tmp * 2; + contentPtr->iPadY = tmp * 2; break; case CONF_PADX: if (TkParsePadAmount(interp, tkwin, objv[i+1], - &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) { + &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) { return TCL_ERROR; } break; case CONF_PADY: if (TkParsePadAmount(interp, tkwin, objv[i+1], - &slavePtr->padTop, &slavePtr->padY) != TCL_OK) { + &contentPtr->padTop, &contentPtr->padY) != TCL_OK) { return TCL_ERROR; } break; @@ -3265,7 +3266,7 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL); return TCL_ERROR; } - if (SetSlaveRow(interp, slavePtr, tmp, -1) != TCL_OK) { + if (SetContentRow(interp, contentPtr, tmp, -1) != TCL_OK) { return TCL_ERROR; } break; @@ -3278,7 +3279,7 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL); return TCL_ERROR; } - if (SetSlaveRow(interp, slavePtr, -1, tmp) != TCL_OK) { + if (SetContentRow(interp, contentPtr, -1, tmp) != TCL_OK) { return TCL_ERROR; } break; @@ -3286,12 +3287,12 @@ ConfigureSlaves( } /* - * If no position was specified via -in and the slave is already + * If no position was specified via -in and the content is already * packed, then leave it in its current location. */ - if (!positionGiven && (slavePtr->masterPtr != NULL)) { - masterPtr = slavePtr->masterPtr; + if (!positionGiven && (contentPtr->containerPtr != NULL)) { + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } @@ -3300,54 +3301,54 @@ ConfigureSlaves( * its current location. */ - if (positionGiven && (masterPtr == slavePtr->masterPtr)) { + if (positionGiven && (containerPtr == contentPtr->containerPtr)) { goto scheduleLayout; } /* - * Make sure we have a geometry master. We look at: + * Make sure we have a geometry container. We look at: * 1) the -in flag - * 2) the parent of the first slave. + * 2) the parent of the first content. */ - parent = Tk_Parent(slave); - if (masterPtr == NULL) { - masterPtr = GetGrid(parent); - InitMasterData(masterPtr); + parent = Tk_Parent(content); + if (containerPtr == NULL) { + containerPtr = GetGrid(parent); + InitContainerData(containerPtr); } - if (slavePtr->masterPtr != NULL && slavePtr->masterPtr != masterPtr) { - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (contentPtr->containerPtr != NULL && contentPtr->containerPtr != containerPtr) { + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - slavePtr->masterPtr = NULL; + Unlink(contentPtr); + contentPtr->containerPtr = NULL; } - if (slavePtr->masterPtr == NULL) { - Gridder *tempPtr = masterPtr->slavePtr; + if (contentPtr->containerPtr == NULL) { + Gridder *tempPtr = containerPtr->contentPtr; - slavePtr->masterPtr = masterPtr; - masterPtr->slavePtr = slavePtr; - slavePtr->nextPtr = tempPtr; + contentPtr->containerPtr = containerPtr; + containerPtr->contentPtr = contentPtr; + contentPtr->nextPtr = tempPtr; } /* - * Make sure that the slave's parent is either the master or an - * ancestor of the master, and that the master and slave aren't the + * Make sure that the content's parent is either the container or an + * ancestor of the container, and that the container and content aren't the * same. */ - for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { + for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { if (ancestor == parent) { break; } if (Tk_TopWinHierarchy(ancestor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s", Tcl_GetString(objv[j]), - Tk_PathName(masterPtr->tkwin))); + Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); - Unlink(slavePtr); + Unlink(contentPtr); return TCL_ERROR; } } @@ -3356,65 +3357,65 @@ ConfigureSlaves( * Check for management loops. */ - for (master = (TkWindow *)masterPtr->tkwin; master != NULL; - master = (TkWindow *)TkGetGeomMaster(master)) { - if (master == (TkWindow *)slave) { + for (container = (TkWindow *)containerPtr->tkwin; container != NULL; + container = (TkWindow *)TkGetGeomMaster(container)) { + if (container == (TkWindow *)content) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", - Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin))); + Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); - Unlink(slavePtr); + Unlink(contentPtr); return TCL_ERROR; } } - if (masterPtr->tkwin != Tk_Parent(slave)) { - ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin; + if (containerPtr->tkwin != Tk_Parent(content)) { + ((TkWindow *)content)->maintainerPtr = (TkWindow *)containerPtr->tkwin; } - Tk_ManageGeometry(slave, &gridMgrType, slavePtr); + Tk_ManageGeometry(content, &gridMgrType, contentPtr); - if (!(masterPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryMaster(interp, masterPtr->tkwin, "grid") + if (!(containerPtr->flags & DONT_PROPAGATE)) { + if (TkSetGeometryContainer(interp, containerPtr->tkwin, "grid") != TCL_OK) { - Tk_ManageGeometry(slave, NULL, NULL); - Unlink(slavePtr); + Tk_ManageGeometry(content, NULL, NULL); + Unlink(contentPtr); return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } /* * Assign default position information. */ - if (slavePtr->column == -1) { - if (SetSlaveColumn(interp, slavePtr, defaultColumn,-1) != TCL_OK){ + if (contentPtr->column == -1) { + if (SetContentColumn(interp, contentPtr, defaultColumn,-1) != TCL_OK){ return TCL_ERROR; } } - if (SetSlaveColumn(interp, slavePtr, -1, - slavePtr->numCols + defaultColumnSpan - 1) != TCL_OK) { + if (SetContentColumn(interp, contentPtr, -1, + contentPtr->numCols + defaultColumnSpan - 1) != TCL_OK) { return TCL_ERROR; } - if (slavePtr->row == -1) { - if (SetSlaveRow(interp, slavePtr, defaultRow, -1) != TCL_OK) { + if (contentPtr->row == -1) { + if (SetContentRow(interp, contentPtr, defaultRow, -1) != TCL_OK) { return TCL_ERROR; } } - defaultColumn += slavePtr->numCols; + defaultColumn += contentPtr->numCols; defaultColumnSpan = 1; /* - * Arrange for the master to be re-arranged at the first idle moment. + * Arrange for the container to be re-arranged at the first idle moment. */ scheduleLayout: - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } } @@ -3443,7 +3444,7 @@ ConfigureSlaves( continue; } - if (masterPtr == NULL) { + if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't use '^', cant find master", -1)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); @@ -3479,19 +3480,19 @@ ConfigureSlaves( lastColumn += numSkip; match = 0; - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - - if (slavePtr->column == lastColumn - && slavePtr->row + slavePtr->numRows - 1 == lastRow) { - if (slavePtr->numCols <= width) { - if (SetSlaveRow(interp, slavePtr, -1, - slavePtr->numRows + 1) != TCL_OK) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + + if (contentPtr->column == lastColumn + && contentPtr->row + contentPtr->numRows - 1 == lastRow) { + if (contentPtr->numCols <= width) { + if (SetContentRow(interp, contentPtr, -1, + contentPtr->numRows + 1) != TCL_OK) { return TCL_ERROR; } match++; - j += slavePtr->numCols - 1; - lastWindow = Tk_PathName(slavePtr->tkwin); + j += contentPtr->numCols - 1; + lastWindow = Tk_PathName(contentPtr->tkwin); numSkip = 0; break; } @@ -3505,22 +3506,22 @@ ConfigureSlaves( } } - if (masterPtr == NULL) { + if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't determine master window", -1)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } - SetGridSize(masterPtr); + SetGridSize(containerPtr); /* - * If we have emptied this master from slaves it means we are no longer + * If we have emptied this container from content it means we are no longer * handling it and should mark it as free. */ - if (masterPtr->slavePtr == NULL && masterPtr->flags & ALLOCED_MASTER) { - TkFreeGeometryMaster(masterPtr->tkwin, "grid"); - masterPtr->flags &= ~ALLOCED_MASTER; + if (containerPtr->contentPtr == NULL && containerPtr->flags & ALLOCED_CONTAINER) { + TkFreeGeometryContainer(containerPtr->tkwin, "grid"); + containerPtr->flags &= ~ALLOCED_CONTAINER; } return TCL_OK; diff --git a/generic/tkImage.c b/generic/tkImage.c index dc4e8e0..8192c23 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -26,7 +26,7 @@ typedef struct Image { Display *display; /* Display for tkwin. Needed because when the * image is eventually freed tkwin may not * exist anymore. */ - struct ImageMaster *masterPtr; + struct ImageModel *masterPtr; /* Master for this image (identifiers image * manager, for example). */ ClientData instanceData; /* One word argument to pass to image manager @@ -45,7 +45,7 @@ typedef struct Image { * from it. Entries in mainPtr->imageTable point to these structures. */ -typedef struct ImageMaster { +typedef struct ImageModel { Tk_ImageType *typePtr; /* Information about image type. NULL means * that no image manager owns this image: the * image was deleted. */ @@ -64,7 +64,7 @@ typedef struct ImageMaster { int deleted; /* Flag set when image is being deleted. */ TkWindow *winPtr; /* Main window of interpreter (used to detect * when the world is falling apart.) */ -} ImageMaster; +} ImageModel; typedef struct { Tk_ImageType *imageTypeList;/* First in a list of all known image @@ -82,8 +82,8 @@ static Tcl_ThreadDataKey dataKey; */ static void ImageTypeThreadExitProc(ClientData clientData); -static void DeleteImage(ImageMaster *masterPtr); -static void EventuallyDeleteImage(ImageMaster *masterPtr, +static void DeleteImage(ImageModel *masterPtr); +static void EventuallyDeleteImage(ImageModel *masterPtr, int forgetImageHashNow); /* @@ -218,7 +218,7 @@ Tk_ImageObjCmd( TkWindow *winPtr = clientData; int i, isNew, firstOption, index; Tk_ImageType *typePtr; - ImageMaster *masterPtr; + ImageModel *masterPtr; Image *imagePtr; Tcl_HashEntry *hPtr; Tcl_HashSearch search; @@ -318,7 +318,7 @@ Tk_ImageObjCmd( hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable, name, &isNew); if (isNew) { - masterPtr = ckalloc(sizeof(ImageMaster)); + masterPtr = ckalloc(sizeof(ImageModel)); masterPtr->typePtr = NULL; masterPtr->masterData = NULL; masterPtr->width = masterPtr->height = 1; @@ -371,7 +371,7 @@ Tk_ImageObjCmd( } Tcl_Preserve(masterPtr); if (typePtr->createProc(interp, name, objc, args, typePtr, - (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK){ + (Tk_ImageModel)masterPtr, &masterPtr->masterData) != TCL_OK){ EventuallyDeleteImage(masterPtr, 0); Tcl_Release(masterPtr); if (oldimage) { @@ -523,7 +523,7 @@ Tk_ImageObjCmd( void Tk_ImageChanged( - Tk_ImageMaster imageMaster, /* Image that needs redisplay. */ + Tk_ImageModel imageModel, /* Image that needs redisplay. */ int x, int y, /* Coordinates of upper-left pixel of region * of image that needs to be redrawn. */ int width, int height, /* Dimensions (in pixels) of region of image @@ -534,7 +534,7 @@ Tk_ImageChanged( int imageWidth, int imageHeight) /* New dimensions of image. */ { - ImageMaster *masterPtr = (ImageMaster *) imageMaster; + ImageModel *masterPtr = (ImageModel *) imageModel; Image *imagePtr; masterPtr->width = imageWidth; @@ -555,7 +555,7 @@ Tk_ImageChanged( * the image. * * Results: - * The return value is the string name for imageMaster. + * The return value is the string name for imageModel. * * Side effects: * None. @@ -565,9 +565,9 @@ Tk_ImageChanged( const char * Tk_NameOfImage( - Tk_ImageMaster imageMaster) /* Token for image. */ + Tk_ImageModel imageModel) /* Token for image. */ { - ImageMaster *masterPtr = (ImageMaster *) imageMaster; + ImageModel *masterPtr = (ImageModel *) imageModel; if (masterPtr->hPtr == NULL) { return NULL; @@ -610,7 +610,7 @@ Tk_GetImage( ClientData clientData) /* One-word argument to pass to damageProc. */ { Tcl_HashEntry *hPtr; - ImageMaster *masterPtr; + ImageModel *masterPtr; Image *imagePtr; hPtr = Tcl_FindHashEntry(&((TkWindow *) tkwin)->mainPtr->imageTable, name); @@ -669,7 +669,7 @@ Tk_FreeImage( * a widget. */ { Image *imagePtr = (Image *) image; - ImageMaster *masterPtr = imagePtr->masterPtr; + ImageModel *masterPtr = imagePtr->masterPtr; Image *prevPtr; /* @@ -956,7 +956,7 @@ Tk_DeleteImage( static void DeleteImage( - ImageMaster *masterPtr) /* Pointer to main data structure for image. */ + ImageModel *masterPtr) /* Pointer to main data structure for image. */ { Image *imagePtr; Tk_ImageType *typePtr; @@ -1004,7 +1004,7 @@ DeleteImage( static void EventuallyDeleteImage( - ImageMaster *masterPtr, /* Pointer to main data structure for image. */ + ImageModel *masterPtr, /* Pointer to main data structure for image. */ int forgetImageHashNow) /* Flag to say whether the hash table is about * to vanish. */ { @@ -1053,7 +1053,7 @@ TkDeleteAllImages( /* *---------------------------------------------------------------------- * - * Tk_GetImageMasterData -- + * Tk_GetImageModelData -- * * Given the name of an image, this function returns the type of the * image and the clientData associated with its master. @@ -1071,7 +1071,7 @@ TkDeleteAllImages( */ ClientData -Tk_GetImageMasterData( +Tk_GetImageModelData( Tcl_Interp *interp, /* Interpreter in which the image was * created. */ const char *name, /* Name of image. */ @@ -1081,7 +1081,7 @@ Tk_GetImageMasterData( { TkWindow *winPtr = (TkWindow *) Tk_MainWindow(interp); Tcl_HashEntry *hPtr; - ImageMaster *masterPtr; + ImageModel *masterPtr; hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, name); if (hPtr == NULL) { diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index f4ee407..8d51671 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -18,8 +18,8 @@ * image: */ -typedef struct BitmapMaster { - Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the +typedef struct BitmapModel { + Tk_ImageModel tkModel; /* Tk's token for image model. NULL means the * image is being deleted. */ Tcl_Interp *interp; /* Interpreter for application that is using * image. */ @@ -41,7 +41,7 @@ typedef struct BitmapMaster { struct BitmapInstance *instancePtr; /* First in list of all instances associated * with this master. */ -} BitmapMaster; +} BitmapModel; /* * The following data structure represents all of the instances of an image @@ -51,7 +51,7 @@ typedef struct BitmapMaster { typedef struct BitmapInstance { int refCount; /* Number of instances that share this data * structure. */ - BitmapMaster *masterPtr; /* Pointer to master for image. */ + BitmapModel *modelPtr; /* Pointer to master for image. */ Tk_Window tkwin; /* Window in which the instances will be * displayed. */ XColor *fg; /* Foreground color for displaying image. */ @@ -65,7 +65,7 @@ typedef struct BitmapInstance { * displayed. */ struct BitmapInstance *nextPtr; /* Next in list of all instance structures - * associated with masterPtr (NULL means end + * associated with modelPtr (NULL means end * of list). */ } BitmapInstance; @@ -76,7 +76,7 @@ typedef struct BitmapInstance { static int GetByte(Tcl_Channel chan); static int ImgBmapCreate(Tcl_Interp *interp, const char *name, int argc, Tcl_Obj *const objv[], - const Tk_ImageType *typePtr, Tk_ImageMaster master, + const Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData); static void ImgBmapDisplay(ClientData clientData, @@ -108,17 +108,17 @@ Tk_ImageType tkBitmapImageType = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_UID, "-background", NULL, NULL, - "", Tk_Offset(BitmapMaster, bgUid), 0, NULL}, + "", Tk_Offset(BitmapModel, bgUid), 0, NULL}, {TK_CONFIG_STRING, "-data", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, dataString), TK_CONFIG_NULL_OK, NULL}, + NULL, Tk_Offset(BitmapModel, dataString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-file", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, fileString), TK_CONFIG_NULL_OK, NULL}, + NULL, Tk_Offset(BitmapModel, fileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_UID, "-foreground", NULL, NULL, - "#000000", Tk_Offset(BitmapMaster, fgUid), 0, NULL}, + "#000000", Tk_Offset(BitmapModel, fgUid), 0, NULL}, {TK_CONFIG_STRING, "-maskdata", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, maskDataString), TK_CONFIG_NULL_OK, NULL}, + NULL, Tk_Offset(BitmapModel, maskDataString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-maskfile", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, maskFileString), TK_CONFIG_NULL_OK, NULL}, + NULL, Tk_Offset(BitmapModel, maskFileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; @@ -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(BitmapMaster *masterPtr, +static int ImgBmapConfigureModel(BitmapModel *modelPtr, int argc, Tcl_Obj *const objv[], int flags); static int NextBitmapWord(ParseInfo *parseInfoPtr); @@ -179,39 +179,39 @@ ImgBmapCreate( Tcl_Obj *const argv[], /* Argument objects for options (doesn't * include image name or type). */ const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */ - Tk_ImageMaster master, /* Token for image, to be used by us in later + Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - BitmapMaster *masterPtr = ckalloc(sizeof(BitmapMaster)); - - masterPtr->tkMaster = master; - masterPtr->interp = interp; - masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd, - masterPtr, ImgBmapCmdDeletedProc); - masterPtr->width = masterPtr->height = 0; - masterPtr->data = NULL; - masterPtr->maskData = NULL; - masterPtr->fgUid = NULL; - masterPtr->bgUid = NULL; - masterPtr->fileString = NULL; - masterPtr->dataString = NULL; - masterPtr->maskFileString = NULL; - masterPtr->maskDataString = NULL; - masterPtr->instancePtr = NULL; - if (ImgBmapConfigureMaster(masterPtr, argc, argv, 0) != TCL_OK) { - ImgBmapDelete(masterPtr); + BitmapModel *modelPtr = ckalloc(sizeof(BitmapModel)); + + modelPtr->tkModel = model; + modelPtr->interp = interp; + modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd, + modelPtr, ImgBmapCmdDeletedProc); + modelPtr->width = modelPtr->height = 0; + modelPtr->data = NULL; + modelPtr->maskData = NULL; + modelPtr->fgUid = NULL; + modelPtr->bgUid = NULL; + modelPtr->fileString = NULL; + modelPtr->dataString = NULL; + modelPtr->maskFileString = NULL; + modelPtr->maskDataString = NULL; + modelPtr->instancePtr = NULL; + if (ImgBmapConfigureModel(modelPtr, argc, argv, 0) != TCL_OK) { + ImgBmapDelete(modelPtr); return TCL_ERROR; } - *clientDataPtr = masterPtr; + *clientDataPtr = modelPtr; return TCL_OK; } /* *---------------------------------------------------------------------- * - * ImgBmapConfigureMaster -- + * ImgBmapConfigureModel -- * * This procedure is called when a bitmap image is created or * reconfigured. It process configuration options and resets any @@ -219,7 +219,7 @@ ImgBmapCreate( * * Results: * A standard Tcl return value. If TCL_ERROR is returned then an error - * message is left in the masterPtr->interp's result. + * message is left in the modelPtr->interp's result. * * Side effects: * Existing instances of the image will be redisplayed to match the new @@ -229,8 +229,8 @@ ImgBmapCreate( */ static int -ImgBmapConfigureMaster( - BitmapMaster *masterPtr, /* Pointer to data structure describing +ImgBmapConfigureModel( + BitmapModel *modelPtr, /* Pointer to data structure describing * overall bitmap image to (reconfigure). */ int objc, /* Number of entries in objv. */ Tcl_Obj *const objv[], /* Pairs of configuration options for image. */ @@ -246,8 +246,8 @@ ImgBmapConfigureMaster( } argv[objc] = NULL; - if (Tk_ConfigureWidget(masterPtr->interp, Tk_MainWindow(masterPtr->interp), - configSpecs, objc, argv, (char *) masterPtr, flags) != TCL_OK) { + if (Tk_ConfigureWidget(modelPtr->interp, Tk_MainWindow(modelPtr->interp), + configSpecs, objc, argv, (char *) modelPtr, flags) != TCL_OK) { ckfree(argv); return TCL_ERROR; } @@ -258,44 +258,44 @@ ImgBmapConfigureMaster( * bitmap and mask have the same dimensions. */ - if (masterPtr->data != NULL) { - ckfree(masterPtr->data); - masterPtr->data = NULL; + if (modelPtr->data != NULL) { + ckfree(modelPtr->data); + modelPtr->data = NULL; } - if ((masterPtr->fileString != NULL) || (masterPtr->dataString != NULL)) { - masterPtr->data = TkGetBitmapData(masterPtr->interp, - masterPtr->dataString, masterPtr->fileString, - &masterPtr->width, &masterPtr->height, &dummy1, &dummy2); - if (masterPtr->data == NULL) { + if ((modelPtr->fileString != NULL) || (modelPtr->dataString != NULL)) { + modelPtr->data = TkGetBitmapData(modelPtr->interp, + modelPtr->dataString, modelPtr->fileString, + &modelPtr->width, &modelPtr->height, &dummy1, &dummy2); + if (modelPtr->data == NULL) { return TCL_ERROR; } } - if (masterPtr->maskData != NULL) { - ckfree(masterPtr->maskData); - masterPtr->maskData = NULL; + if (modelPtr->maskData != NULL) { + ckfree(modelPtr->maskData); + modelPtr->maskData = NULL; } - if ((masterPtr->maskFileString != NULL) - || (masterPtr->maskDataString != NULL)) { - if (masterPtr->data == NULL) { - Tcl_SetObjResult(masterPtr->interp, Tcl_NewStringObj( + if ((modelPtr->maskFileString != NULL) + || (modelPtr->maskDataString != NULL)) { + if (modelPtr->data == NULL) { + Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( "can't have mask without bitmap", -1)); - Tcl_SetErrorCode(masterPtr->interp, "TK", "IMAGE", "BITMAP", + Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP", "NO_BITMAP", NULL); return TCL_ERROR; } - masterPtr->maskData = TkGetBitmapData(masterPtr->interp, - masterPtr->maskDataString, masterPtr->maskFileString, + modelPtr->maskData = TkGetBitmapData(modelPtr->interp, + modelPtr->maskDataString, modelPtr->maskFileString, &maskWidth, &maskHeight, &dummy1, &dummy2); - if (masterPtr->maskData == NULL) { + if (modelPtr->maskData == NULL) { return TCL_ERROR; } - if ((maskWidth != masterPtr->width) - || (maskHeight != masterPtr->height)) { - ckfree(masterPtr->maskData); - masterPtr->maskData = NULL; - Tcl_SetObjResult(masterPtr->interp, Tcl_NewStringObj( + if ((maskWidth != modelPtr->width) + || (maskHeight != modelPtr->height)) { + ckfree(modelPtr->maskData); + modelPtr->maskData = NULL; + Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( "bitmap and mask have different sizes", -1)); - Tcl_SetErrorCode(masterPtr->interp, "TK", "IMAGE", "BITMAP", + Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP", "MASK_SIZE", NULL); return TCL_ERROR; } @@ -307,12 +307,12 @@ ImgBmapConfigureMaster( * everywhere that it is used. */ - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { ImgBmapConfigureInstance(instancePtr); } - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width, - masterPtr->height, masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width, + modelPtr->height, modelPtr->width, modelPtr->height); return TCL_OK; } @@ -340,7 +340,7 @@ static void ImgBmapConfigureInstance( BitmapInstance *instancePtr)/* Instance to reconfigure. */ { - BitmapMaster *masterPtr = instancePtr->masterPtr; + BitmapModel *modelPtr = instancePtr->modelPtr; XColor *colorPtr; XGCValues gcValues; GC gc; @@ -348,13 +348,13 @@ ImgBmapConfigureInstance( Pixmap oldBitmap, oldMask; /* - * For each of the options in masterPtr, translate the string form into an + * For each of the options in modelPtr, translate the string form into an * internal form appropriate for instancePtr. */ - if (*masterPtr->bgUid != 0) { - colorPtr = Tk_GetColor(masterPtr->interp, instancePtr->tkwin, - masterPtr->bgUid); + if (*modelPtr->bgUid != 0) { + colorPtr = Tk_GetColor(modelPtr->interp, instancePtr->tkwin, + modelPtr->bgUid); if (colorPtr == NULL) { goto error; } @@ -366,8 +366,8 @@ ImgBmapConfigureInstance( } instancePtr->bg = colorPtr; - colorPtr = Tk_GetColor(masterPtr->interp, instancePtr->tkwin, - masterPtr->fgUid); + colorPtr = Tk_GetColor(modelPtr->interp, instancePtr->tkwin, + modelPtr->fgUid); if (colorPtr == NULL) { goto error; } @@ -388,19 +388,19 @@ ImgBmapConfigureInstance( oldMask = instancePtr->mask; instancePtr->mask = None; - if (masterPtr->data != NULL) { + if (modelPtr->data != NULL) { instancePtr->bitmap = XCreateBitmapFromData( Tk_Display(instancePtr->tkwin), RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)), - masterPtr->data, (unsigned) masterPtr->width, - (unsigned) masterPtr->height); + modelPtr->data, (unsigned) modelPtr->width, + (unsigned) modelPtr->height); } - if (masterPtr->maskData != NULL) { + if (modelPtr->maskData != NULL) { instancePtr->mask = XCreateBitmapFromData( Tk_Display(instancePtr->tkwin), RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)), - masterPtr->maskData, (unsigned) masterPtr->width, - (unsigned) masterPtr->height); + modelPtr->maskData, (unsigned) modelPtr->width, + (unsigned) modelPtr->height); } if (oldMask != None) { @@ -410,7 +410,7 @@ ImgBmapConfigureInstance( Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldBitmap); } - if (masterPtr->data != NULL) { + if (modelPtr->data != NULL) { gcValues.foreground = instancePtr->fg->pixel; gcValues.graphics_exposures = False; mask = GCForeground|GCGraphicsExposures; @@ -445,10 +445,10 @@ ImgBmapConfigureInstance( Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc); } instancePtr->gc = NULL; - Tcl_AppendObjToErrorInfo(masterPtr->interp, Tcl_ObjPrintf( + Tcl_AppendObjToErrorInfo(modelPtr->interp, Tcl_ObjPrintf( "\n (while configuring image \"%s\")", Tk_NameOfImage( - masterPtr->tkMaster))); - Tcl_BackgroundException(masterPtr->interp, TCL_ERROR); + modelPtr->tkModel))); + Tcl_BackgroundException(modelPtr->interp, TCL_ERROR); } /* @@ -757,7 +757,7 @@ ImgBmapCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const bmapOptions[] = {"cget", "configure", NULL}; - BitmapMaster *masterPtr = clientData; + BitmapModel *modelPtr = clientData; int index; if (objc < 2) { @@ -775,17 +775,17 @@ ImgBmapCmd( return TCL_ERROR; } return Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs, - (char *) masterPtr, Tcl_GetString(objv[2]), 0); + (char *) modelPtr, Tcl_GetString(objv[2]), 0); case 1: /* configure */ if (objc == 2) { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) masterPtr, NULL, 0); + configSpecs, (char *) modelPtr, NULL, 0); } else if (objc == 3) { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) masterPtr, + configSpecs, (char *) modelPtr, Tcl_GetString(objv[2]), 0); } else { - return ImgBmapConfigureMaster(masterPtr, objc-2, objv+2, + return ImgBmapConfigureModel(modelPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); } default: @@ -819,7 +819,7 @@ ImgBmapGet( ClientData masterData) /* Pointer to our master structure for the * image. */ { - BitmapMaster *masterPtr = masterData; + BitmapModel *modelPtr = masterData; BitmapInstance *instancePtr; /* @@ -827,7 +827,7 @@ ImgBmapGet( * re-use it. */ - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { if (instancePtr->tkwin == tkwin) { instancePtr->refCount++; @@ -842,15 +842,15 @@ ImgBmapGet( instancePtr = ckalloc(sizeof(BitmapInstance)); instancePtr->refCount = 1; - instancePtr->masterPtr = masterPtr; + instancePtr->modelPtr = modelPtr; instancePtr->tkwin = tkwin; instancePtr->fg = NULL; instancePtr->bg = NULL; instancePtr->bitmap = None; instancePtr->mask = None; instancePtr->gc = NULL; - instancePtr->nextPtr = masterPtr->instancePtr; - masterPtr->instancePtr = instancePtr; + instancePtr->nextPtr = modelPtr->instancePtr; + modelPtr->instancePtr = instancePtr; ImgBmapConfigureInstance(instancePtr); /* @@ -858,8 +858,8 @@ ImgBmapGet( */ if (instancePtr->nextPtr == NULL) { - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width, - masterPtr->height); + Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width, + modelPtr->height); } return instancePtr; @@ -976,10 +976,10 @@ ImgBmapFree( if (instancePtr->gc != NULL) { Tk_FreeGC(display, instancePtr->gc); } - if (instancePtr->masterPtr->instancePtr == instancePtr) { - instancePtr->masterPtr->instancePtr = instancePtr->nextPtr; + if (instancePtr->modelPtr->instancePtr == instancePtr) { + instancePtr->modelPtr->instancePtr = instancePtr->nextPtr; } else { - for (prevPtr = instancePtr->masterPtr->instancePtr; + for (prevPtr = instancePtr->modelPtr->instancePtr; prevPtr->nextPtr != instancePtr; prevPtr = prevPtr->nextPtr) { /* Empty loop body */ } @@ -1007,26 +1007,26 @@ ImgBmapFree( static void ImgBmapDelete( - ClientData masterData) /* Pointer to BitmapMaster structure for + ClientData masterData) /* Pointer to BitmapModel structure for * image. Must not have any more instances. */ { - BitmapMaster *masterPtr = masterData; + BitmapModel *modelPtr = masterData; - if (masterPtr->instancePtr != NULL) { + if (modelPtr->instancePtr != NULL) { Tcl_Panic("tried to delete bitmap image when instances still exist"); } - masterPtr->tkMaster = NULL; - if (masterPtr->imageCmd != NULL) { - Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd); + modelPtr->tkModel = NULL; + if (modelPtr->imageCmd != NULL) { + Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd); } - if (masterPtr->data != NULL) { - ckfree(masterPtr->data); + if (modelPtr->data != NULL) { + ckfree(modelPtr->data); } - if (masterPtr->maskData != NULL) { - ckfree(masterPtr->maskData); + if (modelPtr->maskData != NULL) { + ckfree(modelPtr->maskData); } - Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0); - ckfree(masterPtr); + Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0); + ckfree(modelPtr); } /* @@ -1048,14 +1048,14 @@ ImgBmapDelete( static void ImgBmapCmdDeletedProc( - ClientData clientData) /* Pointer to BitmapMaster structure for + ClientData clientData) /* Pointer to BitmapModel structure for * image. */ { - BitmapMaster *masterPtr = clientData; + BitmapModel *modelPtr = clientData; - masterPtr->imageCmd = NULL; - if (masterPtr->tkMaster != NULL) { - Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster)); + modelPtr->imageCmd = NULL; + if (modelPtr->tkModel != NULL) { + Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel)); } } @@ -1198,7 +1198,7 @@ ImgBmapPostscript( int x, int y, int width, int height, int prepass) { - BitmapMaster *masterPtr = clientData; + BitmapModel *modelPtr = clientData; Tcl_InterpState interpState; Tcl_Obj *psObj; @@ -1210,7 +1210,7 @@ ImgBmapPostscript( * There is nothing to do for bitmaps with zero width or height. */ - if (width<=0 || height<=0 || masterPtr->width<=0 || masterPtr->height<=0){ + if (width<=0 || height<=0 || modelPtr->width<=0 || modelPtr->height<=0){ return TCL_OK; } @@ -1220,7 +1220,7 @@ ImgBmapPostscript( * we bail out. */ - if (masterPtr->width*masterPtr->height > 60000) { + if (modelPtr->width*modelPtr->height > 60000) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "unable to generate postscript for bitmaps larger than 60000" " pixels", -1)); @@ -1259,10 +1259,10 @@ ImgBmapPostscript( * color to the bits specified by the mask. */ - if ((masterPtr->bgUid != NULL) && (masterPtr->bgUid[0] != '\000')) { + if ((modelPtr->bgUid != NULL) && (modelPtr->bgUid[0] != '\000')) { XColor color; - TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->bgUid, + TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), modelPtr->bgUid, &color); Tcl_ResetResult(interp); if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) { @@ -1270,13 +1270,13 @@ ImgBmapPostscript( } Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); - if (masterPtr->maskData == NULL) { + if (modelPtr->maskData == NULL) { Tcl_AppendToObj(psObj, "0 0 moveto 1 0 rlineto 0 1 rlineto -1 0 rlineto " "closepath fill\n", -1); } else { - ImgBmapPsImagemask(psObj, masterPtr->width, masterPtr->height, - masterPtr->maskData); + ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height, + modelPtr->maskData); } } @@ -1284,10 +1284,10 @@ ImgBmapPostscript( * Draw the bitmap foreground, assuming there is one. */ - if ((masterPtr->fgUid != NULL) && (masterPtr->data != NULL)) { + if ((modelPtr->fgUid != NULL) && (modelPtr->data != NULL)) { XColor color; - TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->fgUid, + TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), modelPtr->fgUid, &color); Tcl_ResetResult(interp); if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) { @@ -1295,8 +1295,8 @@ ImgBmapPostscript( } Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); - ImgBmapPsImagemask(psObj, masterPtr->width, masterPtr->height, - masterPtr->data); + ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height, + modelPtr->data); } /* diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index 32b09be..a8e5b5e 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -77,7 +77,7 @@ void TkImgPhotoConfigureInstance( PhotoInstance *instancePtr) /* Instance to reconfigure. */ { - PhotoMaster *masterPtr = instancePtr->masterPtr; + PhotoModel *masterPtr = instancePtr->masterPtr; XImage *imagePtr; int bitsPerPixel; ColorTable *colorTablePtr; @@ -210,7 +210,7 @@ TkImgPhotoGet( ClientData masterData) /* Pointer to our master structure for the * image. */ { - PhotoMaster *masterPtr = masterData; + PhotoModel *masterPtr = masterData; PhotoInstance *instancePtr; Colormap colormap; int mono, nRed, nGreen, nBlue, numVisuals; @@ -768,7 +768,7 @@ void TkImgPhotoInstanceSetSize( PhotoInstance *instancePtr) /* Instance whose size is to be changed. */ { - PhotoMaster *masterPtr; + PhotoModel *masterPtr; schar *newError, *errSrcPtr, *errDestPtr; int h, offset; XRectangle validBox; @@ -1635,7 +1635,7 @@ TkImgDitherInstance( * block to be dithered. */ int width, int height) /* Dimensions of the block to be dithered. */ { - PhotoMaster *masterPtr = instancePtr->masterPtr; + PhotoModel *masterPtr = instancePtr->masterPtr; ColorTable *colorPtr = instancePtr->colorTablePtr; XImage *imagePtr; int nLines, bigEndian, i, c, x, y, xEnd, doDithering = 1; diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 26b0446..765b8a2 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -101,7 +101,7 @@ static const char *const optionNames[] = { static int ImgPhotoCreate(Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], - const Tk_ImageType *typePtr, Tk_ImageMaster master, + const Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static void ImgPhotoDelete(ClientData clientData); static int ImgPhotoPostscript(ClientData clientData, @@ -152,15 +152,15 @@ static Tcl_ThreadDataKey dataKey; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-file", NULL, NULL, - NULL, Tk_Offset(PhotoMaster, fileString), TK_CONFIG_NULL_OK, NULL}, + NULL, Tk_Offset(PhotoModel, fileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_DOUBLE, "-gamma", NULL, NULL, - DEF_PHOTO_GAMMA, Tk_Offset(PhotoMaster, gamma), 0, NULL}, + DEF_PHOTO_GAMMA, Tk_Offset(PhotoModel, gamma), 0, NULL}, {TK_CONFIG_INT, "-height", NULL, NULL, - DEF_PHOTO_HEIGHT, Tk_Offset(PhotoMaster, userHeight), 0, NULL}, + DEF_PHOTO_HEIGHT, Tk_Offset(PhotoModel, userHeight), 0, NULL}, {TK_CONFIG_UID, "-palette", NULL, NULL, - DEF_PHOTO_PALETTE, Tk_Offset(PhotoMaster, palette), 0, NULL}, + DEF_PHOTO_PALETTE, Tk_Offset(PhotoModel, palette), 0, NULL}, {TK_CONFIG_INT, "-width", NULL, NULL, - DEF_PHOTO_WIDTH, Tk_Offset(PhotoMaster, userWidth), 0, NULL}, + DEF_PHOTO_WIDTH, Tk_Offset(PhotoModel, userWidth), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; @@ -176,16 +176,16 @@ 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, - PhotoMaster *masterPtr, int objc, +static int ImgPhotoConfigureModel(Tcl_Interp *interp, + PhotoModel *modelPtr, int objc, Tcl_Obj *const objv[], int flags); -static int ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr); -static int ImgPhotoSetSize(PhotoMaster *masterPtr, int width, +static int ToggleComplexAlphaIfNeeded(PhotoModel *mPtr); +static int ImgPhotoSetSize(PhotoModel *modelPtr, int width, int height); static int ImgStringWrite(Tcl_Interp *interp, Tcl_Obj *formatString, Tk_PhotoImageBlock *blockPtr); -static char * ImgGetPhoto(PhotoMaster *masterPtr, +static char * ImgGetPhoto(PhotoModel *modelPtr, Tk_PhotoImageBlock *blockPtr, struct SubcommandOptions *optPtr); static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan, @@ -331,38 +331,38 @@ ImgPhotoCreate( Tcl_Obj *const objv[], /* Argument objects for options (doesn't * include image name or type). */ const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */ - Tk_ImageMaster master, /* Token for image, to be used by us in later + Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - PhotoMaster *masterPtr; + PhotoModel *modelPtr; /* * Allocate and initialize the photo image master record. */ - masterPtr = ckalloc(sizeof(PhotoMaster)); - memset(masterPtr, 0, sizeof(PhotoMaster)); - masterPtr->tkMaster = master; - masterPtr->interp = interp; - masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd, - masterPtr, ImgPhotoCmdDeletedProc); - masterPtr->palette = NULL; - masterPtr->pix32 = NULL; - masterPtr->instancePtr = NULL; - masterPtr->validRegion = TkCreateRegion(); + modelPtr = ckalloc(sizeof(PhotoModel)); + memset(modelPtr, 0, sizeof(PhotoModel)); + modelPtr->tkMaster = model; + modelPtr->interp = interp; + modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd, + modelPtr, ImgPhotoCmdDeletedProc); + modelPtr->palette = NULL; + modelPtr->pix32 = NULL; + modelPtr->instancePtr = NULL; + modelPtr->validRegion = TkCreateRegion(); /* * Process configuration options given in the image create command. */ - if (ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, 0) != TCL_OK) { - ImgPhotoDelete(masterPtr); + if (ImgPhotoConfigureModel(interp, modelPtr, objc, objv, 0) != TCL_OK) { + ImgPhotoDelete(modelPtr); return TCL_ERROR; } - *clientDataPtr = masterPtr; + *clientDataPtr = modelPtr; return TCL_OK; } @@ -401,7 +401,7 @@ ImgPhotoCmd( PHOTO_WRITE }; - PhotoMaster *masterPtr = clientData; + PhotoModel *modelPtr = clientData; int result, index, x, y, width, height, dataWidth, dataHeight, listObjc; struct SubcommandOptions options; Tcl_Obj **listObjv, **srcObjv; @@ -433,7 +433,7 @@ ImgPhotoCmd( */ if (objc == 2) { - Tk_PhotoBlank(masterPtr); + Tk_PhotoBlank(modelPtr); return TCL_OK; } else { Tcl_WrongNumArgs(interp, 2, objv, NULL); @@ -450,16 +450,16 @@ ImgPhotoCmd( arg = Tcl_GetString(objv[2]); length = objv[2]->length; if (strncmp(arg,"-data", length) == 0) { - if (masterPtr->dataString) { - Tcl_SetObjResult(interp, masterPtr->dataString); + if (modelPtr->dataString) { + Tcl_SetObjResult(interp, modelPtr->dataString); } } else if (strncmp(arg,"-format", length) == 0) { - if (masterPtr->format) { - Tcl_SetObjResult(interp, masterPtr->format); + if (modelPtr->format) { + Tcl_SetObjResult(interp, modelPtr->format); } } else { Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs, - (char *) masterPtr, Tcl_GetString(objv[2]), 0); + (char *) modelPtr, Tcl_GetString(objv[2]), 0); } return TCL_OK; } @@ -473,21 +473,21 @@ ImgPhotoCmd( Tcl_Obj *obj, *subobj; result = Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) masterPtr, NULL, 0); + configSpecs, (char *) modelPtr, NULL, 0); if (result != TCL_OK) { return result; } obj = Tcl_NewObj(); subobj = Tcl_NewStringObj("-data {} {} {}", 14); - if (masterPtr->dataString) { - Tcl_ListObjAppendElement(NULL, subobj, masterPtr->dataString); + if (modelPtr->dataString) { + Tcl_ListObjAppendElement(NULL, subobj, modelPtr->dataString); } else { Tcl_AppendStringsToObj(subobj, " {}", NULL); } Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewStringObj("-format {} {} {}", 16); - if (masterPtr->format) { - Tcl_ListObjAppendElement(NULL, subobj, masterPtr->format); + if (modelPtr->format) { + Tcl_ListObjAppendElement(NULL, subobj, modelPtr->format); } else { Tcl_AppendStringsToObj(subobj, " {}", NULL); } @@ -502,13 +502,13 @@ ImgPhotoCmd( length = objv[2]->length; if (length > 1 && !strncmp(arg, "-data", length)) { Tcl_AppendResult(interp, "-data {} {} {}", NULL); - if (masterPtr->dataString) { + if (modelPtr->dataString) { /* * TODO: Modifying result is bad! */ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), - masterPtr->dataString); + modelPtr->dataString); } else { Tcl_AppendResult(interp, " {}", NULL); } @@ -516,23 +516,23 @@ ImgPhotoCmd( } else if (length > 1 && !strncmp(arg, "-format", length)) { Tcl_AppendResult(interp, "-format {} {} {}", NULL); - if (masterPtr->format) { + if (modelPtr->format) { /* * TODO: Modifying result is bad! */ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), - masterPtr->format); + modelPtr->format); } else { Tcl_AppendResult(interp, " {}", NULL); } return TCL_OK; } else { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) masterPtr, arg, 0); + configSpecs, (char *) modelPtr, arg, 0); } } else { - return ImgPhotoConfigureMaster(interp, masterPtr, objc-2, objv+2, + return ImgPhotoConfigureModel(interp, modelPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); } @@ -591,7 +591,7 @@ ImgPhotoCmd( * has a simple alpha channel. */ - if (!(((PhotoMaster *) srcHandle)->flags & COMPLEX_ALPHA)) { + if (!(((PhotoModel *) srcHandle)->flags & COMPLEX_ALPHA)) { options.compositingRule |= SOURCE_IS_SIMPLE_ALPHA_PHOTO; } @@ -635,7 +635,7 @@ ImgPhotoCmd( + options.fromY * block.pitch; block.width = options.fromX2 - options.fromX; block.height = options.fromY2 - options.fromY; - result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr, + result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) modelPtr, &block, options.toX, options.toY, options.toX2 - options.toX, options.toY2 - options.toY, options.zoomX, options.zoomY, options.subsampleX, options.subsampleY, @@ -649,7 +649,7 @@ ImgPhotoCmd( */ if (options.options & OPT_SHRINK) { - if (ImgPhotoSetSize(masterPtr, options.toX2, + if (ImgPhotoSetSize(modelPtr, options.toX2, options.toY2) != TCL_OK) { if (options.background) { Tk_FreeColor(options.background); @@ -660,8 +660,8 @@ ImgPhotoCmd( return TCL_ERROR; } } - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, - masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, + modelPtr->width, modelPtr->height); if (options.background) { Tk_FreeColor(options.background); } @@ -691,10 +691,10 @@ ImgPhotoCmd( Tcl_WrongNumArgs(interp, 2, objv, "?-option value ...?"); return TCL_ERROR; } - if ((options.fromX > masterPtr->width) - || (options.fromY > masterPtr->height) - || (options.fromX2 > masterPtr->width) - || (options.fromY2 > masterPtr->height)) { + if ((options.fromX > modelPtr->width) + || (options.fromY > modelPtr->height) + || (options.fromX2 > modelPtr->width) + || (options.fromY2 > modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); @@ -706,8 +706,8 @@ ImgPhotoCmd( */ if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) { - options.fromX2 = masterPtr->width; - options.fromY2 = masterPtr->height; + options.fromX2 = modelPtr->width; + options.fromY2 = modelPtr->height; } /* @@ -759,7 +759,7 @@ ImgPhotoCmd( * Call the handler's string write function to write out the image. */ - data = ImgGetPhoto(masterPtr, &block, &options); + data = ImgGetPhoto(modelPtr, &block, &options); if (oldformat) { Tcl_DString buffer; @@ -807,8 +807,8 @@ ImgPhotoCmd( || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) { return TCL_ERROR; } - if ((x < 0) || (x >= masterPtr->width) - || (y < 0) || (y >= masterPtr->height)) { + if ((x < 0) || (x >= modelPtr->width) + || (y < 0) || (y >= modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s get: coordinates out of range", Tcl_GetString(objv[0]))); @@ -821,7 +821,7 @@ ImgPhotoCmd( * Extract the value of the desired pixel and format it as a string. */ - pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; + pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; channels[0] = Tcl_NewIntObj(pixelPtr[0]); channels[1] = Tcl_NewIntObj(pixelPtr[1]); channels[2] = Tcl_NewIntObj(pixelPtr[2]); @@ -870,11 +870,11 @@ ImgPhotoCmd( data = (Tcl_Obj *) Tcl_GetString(data); } if (imageFormat->stringReadProc(interp, data, format, - (Tk_PhotoHandle) masterPtr, options.toX, options.toY, + (Tk_PhotoHandle) modelPtr, options.toX, options.toY, imageWidth, imageHeight, 0, 0) != TCL_OK) { return TCL_ERROR; } - masterPtr->flags |= IMAGE_CHANGED; + modelPtr->flags |= IMAGE_CHANGED; return TCL_OK; } if (options.options & OPT_FORMAT) { @@ -1007,7 +1007,7 @@ ImgPhotoCmd( block.offset[1] = 1; block.offset[2] = 2; block.offset[3] = 0; - result = Tk_PhotoPutBlock(interp, masterPtr, &block, + result = Tk_PhotoPutBlock(interp, modelPtr, &block, options.toX, options.toY, options.toX2 - options.toX, options.toY2 - options.toY, TK_PHOTO_COMPOSITE_SET); @@ -1100,7 +1100,7 @@ ImgPhotoCmd( */ if (options.options & OPT_SHRINK) { - if (ImgPhotoSetSize(masterPtr, options.toX + width, + if (ImgPhotoSetSize(modelPtr, options.toX + width, options.toY + height) != TCL_OK) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -1122,7 +1122,7 @@ ImgPhotoCmd( } result = imageFormat->fileReadProc(interp, chan, Tcl_GetString(options.name), - format, (Tk_PhotoHandle) masterPtr, options.toX, + format, (Tk_PhotoHandle) modelPtr, options.toX, options.toY, width, height, options.fromX, options.fromY); if (chan != NULL) { Tcl_Close(NULL, chan); @@ -1141,27 +1141,27 @@ ImgPhotoCmd( * present. */ - x = masterPtr->ditherX; - y = masterPtr->ditherY; - if (masterPtr->ditherX != 0) { - Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y, - masterPtr->width - x, 1); + x = modelPtr->ditherX; + y = modelPtr->ditherY; + if (modelPtr->ditherX != 0) { + Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y, + modelPtr->width - x, 1); } - if (masterPtr->ditherY < masterPtr->height) { + if (modelPtr->ditherY < modelPtr->height) { x = 0; - Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, 0, - masterPtr->ditherY, masterPtr->width, - masterPtr->height - masterPtr->ditherY); + Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, 0, + modelPtr->ditherY, modelPtr->width, + modelPtr->height - modelPtr->ditherY); } - if (y < masterPtr->height) { + if (y < modelPtr->height) { /* * Tell the core image code that part of the image has changed. */ - Tk_ImageChanged(masterPtr->tkMaster, x, y, - (masterPtr->width - x), (masterPtr->height - y), - masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, x, y, + (modelPtr->width - x), (modelPtr->height - y), + modelPtr->width, modelPtr->height); } return TCL_OK; @@ -1195,8 +1195,8 @@ ImgPhotoCmd( || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)) { return TCL_ERROR; } - if ((x < 0) || (x >= masterPtr->width) - || (y < 0) || (y >= masterPtr->height)) { + if ((x < 0) || (x >= modelPtr->width) + || (y < 0) || (y >= modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s transparency get: coordinates out of range", Tcl_GetString(objv[0]))); @@ -1212,7 +1212,7 @@ ImgPhotoCmd( /* What a way to do a test! */ testRegion = TkCreateRegion(); TkUnionRectWithRegion(&testBox, testRegion, testRegion); - TkIntersectRegion(testRegion, masterPtr->validRegion, testRegion); + TkIntersectRegion(testRegion, modelPtr->validRegion, testRegion); TkClipBox(testRegion, &testBox); TkDestroyRegion(testRegion); @@ -1235,8 +1235,8 @@ ImgPhotoCmd( &transFlag) != TCL_OK)) { return TCL_ERROR; } - if ((x < 0) || (x >= masterPtr->width) - || (y < 0) || (y >= masterPtr->height)) { + if ((x < 0) || (x >= modelPtr->width) + || (y < 0) || (y >= modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s transparency set: coordinates out of range", Tcl_GetString(objv[0]))); @@ -1249,7 +1249,7 @@ ImgPhotoCmd( setBox.y = y; setBox.width = 1; setBox.height = 1; - pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; + pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; if (transFlag) { /* @@ -1259,8 +1259,8 @@ ImgPhotoCmd( TkRegion clearRegion = TkCreateRegion(); TkUnionRectWithRegion(&setBox, clearRegion, clearRegion); - TkSubtractRegion(masterPtr->validRegion, clearRegion, - masterPtr->validRegion); + TkSubtractRegion(modelPtr->validRegion, clearRegion, + modelPtr->validRegion); TkDestroyRegion(clearRegion); /* @@ -1273,8 +1273,8 @@ ImgPhotoCmd( * Make pixel opaque. */ - TkUnionRectWithRegion(&setBox, masterPtr->validRegion, - masterPtr->validRegion); + TkUnionRectWithRegion(&setBox, modelPtr->validRegion, + modelPtr->validRegion); pixelPtr[3] = 255; } @@ -1283,9 +1283,9 @@ ImgPhotoCmd( * has (potentially) changed. */ - Tk_ImageChanged(masterPtr->tkMaster, x, y, 1, 1, - masterPtr->width, masterPtr->height); - masterPtr->flags &= ~IMAGE_CHANGED; + Tk_ImageChanged(modelPtr->tkMaster, x, y, 1, 1, + modelPtr->width, modelPtr->height); + modelPtr->flags &= ~IMAGE_CHANGED; return TCL_OK; } @@ -1327,10 +1327,10 @@ ImgPhotoCmd( Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?"); return TCL_ERROR; } - if ((options.fromX > masterPtr->width) - || (options.fromY > masterPtr->height) - || (options.fromX2 > masterPtr->width) - || (options.fromY2 > masterPtr->height)) { + if ((options.fromX > modelPtr->width) + || (options.fromY > modelPtr->height) + || (options.fromX2 > modelPtr->width) + || (options.fromY2 > modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); @@ -1344,8 +1344,8 @@ ImgPhotoCmd( */ if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) { - options.fromX2 = masterPtr->width; - options.fromY2 = masterPtr->height; + options.fromX2 = modelPtr->width; + options.fromY2 = modelPtr->height; } if (options.format == NULL) { fmtString = GetExtension(Tcl_GetString(options.name)); @@ -1420,7 +1420,7 @@ ImgPhotoCmd( * Call the handler's file write function to write out the image. */ - data = ImgGetPhoto(masterPtr, &block, &options); + data = ImgGetPhoto(modelPtr, &block, &options); format = options.format; if (oldformat && format) { format = (Tcl_Obj *) Tcl_GetString(options.format); @@ -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 @@ -1767,7 +1767,7 @@ ParseSubcommandOptions( * * Results: * A standard Tcl return value. If TCL_ERROR is returned then an error - * message is left in the masterPtr->interp's result. + * message is left in the modelPtr->interp's result. * * Side effects: * Existing instances of the image will be redisplayed to match the new @@ -1777,9 +1777,9 @@ ParseSubcommandOptions( */ static int -ImgPhotoConfigureMaster( +ImgPhotoConfigureModel( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ - PhotoMaster *masterPtr, /* Pointer to data structure describing + PhotoModel *modelPtr, /* Pointer to data structure describing * overall photo image to (re)configure. */ int objc, /* Number of entries in objv. */ Tcl_Obj *const objv[], /* Pairs of configuration options for image. */ @@ -1839,28 +1839,28 @@ ImgPhotoConfigureMaster( * the format string influences how "-data" or "-file" is interpreted. */ - oldFileString = masterPtr->fileString; + oldFileString = modelPtr->fileString; if (oldFileString == NULL) { - oldData = masterPtr->dataString; + oldData = modelPtr->dataString; if (oldData != NULL) { Tcl_IncrRefCount(oldData); } } else { oldData = NULL; } - oldFormat = masterPtr->format; + oldFormat = modelPtr->format; if (oldFormat != NULL) { Tcl_IncrRefCount(oldFormat); } - oldPaletteString = masterPtr->palette; - oldGamma = masterPtr->gamma; + oldPaletteString = modelPtr->palette; + oldGamma = modelPtr->gamma; /* * Process the configuration options specified. */ if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs, - j, args, (char *) masterPtr, flags) != TCL_OK) { + j, args, (char *) modelPtr, flags) != TCL_OK) { ckfree(args); goto errorExit; } @@ -1870,9 +1870,9 @@ ImgPhotoConfigureMaster( * Regard the empty string for -file, -data or -format as the null value. */ - if ((masterPtr->fileString != NULL) && (masterPtr->fileString[0] == 0)) { - ckfree(masterPtr->fileString); - masterPtr->fileString = NULL; + if ((modelPtr->fileString != NULL) && (modelPtr->fileString[0] == 0)) { + ckfree(modelPtr->fileString); + modelPtr->fileString = NULL; } if (data) { /* @@ -1887,10 +1887,10 @@ ImgPhotoConfigureMaster( } else { data = NULL; } - if (masterPtr->dataString) { - Tcl_DecrRefCount(masterPtr->dataString); + if (modelPtr->dataString) { + Tcl_DecrRefCount(modelPtr->dataString); } - masterPtr->dataString = data; + modelPtr->dataString = data; } if (format) { /* @@ -1904,18 +1904,18 @@ ImgPhotoConfigureMaster( } else { format = NULL; } - if (masterPtr->format) { - Tcl_DecrRefCount(masterPtr->format); + if (modelPtr->format) { + Tcl_DecrRefCount(modelPtr->format); } - masterPtr->format = format; + modelPtr->format = format; } /* * Set the image to the user-requested size, if any, and make sure storage * is correctly allocated for this image. */ - if (ImgPhotoSetSize(masterPtr, masterPtr->width, - masterPtr->height) != TCL_OK) { + if (ImgPhotoSetSize(modelPtr, modelPtr->width, + modelPtr->height) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); @@ -1927,9 +1927,9 @@ ImgPhotoConfigureMaster( * -file or -data option. */ - if ((masterPtr->fileString != NULL) - && ((masterPtr->fileString != oldFileString) - || (masterPtr->format != oldFormat))) { + if ((modelPtr->fileString != NULL) + && ((modelPtr->fileString != oldFileString) + || (modelPtr->format != oldFormat))) { /* * Prevent file system access in a safe interpreter. */ @@ -1943,7 +1943,7 @@ ImgPhotoConfigureMaster( goto errorExit; } - chan = Tcl_OpenFileChannel(interp, masterPtr->fileString, "r", 0); + chan = Tcl_OpenFileChannel(interp, modelPtr->fileString, "r", 0); if (chan == NULL) { goto errorExit; } @@ -1954,13 +1954,13 @@ ImgPhotoConfigureMaster( if ((Tcl_SetChannelOption(interp, chan, "-translation", "binary") != TCL_OK) || - (MatchFileFormat(interp, chan, masterPtr->fileString, - masterPtr->format, &imageFormat, &imageWidth, + (MatchFileFormat(interp, chan, modelPtr->fileString, + modelPtr->format, &imageFormat, &imageWidth, &imageHeight, &oldformat) != TCL_OK)) { Tcl_Close(NULL, chan); goto errorExit; } - result = ImgPhotoSetSize(masterPtr, imageWidth, imageHeight); + result = ImgPhotoSetSize(modelPtr, imageWidth, imageHeight); if (result != TCL_OK) { Tcl_Close(NULL, chan); Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -1968,12 +1968,12 @@ ImgPhotoConfigureMaster( Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); goto errorExit; } - tempformat = masterPtr->format; + tempformat = modelPtr->format; if (oldformat && tempformat) { tempformat = (Tcl_Obj *) Tcl_GetString(tempformat); } result = imageFormat->fileReadProc(interp, chan, - masterPtr->fileString, tempformat, (Tk_PhotoHandle) masterPtr, + modelPtr->fileString, tempformat, (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight, 0, 0); Tcl_Close(NULL, chan); if (result != TCL_OK) { @@ -1981,26 +1981,26 @@ ImgPhotoConfigureMaster( } Tcl_ResetResult(interp); - masterPtr->flags |= IMAGE_CHANGED; + modelPtr->flags |= IMAGE_CHANGED; } - if ((masterPtr->fileString == NULL) && (masterPtr->dataString != NULL) - && ((masterPtr->dataString != oldData) - || (masterPtr->format != oldFormat))) { + if ((modelPtr->fileString == NULL) && (modelPtr->dataString != NULL) + && ((modelPtr->dataString != oldData) + || (modelPtr->format != oldFormat))) { - if (MatchStringFormat(interp, masterPtr->dataString, - masterPtr->format, &imageFormat, &imageWidth, + if (MatchStringFormat(interp, modelPtr->dataString, + modelPtr->format, &imageFormat, &imageWidth, &imageHeight, &oldformat) != TCL_OK) { goto errorExit; } - if (ImgPhotoSetSize(masterPtr, imageWidth, imageHeight) != TCL_OK) { + if (ImgPhotoSetSize(modelPtr, imageWidth, imageHeight) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); goto errorExit; } - tempformat = masterPtr->format; - tempdata = masterPtr->dataString; + tempformat = modelPtr->format; + tempdata = modelPtr->dataString; if (oldformat) { if (tempformat) { tempformat = (Tcl_Obj *) Tcl_GetString(tempformat); @@ -2008,26 +2008,26 @@ ImgPhotoConfigureMaster( tempdata = (Tcl_Obj *) Tcl_GetString(tempdata); } if (imageFormat->stringReadProc(interp, tempdata, tempformat, - (Tk_PhotoHandle) masterPtr, 0, 0, imageWidth, imageHeight, + (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight, 0, 0) != TCL_OK) { goto errorExit; } Tcl_ResetResult(interp); - masterPtr->flags |= IMAGE_CHANGED; + modelPtr->flags |= IMAGE_CHANGED; } /* * Enforce a reasonable value for gamma. */ - if (masterPtr->gamma <= 0) { - masterPtr->gamma = 1.0; + if (modelPtr->gamma <= 0) { + modelPtr->gamma = 1.0; } - if ((masterPtr->gamma != oldGamma) - || (masterPtr->palette != oldPaletteString)) { - masterPtr->flags |= IMAGE_CHANGED; + if ((modelPtr->gamma != oldGamma) + || (modelPtr->palette != oldPaletteString)) { + modelPtr->flags |= IMAGE_CHANGED; } /* @@ -2036,7 +2036,7 @@ ImgPhotoConfigureMaster( * everywhere that it is used. */ - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { TkImgPhotoConfigureInstance(instancePtr); } @@ -2045,9 +2045,9 @@ ImgPhotoConfigureMaster( * Inform the generic image code that the image has (potentially) changed. */ - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width, - masterPtr->height, masterPtr->width, masterPtr->height); - masterPtr->flags &= ~IMAGE_CHANGED; + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width, + modelPtr->height, modelPtr->width, modelPtr->height); + modelPtr->flags &= ~IMAGE_CHANGED; if (oldData != NULL) { Tcl_DecrRefCount(oldData); @@ -2056,7 +2056,7 @@ ImgPhotoConfigureMaster( Tcl_DecrRefCount(oldFormat); } - ToggleComplexAlphaIfNeeded(masterPtr); + ToggleComplexAlphaIfNeeded(modelPtr); return TCL_OK; @@ -2090,7 +2090,7 @@ ImgPhotoConfigureMaster( static int ToggleComplexAlphaIfNeeded( - PhotoMaster *mPtr) + PhotoModel *mPtr) { size_t len = (size_t)MAX(mPtr->userWidth, mPtr->width) * (size_t)MAX(mPtr->userHeight, mPtr->height) * 4; @@ -2135,37 +2135,37 @@ ToggleComplexAlphaIfNeeded( static void ImgPhotoDelete( - ClientData masterData) /* Pointer to PhotoMaster structure for image. + ClientData masterData) /* Pointer to PhotoModel structure for image. * Must not have any more instances. */ { - PhotoMaster *masterPtr = masterData; + PhotoModel *modelPtr = masterData; PhotoInstance *instancePtr; - while ((instancePtr = masterPtr->instancePtr) != NULL) { + while ((instancePtr = modelPtr->instancePtr) != NULL) { if (instancePtr->refCount > 0) { Tcl_Panic("tried to delete photo image when instances still exist"); } Tcl_CancelIdleCall(TkImgDisposeInstance, instancePtr); TkImgDisposeInstance(instancePtr); } - masterPtr->tkMaster = NULL; - if (masterPtr->imageCmd != NULL) { - Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd); + modelPtr->tkMaster = NULL; + if (modelPtr->imageCmd != NULL) { + Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd); } - if (masterPtr->pix32 != NULL) { - ckfree(masterPtr->pix32); + if (modelPtr->pix32 != NULL) { + ckfree(modelPtr->pix32); } - if (masterPtr->validRegion != NULL) { - TkDestroyRegion(masterPtr->validRegion); + if (modelPtr->validRegion != NULL) { + TkDestroyRegion(modelPtr->validRegion); } - if (masterPtr->dataString != NULL) { - Tcl_DecrRefCount(masterPtr->dataString); + if (modelPtr->dataString != NULL) { + Tcl_DecrRefCount(modelPtr->dataString); } - if (masterPtr->format != NULL) { - Tcl_DecrRefCount(masterPtr->format); + if (modelPtr->format != NULL) { + Tcl_DecrRefCount(modelPtr->format); } - Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0); - ckfree(masterPtr); + Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0); + ckfree(modelPtr); } /* @@ -2187,14 +2187,14 @@ ImgPhotoDelete( static void ImgPhotoCmdDeletedProc( - ClientData clientData) /* Pointer to PhotoMaster structure for + ClientData clientData) /* Pointer to PhotoModel structure for * image. */ { - PhotoMaster *masterPtr = clientData; + PhotoModel *modelPtr = clientData; - masterPtr->imageCmd = NULL; - if (masterPtr->tkMaster != NULL) { - Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster)); + modelPtr->imageCmd = NULL; + if (modelPtr->tkMaster != NULL) { + Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkMaster)); } } @@ -2219,7 +2219,7 @@ ImgPhotoCmdDeletedProc( static int ImgPhotoSetSize( - PhotoMaster *masterPtr, + PhotoModel *modelPtr, int width, int height) { unsigned char *newPix32 = NULL; @@ -2229,11 +2229,11 @@ ImgPhotoSetSize( TkRegion clipRegion; PhotoInstance *instancePtr; - if (masterPtr->userWidth > 0) { - width = masterPtr->userWidth; + if (modelPtr->userWidth > 0) { + width = modelPtr->userWidth; } - if (masterPtr->userHeight > 0) { - height = masterPtr->userHeight; + if (modelPtr->userHeight > 0) { + height = modelPtr->userHeight; } if (width > INT_MAX / 4) { @@ -2247,8 +2247,8 @@ ImgPhotoSetSize( * failures will leave the photo unchanged. */ - if ((width != masterPtr->width) || (height != masterPtr->height) - || (masterPtr->pix32 == NULL)) { + if ((width != modelPtr->width) || (height != modelPtr->height) + || (modelPtr->pix32 == NULL)) { unsigned newPixSize; if (pitch && height > (int)(UINT_MAX / pitch)) { @@ -2275,7 +2275,7 @@ ImgPhotoSetSize( * image size. */ - TkClipBox(masterPtr->validRegion, &validBox); + TkClipBox(modelPtr->validRegion, &validBox); if ((validBox.x + validBox.width > width) || (validBox.y + validBox.height > height)) { clipBox.x = 0; @@ -2284,10 +2284,10 @@ ImgPhotoSetSize( clipBox.height = height; clipRegion = TkCreateRegion(); TkUnionRectWithRegion(&clipBox, clipRegion, clipRegion); - TkIntersectRegion(masterPtr->validRegion, clipRegion, - masterPtr->validRegion); + TkIntersectRegion(modelPtr->validRegion, clipRegion, + modelPtr->validRegion); TkDestroyRegion(clipRegion); - TkClipBox(masterPtr->validRegion, &validBox); + TkClipBox(modelPtr->validRegion, &validBox); } /* @@ -2303,8 +2303,8 @@ ImgPhotoSetSize( * or written to a file. */ - if ((masterPtr->pix32 != NULL) - && ((width == masterPtr->width) || (width == validBox.width))) { + if ((modelPtr->pix32 != NULL) + && ((width == modelPtr->width) || (width == validBox.width))) { if (validBox.y > 0) { memset(newPix32, 0, ((size_t) validBox.y * pitch)); } @@ -2316,20 +2316,20 @@ ImgPhotoSetSize( memset(newPix32, 0, ((size_t)height * pitch)); } - if (masterPtr->pix32 != NULL) { + if (modelPtr->pix32 != NULL) { /* * Copy the common area over to the new array array and free the * old array. */ - if (width == masterPtr->width) { + if (width == modelPtr->width) { /* * The region to be copied is contiguous. */ offset = validBox.y * pitch; - memcpy(newPix32 + offset, masterPtr->pix32 + offset, + memcpy(newPix32 + offset, modelPtr->pix32 + offset, ((size_t)validBox.height * pitch)); } else if ((validBox.width > 0) && (validBox.height > 0)) { @@ -2338,21 +2338,21 @@ ImgPhotoSetSize( */ destPtr = newPix32 + (validBox.y * width + validBox.x) * 4; - srcPtr = masterPtr->pix32 + (validBox.y * masterPtr->width + srcPtr = modelPtr->pix32 + (validBox.y * modelPtr->width + validBox.x) * 4; for (h = validBox.height; h > 0; h--) { memcpy(destPtr, srcPtr, ((size_t)validBox.width * 4)); destPtr += width * 4; - srcPtr += masterPtr->width * 4; + srcPtr += modelPtr->width * 4; } } - ckfree(masterPtr->pix32); + ckfree(modelPtr->pix32); } - masterPtr->pix32 = newPix32; - masterPtr->width = width; - masterPtr->height = height; + modelPtr->pix32 = newPix32; + modelPtr->width = width; + modelPtr->height = height; /* * Dithering will be correct up to the end of the last pre-existing @@ -2360,27 +2360,27 @@ ImgPhotoSetSize( */ if ((validBox.x > 0) || (validBox.y > 0)) { - masterPtr->ditherX = 0; - masterPtr->ditherY = 0; + modelPtr->ditherX = 0; + modelPtr->ditherY = 0; } else if (validBox.width == width) { - if ((int) validBox.height < masterPtr->ditherY) { - masterPtr->ditherX = 0; - masterPtr->ditherY = validBox.height; + if ((int) validBox.height < modelPtr->ditherY) { + modelPtr->ditherX = 0; + modelPtr->ditherY = validBox.height; } - } else if ((masterPtr->ditherY > 0) - || ((int) validBox.width < masterPtr->ditherX)) { - masterPtr->ditherX = validBox.width; - masterPtr->ditherY = 0; + } else if ((modelPtr->ditherY > 0) + || ((int) validBox.width < modelPtr->ditherX)) { + modelPtr->ditherX = validBox.width; + modelPtr->ditherY = 0; } } - ToggleComplexAlphaIfNeeded(masterPtr); + ToggleComplexAlphaIfNeeded(modelPtr); /* * Now adjust the sizes of the pixmaps for all of the instances. */ - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { TkImgPhotoInstanceSetSize(instancePtr); } @@ -2659,7 +2659,7 @@ MatchStringFormat( * Tk_FindPhoto -- * * This function is called to get an opaque handle (actually a - * PhotoMaster *) for a given image, which can be used in subsequent + * PhotoModel *) for a given image, which can be used in subsequent * calls to Tk_PhotoPutBlock, etc. The `name' parameter is the name of * the image. * @@ -2724,7 +2724,7 @@ Tk_PhotoPutBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoMaster *masterPtr = (PhotoMaster *) handle; + register PhotoModel *modelPtr = (PhotoModel *) handle; Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -2743,12 +2743,12 @@ Tk_PhotoPutBlock( compRule &= ~SOURCE_IS_SIMPLE_ALPHA_PHOTO; - if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) { - width = masterPtr->userWidth - x; + if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) { + width = modelPtr->userWidth - x; } - if ((masterPtr->userHeight != 0) - && ((y + height) > masterPtr->userHeight)) { - height = masterPtr->userHeight - y; + if ((modelPtr->userHeight != 0) + && ((y + height) > modelPtr->userHeight)) { + height = modelPtr->userHeight - y; } if ((width <= 0) || (height <= 0)) { return TCL_OK; @@ -2769,18 +2769,18 @@ Tk_PhotoPutBlock( */ sourceBlock = *blockPtr; memToFree = NULL; - if (sourceBlock.pixelPtr >= masterPtr->pix32 - && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width - * masterPtr->height * 4) { + if (sourceBlock.pixelPtr >= modelPtr->pix32 + && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width + * modelPtr->height * 4) { /* * Fix 5c51be6411: avoid reading * * (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize) * - * bytes past the end of masterPtr->pix32[] when + * bytes past the end of modelPtr->pix32[] when * - * blockPtr->pixelPtr > (masterPtr->pix32 + - * 4 * masterPtr->width * masterPtr->height - + * blockPtr->pixelPtr > (modelPtr->pix32 + + * 4 * modelPtr->width * modelPtr->height - * sourceBlock.height * sourceBlock.pitch) */ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + @@ -2802,9 +2802,9 @@ Tk_PhotoPutBlock( xEnd = x + width; yEnd = y + height; - if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) { - if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width), - MAX(yEnd, masterPtr->height)) == TCL_ERROR) { + if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) { + if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width), + MAX(yEnd, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); @@ -2814,14 +2814,14 @@ Tk_PhotoPutBlock( } } - if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY) - && (x < masterPtr->ditherX))) { + if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY) + && (x < modelPtr->ditherX))) { /* * The dithering isn't correct past the start of this block. */ - masterPtr->ditherX = x; - masterPtr->ditherY = y; + modelPtr->ditherX = x; + modelPtr->ditherY = y; } /* @@ -2839,7 +2839,7 @@ Tk_PhotoPutBlock( alphaOffset -= sourceBlock.offset[0]; } if ((greenOffset != 0) || (blueOffset != 0)) { - masterPtr->flags |= COLOR_IMAGE; + modelPtr->flags |= COLOR_IMAGE; } /* @@ -2847,8 +2847,8 @@ Tk_PhotoPutBlock( * single memmove, we do. */ - destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; - pitch = masterPtr->width * 4; + destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; + pitch = modelPtr->width * 4; /* * Test to see if we can do the whole write in a single copy. This test is @@ -2859,7 +2859,7 @@ Tk_PhotoPutBlock( if ((sourceBlock.pixelSize == 4) && (greenOffset == 1) && (blueOffset == 2) && (alphaOffset == 3) && (width <= sourceBlock.width) && (height <= sourceBlock.height) - && ((height == 1) || ((x == 0) && (width == masterPtr->width) + && ((height == 1) || ((x == 0) && (width == modelPtr->width) && (sourceBlock.pitch == pitch))) && (compRule == TK_PHOTO_COMPOSITE_SET)) { memmove(destLinePtr, sourceBlock.pixelPtr + sourceBlock.offset[0], @@ -3041,8 +3041,8 @@ Tk_PhotoPutBlock( rect.width = width; rect.height = height; TkUnionRectWithRegion(&rect, workRgn, workRgn); - TkSubtractRegion(masterPtr->validRegion, workRgn, - masterPtr->validRegion); + TkSubtractRegion(modelPtr->validRegion, workRgn, + modelPtr->validRegion); TkDestroyRegion(workRgn); } @@ -3051,17 +3051,17 @@ Tk_PhotoPutBlock( * allow for more efficient per-platform implementations. [Bug 919066] */ - TkpBuildRegionFromAlphaData(masterPtr->validRegion, (unsigned) x, + TkpBuildRegionFromAlphaData(modelPtr->validRegion, (unsigned) x, (unsigned) y, (unsigned) width, (unsigned) height, - masterPtr->pix32 + (y * masterPtr->width + x) * 4 + 3, - 4, (unsigned) masterPtr->width * 4); + modelPtr->pix32 + (y * modelPtr->width + x) * 4 + 3, + 4, (unsigned) modelPtr->width * 4); } else { rect.x = x; rect.y = y; rect.width = width; rect.height = height; - TkUnionRectWithRegion(&rect, masterPtr->validRegion, - masterPtr->validRegion); + TkUnionRectWithRegion(&rect, modelPtr->validRegion, + modelPtr->validRegion); } /* @@ -3076,21 +3076,21 @@ Tk_PhotoPutBlock( * [Patch 1539990] */ - if (!(masterPtr->flags & COMPLEX_ALPHA)) { + if (!(modelPtr->flags & COMPLEX_ALPHA)) { register int x1; for (x1=x ; x1<x+width ; x1++) { register unsigned char newAlpha; - destLinePtr = masterPtr->pix32 + (y*masterPtr->width + x1)*4; + destLinePtr = modelPtr->pix32 + (y*modelPtr->width + x1)*4; newAlpha = destLinePtr[3]; if (newAlpha && newAlpha != 255) { - masterPtr->flags |= COMPLEX_ALPHA; + modelPtr->flags |= COMPLEX_ALPHA; break; } } } - } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) { + } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) { /* * Check for partial transparency if alpha pixels are specified, or * rescan if we already knew such pixels existed. To restrict this @@ -3098,21 +3098,21 @@ Tk_PhotoPutBlock( * the alpha pixels are. */ - ToggleComplexAlphaIfNeeded(masterPtr); + ToggleComplexAlphaIfNeeded(modelPtr); } /* * Update each instance. */ - Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, x, y, width, height); + Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, x, y, width, height); /* * Tell the core image code that this image has changed. */ - Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, - masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height, + modelPtr->width, modelPtr->height); if (memToFree) ckfree(memToFree); @@ -3162,7 +3162,7 @@ Tk_PhotoPutZoomedBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoMaster *masterPtr = (PhotoMaster *) handle; + register PhotoModel *modelPtr = (PhotoModel *) handle; register Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -3190,12 +3190,12 @@ Tk_PhotoPutZoomedBlock( if (zoomX <= 0 || zoomY <= 0) { return TCL_OK; } - if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) { - width = masterPtr->userWidth - x; + if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) { + width = modelPtr->userWidth - x; } - if ((masterPtr->userHeight != 0) - && ((y + height) > masterPtr->userHeight)) { - height = masterPtr->userHeight - y; + if ((modelPtr->userHeight != 0) + && ((y + height) > modelPtr->userHeight)) { + height = modelPtr->userHeight - y; } if (width <= 0 || height <= 0) { return TCL_OK; @@ -3215,18 +3215,18 @@ Tk_PhotoPutZoomedBlock( */ sourceBlock = *blockPtr; memToFree = NULL; - if (sourceBlock.pixelPtr >= masterPtr->pix32 - && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width - * masterPtr->height * 4) { + if (sourceBlock.pixelPtr >= modelPtr->pix32 + && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width + * modelPtr->height * 4) { /* * Fix 5c51be6411: avoid reading * * (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize) * - * bytes past the end of masterPtr->pix32[] when + * bytes past the end of modelPtr->pix32[] when * - * blockPtr->pixelPtr > (masterPtr->pix32 + - * 4 * masterPtr->width * masterPtr->height - + * blockPtr->pixelPtr > (modelPtr->pix32 + + * 4 * modelPtr->width * modelPtr->height - * sourceBlock.height * sourceBlock.pitch) */ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + @@ -3247,9 +3247,9 @@ Tk_PhotoPutZoomedBlock( xEnd = x + width; yEnd = y + height; - if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) { - if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width), - MAX(yEnd, masterPtr->height)) == TCL_ERROR) { + if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) { + if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width), + MAX(yEnd, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); @@ -3259,14 +3259,14 @@ Tk_PhotoPutZoomedBlock( } } - if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY) - && (x < masterPtr->ditherX))) { + if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY) + && (x < modelPtr->ditherX))) { /* * The dithering isn't correct past the start of this block. */ - masterPtr->ditherX = x; - masterPtr->ditherY = y; + modelPtr->ditherX = x; + modelPtr->ditherY = y; } /* @@ -3284,7 +3284,7 @@ Tk_PhotoPutZoomedBlock( alphaOffset -= sourceBlock.offset[0]; } if ((greenOffset != 0) || (blueOffset != 0)) { - masterPtr->flags |= COLOR_IMAGE; + modelPtr->flags |= COLOR_IMAGE; } /* @@ -3313,7 +3313,7 @@ Tk_PhotoPutZoomedBlock( * Copy the data into our local 32-bit/pixel array. */ - destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; + destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; srcOrigPtr = sourceBlock.pixelPtr + sourceBlock.offset[0]; if (subsampleX < 0) { srcOrigPtr += (sourceBlock.width - 1) * sourceBlock.pixelSize; @@ -3322,7 +3322,7 @@ Tk_PhotoPutZoomedBlock( srcOrigPtr += (sourceBlock.height - 1) * sourceBlock.pitch; } - pitch = masterPtr->width * 4; + pitch = modelPtr->width * 4; for (hLeft = height; hLeft > 0; ) { hCopy = MIN(hLeft, blockHt); hLeft -= hCopy; @@ -3409,22 +3409,22 @@ Tk_PhotoPutZoomedBlock( rect.width = width; rect.height = 1; TkUnionRectWithRegion(&rect, workRgn, workRgn); - TkSubtractRegion(masterPtr->validRegion, workRgn, - masterPtr->validRegion); + TkSubtractRegion(modelPtr->validRegion, workRgn, + modelPtr->validRegion); TkDestroyRegion(workRgn); } - TkpBuildRegionFromAlphaData(masterPtr->validRegion, + TkpBuildRegionFromAlphaData(modelPtr->validRegion, (unsigned)x, (unsigned)y, (unsigned)width, (unsigned)height, - &masterPtr->pix32[(y * masterPtr->width + x) * 4 + 3], 4, - (unsigned) masterPtr->width * 4); + &modelPtr->pix32[(y * modelPtr->width + x) * 4 + 3], 4, + (unsigned) modelPtr->width * 4); } else { rect.x = x; rect.y = y; rect.width = width; rect.height = height; - TkUnionRectWithRegion(&rect, masterPtr->validRegion, - masterPtr->validRegion); + TkUnionRectWithRegion(&rect, modelPtr->validRegion, + modelPtr->validRegion); } /* @@ -3437,38 +3437,38 @@ Tk_PhotoPutZoomedBlock( * builds up large simple-alpha images by single pixels. We don't * negate COMPLEX_ALPHA in this case. [Bug 1409140] */ - if (!(masterPtr->flags & COMPLEX_ALPHA)) { + if (!(modelPtr->flags & COMPLEX_ALPHA)) { unsigned char newAlpha; - destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; + destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; newAlpha = destLinePtr[3]; if (newAlpha && newAlpha != 255) { - masterPtr->flags |= COMPLEX_ALPHA; + modelPtr->flags |= COMPLEX_ALPHA; } } - } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) { + } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) { /* * Check for partial transparency if alpha pixels are specified, or * rescan if we already knew such pixels existed. To restrict this * Toggle to only checking the changed pixels requires knowing where * the alpha pixels are. */ - ToggleComplexAlphaIfNeeded(masterPtr); + ToggleComplexAlphaIfNeeded(modelPtr); } /* * Update each instance. */ - Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y, width, height); + Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y, width, height); /* * Tell the core image code that this image has changed. */ - Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, masterPtr->width, - masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height, modelPtr->width, + modelPtr->height); if (memToFree) ckfree(memToFree); @@ -3493,7 +3493,7 @@ Tk_PhotoPutZoomedBlock( * * Side effects: * The pixmap of each instance of this image gets updated. The fields in - * *masterPtr indicating which area of the image is correctly dithered + * *modelPtr indicating which area of the image is correctly dithered * get updated. * *---------------------------------------------------------------------- @@ -3507,14 +3507,14 @@ Tk_DitherPhoto( * area to be dithered. */ int width, int height) /* Dimensions of the area to be dithered. */ { - PhotoMaster *masterPtr = (PhotoMaster *) photo; + PhotoModel *modelPtr = (PhotoModel *) photo; PhotoInstance *instancePtr; if ((width <= 0) || (height <= 0)) { return; } - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { TkImgDitherInstance(instancePtr, x, y, width, height); } @@ -3524,23 +3524,23 @@ Tk_DitherPhoto( * will extend the correctly dithered region. */ - if (((y < masterPtr->ditherY) - || ((y == masterPtr->ditherY) && (x <= masterPtr->ditherX))) - && ((y + height) > (masterPtr->ditherY))) { + if (((y < modelPtr->ditherY) + || ((y == modelPtr->ditherY) && (x <= modelPtr->ditherX))) + && ((y + height) > (modelPtr->ditherY))) { /* * This block starts inside (or immediately after) the correctly * dithered region, so the first scan line at least will be right. - * Furthermore this block extends into scanline masterPtr->ditherY. + * Furthermore this block extends into scanline modelPtr->ditherY. */ - if ((x == 0) && (width == masterPtr->width)) { + if ((x == 0) && (width == modelPtr->width)) { /* * We are doing the full width, therefore the dithering will be * correct to the end. */ - masterPtr->ditherX = 0; - masterPtr->ditherY = y + height; + modelPtr->ditherX = 0; + modelPtr->ditherY = y + height; } else { /* * We are doing partial scanlines, therefore the @@ -3548,11 +3548,11 @@ Tk_DitherPhoto( * line. */ - if (x <= masterPtr->ditherX) { - masterPtr->ditherX = x + width; - if (masterPtr->ditherX >= masterPtr->width) { - masterPtr->ditherX = 0; - masterPtr->ditherY++; + if (x <= modelPtr->ditherX) { + modelPtr->ditherX = x + width; + if (modelPtr->ditherX >= modelPtr->width) { + modelPtr->ditherX = 0; + modelPtr->ditherY++; } } } @@ -3580,29 +3580,29 @@ void Tk_PhotoBlank( Tk_PhotoHandle handle) /* Handle for the image to be blanked. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; PhotoInstance *instancePtr; - masterPtr->ditherX = masterPtr->ditherY = 0; - masterPtr->flags = 0; + modelPtr->ditherX = modelPtr->ditherY = 0; + modelPtr->flags = 0; /* * The image has valid data nowhere. */ - if (masterPtr->validRegion != NULL) { - TkDestroyRegion(masterPtr->validRegion); + if (modelPtr->validRegion != NULL) { + TkDestroyRegion(modelPtr->validRegion); } - masterPtr->validRegion = TkCreateRegion(); + modelPtr->validRegion = TkCreateRegion(); /* * Clear out the 32-bit pixel storage array. Clear out the dithering error * arrays for each instance. */ - memset(masterPtr->pix32, 0, - ((size_t)masterPtr->width * masterPtr->height * 4)); - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + memset(modelPtr->pix32, 0, + ((size_t)modelPtr->width * modelPtr->height * 4)); + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { TkImgResetDither(instancePtr); } @@ -3611,8 +3611,8 @@ Tk_PhotoBlank( * Tell the core image code that this image has changed. */ - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width, - masterPtr->height, masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width, + modelPtr->height, modelPtr->width, modelPtr->height); } /* @@ -3642,17 +3642,17 @@ Tk_PhotoExpand( Tk_PhotoHandle handle, /* Handle for the image to be expanded. */ int width, int height) /* Desired minimum dimensions of the image. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; - if (width <= masterPtr->width) { - width = masterPtr->width; + if (width <= modelPtr->width) { + width = modelPtr->width; } - if (height <= masterPtr->height) { - height = masterPtr->height; + if (height <= modelPtr->height) { + height = modelPtr->height; } - if ((width != masterPtr->width) || (height != masterPtr->height)) { - if (ImgPhotoSetSize(masterPtr, MAX(width, masterPtr->width), - MAX(height, masterPtr->height)) == TCL_ERROR) { + if ((width != modelPtr->width) || (height != modelPtr->height)) { + if (ImgPhotoSetSize(modelPtr, MAX(width, modelPtr->width), + MAX(height, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); @@ -3660,8 +3660,8 @@ Tk_PhotoExpand( } return TCL_ERROR; } - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width, - masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, modelPtr->width, + modelPtr->height); } return TCL_OK; } @@ -3690,10 +3690,10 @@ Tk_PhotoGetSize( /* The dimensions of the image are returned * here. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; - *widthPtr = masterPtr->width; - *heightPtr = masterPtr->height; + *widthPtr = modelPtr->width; + *heightPtr = modelPtr->height; } /* @@ -3722,12 +3722,12 @@ Tk_PhotoSetSize( * set. */ int width, int height) /* New dimensions for the image. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; - masterPtr->userWidth = width; - masterPtr->userHeight = height; - if (ImgPhotoSetSize(masterPtr, ((width > 0) ? width: masterPtr->width), - ((height > 0) ? height: masterPtr->height)) == TCL_ERROR) { + modelPtr->userWidth = width; + modelPtr->userHeight = height; + if (ImgPhotoSetSize(modelPtr, ((width > 0) ? width: modelPtr->width), + ((height > 0) ? height: modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); @@ -3735,8 +3735,8 @@ Tk_PhotoSetSize( } return TCL_ERROR; } - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, - masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, + modelPtr->width, modelPtr->height); return TCL_OK; } @@ -3765,9 +3765,9 @@ TkPhotoGetValidRegion( Tk_PhotoHandle handle) /* Handle for the image whose valid region is * to obtained. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; - return masterPtr->validRegion; + return modelPtr->validRegion; } /* @@ -3793,7 +3793,7 @@ TkPhotoGetValidRegion( static char * ImgGetPhoto( - PhotoMaster *masterPtr, /* Handle for the photo image from which image + PhotoModel *modelPtr, /* Handle for the photo image from which image * data is desired. */ Tk_PhotoImageBlock *blockPtr, /* Information about the address and layout of @@ -3803,13 +3803,13 @@ ImgGetPhoto( unsigned char *pixelPtr; int x, y, greenOffset, blueOffset, alphaOffset; - Tk_PhotoGetImage((Tk_PhotoHandle) masterPtr, blockPtr); + Tk_PhotoGetImage((Tk_PhotoHandle) modelPtr, blockPtr); blockPtr->pixelPtr += optPtr->fromY * blockPtr->pitch + optPtr->fromX * blockPtr->pixelSize; blockPtr->width = optPtr->fromX2 - optPtr->fromX; blockPtr->height = optPtr->fromY2 - optPtr->fromY; - if (!(masterPtr->flags & COLOR_IMAGE) && + if (!(modelPtr->flags & COLOR_IMAGE) && (!(optPtr->options & OPT_BACKGROUND) || ((optPtr->background->red == optPtr->background->green) && (optPtr->background->red == optPtr->background->blue)))) { @@ -4041,12 +4041,12 @@ Tk_PhotoGetImage( /* Information about the address and layout of * the image data is returned here. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; - blockPtr->pixelPtr = masterPtr->pix32; - blockPtr->width = masterPtr->width; - blockPtr->height = masterPtr->height; - blockPtr->pitch = masterPtr->width * 4; + blockPtr->pixelPtr = modelPtr->pix32; + blockPtr->width = modelPtr->width; + blockPtr->height = modelPtr->height; + blockPtr->pitch = modelPtr->width * 4; blockPtr->pixelSize = 4; blockPtr->offset[0] = 0; blockPtr->offset[1] = 1; diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h index 36bc6cb..9cd4195 100644 --- a/generic/tkImgPhoto.h +++ b/generic/tkImgPhoto.h @@ -27,6 +27,7 @@ * Forward declarations of the structures we define. */ +#define PhotoModel PhotoMaster typedef struct ColorTableId ColorTableId; typedef struct ColorTable ColorTable; typedef struct PhotoInstance PhotoInstance; @@ -141,7 +142,7 @@ struct ColorTable { */ struct PhotoMaster { - Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the + Tk_ImageMaster tkMaster; /* Tk's token for image model. NULL means the * image is being deleted. */ Tcl_Interp *interp; /* Interpreter associated with the application * using this image. */ diff --git a/generic/tkInt.h b/generic/tkInt.h index 23605cf..f4bb23f 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -665,7 +665,7 @@ typedef struct TkMainInfo { /* Top level of option hierarchy for this main * window. NULL means uninitialized. Managed * by tkOption.c. */ - Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageMaster + Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageModel * structures. Managed by tkImage.c. */ int strictMotif; /* This is linked to the tk_strictMotif global * variable. */ @@ -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/tkOldConfig.c b/generic/tkOldConfig.c index f20f38f..d05a2c7 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -1104,7 +1104,7 @@ GetCachedSpecs( /* * Now allocate our working copy's space and copy over the contents - * from the master copy. + * from the origin. */ cachedSpecs = ckalloc(entrySpace); diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c index 948883d..8996f31 100644 --- a/generic/tkOldTest.c +++ b/generic/tkOldTest.c @@ -25,17 +25,17 @@ #include "tkInt.h" /* - * The following data structure represents the master for a test image: + * The following data structure represents the model for a test image: */ -typedef struct TImageMaster { - Tk_ImageMaster master; /* Tk's token for image master. */ +typedef struct TImageModel { + Tk_ImageModel model; /* Tk's token for image model. */ Tcl_Interp *interp; /* Interpreter for application. */ int width, height; /* Dimensions of image. */ char *imageName; /* Name of image (malloc-ed). */ char *varName; /* Name of variable in which to log events for * image (malloc-ed). */ -} TImageMaster; +} TImageModel; /* * The following data structure represents a particular use of a particular @@ -43,7 +43,7 @@ typedef struct TImageMaster { */ typedef struct TImageInstance { - TImageMaster *masterPtr; /* Pointer to master for image. */ + TImageModel *modelPtr; /* Pointer to model for image. */ XColor *fg; /* Foreground color for drawing in image. */ GC gc; /* Graphics context for drawing in image. */ } TImageInstance; @@ -54,7 +54,7 @@ typedef struct TImageInstance { static int ImageCreate(Tcl_Interp *interp, char *name, int argc, char **argv, - Tk_ImageType *typePtr, Tk_ImageMaster master, + Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static ClientData ImageGet(Tk_Window tkwin, ClientData clientData); static void ImageDisplay(ClientData clientData, @@ -143,12 +143,12 @@ ImageCreate( char **argv, /* Argument strings for options (doesn't * include image name or type). */ Tk_ImageType *typePtr, /* Pointer to our type record (not used). */ - Tk_ImageMaster master, /* Token for image, to be used by us in later + Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - TImageMaster *timPtr; + TImageModel *timPtr; const char *varName; int i; @@ -167,8 +167,8 @@ ImageCreate( varName = argv[i+1]; } - timPtr = ckalloc(sizeof(TImageMaster)); - timPtr->master = master; + timPtr = ckalloc(sizeof(TImageModel)); + timPtr->model = model; timPtr->interp = interp; timPtr->width = 30; timPtr->height = 15; @@ -178,7 +178,7 @@ ImageCreate( strcpy(timPtr->varName, varName); Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL); *clientDataPtr = timPtr; - Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15); + Tk_ImageChanged(model, 0, 0, 30, 15, 30, 15); return TCL_OK; } @@ -207,7 +207,7 @@ ImageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TImageMaster *timPtr = clientData; + TImageModel *timPtr = clientData; int x, y, width, height; if (objc < 2) { @@ -228,7 +228,7 @@ ImageObjCmd( || (Tcl_GetIntFromObj(interp, objv[7], &timPtr->height) != TCL_OK)) { return TCL_ERROR; } - Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width, + Tk_ImageChanged(timPtr->model, x, y, width, height, timPtr->width, timPtr->height); } else { Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]), @@ -260,9 +260,9 @@ static ClientData ImageGet( Tk_Window tkwin, /* Token for window in which image will be * used. */ - ClientData clientData) /* Pointer to TImageMaster for image. */ + ClientData clientData) /* Pointer to TImageModel for image. */ { - TImageMaster *timPtr = clientData; + TImageModel *timPtr = clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -272,7 +272,7 @@ ImageGet( TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); instPtr = ckalloc(sizeof(TImageInstance)); - instPtr->masterPtr = timPtr; + instPtr->modelPtr = timPtr; instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues); @@ -313,15 +313,15 @@ ImageDisplay( char buffer[200 + TCL_INTEGER_SPACE * 6]; sprintf(buffer, "%s display %d %d %d %d %d %d", - instPtr->masterPtr->imageName, imageX, imageY, width, height, + instPtr->modelPtr->imageName, imageX, imageY, width, height, drawableX, drawableY); - Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL, + Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - if (width > (instPtr->masterPtr->width - imageX)) { - width = instPtr->masterPtr->width - imageX; + if (width > (instPtr->modelPtr->width - imageX)) { + width = instPtr->modelPtr->width - imageX; } - if (height > (instPtr->masterPtr->height - imageY)) { - height = instPtr->masterPtr->height - imageY; + if (height > (instPtr->modelPtr->height - imageY)) { + height = instPtr->modelPtr->height - imageY; } XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY, (unsigned) (width-1), (unsigned) (height-1)); @@ -357,8 +357,8 @@ ImageFree( TImageInstance *instPtr = clientData; char buffer[200]; - sprintf(buffer, "%s free", instPtr->masterPtr->imageName); - Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL, + sprintf(buffer, "%s free", instPtr->modelPtr->imageName); + Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); Tk_FreeColor(instPtr->fg); Tk_FreeGC(display, instPtr->gc); @@ -384,11 +384,11 @@ ImageFree( static void ImageDelete( - ClientData clientData) /* Pointer to TImageMaster for image. When + ClientData clientData) /* Pointer to TImageModel for image. When * this function is called, no more instances * exist. */ { - TImageMaster *timPtr = clientData; + TImageModel *timPtr = clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); diff --git a/generic/tkPack.c b/generic/tkPack.c index 9005d7f..28ae74b 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -20,7 +20,7 @@ static const char *const sideNames[] = { /* * For each window that the packer cares about (either because the window is - * managed by the packer or because the window has slaves that are managed by + * managed by the packer or because the window has content managed by * the packer), there is a structure of the following type: */ @@ -29,15 +29,15 @@ typedef struct Packer { * window has been deleted, but the packet * hasn't had a chance to clean up yet because * the structure is still in use. */ - struct Packer *masterPtr; /* Master window within which this window is + struct Packer *containerPtr; /* Container window within which this window is * packed (NULL means this window isn't * managed by the packer). */ - struct Packer *nextPtr; /* Next window packed within same master. List + struct Packer *nextPtr; /* Next window packed within same container. List * is priority-ordered: first on list gets * packed first. */ - struct Packer *slavePtr; /* First in list of slaves packed inside this - * window (NULL means no packed slaves). */ - Side side; /* Side of master against which this window is + struct Packer *contentPtr; /* First in list of content packed inside this + * window (NULL means no packed content). */ + Side side; /* Side of container against which this window is * packed. */ Tk_Anchor anchor; /* If frame allocated for window is larger * than window needs, this indicates how where @@ -55,13 +55,13 @@ typedef struct Packer { * each side). */ int doubleBw; /* Twice the window's last known border width. * If this changes, the window must be - * repacked within its master. */ + * repacked within its container. */ int *abortPtr; /* If non-NULL, it means that there is a * nested call to ArrangePacking already * working on this window. *abortPtr may be * set to 1 to abort that nested call. This * happens, for example, if tkwin or any of - * its slaves is deleted. */ + * its content is deleted. */ int flags; /* Miscellaneous flags; see below for * definitions. */ } Packer; @@ -70,7 +70,7 @@ typedef struct Packer { * Flag values for Packer structures: * * REQUESTED_REPACK: 1 means a Tcl_DoWhenIdle request has already - * been made to repack all the slaves of this + * been made to repack all the content of this * window. * FILLX: 1 means if frame allocated for window is wider * than window needs, expand window to fill @@ -78,17 +78,17 @@ typedef struct Packer { * than needed. * FILLY: Same as FILLX, except for height. * EXPAND: 1 means this window's frame will absorb any - * extra space in the master window. + * extra space in the container window. * OLD_STYLE: 1 means this window is being managed with the * old-style packer algorithms (before Tk version * 3.3). The main difference is that padding and * filling are done differently. * DONT_PROPAGATE: 1 means don't set this window's requested - * size. 0 means if this window is a master then + * size. 0 means if this window is a container then * Tk will set its requested size to fit the - * needs of its slaves. - * ALLOCED_MASTER 1 means that Pack has allocated itself as - * geometry master for this window. + * needs of its content. + * ALLOCED_CONTAINER 1 means that Pack has allocated itself as + * geometry container for this window. */ #define REQUESTED_REPACK 1 @@ -97,20 +97,20 @@ typedef struct Packer { #define EXPAND 8 #define OLD_STYLE 16 #define DONT_PROPAGATE 32 -#define ALLOCED_MASTER 64 +#define ALLOCED_CONTAINER 64 /* * The following structure is the official type record for the packer: */ static void PackReqProc(ClientData clientData, Tk_Window tkwin); -static void PackLostSlaveProc(ClientData clientData, +static void PackLostContentProc(ClientData clientData, Tk_Window tkwin); static const Tk_GeomMgr packerType = { "pack", /* name */ PackReqProc, /* requestProc */ - PackLostSlaveProc, /* lostSlaveProc */ + PackLostContentProc, /* lostContentProc */ }; /* @@ -118,17 +118,17 @@ static const Tk_GeomMgr packerType = { */ static void ArrangePacking(ClientData clientData); -static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin, +static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, int objc, Tcl_Obj *const objv[]); static void DestroyPacker(void *memPtr); static Packer * GetPacker(Tk_Window tkwin); static int PackAfter(Tcl_Interp *interp, Packer *prevPtr, - Packer *masterPtr, int objc,Tcl_Obj *const objv[]); + Packer *containerPtr, int objc,Tcl_Obj *const objv[]); static void PackStructureProc(ClientData clientData, XEvent *eventPtr); static void Unlink(Packer *packPtr); -static int XExpansion(Packer *slavePtr, int cavityWidth); -static int YExpansion(Packer *slavePtr, int cavityHeight); +static int XExpansion(Packer *contentPtr, int cavityWidth); +static int YExpansion(Packer *contentPtr, int cavityHeight); /* *------------------------------------------------------------------------ @@ -194,22 +194,22 @@ Tk_PackObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; const char *argv2; static const char *const optionStrings[] = { /* after, append, before and unpack are deprecated */ - "after", "append", "before", "unpack", - "configure", "forget", "info", "propagate", "slaves", NULL }; + "after", "append", "before", "unpack", "configure", + "content", "forget", "info", "propagate", "slaves", NULL }; enum options { - PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK, - PACK_CONFIGURE, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES }; + PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK, PACK_CONFIGURE, + PACK_CONTENT, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES }; int index; if (objc >= 2) { const char *string = Tcl_GetString(objv[1]); if (string[0] == '.') { - return ConfigureSlaves(interp, tkwin, objc-1, objv+1); + return ConfigureContent(interp, tkwin, objc-1, objv+1); } } if (objc < 3) { @@ -241,48 +241,48 @@ Tk_PackObjCmd( return TCL_ERROR; } prevPtr = GetPacker(tkwin2); - if (prevPtr->masterPtr == NULL) { + if (prevPtr->containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL); return TCL_ERROR; } - return PackAfter(interp, prevPtr, prevPtr->masterPtr, objc-3, objv+3); + return PackAfter(interp, prevPtr, prevPtr->containerPtr, objc-3, objv+3); } case PACK_APPEND: { - Packer *masterPtr; - register Packer *prevPtr; + Packer *containerPtr; + Packer *prevPtr; Tk_Window tkwin2; if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetPacker(tkwin2); - prevPtr = masterPtr->slavePtr; + containerPtr = GetPacker(tkwin2); + prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { prevPtr = prevPtr->nextPtr; } } - return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3); + return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3); } case PACK_BEFORE: { - Packer *packPtr, *masterPtr; - register Packer *prevPtr; + Packer *packPtr, *containerPtr; + Packer *prevPtr; Tk_Window tkwin2; if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { return TCL_ERROR; } packPtr = GetPacker(tkwin2); - if (packPtr->masterPtr == NULL) { + if (packPtr->containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL); return TCL_ERROR; } - masterPtr = packPtr->masterPtr; - prevPtr = masterPtr->slavePtr; + containerPtr = packPtr->containerPtr; + prevPtr = containerPtr->contentPtr; if (prevPtr == packPtr) { prevPtr = NULL; } else { @@ -295,7 +295,7 @@ Tk_PackObjCmd( } } } - return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3); + return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3); } case PACK_CONFIGURE: if (argv2[0] != '.') { @@ -304,43 +304,43 @@ Tk_PackObjCmd( Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return TCL_ERROR; } - return ConfigureSlaves(interp, tkwin, objc-2, objv+2); + return ConfigureContent(interp, tkwin, objc-2, objv+2); case PACK_FORGET: { - Tk_Window slave; - Packer *slavePtr; + Tk_Window content; + Packer *contentPtr; int i; for (i = 2; i < objc; i++) { - if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) { continue; } - slavePtr = GetPacker(slave); - if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) { - Tk_ManageGeometry(slave, NULL, NULL); - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->masterPtr->tkwin); + contentPtr = GetPacker(content); + if ((contentPtr != NULL) && (contentPtr->containerPtr != NULL)) { + Tk_ManageGeometry(content, NULL, NULL); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, + contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } } break; } case PACK_INFO: { - register Packer *slavePtr; - Tk_Window slave; + Packer *contentPtr; + Tk_Window content; Tcl_Obj *infoObj; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) { return TCL_ERROR; } - slavePtr = GetPacker(slave); - if (slavePtr->masterPtr == NULL) { + contentPtr = GetPacker(content); + if (contentPtr->containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL); @@ -349,12 +349,12 @@ Tk_PackObjCmd( infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), - TkNewWindowObj(slavePtr->masterPtr->tkwin)); + TkNewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", -1), - Tcl_NewStringObj(Tk_NameOfAnchor(slavePtr->anchor), -1)); + Tcl_NewStringObj(Tk_NameOfAnchor(contentPtr->anchor), -1)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", -1), - Tcl_NewBooleanObj(slavePtr->flags & EXPAND)); - switch (slavePtr->flags & (FILLX|FILLY)) { + Tcl_NewBooleanObj(contentPtr->flags & EXPAND)); + switch (contentPtr->flags & (FILLX|FILLY)) { case 0: Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", -1), Tcl_NewStringObj("none", -1)); @@ -372,31 +372,31 @@ Tk_PackObjCmd( Tcl_NewStringObj("both", -1)); break; } - TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX); - TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY); - TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft,slavePtr->padX); - TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY); + TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX); + TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY); + TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft,contentPtr->padX); + TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-side", -1), - Tcl_NewStringObj(sideNames[slavePtr->side], -1)); + Tcl_NewStringObj(sideNames[contentPtr->side], -1)); Tcl_SetObjResult(interp, infoObj); break; } case PACK_PROPAGATE: { - Tk_Window master; - Packer *masterPtr; + Tk_Window container; + Packer *containerPtr; int propagate; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetPacker(master); + containerPtr = GetPacker(container); if (objc == 3) { Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(!(masterPtr->flags & DONT_PROPAGATE))); + Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE))); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) { @@ -404,56 +404,57 @@ Tk_PackObjCmd( } if (propagate) { /* - * If we have slaves, we need to register as geometry master. + * If we have content windows, we need to register as geometry container. */ - if (masterPtr->slavePtr != NULL) { - if (TkSetGeometryMaster(interp, master, "pack") != TCL_OK) { + if (containerPtr->contentPtr != NULL) { + if (TkSetGeometryContainer(interp, container, "pack") != TCL_OK) { return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } - masterPtr->flags &= ~DONT_PROPAGATE; + containerPtr->flags &= ~DONT_PROPAGATE; /* - * Repack the master to allow new geometry information to - * propagate upwards to the master's master. + * Repack the container to allow new geometry information to + * propagate upwards to the container's container. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_REPACK)) { - masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, masterPtr); + if (!(containerPtr->flags & REQUESTED_REPACK)) { + containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, containerPtr); } } else { - if (masterPtr->flags & ALLOCED_MASTER) { - TkFreeGeometryMaster(master, "pack"); - masterPtr->flags &= ~ALLOCED_MASTER; + if (containerPtr->flags & ALLOCED_CONTAINER) { + TkFreeGeometryContainer(container, "pack"); + containerPtr->flags &= ~ALLOCED_CONTAINER; } - masterPtr->flags |= DONT_PROPAGATE; + containerPtr->flags |= DONT_PROPAGATE; } break; } + case PACK_CONTENT: case PACK_SLAVES: { - Tk_Window master; - Packer *masterPtr, *slavePtr; + Tk_Window container; + Packer *containerPtr, *contentPtr; Tcl_Obj *resultObj; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } resultObj = Tcl_NewObj(); - masterPtr = GetPacker(master); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { + containerPtr = GetPacker(container); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, - TkNewWindowObj(slavePtr->tkwin)); + TkNewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, resultObj); break; @@ -470,11 +471,11 @@ Tk_PackObjCmd( return TCL_ERROR; } packPtr = GetPacker(tkwin2); - if ((packPtr != NULL) && (packPtr->masterPtr != NULL)) { + if ((packPtr != NULL) && (packPtr->containerPtr != NULL)) { Tk_ManageGeometry(tkwin2, NULL, NULL); - if (packPtr->masterPtr->tkwin != Tk_Parent(packPtr->tkwin)) { + if (packPtr->containerPtr->tkwin != Tk_Parent(packPtr->tkwin)) { Tk_UnmaintainGeometry(packPtr->tkwin, - packPtr->masterPtr->tkwin); + packPtr->containerPtr->tkwin); } Unlink(packPtr); Tk_UnmapWindow(packPtr->tkwin); @@ -504,17 +505,16 @@ Tk_PackObjCmd( *------------------------------------------------------------------------ */ - /* ARGSUSED */ static void PackReqProc( ClientData clientData, /* Packer's information about window that got * new preferred geometry. */ - Tk_Window tkwin) /* Other Tk-related information about the + TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ { - register Packer *packPtr = clientData; + Packer *packPtr = (Packer *)clientData; - packPtr = packPtr->masterPtr; + packPtr = packPtr->containerPtr; if (!(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; Tcl_DoWhenIdle(ArrangePacking, packPtr); @@ -524,34 +524,33 @@ PackReqProc( /* *------------------------------------------------------------------------ * - * PackLostSlaveProc -- + * PackLostContentProc -- * * This function is invoked by Tk whenever some other geometry claims - * control over a slave that used to be managed by us. + * control over a content window that used to be managed by us. * * Results: * None. * * Side effects: - * Forgets all packer-related information about the slave. + * Forgets all packer-related information about the content. * *------------------------------------------------------------------------ */ - /* ARGSUSED */ static void -PackLostSlaveProc( - ClientData clientData, /* Packer structure for slave window that was +PackLostContentProc( + void *clientData, /* Packer structure for content window that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */ { - register Packer *slavePtr = clientData; + Packer *contentPtr = (Packer *)clientData; - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } /* @@ -568,22 +567,22 @@ PackLostSlaveProc( * None. * * Side effects: - * The packed slaves of masterPtr may get resized or moved. + * The packed content of containerPtr may get resized or moved. * *------------------------------------------------------------------------ */ static void ArrangePacking( - ClientData clientData) /* Structure describing master whose slaves + ClientData clientData) /* Structure describing container whose content * are to be re-layed out. */ { - register Packer *masterPtr = clientData; - register Packer *slavePtr; + Packer *containerPtr = (Packer *)clientData; + Packer *contentPtr; int cavityX, cavityY, cavityWidth, cavityHeight; /* These variables keep track of the * as-yet-unallocated space remaining in the - * middle of the master window. */ + * middle of the container window. */ int frameX, frameY, frameWidth, frameHeight; /* These variables keep track of the frame * allocated to the current window. */ @@ -596,14 +595,15 @@ ArrangePacking( int borderLeft, borderRight; int maxWidth, maxHeight, tmp; - masterPtr->flags &= ~REQUESTED_REPACK; + containerPtr->flags &= ~REQUESTED_REPACK; /* - * If the master has no slaves anymore, then don't do anything at all: - * just leave the master's size as-is. + * If the container has no content anymore, then leave the container size as-is. + * Otherwise there is no way to "relinquish" control over the container + * so another geometry manager can take over. */ - if (masterPtr->slavePtr == NULL) { + if (containerPtr->contentPtr == NULL) { return; } @@ -613,52 +613,52 @@ ArrangePacking( * necessary. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - masterPtr->abortPtr = &abort; + containerPtr->abortPtr = &abort; abort = 0; - Tcl_Preserve(masterPtr); + Tcl_Preserve(containerPtr); /* - * Pass #1: scan all the slaves to figure out the total amount of space + * Pass #1: scan all the content to figure out the total amount of space * needed. Two separate width and height values are computed: * * width - Holds the sum of the widths (plus padding) of all the - * slaves seen so far that were packed LEFT or RIGHT. + * content seen so far that were packed LEFT or RIGHT. * height - Holds the sum of the heights (plus padding) of all the - * slaves seen so far that were packed TOP or BOTTOM. + * content seen so far that were packed TOP or BOTTOM. * - * maxWidth - Gradually builds up the width needed by the master to - * just barely satisfy all the slave's needs. For each - * slave, the code computes the width needed for all the - * slaves so far and updates maxWidth if the new value is + * maxWidth - Gradually builds up the width needed by the container to + * just barely satisfy all the content's needs. For each + * content, the code computes the width needed for all the + * content so far and updates maxWidth if the new value is * greater. * maxHeight - Same as maxWidth, except keeps height info. */ - width = maxWidth = Tk_InternalBorderLeft(masterPtr->tkwin) + - Tk_InternalBorderRight(masterPtr->tkwin); - height = maxHeight = Tk_InternalBorderTop(masterPtr->tkwin) + - Tk_InternalBorderBottom(masterPtr->tkwin); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) { - tmp = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padX + slavePtr->iPadX + width; + width = maxWidth = Tk_InternalBorderLeft(containerPtr->tkwin) + + Tk_InternalBorderRight(containerPtr->tkwin); + height = maxHeight = Tk_InternalBorderTop(containerPtr->tkwin) + + Tk_InternalBorderBottom(containerPtr->tkwin); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) { + tmp = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX + width; if (tmp > maxWidth) { maxWidth = tmp; } - height += Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY; + height += Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY; } else { - tmp = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY + height; + tmp = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY + height; if (tmp > maxHeight) { maxHeight = tmp; } - width += Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padX + slavePtr->iPadX; + width += Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX; } } if (width > maxWidth) { @@ -668,31 +668,31 @@ ArrangePacking( maxHeight = height; } - if (maxWidth < Tk_MinReqWidth(masterPtr->tkwin)) { - maxWidth = Tk_MinReqWidth(masterPtr->tkwin); + if (maxWidth < Tk_MinReqWidth(containerPtr->tkwin)) { + maxWidth = Tk_MinReqWidth(containerPtr->tkwin); } - if (maxHeight < Tk_MinReqHeight(masterPtr->tkwin)) { - maxHeight = Tk_MinReqHeight(masterPtr->tkwin); + if (maxHeight < Tk_MinReqHeight(containerPtr->tkwin)) { + maxHeight = Tk_MinReqHeight(containerPtr->tkwin); } /* - * If the total amount of space needed in the master window has changed, + * If the total amount of space needed in the container window has changed, * and if we're propagating geometry information, then notify the next * geometry manager up and requeue ourselves to start again after the - * master has had a chance to resize us. + * container has had a chance to resize us. */ - if (((maxWidth != Tk_ReqWidth(masterPtr->tkwin)) - || (maxHeight != Tk_ReqHeight(masterPtr->tkwin))) - && !(masterPtr->flags & DONT_PROPAGATE)) { - Tk_GeometryRequest(masterPtr->tkwin, maxWidth, maxHeight); - masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, masterPtr); + if (((maxWidth != Tk_ReqWidth(containerPtr->tkwin)) + || (maxHeight != Tk_ReqHeight(containerPtr->tkwin))) + && !(containerPtr->flags & DONT_PROPAGATE)) { + Tk_GeometryRequest(containerPtr->tkwin, maxWidth, maxHeight); + containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, containerPtr); goto done; } /* - * Pass #2: scan the slaves a second time assigning new sizes. The + * Pass #2: scan the content a second time assigning new sizes. The * "cavity" variables keep track of the unclaimed space in the cavity of * the window; this shrinks inward as we allocate windows around the * edges. The "frame" variables keep track of the space allocated to the @@ -700,22 +700,22 @@ ArrangePacking( * somewhere inside the frame, depending on anchor. */ - cavityX = x = Tk_InternalBorderLeft(masterPtr->tkwin); - cavityY = y = Tk_InternalBorderTop(masterPtr->tkwin); - cavityWidth = Tk_Width(masterPtr->tkwin) - - Tk_InternalBorderLeft(masterPtr->tkwin) - - Tk_InternalBorderRight(masterPtr->tkwin); - cavityHeight = Tk_Height(masterPtr->tkwin) - - Tk_InternalBorderTop(masterPtr->tkwin) - - Tk_InternalBorderBottom(masterPtr->tkwin); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) { + cavityX = x = Tk_InternalBorderLeft(containerPtr->tkwin); + cavityY = y = Tk_InternalBorderTop(containerPtr->tkwin); + cavityWidth = Tk_Width(containerPtr->tkwin) - + Tk_InternalBorderLeft(containerPtr->tkwin) - + Tk_InternalBorderRight(containerPtr->tkwin); + cavityHeight = Tk_Height(containerPtr->tkwin) - + Tk_InternalBorderTop(containerPtr->tkwin) - + Tk_InternalBorderBottom(containerPtr->tkwin); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) { frameWidth = cavityWidth; - frameHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY; - if (slavePtr->flags & EXPAND) { - frameHeight += YExpansion(slavePtr, cavityHeight); + frameHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY; + if (contentPtr->flags & EXPAND) { + frameHeight += YExpansion(contentPtr, cavityHeight); } cavityHeight -= frameHeight; if (cavityHeight < 0) { @@ -723,7 +723,7 @@ ArrangePacking( cavityHeight = 0; } frameX = cavityX; - if (slavePtr->side == TOP) { + if (contentPtr->side == TOP) { frameY = cavityY; cavityY += frameHeight; } else { @@ -731,10 +731,10 @@ ArrangePacking( } } else { frameHeight = cavityHeight; - frameWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padX + slavePtr->iPadX; - if (slavePtr->flags & EXPAND) { - frameWidth += XExpansion(slavePtr, cavityWidth); + frameWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX; + if (contentPtr->flags & EXPAND) { + frameWidth += XExpansion(contentPtr, cavityWidth); } cavityWidth -= frameWidth; if (cavityWidth < 0) { @@ -742,7 +742,7 @@ ArrangePacking( cavityWidth = 0; } frameY = cavityY; - if (slavePtr->side == LEFT) { + if (contentPtr->side == LEFT) { frameX = cavityX; cavityX += frameWidth; } else { @@ -759,31 +759,31 @@ ArrangePacking( * completely ignored except when computing frame size). */ - if (slavePtr->flags & OLD_STYLE) { + if (contentPtr->flags & OLD_STYLE) { borderX = borderY = 0; borderTop = borderBtm = 0; borderLeft = borderRight = 0; } else { - borderX = slavePtr->padX; - borderY = slavePtr->padY; - borderLeft = slavePtr->padLeft; + borderX = contentPtr->padX; + borderY = contentPtr->padY; + borderLeft = contentPtr->padLeft; borderRight = borderX - borderLeft; - borderTop = slavePtr->padTop; + borderTop = contentPtr->padTop; borderBtm = borderY - borderTop; } - width = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->iPadX; - if ((slavePtr->flags & FILLX) + width = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->iPadX; + if ((contentPtr->flags & FILLX) || (width > (frameWidth - borderX))) { width = frameWidth - borderX; } - height = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->iPadY; - if ((slavePtr->flags & FILLY) + height = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->iPadY; + if ((contentPtr->flags & FILLY) || (height > (frameHeight - borderY))) { height = frameHeight - borderY; } - switch (slavePtr->anchor) { + switch (contentPtr->anchor) { case TK_ANCHOR_N: x = frameX + (borderLeft + frameWidth - width - borderRight)/2; y = frameY + borderTop; @@ -823,44 +823,44 @@ ArrangePacking( default: Tcl_Panic("bad frame factor in ArrangePacking"); } - width -= slavePtr->doubleBw; - height -= slavePtr->doubleBw; + width -= contentPtr->doubleBw; + height -= contentPtr->doubleBw; /* * The final step is to set the position, size, and mapped/unmapped - * state of the slave. If the slave is a child of the master, then do + * state of the content. If the content is a child of the container, then do * this here. Otherwise let Tk_MaintainGeometry do the work. */ - if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { + if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) { if ((width <= 0) || (height <= 0)) { - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - if ((x != Tk_X(slavePtr->tkwin)) - || (y != Tk_Y(slavePtr->tkwin)) - || (width != Tk_Width(slavePtr->tkwin)) - || (height != Tk_Height(slavePtr->tkwin))) { - Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height); + if ((x != Tk_X(contentPtr->tkwin)) + || (y != Tk_Y(contentPtr->tkwin)) + || (width != Tk_Width(contentPtr->tkwin)) + || (height != Tk_Height(contentPtr->tkwin))) { + Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height); } if (abort) { goto done; } /* - * Don't map the slave if the master isn't mapped: wait until - * the master gets mapped later. + * Don't map the content if the container isn't mapped: wait until + * the container gets mapped later. */ - if (Tk_IsMapped(masterPtr->tkwin)) { - Tk_MapWindow(slavePtr->tkwin); + if (Tk_IsMapped(containerPtr->tkwin)) { + Tk_MapWindow(contentPtr->tkwin); } } } else { if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin); - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, + Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y, width, height); } } @@ -877,8 +877,8 @@ ArrangePacking( } done: - masterPtr->abortPtr = NULL; - Tcl_Release(masterPtr); + containerPtr->abortPtr = NULL; + Tcl_Release(containerPtr); } /* @@ -886,7 +886,7 @@ ArrangePacking( * * XExpansion -- * - * Given a list of packed slaves, the first of which is packed on the + * Given a list of packed content, the first of which is packed on the * left or right and is expandable, compute how much to expand the child. * * Results: @@ -901,9 +901,9 @@ ArrangePacking( static int XExpansion( - register Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *contentPtr, /* First in list of remaining content. */ int cavityWidth) /* Horizontal space left for all remaining - * slaves. */ + * content. */ { int numExpand, minExpand, curExpand; int childWidth; @@ -921,10 +921,10 @@ XExpansion( minExpand = cavityWidth; numExpand = 0; - for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { - childWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padX + slavePtr->iPadX; - if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) { + for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) { + childWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX; + if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) { if (numExpand) { curExpand = (cavityWidth - childWidth)/numExpand; if (curExpand < minExpand) { @@ -933,7 +933,7 @@ XExpansion( } } else { cavityWidth -= childWidth; - if (slavePtr->flags & EXPAND) { + if (contentPtr->flags & EXPAND) { numExpand++; } } @@ -952,7 +952,7 @@ XExpansion( * * YExpansion -- * - * Given a list of packed slaves, the first of which is packed on the top + * Given a list of packed content, the first of which is packed on the top * or bottom and is expandable, compute how much to expand the child. * * Results: @@ -967,9 +967,9 @@ XExpansion( static int YExpansion( - register Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *contentPtr, /* First in list of remaining content. */ int cavityHeight) /* Vertical space left for all remaining - * slaves. */ + * content. */ { int numExpand, minExpand, curExpand; int childHeight; @@ -980,10 +980,10 @@ YExpansion( minExpand = cavityHeight; numExpand = 0; - for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { - childHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY; - if ((slavePtr->side == LEFT) || (slavePtr->side == RIGHT)) { + for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) { + childHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY; + if ((contentPtr->side == LEFT) || (contentPtr->side == RIGHT)) { if (numExpand) { curExpand = (cavityHeight - childHeight)/numExpand; if (curExpand < minExpand) { @@ -992,7 +992,7 @@ YExpansion( } } else { cavityHeight -= childHeight; - if (slavePtr->flags & EXPAND) { + if (contentPtr->flags & EXPAND) { numExpand++; } } @@ -1030,7 +1030,7 @@ GetPacker( Tk_Window tkwin) /* Token for window for which packer structure * is desired. */ { - register Packer *packPtr; + Packer *packPtr; Tcl_HashEntry *hPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -1048,13 +1048,13 @@ GetPacker( hPtr = Tcl_CreateHashEntry(&dispPtr->packerHashTable, (char *) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Packer *)Tcl_GetHashValue(hPtr); } - packPtr = ckalloc(sizeof(Packer)); + packPtr = (Packer *)ckalloc(sizeof(Packer)); packPtr->tkwin = tkwin; - packPtr->masterPtr = NULL; + packPtr->containerPtr = NULL; packPtr->nextPtr = NULL; - packPtr->slavePtr = NULL; + packPtr->contentPtr = NULL; packPtr->side = TOP; packPtr->anchor = TK_ANCHOR_CENTER; packPtr->padX = packPtr->padY = 0; @@ -1075,7 +1075,7 @@ GetPacker( * PackAfter -- * * This function does most of the real work of adding one or more windows - * into the packing order for its master. + * into the packing order for its container. * * Results: * A standard Tcl return value. @@ -1092,14 +1092,14 @@ PackAfter( Tcl_Interp *interp, /* Interpreter for error reporting. */ Packer *prevPtr, /* Pack windows in argv just after this * window; NULL means pack as first child of - * masterPtr. */ - Packer *masterPtr, /* Master in which to pack windows. */ + * containerPtr. */ + Packer *containerPtr, /* Container in which to pack windows. */ int objc, /* Number of elements in objv. */ Tcl_Obj *const objv[]) /* Array of lists, each containing 2 elements: * window name and side against which to * pack. */ { - register Packer *packPtr; + Packer *packPtr; Tk_Window tkwin, ancestor, parent; Tcl_Obj **options; int index, optionCount, c; @@ -1125,13 +1125,13 @@ PackAfter( * its parent. */ - if (TkGetWindowFromObj(interp, masterPtr->tkwin, objv[0], &tkwin) + if (TkGetWindowFromObj(interp, containerPtr->tkwin, objv[0], &tkwin) != TCL_OK) { return TCL_ERROR; } parent = Tk_Parent(tkwin); - for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { + for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { if (ancestor == parent) { break; } @@ -1139,7 +1139,7 @@ PackAfter( badWindow: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack %s inside %s", Tcl_GetString(objv[0]), - Tk_PathName(masterPtr->tkwin))); + Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); return TCL_ERROR; } @@ -1147,7 +1147,7 @@ PackAfter( if (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) { goto badWindow; } - if (tkwin == masterPtr->tkwin) { + if (tkwin == containerPtr->tkwin) { goto badWindow; } packPtr = GetPacker(tkwin); @@ -1169,8 +1169,8 @@ PackAfter( packPtr->flags |= OLD_STYLE; for (index = 0 ; index < optionCount; index++) { Tcl_Obj *curOptPtr = options[index]; - const char *curOpt = Tcl_GetString(curOptPtr); - size_t length = curOptPtr->length; + int length; + const char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length); c = curOpt[0]; @@ -1227,7 +1227,7 @@ PackAfter( packPtr->iPadY = 0; index++; } else if ((c == 'f') && (length > 1) - && (strncmp(curOpt, "frame", (size_t) length) == 0)) { + && (strncmp(curOpt, "frame", length) == 0)) { if (optionCount < (index+2)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "wrong # args: \"frame\"" @@ -1257,53 +1257,53 @@ PackAfter( * Unpack this window if it's currently packed. */ - if (packPtr->masterPtr != NULL) { - if ((packPtr->masterPtr != masterPtr) && - (packPtr->masterPtr->tkwin + if (packPtr->containerPtr != NULL) { + if ((packPtr->containerPtr != containerPtr) && + (packPtr->containerPtr->tkwin != Tk_Parent(packPtr->tkwin))) { Tk_UnmaintainGeometry(packPtr->tkwin, - packPtr->masterPtr->tkwin); + packPtr->containerPtr->tkwin); } Unlink(packPtr); } /* - * Add the window in the correct place in its master's packing + * Add the window in the correct place in its container's packing * order, then make sure that the window is managed by us. */ - packPtr->masterPtr = masterPtr; + packPtr->containerPtr = containerPtr; if (prevPtr == NULL) { - packPtr->nextPtr = masterPtr->slavePtr; - masterPtr->slavePtr = packPtr; + packPtr->nextPtr = containerPtr->contentPtr; + containerPtr->contentPtr = packPtr; } else { packPtr->nextPtr = prevPtr->nextPtr; prevPtr->nextPtr = packPtr; } Tk_ManageGeometry(tkwin, &packerType, packPtr); - if (!(masterPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryMaster(interp, masterPtr->tkwin, "pack") + if (!(containerPtr->flags & DONT_PROPAGATE)) { + if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack") != TCL_OK) { Tk_ManageGeometry(tkwin, NULL, NULL); Unlink(packPtr); return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } } } /* - * Arrange for the master to be re-packed at the first idle moment. + * Arrange for the container to be re-packed at the first idle moment. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_REPACK)) { - masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, masterPtr); + if (!(containerPtr->flags & REQUESTED_REPACK)) { + containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, containerPtr); } return TCL_OK; } @@ -1313,31 +1313,31 @@ PackAfter( * * Unlink -- * - * Remove a packer from its master's list of slaves. + * Remove a packer from its container's list of content. * * Results: * None. * * Side effects: - * The master will be scheduled for repacking. + * The container will be scheduled for repacking. * *---------------------------------------------------------------------- */ static void Unlink( - register Packer *packPtr) /* Window to unlink. */ + Packer *packPtr) /* Window to unlink. */ { - register Packer *masterPtr, *packPtr2; + Packer *containerPtr, *packPtr2; - masterPtr = packPtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = packPtr->containerPtr; + if (containerPtr == NULL) { return; } - if (masterPtr->slavePtr == packPtr) { - masterPtr->slavePtr = packPtr->nextPtr; + if (containerPtr->contentPtr == packPtr) { + containerPtr->contentPtr = packPtr->nextPtr; } else { - for (packPtr2 = masterPtr->slavePtr; ; packPtr2 = packPtr2->nextPtr) { + for (packPtr2 = containerPtr->contentPtr; ; packPtr2 = packPtr2->nextPtr) { if (packPtr2 == NULL) { Tcl_Panic("Unlink couldn't find previous window"); } @@ -1347,24 +1347,24 @@ Unlink( } } } - if (!(masterPtr->flags & REQUESTED_REPACK)) { - masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, masterPtr); + if (!(containerPtr->flags & REQUESTED_REPACK)) { + containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, containerPtr); } - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - packPtr->masterPtr = NULL; + packPtr->containerPtr = NULL; /* - * If we have emptied this master from slaves it means we are no longer + * If we have emptied this container from content it means we are no longer * handling it and should mark it as free. */ - if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { - TkFreeGeometryMaster(masterPtr->tkwin, "pack"); - masterPtr->flags &= ~ALLOCED_MASTER; + if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { + TkFreeGeometryContainer(containerPtr->tkwin, "pack"); + containerPtr->flags &= ~ALLOCED_CONTAINER; } } @@ -1392,7 +1392,7 @@ DestroyPacker( void *memPtr) /* Info about packed window that is now * dead. */ { - register Packer *packPtr = memPtr; + Packer *packPtr = (Packer *)memPtr; ckfree(packPtr); } @@ -1410,7 +1410,7 @@ DestroyPacker( * * Side effects: * If a window was just deleted, clean up all its packer-related - * information. If it was just resized, repack its slaves, if any. + * information. If it was just resized, repack its content, if any. * *---------------------------------------------------------------------- */ @@ -1421,42 +1421,42 @@ PackStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Packer *packPtr = clientData; + Packer *packPtr = (Packer *)clientData; if (eventPtr->type == ConfigureNotify) { - if ((packPtr->slavePtr != NULL) + if ((packPtr->contentPtr != NULL) && !(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; Tcl_DoWhenIdle(ArrangePacking, packPtr); } - if ((packPtr->masterPtr != NULL) + if ((packPtr->containerPtr != NULL) && (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width)) { - if (!(packPtr->masterPtr->flags & REQUESTED_REPACK)) { + if (!(packPtr->containerPtr->flags & REQUESTED_REPACK)) { packPtr->doubleBw = 2*Tk_Changes(packPtr->tkwin)->border_width; - packPtr->masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, packPtr->masterPtr); + packPtr->containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, packPtr->containerPtr); } } } else if (eventPtr->type == DestroyNotify) { - register Packer *slavePtr, *nextPtr; + Packer *contentPtr, *nextPtr; - if (packPtr->masterPtr != NULL) { + if (packPtr->containerPtr != NULL) { Unlink(packPtr); } - for (slavePtr = packPtr->slavePtr; slavePtr != NULL; - slavePtr = nextPtr) { - Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL); - Tk_UnmapWindow(slavePtr->tkwin); - slavePtr->masterPtr = NULL; - nextPtr = slavePtr->nextPtr; - slavePtr->nextPtr = NULL; + for (contentPtr = packPtr->contentPtr; contentPtr != NULL; + contentPtr = nextPtr) { + Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL); + Tk_UnmapWindow(contentPtr->tkwin); + contentPtr->containerPtr = NULL; + nextPtr = contentPtr->nextPtr; + contentPtr->nextPtr = NULL; } if (packPtr->tkwin != NULL) { TkDisplay *dispPtr = ((TkWindow *) packPtr->tkwin)->dispPtr; Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->packerHashTable, - (char *) packPtr->tkwin)); + (void *)packPtr->tkwin)); } if (packPtr->flags & REQUESTED_REPACK) { @@ -1466,24 +1466,24 @@ PackStructureProc( Tcl_EventuallyFree(packPtr, (Tcl_FreeProc *) DestroyPacker); } else if (eventPtr->type == MapNotify) { /* - * When a master gets mapped, must redo the geometry computation so - * that all of its slaves get remapped. + * When a container gets mapped, must redo the geometry computation so + * that all of its content get remapped. */ - if ((packPtr->slavePtr != NULL) + if ((packPtr->contentPtr != NULL) && !(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; Tcl_DoWhenIdle(ArrangePacking, packPtr); } } else if (eventPtr->type == UnmapNotify) { - register Packer *packPtr2; + Packer *packPtr2; /* - * Unmap all of the slaves when the master gets unmapped, so that they + * Unmap all of the content when the container gets unmapped, so that they * don't bother to keep redisplaying themselves. */ - for (packPtr2 = packPtr->slavePtr; packPtr2 != NULL; + for (packPtr2 = packPtr->contentPtr; packPtr2 != NULL; packPtr2 = packPtr2->nextPtr) { Tk_UnmapWindow(packPtr2->tkwin); } @@ -1493,36 +1493,36 @@ PackStructureProc( /* *---------------------------------------------------------------------- * - * ConfigureSlaves -- + * ConfigureContent -- * * This implements the guts of the "pack configure" command. Given a list - * of slaves and configuration options, it arranges for the packer to - * manage the slaves and sets the specified options. + * of content and configuration options, it arranges for the packer to + * manage the content and sets the specified options. * * Results: * TCL_OK is returned if all went well. Otherwise, TCL_ERROR is returned * and the interp's result is set to contain an error message. * * Side effects: - * Slave windows get taken over by the packer. + * Content windows get taken over by the packer. * *---------------------------------------------------------------------- */ static int -ConfigureSlaves( +ConfigureContent( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Any window in application containing - * slaves. Used to look up slave names. */ + * content. Used to look up content names. */ int objc, /* Number of elements in argv. */ Tcl_Obj *const objv[]) /* Argument objects: contains one or more * window names followed by any number of * "option value" pairs. Caller must make sure * that there is at least one window name. */ { - Packer *masterPtr, *slavePtr, *prevPtr, *otherPtr; - Tk_Window other, slave, parent, ancestor; - TkWindow *master; + Packer *containerPtr, *contentPtr, *prevPtr, *otherPtr; + Tk_Window other, content, parent, ancestor; + TkWindow *container; int i, j, numWindows, tmp, positionGiven; const char *string; static const char *const optionStrings[] = { @@ -1545,45 +1545,45 @@ ConfigureSlaves( } /* - * Iterate over all of the slave windows, parsing the configuration - * options for each slave. It's a bit wasteful to re-parse the options for - * each slave, but things get too messy if we try to parse the arguments - * just once at the beginning. For example, if a slave already is packed + * Iterate over all of the content windows, parsing the configuration + * options for each content. It's a bit wasteful to re-parse the options for + * each content, but things get too messy if we try to parse the arguments + * just once at the beginning. For example, if a content already is packed * we want to just change a few existing values without resetting * everything. If there are multiple windows, the -after, -before, and -in * options only get processed for the first window. */ - masterPtr = NULL; + containerPtr = NULL; prevPtr = NULL; positionGiven = 0; for (j = 0; j < numWindows; j++) { - if (TkGetWindowFromObj(interp, tkwin, objv[j], &slave) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[j], &content) != TCL_OK) { return TCL_ERROR; } - if (Tk_TopWinHierarchy(slave)) { + if (Tk_TopWinHierarchy(content)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack \"%s\": it's a top-level window", Tcl_GetString(objv[j]))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL); return TCL_ERROR; } - slavePtr = GetPacker(slave); - slavePtr->flags &= ~OLD_STYLE; + contentPtr = GetPacker(content); + contentPtr->flags &= ~OLD_STYLE; /* - * If the slave isn't currently packed, reset all of its configuration + * If the content isn't currently packed, reset all of its configuration * information to default values (there could be old values left from * a previous packing). */ - if (slavePtr->masterPtr == NULL) { - slavePtr->side = TOP; - slavePtr->anchor = TK_ANCHOR_CENTER; - slavePtr->padX = slavePtr->padY = 0; - slavePtr->padLeft = slavePtr->padTop = 0; - slavePtr->iPadX = slavePtr->iPadY = 0; - slavePtr->flags &= ~(FILLX|FILLY|EXPAND); + if (contentPtr->containerPtr == NULL) { + contentPtr->side = TOP; + contentPtr->anchor = TK_ANCHOR_CENTER; + contentPtr->padX = contentPtr->padY = 0; + contentPtr->padLeft = contentPtr->padTop = 0; + contentPtr->iPadX = contentPtr->iPadY = 0; + contentPtr->flags &= ~(FILLX|FILLY|EXPAND); } for (i = numWindows; i < objc; i+=2) { @@ -1607,7 +1607,7 @@ ConfigureSlaves( return TCL_ERROR; } prevPtr = GetPacker(other); - if (prevPtr->masterPtr == NULL) { + if (prevPtr->containerPtr == NULL) { notPacked: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", @@ -1616,12 +1616,12 @@ ConfigureSlaves( NULL); return TCL_ERROR; } - masterPtr = prevPtr->masterPtr; + containerPtr = prevPtr->containerPtr; positionGiven = 1; } break; case CONF_ANCHOR: - if (Tk_GetAnchorFromObj(interp, objv[i+1], &slavePtr->anchor) + if (Tk_GetAnchorFromObj(interp, objv[i+1], &contentPtr->anchor) != TCL_OK) { return TCL_ERROR; } @@ -1633,11 +1633,11 @@ ConfigureSlaves( return TCL_ERROR; } otherPtr = GetPacker(other); - if (otherPtr->masterPtr == NULL) { + if (otherPtr->containerPtr == NULL) { goto notPacked; } - masterPtr = otherPtr->masterPtr; - prevPtr = masterPtr->slavePtr; + containerPtr = otherPtr->containerPtr; + prevPtr = containerPtr->contentPtr; if (prevPtr == otherPtr) { prevPtr = NULL; } else { @@ -1652,21 +1652,21 @@ ConfigureSlaves( if (Tcl_GetBooleanFromObj(interp, objv[i+1], &tmp) != TCL_OK) { return TCL_ERROR; } - slavePtr->flags &= ~EXPAND; + contentPtr->flags &= ~EXPAND; if (tmp) { - slavePtr->flags |= EXPAND; + contentPtr->flags |= EXPAND; } break; case CONF_FILL: string = Tcl_GetString(objv[i+1]); if (strcmp(string, "none") == 0) { - slavePtr->flags &= ~(FILLX|FILLY); + contentPtr->flags &= ~(FILLX|FILLY); } else if (strcmp(string, "x") == 0) { - slavePtr->flags = (slavePtr->flags & ~FILLY) | FILLX; + contentPtr->flags = (contentPtr->flags & ~FILLY) | FILLX; } else if (strcmp(string, "y") == 0) { - slavePtr->flags = (slavePtr->flags & ~FILLX) | FILLY; + contentPtr->flags = (contentPtr->flags & ~FILLX) | FILLY; } else if (strcmp(string, "both") == 0) { - slavePtr->flags |= FILLX|FILLY; + contentPtr->flags |= FILLX|FILLY; } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad fill style \"%s\": must be " @@ -1681,8 +1681,8 @@ ConfigureSlaves( != TCL_OK) { return TCL_ERROR; } - masterPtr = GetPacker(other); - prevPtr = masterPtr->slavePtr; + containerPtr = GetPacker(other); + prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { prevPtr = prevPtr->nextPtr; @@ -1692,7 +1692,7 @@ ConfigureSlaves( } break; case CONF_IPADX: - if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp) + if ((Tk_GetPixelsFromObj(interp, content, objv[i+1], &tmp) != TCL_OK) || (tmp < 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipadx value \"%s\": must be positive screen" @@ -1700,10 +1700,10 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadX = tmp * 2; + contentPtr->iPadX = tmp * 2; break; case CONF_IPADY: - if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp) + if ((Tk_GetPixelsFromObj(interp, content, objv[i+1], &tmp) != TCL_OK) || (tmp < 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad ipady value \"%s\": must be positive screen" @@ -1711,17 +1711,17 @@ ConfigureSlaves( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadY = tmp * 2; + contentPtr->iPadY = tmp * 2; break; case CONF_PADX: - if (TkParsePadAmount(interp, slave, objv[i+1], - &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) { + if (TkParsePadAmount(interp, content, objv[i+1], + &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) { return TCL_ERROR; } break; case CONF_PADY: - if (TkParsePadAmount(interp, slave, objv[i+1], - &slavePtr->padTop, &slavePtr->padY) != TCL_OK) { + if (TkParsePadAmount(interp, content, objv[i+1], + &contentPtr->padTop, &contentPtr->padY) != TCL_OK) { return TCL_ERROR; } break; @@ -1730,42 +1730,42 @@ ConfigureSlaves( sizeof(char *), "side", TCL_EXACT, &side) != TCL_OK) { return TCL_ERROR; } - slavePtr->side = (Side) side; + contentPtr->side = (Side) side; break; } } /* - * If no position in a packing list was specified and the slave is + * If no position in a packing list was specified and the content is * already packed, then leave it in its current location in its * current packing list. */ - if (!positionGiven && (slavePtr->masterPtr != NULL)) { - masterPtr = slavePtr->masterPtr; + if (!positionGiven && (contentPtr->containerPtr != NULL)) { + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } /* - * If the slave is going to be put back after itself or the same -in + * If the content is going to be put back after itself or the same -in * window is passed in again, then just skip the whole operation, * since it won't work anyway. */ - if (prevPtr == slavePtr) { - masterPtr = slavePtr->masterPtr; + if (prevPtr == contentPtr) { + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } /* * If none of the "-in", "-before", or "-after" options has been - * specified, arrange for the slave to go at the end of the order for + * specified, arrange for the content to go at the end of the order for * its parent. */ if (!positionGiven) { - masterPtr = GetPacker(Tk_Parent(slave)); - prevPtr = masterPtr->slavePtr; + containerPtr = GetPacker(Tk_Parent(content)); + prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { prevPtr = prevPtr->nextPtr; @@ -1774,25 +1774,25 @@ ConfigureSlaves( } /* - * Make sure that the slave's parent is either the master or an - * ancestor of the master, and that the master and slave aren't the + * Make sure that the content's parent is either the container or an + * ancestor of the container, and that the container and content aren't the * same. */ - parent = Tk_Parent(slave); - for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { + parent = Tk_Parent(content); + for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) { if (ancestor == parent) { break; } if (Tk_TopWinHierarchy(ancestor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack %s inside %s", Tcl_GetString(objv[j]), - Tk_PathName(masterPtr->tkwin))); + Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); return TCL_ERROR; } } - if (slave == masterPtr->tkwin) { + if (content == containerPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack %s inside itself", Tcl_GetString(objv[j]))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); @@ -1803,67 +1803,67 @@ ConfigureSlaves( * Check for management loops. */ - for (master = (TkWindow *)masterPtr->tkwin; master != NULL; - master = (TkWindow *)TkGetGeomMaster(master)) { - if (master == (TkWindow *)slave) { + for (container = (TkWindow *)containerPtr->tkwin; container != NULL; + container = (TkWindow *)TkGetGeomMaster(container)) { + if (container == (TkWindow *)content) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", - Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin))); + Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); return TCL_ERROR; } } - if (masterPtr->tkwin != Tk_Parent(slave)) { - ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin; + if (containerPtr->tkwin != Tk_Parent(content)) { + ((TkWindow *)content)->maintainerPtr = (TkWindow *)containerPtr->tkwin; } /* - * Unpack the slave if it's currently packed, then position it after + * Unpack the content if it's currently packed, then position it after * prevPtr. */ - if (slavePtr->masterPtr != NULL) { - if ((slavePtr->masterPtr != masterPtr) && - (slavePtr->masterPtr->tkwin - != Tk_Parent(slavePtr->tkwin))) { - Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->masterPtr->tkwin); + if (contentPtr->containerPtr != NULL) { + if ((contentPtr->containerPtr != containerPtr) && + (contentPtr->containerPtr->tkwin + != Tk_Parent(contentPtr->tkwin))) { + Tk_UnmaintainGeometry(contentPtr->tkwin, + contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); + Unlink(contentPtr); } - slavePtr->masterPtr = masterPtr; + contentPtr->containerPtr = containerPtr; if (prevPtr == NULL) { - slavePtr->nextPtr = masterPtr->slavePtr; - masterPtr->slavePtr = slavePtr; + contentPtr->nextPtr = containerPtr->contentPtr; + containerPtr->contentPtr = contentPtr; } else { - slavePtr->nextPtr = prevPtr->nextPtr; - prevPtr->nextPtr = slavePtr; + contentPtr->nextPtr = prevPtr->nextPtr; + prevPtr->nextPtr = contentPtr; } - Tk_ManageGeometry(slave, &packerType, slavePtr); - prevPtr = slavePtr; + Tk_ManageGeometry(content, &packerType, contentPtr); + prevPtr = contentPtr; - if (!(masterPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryMaster(interp, masterPtr->tkwin, "pack") + if (!(containerPtr->flags & DONT_PROPAGATE)) { + if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack") != TCL_OK) { - Tk_ManageGeometry(slave, NULL, NULL); - Unlink(slavePtr); + Tk_ManageGeometry(content, NULL, NULL); + Unlink(contentPtr); return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } /* - * Arrange for the master to be re-packed at the first idle moment. + * Arrange for the container to be re-packed at the first idle moment. */ scheduleLayout: - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_REPACK)) { - masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, masterPtr); + if (!(containerPtr->flags & REQUESTED_REPACK)) { + containerPtr->flags |= REQUESTED_REPACK; + Tcl_DoWhenIdle(ArrangePacking, containerPtr); } } return TCL_OK; diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index ac61ba8..fec9448 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -70,7 +70,7 @@ enum stretch { typedef struct { Tk_OptionTable pwOptions; /* Token for paned window option table. */ - Tk_OptionTable slaveOpts; /* Token for slave cget option table. */ + Tk_OptionTable paneOpts; /* Token for pane cget option table. */ } OptionTables; /* @@ -78,35 +78,35 @@ typedef struct { * managed by a paned window widget. */ -typedef struct Slave { +typedef struct Pane { Tk_Window tkwin; /* Window being managed. */ int minSize; /* Minimum size of this pane, on the relevant * axis, in pixels. */ - int padx; /* Additional padding requested for slave, in + int padx; /* Additional padding requested for pane, in * the x dimension. */ - int pady; /* Additional padding requested for slave, in + int pady; /* Additional padding requested for pane, in * the y dimension. */ Tcl_Obj *widthPtr, *heightPtr; - /* Tcl_Obj rep's of slave width/height, to + /* Tcl_Obj rep's of pane width/height, to * allow for null values. */ - int width; /* Slave width. */ - int height; /* Slave height. */ + int width; /* Pane width. */ + int height; /* Pane height. */ int sticky; /* Sticky string. */ int x, y; /* Coordinates of the widget. */ int paneWidth, paneHeight; /* Pane dimensions (may be different from - * slave width/height). */ + * pane width/height). */ int sashx, sashy; /* Coordinates of the sash of the right or * bottom of this pane. */ int markx, marky; /* Coordinates of the last mark set for the * sash. */ int handlex, handley; /* Coordinates of the sash handle. */ - enum stretch stretch; /* Controls how slave grows/shrinks */ + enum stretch stretch; /* Controls how pane grows/shrinks */ int hide; /* Controls visibility of pane */ - struct PanedWindow *masterPtr; + struct PanedWindow *containerPtr; /* Paned window managing the window. */ Tk_Window after; /* Placeholder for parsing options. */ Tk_Window before; /* Placeholder for parsing options. */ -} Slave; +} Pane; /* * A data structure of the following type is kept for each paned window widget @@ -121,7 +121,7 @@ typedef struct PanedWindow { Tcl_Command widgetCmd; /* Token for square's widget command. */ Tk_OptionTable optionTable; /* Token representing the configuration * specifications. */ - Tk_OptionTable slaveOpts; /* Token for slave cget table. */ + Tk_OptionTable paneOpts; /* Token for pane cget table. */ Tk_3DBorder background; /* Background color. */ int borderWidth; /* Value of -borderwidth option. */ int relief; /* 3D border effect (TK_RELIEF_RAISED, etc) */ @@ -151,9 +151,9 @@ typedef struct PanedWindow { Tcl_Obj *proxyBorderWidthPtr; /* Tcl_Obj rep for proxyBorderWidth */ int proxyBorderWidth; /* Borderwidth used to draw proxy. */ int proxyRelief; /* Relief used to draw proxy, if TK_RELIEF_NULL then use relief. */ - Slave **slaves; /* Pointer to array of Slaves. */ - int numSlaves; /* Number of slaves. */ - int sizeofSlaves; /* Number of elements in the slaves array. */ + Pane **panes; /* Pointer to array of Panes. */ + int numPanes; /* Number of panes. */ + int sizeofPanes; /* Number of elements in the panes array. */ int flags; /* Flags for widget; see below. */ } PanedWindow; @@ -200,16 +200,16 @@ static void DisplayProxyWindow(ClientData clientData); static void PanedWindowWorldChanged(ClientData instanceData); static int PanedWindowWidgetObjCmd(ClientData clientData, Tcl_Interp *, int objc, Tcl_Obj * const objv[]); -static void PanedWindowLostSlaveProc(ClientData clientData, +static void PanedWindowLostPaneProc(ClientData clientData, Tk_Window tkwin); static void PanedWindowReqProc(ClientData clientData, Tk_Window tkwin); static void ArrangePanes(ClientData clientData); -static void Unlink(Slave *slavePtr); -static Slave * GetPane(PanedWindow *pwPtr, Tk_Window tkwin); +static void Unlink(Pane *panePtr); +static Pane * GetPane(PanedWindow *pwPtr, Tk_Window tkwin); static void GetFirstLastVisiblePane(PanedWindow *pwPtr, int *firstPtr, int *lastPtr); -static void SlaveStructureProc(ClientData clientData, +static void PaneStructureProc(ClientData clientData, XEvent *eventPtr); static int PanedWindowSashCommand(PanedWindow *pwPtr, Tcl_Interp *interp, int objc, @@ -218,7 +218,7 @@ static int PanedWindowProxyCommand(PanedWindow *pwPtr, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); static void ComputeGeometry(PanedWindow *pwPtr); -static int ConfigureSlaves(PanedWindow *pwPtr, +static int ConfigurePanes(PanedWindow *pwPtr, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); static void DestroyOptionTables(ClientData clientData, @@ -233,7 +233,7 @@ static void RestoreSticky(ClientData clientData, Tk_Window tkwin, char *internalPtr, char *oldInternalPtr); static void AdjustForSticky(int sticky, int cavityWidth, int cavityHeight, int *xPtr, int *yPtr, - int *slaveWidthPtr, int *slaveHeightPtr); + int *paneWidthPtr, int *paneHeightPtr); static void MoveSash(PanedWindow *pwPtr, int sash, int diff); static int ObjectIsEmpty(Tcl_Obj *objPtr); static char * ComputeSlotAddress(char *recordPtr, int offset); @@ -241,16 +241,16 @@ static int PanedWindowIdentifyCoords(PanedWindow *pwPtr, Tcl_Interp *interp, int x, int y); /* - * Sashes are between panes only, so there is one less sash than slaves + * Sashes are between panes only, so there is one less sash than panes */ #define ValidSashIndex(pwPtr, sash) \ - (((sash) >= 0) && ((sash) < ((pwPtr)->numSlaves-1))) + (((sash) >= 0) && ((sash) < ((pwPtr)->numPanes-1))) static const Tk_GeomMgr panedWindowMgrType = { "panedwindow", /* name */ PanedWindowReqProc, /* requestProc */ - PanedWindowLostSlaveProc, /* lostSlaveProc */ + PanedWindowLostPaneProc, /* lostPaneProc */ }; /* @@ -261,7 +261,7 @@ static const Tk_GeomMgr panedWindowMgrType = { /* * The following structure contains pointers to functions used for processing - * the custom "-sticky" option for slave windows. + * the custom "-sticky" option for panes. */ static const Tk_ObjCustomOption stickyOption = { @@ -334,33 +334,33 @@ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; -static const Tk_OptionSpec slaveOptionSpecs[] = { +static const Tk_OptionSpec paneOptionSpecs[] = { {TK_OPTION_WINDOW, "-after", NULL, NULL, - DEF_PANEDWINDOW_PANE_AFTER, -1, Tk_Offset(Slave, after), + DEF_PANEDWINDOW_PANE_AFTER, -1, Tk_Offset(Pane, after), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_WINDOW, "-before", NULL, NULL, - DEF_PANEDWINDOW_PANE_BEFORE, -1, Tk_Offset(Slave, before), + DEF_PANEDWINDOW_PANE_BEFORE, -1, Tk_Offset(Pane, before), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-height", NULL, NULL, - DEF_PANEDWINDOW_PANE_HEIGHT, Tk_Offset(Slave, heightPtr), - Tk_Offset(Slave, height), TK_OPTION_NULL_OK, 0, 0}, + DEF_PANEDWINDOW_PANE_HEIGHT, Tk_Offset(Pane, heightPtr), + Tk_Offset(Pane, height), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", - DEF_PANEDWINDOW_PANE_HIDE, -1, Tk_Offset(Slave, hide), 0,0,GEOMETRY}, + DEF_PANEDWINDOW_PANE_HIDE, -1, Tk_Offset(Pane, hide), 0,0,GEOMETRY}, {TK_OPTION_PIXELS, "-minsize", NULL, NULL, - DEF_PANEDWINDOW_PANE_MINSIZE, -1, Tk_Offset(Slave, minSize), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_MINSIZE, -1, Tk_Offset(Pane, minSize), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, - DEF_PANEDWINDOW_PANE_PADX, -1, Tk_Offset(Slave, padx), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_PADX, -1, Tk_Offset(Pane, padx), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, - DEF_PANEDWINDOW_PANE_PADY, -1, Tk_Offset(Slave, pady), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_PADY, -1, Tk_Offset(Pane, pady), 0, 0, 0}, {TK_OPTION_CUSTOM, "-sticky", NULL, NULL, - DEF_PANEDWINDOW_PANE_STICKY, -1, Tk_Offset(Slave, sticky), 0, + DEF_PANEDWINDOW_PANE_STICKY, -1, Tk_Offset(Pane, sticky), 0, &stickyOption, 0}, {TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch", - DEF_PANEDWINDOW_PANE_STRETCH, -1, Tk_Offset(Slave, stretch), 0, + DEF_PANEDWINDOW_PANE_STRETCH, -1, Tk_Offset(Pane, stretch), 0, (ClientData) stretchStrings, 0}, {TK_OPTION_PIXELS, "-width", NULL, NULL, - DEF_PANEDWINDOW_PANE_WIDTH, Tk_Offset(Slave, widthPtr), - Tk_Offset(Slave, width), TK_OPTION_NULL_OK, 0, 0}, + DEF_PANEDWINDOW_PANE_WIDTH, Tk_Offset(Pane, widthPtr), + Tk_Offset(Pane, width), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; @@ -428,7 +428,7 @@ Tk_PanedWindowObjCmd( */ pwOpts->pwOptions = Tk_CreateOptionTable(interp, optionSpecs); - pwOpts->slaveOpts = Tk_CreateOptionTable(interp, slaveOptionSpecs); + pwOpts->paneOpts = Tk_CreateOptionTable(interp, paneOptionSpecs); } Tk_SetClass(tkwin, "Panedwindow"); @@ -446,7 +446,7 @@ Tk_PanedWindowObjCmd( Tk_PathName(pwPtr->tkwin), PanedWindowWidgetObjCmd, pwPtr, PanedWindowCmdDeletedProc); pwPtr->optionTable = pwOpts->pwOptions; - pwPtr->slaveOpts = pwOpts->slaveOpts; + pwPtr->paneOpts = pwOpts->paneOpts; pwPtr->relief = TK_RELIEF_RAISED; pwPtr->gc = NULL; pwPtr->cursor = NULL; @@ -471,7 +471,7 @@ Tk_PanedWindowObjCmd( /* * Find the toplevel ancestor of the panedwindow, and make a proxy win as * a child of that window; this way the proxy can always float above - * slaves in the panedwindow. + * panes in the panedwindow. */ parent = Tk_Parent(pwPtr->tkwin); @@ -548,7 +548,7 @@ PanedWindowWidgetObjCmd( Tcl_Obj *resultObj; int index, count, i, x, y; Tk_Window tkwin; - Slave *slavePtr; + Pane *panePtr; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?"); @@ -569,7 +569,7 @@ PanedWindowWidgetObjCmd( result = TCL_ERROR; break; } - result = ConfigureSlaves(pwPtr, interp, objc, objv); + result = ConfigurePanes(pwPtr, interp, objc, objv); break; case PW_CGET: @@ -616,21 +616,21 @@ PanedWindowWidgetObjCmd( * Clean up each window named in the arg list. */ for (count = 0, i = 2; i < objc; i++) { - Tk_Window slave = Tk_NameToWindow(interp, Tcl_GetString(objv[i]), + Tk_Window pane = Tk_NameToWindow(interp, Tcl_GetString(objv[i]), pwPtr->tkwin); - if (slave == NULL) { + if (pane == NULL) { continue; } - slavePtr = GetPane(pwPtr, slave); - if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) { + panePtr = GetPane(pwPtr, pane); + if ((panePtr != NULL) && (panePtr->containerPtr != NULL)) { count++; - Tk_ManageGeometry(slave, NULL, NULL); - Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin); - Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask, - SlaveStructureProc, slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); - Unlink(slavePtr); + Tk_ManageGeometry(pane, NULL, NULL); + Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin); + Tk_DeleteEventHandler(panePtr->tkwin, StructureNotifyMask, + PaneStructureProc, panePtr); + Tk_UnmapWindow(panePtr->tkwin); + Unlink(panePtr); } if (count != 0) { ComputeGeometry(pwPtr); @@ -666,15 +666,15 @@ PanedWindowWidgetObjCmd( break; } resultObj = NULL; - for (i = 0; i < pwPtr->numSlaves; i++) { - if (pwPtr->slaves[i]->tkwin == tkwin) { + for (i = 0; i < pwPtr->numPanes; i++) { + if (pwPtr->panes[i]->tkwin == tkwin) { resultObj = Tk_GetOptionValue(interp, - (char *) pwPtr->slaves[i], pwPtr->slaveOpts, + (char *) pwPtr->panes[i], pwPtr->paneOpts, objv[3], tkwin); } } if (resultObj == NULL) { - if (i == pwPtr->numSlaves) { + if (i == pwPtr->numPanes) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "not managed by this window", -1)); Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED", @@ -706,10 +706,10 @@ PanedWindowWidgetObjCmd( result = TCL_ERROR; break; } - for (i = 0; i < pwPtr->numSlaves; i++) { - if (pwPtr->slaves[i]->tkwin == tkwin) { + for (i = 0; i < pwPtr->numPanes; i++) { + if (pwPtr->panes[i]->tkwin == tkwin) { resultObj = Tk_GetOptionInfo(interp, - (char *) pwPtr->slaves[i], pwPtr->slaveOpts, + (char *) pwPtr->panes[i], pwPtr->paneOpts, (objc == 4) ? objv[3] : NULL, pwPtr->tkwin); if (resultObj == NULL) { @@ -721,15 +721,15 @@ PanedWindowWidgetObjCmd( } } } else { - result = ConfigureSlaves(pwPtr, interp, objc, objv); + result = ConfigurePanes(pwPtr, interp, objc, objv); } break; case PW_PANES: resultObj = Tcl_NewObj(); - for (i = 0; i < pwPtr->numSlaves; i++) { + for (i = 0; i < pwPtr->numPanes; i++) { Tcl_ListObjAppendElement(NULL, resultObj, - TkNewWindowObj(pwPtr->slaves[i]->tkwin)); + TkNewWindowObj(pwPtr->panes[i]->tkwin)); } Tcl_SetObjResult(interp, resultObj); break; @@ -749,37 +749,37 @@ PanedWindowWidgetObjCmd( /* *---------------------------------------------------------------------- * - * ConfigureSlaves -- + * ConfigurePanes -- * - * Add or alter the configuration options of a slave in a paned window. + * Add or alter the configuration options of a pane in a paned window. * * Results: * Standard Tcl result. * * Side effects: - * Depends on options; may add a slave to the paned window, may alter the - * geometry management options of a slave. + * Depends on options; may add a pane to the paned window, may alter the + * geometry management options of a pane. * *---------------------------------------------------------------------- */ static int -ConfigureSlaves( +ConfigurePanes( PanedWindow *pwPtr, /* Information about paned window. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int i, firstOptionArg, j, found, doubleBw, index, numNewSlaves, haveLoc; + int i, firstOptionArg, j, found, doubleBw, index, numNewPanes, haveLoc; int insertIndex; Tk_Window tkwin = NULL, ancestor, parent; - Slave *slavePtr, **inserts, **newSlaves; - Slave options; + Pane *panePtr, **inserts, **newPanes; + Pane options; const char *arg; /* * Find the non-window name arguments; these are the configure options for - * the slaves. Also validate that the window names given are legitimate + * the panes. Also validate that the window names given are legitimate * (ie, they are real windows, they are not the panedwindow itself, etc.). */ @@ -817,8 +817,8 @@ ConfigureSlaves( return TCL_ERROR; } else { /* - * Make sure the panedwindow is the parent of the slave, - * or a descendant of the slave's parent. + * Make sure the panedwindow is the parent of the pane, + * or a descendant of the pane's parent. */ parent = Tk_Parent(tkwin); @@ -847,8 +847,8 @@ ConfigureSlaves( * extra testing in the for loop below. */ - memset((void *)&options, 0, sizeof(Slave)); - if (Tk_SetOptions(interp, (char *) &options, pwPtr->slaveOpts, + memset((void *)&options, 0, sizeof(Pane)); + if (Tk_SetOptions(interp, (char *) &options, pwPtr->paneOpts, objc - firstOptionArg, objv + firstOptionArg, pwPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; @@ -865,8 +865,8 @@ ConfigureSlaves( if (options.after != NULL) { tkwin = options.after; haveLoc = 1; - for (i = 0; i < pwPtr->numSlaves; i++) { - if (options.after == pwPtr->slaves[i]->tkwin) { + for (i = 0; i < pwPtr->numPanes; i++) { + if (options.after == pwPtr->panes[i]->tkwin) { index = i + 1; break; } @@ -874,8 +874,8 @@ ConfigureSlaves( } else if (options.before != NULL) { tkwin = options.before; haveLoc = 1; - for (i = 0; i < pwPtr->numSlaves; i++) { - if (options.before == pwPtr->slaves[i]->tkwin) { + for (i = 0; i < pwPtr->numPanes; i++) { + if (options.before == pwPtr->panes[i]->tkwin) { index = i; break; } @@ -892,28 +892,28 @@ ConfigureSlaves( "window \"%s\" is not managed by %s", Tk_PathName(tkwin), Tk_PathName(pwPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED", NULL); - Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts, + Tk_FreeConfigOptions((char *) &options, pwPtr->paneOpts, pwPtr->tkwin); return TCL_ERROR; } /* - * Allocate an array to hold, in order, the pointers to the slave + * Allocate an array to hold, in order, the pointers to the pane * structures corresponding to the windows specified. Some of those * structures may already have existed, some may be new. */ - inserts = ckalloc(sizeof(Slave *) * (firstOptionArg - 2)); + inserts = ckalloc(sizeof(Pane *) * (firstOptionArg - 2)); insertIndex = 0; /* - * Populate the inserts array, creating new slave structures as necessary, + * Populate the inserts array, creating new pane structures as necessary, * applying the options to each structure as we go, and, if necessary, - * marking the spot in the original slaves array as empty (for - * pre-existing slave structures). + * marking the spot in the original panes array as empty (for + * pre-existing pane structures). */ - for (i = 0, numNewSlaves = 0; i < firstOptionArg - 2; i++) { + for (i = 0, numNewPanes = 0; i < firstOptionArg - 2; i++) { /* * We don't check that tkwin is NULL here, because the pre-pass above * guarantees that the input at this stage is good. @@ -923,24 +923,24 @@ ConfigureSlaves( pwPtr->tkwin); found = 0; - for (j = 0; j < pwPtr->numSlaves; j++) { - if (pwPtr->slaves[j] != NULL && pwPtr->slaves[j]->tkwin == tkwin) { - Tk_SetOptions(interp, (char *) pwPtr->slaves[j], - pwPtr->slaveOpts, objc - firstOptionArg, + for (j = 0; j < pwPtr->numPanes; j++) { + if (pwPtr->panes[j] != NULL && pwPtr->panes[j]->tkwin == tkwin) { + Tk_SetOptions(interp, (char *) pwPtr->panes[j], + pwPtr->paneOpts, objc - firstOptionArg, objv + firstOptionArg, pwPtr->tkwin, NULL, NULL); - if (pwPtr->slaves[j]->minSize < 0) { - pwPtr->slaves[j]->minSize = 0; + if (pwPtr->panes[j]->minSize < 0) { + pwPtr->panes[j]->minSize = 0; } found = 1; /* - * If the slave is supposed to move, add it to the inserts + * If the pane is supposed to move, add it to the inserts * array now; otherwise, leave it where it is. */ if (index != -1) { - inserts[insertIndex++] = pwPtr->slaves[j]; - pwPtr->slaves[j] = NULL; + inserts[insertIndex++] = pwPtr->panes[j]; + pwPtr->panes[j] = NULL; } break; } @@ -951,7 +951,7 @@ ConfigureSlaves( } /* - * Make sure this slave wasn't already put into the inserts array, + * Make sure this pane wasn't already put into the inserts array, * i.e., when the user specifies the same window multiple times in a * single add commaned. */ @@ -966,104 +966,104 @@ ConfigureSlaves( } /* - * Create a new slave structure and initialize it. All slaves start + * Create a new pane structure and initialize it. All panes start * out with their "natural" dimensions. */ - slavePtr = ckalloc(sizeof(Slave)); - memset(slavePtr, 0, sizeof(Slave)); - Tk_InitOptions(interp, (char *)slavePtr, pwPtr->slaveOpts, + panePtr = ckalloc(sizeof(Pane)); + memset(panePtr, 0, sizeof(Pane)); + Tk_InitOptions(interp, (char *)panePtr, pwPtr->paneOpts, pwPtr->tkwin); - Tk_SetOptions(interp, (char *)slavePtr, pwPtr->slaveOpts, + Tk_SetOptions(interp, (char *)panePtr, pwPtr->paneOpts, objc - firstOptionArg, objv + firstOptionArg, pwPtr->tkwin, NULL, NULL); - slavePtr->tkwin = tkwin; - slavePtr->masterPtr = pwPtr; - doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width; - if (slavePtr->width > 0) { - slavePtr->paneWidth = slavePtr->width; + panePtr->tkwin = tkwin; + panePtr->containerPtr = pwPtr; + doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width; + if (panePtr->width > 0) { + panePtr->paneWidth = panePtr->width; } else { - slavePtr->paneWidth = Tk_ReqWidth(tkwin) + doubleBw; + panePtr->paneWidth = Tk_ReqWidth(tkwin) + doubleBw; } - if (slavePtr->height > 0) { - slavePtr->paneHeight = slavePtr->height; + if (panePtr->height > 0) { + panePtr->paneHeight = panePtr->height; } else { - slavePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw; + panePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw; } - if (slavePtr->minSize < 0) { - slavePtr->minSize = 0; + if (panePtr->minSize < 0) { + panePtr->minSize = 0; } /* - * Set up the geometry management callbacks for this slave. + * Set up the geometry management callbacks for this pane. */ - Tk_CreateEventHandler(slavePtr->tkwin, StructureNotifyMask, - SlaveStructureProc, slavePtr); - Tk_ManageGeometry(slavePtr->tkwin, &panedWindowMgrType, slavePtr); - inserts[insertIndex++] = slavePtr; - numNewSlaves++; + Tk_CreateEventHandler(panePtr->tkwin, StructureNotifyMask, + PaneStructureProc, panePtr); + Tk_ManageGeometry(panePtr->tkwin, &panedWindowMgrType, panePtr); + inserts[insertIndex++] = panePtr; + numNewPanes++; } /* - * Allocate the new slaves array, then copy the slaves into it, in order. + * Allocate the new panes array, then copy the panes into it, in order. */ - i = sizeof(Slave *) * (pwPtr->numSlaves + numNewSlaves); - newSlaves = ckalloc(i); - memset(newSlaves, 0, (size_t) i); + i = sizeof(Pane *) * (pwPtr->numPanes + numNewPanes); + newPanes = ckalloc(i); + memset(newPanes, 0, (size_t) i); if (index == -1) { /* - * If none of the existing slaves have to be moved, just copy the old + * If none of the existing panes have to be moved, just copy the old * and append the new. */ - memcpy((void *)&(newSlaves[0]), pwPtr->slaves, - sizeof(Slave *) * pwPtr->numSlaves); - memcpy((void *)&(newSlaves[pwPtr->numSlaves]), inserts, - sizeof(Slave *) * numNewSlaves); + memcpy((void *)&(newPanes[0]), pwPtr->panes, + sizeof(Pane *) * pwPtr->numPanes); + memcpy((void *)&(newPanes[pwPtr->numPanes]), inserts, + sizeof(Pane *) * numNewPanes); } else { /* - * If some of the existing slaves were moved, the old slaves array + * If some of the existing panes were moved, the old panes array * will be partially populated, with some valid and some invalid - * entries. Walk through it, copying valid entries to the new slaves + * entries. Walk through it, copying valid entries to the new panes * array as we go; when we get to the insert location for the new - * slaves, copy the inserts array over, then finish off the old slaves + * panes, copy the inserts array over, then finish off the old panes * array. */ for (i = 0, j = 0; i < index; i++) { - if (pwPtr->slaves[i] != NULL) { - newSlaves[j] = pwPtr->slaves[i]; + if (pwPtr->panes[i] != NULL) { + newPanes[j] = pwPtr->panes[i]; j++; } } - memcpy((void *)&(newSlaves[j]), inserts, sizeof(Slave *)*insertIndex); + memcpy((void *)&(newPanes[j]), inserts, sizeof(Pane *)*insertIndex); j += firstOptionArg - 2; - for (i = index; i < pwPtr->numSlaves; i++) { - if (pwPtr->slaves[i] != NULL) { - newSlaves[j] = pwPtr->slaves[i]; + for (i = index; i < pwPtr->numPanes; i++) { + if (pwPtr->panes[i] != NULL) { + newPanes[j] = pwPtr->panes[i]; j++; } } } /* - * Make the new slaves array the paned window's slave array, and clean up. + * Make the new panes array the paned window's pane array, and clean up. */ - ckfree(pwPtr->slaves); + ckfree(pwPtr->panes); ckfree(inserts); - pwPtr->slaves = newSlaves; + pwPtr->panes = newPanes; /* - * Set the paned window's slave count to the new value. + * Set the paned window's pane count to the new value. */ - pwPtr->numSlaves += numNewSlaves; + pwPtr->numPanes += numNewPanes; - Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts, pwPtr->tkwin); + Tk_FreeConfigOptions((char *) &options, pwPtr->paneOpts, pwPtr->tkwin); ComputeGeometry(pwPtr); return TCL_OK; @@ -1101,7 +1101,7 @@ PanedWindowSashCommand( }; int index, sash, x, y, diff; Tcl_Obj *coords[2]; - Slave *slavePtr; + Pane *panePtr; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?"); @@ -1130,10 +1130,10 @@ PanedWindowSashCommand( Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL); return TCL_ERROR; } - slavePtr = pwPtr->slaves[sash]; + panePtr = pwPtr->panes[sash]; - coords[0] = Tcl_NewIntObj(slavePtr->sashx); - coords[1] = Tcl_NewIntObj(slavePtr->sashy); + coords[0] = Tcl_NewIntObj(panePtr->sashx); + coords[1] = Tcl_NewIntObj(panePtr->sashy); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); break; @@ -1163,11 +1163,11 @@ PanedWindowSashCommand( return TCL_ERROR; } - pwPtr->slaves[sash]->markx = x; - pwPtr->slaves[sash]->marky = y; + pwPtr->panes[sash]->markx = x; + pwPtr->panes[sash]->marky = y; } else { - coords[0] = Tcl_NewIntObj(pwPtr->slaves[sash]->markx); - coords[1] = Tcl_NewIntObj(pwPtr->slaves[sash]->marky); + coords[0] = Tcl_NewIntObj(pwPtr->panes[sash]->markx); + coords[1] = Tcl_NewIntObj(pwPtr->panes[sash]->marky); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); } break; @@ -1198,18 +1198,18 @@ PanedWindowSashCommand( return TCL_ERROR; } - slavePtr = pwPtr->slaves[sash]; + panePtr = pwPtr->panes[sash]; if (pwPtr->orient == ORIENT_HORIZONTAL) { if (index == SASH_PLACE) { - diff = x - pwPtr->slaves[sash]->sashx; + diff = x - pwPtr->panes[sash]->sashx; } else { - diff = x - pwPtr->slaves[sash]->markx; + diff = x - pwPtr->panes[sash]->markx; } } else { if (index == SASH_PLACE) { - diff = y - pwPtr->slaves[sash]->sashy; + diff = y - pwPtr->panes[sash]->sashy; } else { - diff = y - pwPtr->slaves[sash]->marky; + diff = y - pwPtr->panes[sash]->marky; } } @@ -1369,15 +1369,15 @@ PanedWindowEventProc( } else if (eventPtr->type == DestroyNotify) { DestroyPanedWindow(pwPtr); } else if (eventPtr->type == UnmapNotify) { - for (i = 0; i < pwPtr->numSlaves; i++) { - if (!pwPtr->slaves[i]->hide) { - Tk_UnmapWindow(pwPtr->slaves[i]->tkwin); + for (i = 0; i < pwPtr->numPanes; i++) { + if (!pwPtr->panes[i]->hide) { + Tk_UnmapWindow(pwPtr->panes[i]->tkwin); } } } else if (eventPtr->type == MapNotify) { - for (i = 0; i < pwPtr->numSlaves; i++) { - if (!pwPtr->slaves[i]->hide) { - Tk_MapWindow(pwPtr->slaves[i]->tkwin); + for (i = 0; i < pwPtr->numPanes; i++) { + if (!pwPtr->panes[i]->hide) { + Tk_MapWindow(pwPtr->panes[i]->tkwin); } } } @@ -1443,7 +1443,7 @@ DisplayPanedWindow( ClientData clientData) /* Information about window. */ { PanedWindow *pwPtr = clientData; - Slave *slavePtr; + Pane *panePtr; Pixmap pixmap; Tk_Window tkwin = pwPtr->tkwin; int i, sashWidth, sashHeight; @@ -1496,19 +1496,19 @@ DisplayPanedWindow( */ GetFirstLastVisiblePane(pwPtr, &first, &last); - for (i = 0; i < pwPtr->numSlaves - 1; i++) { - slavePtr = pwPtr->slaves[i]; - if (slavePtr->hide || i == last) { + for (i = 0; i < pwPtr->numPanes - 1; i++) { + panePtr = pwPtr->panes[i]; + if (panePtr->hide || i == last) { continue; } if (sashWidth > 0 && sashHeight > 0) { Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background, - slavePtr->sashx, slavePtr->sashy, sashWidth, sashHeight, + panePtr->sashx, panePtr->sashy, sashWidth, sashHeight, 1, pwPtr->sashRelief); } if (pwPtr->showHandle) { Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background, - slavePtr->handlex, slavePtr->handley, + panePtr->handlex, panePtr->handley, pwPtr->handleSize, pwPtr->handleSize, 1, TK_RELIEF_RAISED); } @@ -1569,23 +1569,23 @@ DestroyPanedWindow( } /* - * Clean up the slave list; foreach slave: - * o Cancel the slave's structure notification callback - * o Cancel geometry management for the slave. - * o Free memory for the slave + * Clean up the pane list; foreach pane: + * o Cancel the pane's structure notification callback + * o Cancel geometry management for the pane. + * o Free memory for the pane */ - for (i = 0; i < pwPtr->numSlaves; i++) { - Tk_DeleteEventHandler(pwPtr->slaves[i]->tkwin, StructureNotifyMask, - SlaveStructureProc, pwPtr->slaves[i]); - Tk_ManageGeometry(pwPtr->slaves[i]->tkwin, NULL, NULL); - Tk_FreeConfigOptions((char *) pwPtr->slaves[i], pwPtr->slaveOpts, + for (i = 0; i < pwPtr->numPanes; i++) { + Tk_DeleteEventHandler(pwPtr->panes[i]->tkwin, StructureNotifyMask, + PaneStructureProc, pwPtr->panes[i]); + Tk_ManageGeometry(pwPtr->panes[i]->tkwin, NULL, NULL); + Tk_FreeConfigOptions((char *) pwPtr->panes[i], pwPtr->paneOpts, pwPtr->tkwin); - ckfree(pwPtr->slaves[i]); - pwPtr->slaves[i] = NULL; + ckfree(pwPtr->panes[i]); + pwPtr->panes[i] = NULL; } - if (pwPtr->slaves) { - ckfree(pwPtr->slaves); + if (pwPtr->panes) { + ckfree(pwPtr->panes); } /* @@ -1630,8 +1630,8 @@ PanedWindowReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - Slave *slavePtr = clientData; - PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr; + Pane *panePtr = clientData; + PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr; if (Tk_IsMapped(pwPtr->tkwin)) { if (!(pwPtr->flags & RESIZE_PENDING)) { @@ -1639,13 +1639,13 @@ PanedWindowReqProc( Tcl_DoWhenIdle(ArrangePanes, pwPtr); } } else { - int doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width; + int doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width; - if (slavePtr->width <= 0) { - slavePtr->paneWidth = Tk_ReqWidth(slavePtr->tkwin) + doubleBw; + if (panePtr->width <= 0) { + panePtr->paneWidth = Tk_ReqWidth(panePtr->tkwin) + doubleBw; } - if (slavePtr->height <= 0) { - slavePtr->paneHeight = Tk_ReqHeight(slavePtr->tkwin) + doubleBw; + if (panePtr->height <= 0) { + panePtr->paneHeight = Tk_ReqHeight(panePtr->tkwin) + doubleBw; } ComputeGeometry(pwPtr); } @@ -1654,39 +1654,39 @@ PanedWindowReqProc( /* *-------------------------------------------------------------- * - * PanedWindowLostSlaveProc -- + * PanedWindowLostPaneProc -- * * 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 pane that used to be managed by us. * * Results: * None. * * Side effects: - * Forgets all information about the slave. Causes geometry to be + * Forgets all information about the pane. Causes geometry to be * recomputed for the panedwindow. * *-------------------------------------------------------------- */ static void -PanedWindowLostSlaveProc( - ClientData clientData, /* Grid structure for slave window that was +PanedWindowLostPaneProc( + ClientData clientData, /* Grid structure for the pane that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + Tk_Window tkwin) /* Tk's handle for the pane. */ { - register Slave *slavePtr = clientData; - PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr; - - if (pwPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin); - } - Unlink(slavePtr); - Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask, - SlaveStructureProc, slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); - slavePtr->tkwin = NULL; - ckfree(slavePtr); + register Pane *panePtr = clientData; + PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr; + + if (pwPtr->tkwin != Tk_Parent(panePtr->tkwin)) { + Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin); + } + Unlink(panePtr); + Tk_DeleteEventHandler(panePtr->tkwin, StructureNotifyMask, + PaneStructureProc, panePtr); + Tk_UnmapWindow(panePtr->tkwin); + panePtr->tkwin = NULL; + ckfree(panePtr); ComputeGeometry(pwPtr); } @@ -1704,19 +1704,19 @@ PanedWindowLostSlaveProc( * None. * * Side effects: - * The slaves of masterPtr may get resized or moved. + * The panes of containerPtr may get resized or moved. * *-------------------------------------------------------------- */ static void ArrangePanes( - ClientData clientData) /* Structure describing parent whose slaves + ClientData clientData) /* Structure describing parent whose panes * are to be re-layed out. */ { register PanedWindow *pwPtr = clientData; - register Slave *slavePtr; - int i, slaveWidth, slaveHeight, slaveX, slaveY; + register Pane *panePtr; + int i, newPaneWidth, newPaneHeight, paneX, paneY; int paneWidth, paneHeight, paneSize, paneMinSize; int doubleBw; int x, y; @@ -1731,13 +1731,13 @@ ArrangePanes( pwPtr->flags &= ~(REQUESTED_RELAYOUT|RESIZE_PENDING); /* - * If the parent has no slaves anymore, then don't do anything at all: + * If the parent has no panes anymore, then don't do anything at all: * just leave the parent's size as-is. Otherwise there is no way to * "relinquish" control over the parent so another geometry manager can * take over. */ - if (pwPtr->numSlaves == 0) { + if (pwPtr->numPanes == 0) { return; } @@ -1776,37 +1776,37 @@ ArrangePanes( + pwPtr->sashPad; } - for (i = sashCount = 0; i < pwPtr->numSlaves; i++) { - slavePtr = pwPtr->slaves[i]; + for (i = sashCount = 0; i < pwPtr->numPanes; i++) { + panePtr = pwPtr->panes[i]; - if (slavePtr->hide) { + if (panePtr->hide) { continue; } /* - * Compute the total size needed by all the slaves and the left-over, + * Compute the total size needed by all the panes and the left-over, * or shortage of space available. */ if (horizontal) { - if (slavePtr->width > 0) { - paneSize = slavePtr->width; + if (panePtr->width > 0) { + paneSize = panePtr->width; } else { - paneSize = slavePtr->paneWidth; + paneSize = panePtr->paneWidth; } - stretchReserve -= paneSize + (2 * slavePtr->padx); + stretchReserve -= paneSize + (2 * panePtr->padx); } else { - if (slavePtr->height > 0) { - paneSize = slavePtr->height; + if (panePtr->height > 0) { + paneSize = panePtr->height; } else { - paneSize = slavePtr->paneHeight; + paneSize = panePtr->paneHeight; } - stretchReserve -= paneSize + (2 * slavePtr->pady); + stretchReserve -= paneSize + (2 * panePtr->pady); } - if (IsStretchable(slavePtr->stretch,i,first,last) + if (IsStretchable(panePtr->stretch,i,first,last) && Tk_IsMapped(pwPtr->tkwin)) { paneDynSize += paneSize; - paneDynMinSize += slavePtr->minSize; + paneDynMinSize += panePtr->minSize; } if (i != last) { stretchReserve -= sashWidth; @@ -1818,53 +1818,53 @@ ArrangePanes( * Second pass; adjust/arrange panes. */ - for (i = 0; i < pwPtr->numSlaves; i++) { - slavePtr = pwPtr->slaves[i]; + for (i = 0; i < pwPtr->numPanes; i++) { + panePtr = pwPtr->panes[i]; - if (slavePtr->hide) { - Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin); - Tk_UnmapWindow(slavePtr->tkwin); + if (panePtr->hide) { + Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin); + Tk_UnmapWindow(panePtr->tkwin); continue; } /* - * Compute the size of this slave. The algorithm (assuming a + * Compute the size of this pane. The algorithm (assuming a * horizontal paned window) is: * * 1. Get "base" dimensions. If a width or height is specified for - * this slave, use those values; else use the ReqWidth/ReqHeight. + * this pane, use those values; else use the ReqWidth/ReqHeight. * 2. Using base dimensions, pane dimensions, and sticky values, * determine the x and y, and actual width and height of the * widget. */ - doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width; - slaveWidth = (slavePtr->width > 0 ? slavePtr->width : - Tk_ReqWidth(slavePtr->tkwin) + doubleBw); - slaveHeight = (slavePtr->height > 0 ? slavePtr->height : - Tk_ReqHeight(slavePtr->tkwin) + doubleBw); - paneMinSize = slavePtr->minSize; + doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width; + newPaneWidth = (panePtr->width > 0 ? panePtr->width : + Tk_ReqWidth(panePtr->tkwin) + doubleBw); + newPaneHeight = (panePtr->height > 0 ? panePtr->height : + Tk_ReqHeight(panePtr->tkwin) + doubleBw); + paneMinSize = panePtr->minSize; /* * Calculate pane width and height. */ if (horizontal) { - if (slavePtr->width > 0) { - paneSize = slavePtr->width; + if (panePtr->width > 0) { + paneSize = panePtr->width; } else { - paneSize = slavePtr->paneWidth; + paneSize = panePtr->paneWidth; } pwSize = pwWidth; } else { - if (slavePtr->height > 0) { - paneSize = slavePtr->height; + if (panePtr->height > 0) { + paneSize = panePtr->height; } else { - paneSize = slavePtr->paneHeight; + paneSize = panePtr->paneHeight; } pwSize = pwHeight; } - if (IsStretchable(slavePtr->stretch, i, first, last)) { + if (IsStretchable(panePtr->stretch, i, first, last)) { double frac; if (paneDynSize > 0) { @@ -1874,7 +1874,7 @@ ArrangePanes( } paneDynSize -= paneSize; - paneDynMinSize -= slavePtr->minSize; + paneDynMinSize -= panePtr->minSize; stretchAmount = (int) (frac * stretchReserve); if (paneSize + stretchAmount >= paneMinSize) { stretchReserve -= stretchAmount; @@ -1899,9 +1899,9 @@ ArrangePanes( } if (horizontal) { paneWidth = paneSize; - paneHeight = pwHeight - (2 * slavePtr->pady); + paneHeight = pwHeight - (2 * panePtr->pady); } else { - paneWidth = pwWidth - (2 * slavePtr->padx); + paneWidth = pwWidth - (2 * panePtr->padx); paneHeight = paneSize; } @@ -1929,15 +1929,15 @@ ArrangePanes( paneHeight = pwHeight - syReserve - y + internalBW; } - if (slaveWidth > paneWidth) { - slaveWidth = paneWidth; + if (newPaneWidth > paneWidth) { + newPaneWidth = paneWidth; } - if (slaveHeight > paneHeight) { - slaveHeight = paneHeight; + if (newPaneHeight > paneHeight) { + newPaneHeight = paneHeight; } - slavePtr->x = x; - slavePtr->y = y; + panePtr->x = x; + panePtr->y = y; /* * Compute the location of the sash at the right or bottom of the @@ -1945,51 +1945,51 @@ ArrangePanes( */ if (horizontal) { - x += paneWidth + (2 * slavePtr->padx); + x += paneWidth + (2 * panePtr->padx); if (x < internalBW) { x = internalBW; } - slavePtr->sashx = x + sashOffset; - slavePtr->sashy = y; - slavePtr->handlex = x + handleOffset; - slavePtr->handley = y + pwPtr->handlePad; + panePtr->sashx = x + sashOffset; + panePtr->sashy = y; + panePtr->handlex = x + handleOffset; + panePtr->handley = y + pwPtr->handlePad; x += sashWidth; } else { - y += paneHeight + (2 * slavePtr->pady); + y += paneHeight + (2 * panePtr->pady); if (y < internalBW) { y = internalBW; } - slavePtr->sashx = x; - slavePtr->sashy = y + sashOffset; - slavePtr->handlex = x + pwPtr->handlePad; - slavePtr->handley = y + handleOffset; + panePtr->sashx = x; + panePtr->sashy = y + sashOffset; + panePtr->handlex = x + pwPtr->handlePad; + panePtr->handley = y + handleOffset; y += sashWidth; } /* - * Compute the actual dimensions of the slave in the pane. + * Compute the actual dimensions of the pane in the pane. */ - slaveX = slavePtr->x; - slaveY = slavePtr->y; - AdjustForSticky(slavePtr->sticky, paneWidth, paneHeight, - &slaveX, &slaveY, &slaveWidth, &slaveHeight); + paneX = panePtr->x; + paneY = panePtr->y; + AdjustForSticky(panePtr->sticky, paneWidth, paneHeight, + &paneX, &paneY, &newPaneWidth, &newPaneHeight); - slaveX += slavePtr->padx; - slaveY += slavePtr->pady; + paneX += panePtr->padx; + paneY += panePtr->pady; /* * Now put the window in the proper spot. */ - if (slaveWidth <= 0 || slaveHeight <= 0 || - (horizontal ? slaveX - internalBW > pwWidth : - slaveY - internalBW > pwHeight)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin); - Tk_UnmapWindow(slavePtr->tkwin); + if (newPaneWidth <= 0 || newPaneHeight <= 0 || + (horizontal ? paneX - internalBW > pwWidth : + paneY - internalBW > pwHeight)) { + Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin); + Tk_UnmapWindow(panePtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, pwPtr->tkwin, - slaveX, slaveY, slaveWidth, slaveHeight); + Tk_MaintainGeometry(panePtr->tkwin, pwPtr->tkwin, + paneX, paneY, newPaneWidth, newPaneHeight); } sashCount--; } @@ -2001,7 +2001,7 @@ ArrangePanes( * * Unlink -- * - * Remove a slave from a paned window. + * Remove a pane from a paned window. * * Results: * None. @@ -2014,57 +2014,57 @@ ArrangePanes( static void Unlink( - register Slave *slavePtr) /* Window to unlink. */ + register Pane *panePtr) /* Window to unlink. */ { - register PanedWindow *masterPtr; + register PanedWindow *containerPtr; int i, j; - masterPtr = slavePtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = panePtr->containerPtr; + if (containerPtr == NULL) { return; } /* - * Find the specified slave in the panedwindow's list of slaves, then + * Find the specified pane in the panedwindow's list of panes, then * remove it from that list. */ - for (i = 0; i < masterPtr->numSlaves; i++) { - if (masterPtr->slaves[i] == slavePtr) { - for (j = i; j < masterPtr->numSlaves - 1; j++) { - masterPtr->slaves[j] = masterPtr->slaves[j + 1]; + for (i = 0; i < containerPtr->numPanes; i++) { + if (containerPtr->panes[i] == panePtr) { + for (j = i; j < containerPtr->numPanes - 1; j++) { + containerPtr->panes[j] = containerPtr->panes[j + 1]; } break; } } /* - * Clean out any -after or -before references to this slave + * Clean out any -after or -before references to this pane */ - for (i = 0; i < masterPtr->numSlaves; i++) { - if (masterPtr->slaves[i]->before == slavePtr->tkwin) { - masterPtr->slaves[i]->before = NULL; + for (i = 0; i < containerPtr->numPanes; i++) { + if (containerPtr->panes[i]->before == panePtr->tkwin) { + containerPtr->panes[i]->before = NULL; } - if (masterPtr->slaves[i]->after == slavePtr->tkwin) { - masterPtr->slaves[i]->after = NULL; + if (containerPtr->panes[i]->after == panePtr->tkwin) { + containerPtr->panes[i]->after = NULL; } } - masterPtr->flags |= REQUESTED_RELAYOUT; - if (!(masterPtr->flags & REDRAW_PENDING)) { - masterPtr->flags |= REDRAW_PENDING; - Tcl_DoWhenIdle(DisplayPanedWindow, masterPtr); + containerPtr->flags |= REQUESTED_RELAYOUT; + if (!(containerPtr->flags & REDRAW_PENDING)) { + containerPtr->flags |= REDRAW_PENDING; + Tcl_DoWhenIdle(DisplayPanedWindow, containerPtr); } /* - * Set the slave's masterPtr to NULL, so that we can tell that the slave + * Set the pane's containerPtr to NULL, so that we can tell that the pane * is no longer attached to any panedwindow. */ - slavePtr->masterPtr = NULL; + panePtr->containerPtr = NULL; - masterPtr->numSlaves--; + containerPtr->numPanes--; } /* @@ -2076,7 +2076,7 @@ Unlink( * token in a given paned window. * * Results: - * Pointer to the slave structure, or NULL if the window is not managed + * Pointer to the pane structure, or NULL if the window is not managed * by this paned window. * * Side effects: @@ -2085,16 +2085,16 @@ Unlink( *---------------------------------------------------------------------- */ -static Slave * +static Pane * GetPane( PanedWindow *pwPtr, /* Pointer to the paned window info. */ Tk_Window tkwin) /* Window to search for. */ { int i; - for (i = 0; i < pwPtr->numSlaves; i++) { - if (pwPtr->slaves[i]->tkwin == tkwin) { - return pwPtr->slaves[i]; + for (i = 0; i < pwPtr->numPanes; i++) { + if (pwPtr->panes[i]->tkwin == tkwin) { + return pwPtr->panes[i]; } } return NULL; @@ -2125,8 +2125,8 @@ GetFirstLastVisiblePane( { int i; - for (i = 0, *lastPtr = 0, *firstPtr = -1; i < pwPtr->numSlaves; i++) { - if (pwPtr->slaves[i]->hide == 0) { + for (i = 0, *lastPtr = 0, *firstPtr = -1; i < pwPtr->numPanes; i++) { + if (pwPtr->panes[i]->hide == 0) { if (*firstPtr < 0) { *firstPtr = i; } @@ -2138,7 +2138,7 @@ GetFirstLastVisiblePane( /* *-------------------------------------------------------------- * - * SlaveStructureProc -- + * PaneStructureProc -- * * This function is invoked whenever StructureNotify events occur for a * window that's managed by a paned window. This function's only purpose @@ -2148,25 +2148,25 @@ GetFirstLastVisiblePane( * None. * * Side effects: - * The paned window slave structure associated with the window - * is freed, and the slave is disassociated from the paned + * The paned window pane structure associated with the window + * is freed, and the pane is disassociated from the paned * window which managed it. * *-------------------------------------------------------------- */ static void -SlaveStructureProc( +PaneStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - Slave *slavePtr = clientData; - PanedWindow *pwPtr = slavePtr->masterPtr; + Pane *panePtr = clientData; + PanedWindow *pwPtr = panePtr->containerPtr; if (eventPtr->type == DestroyNotify) { - Unlink(slavePtr); - slavePtr->tkwin = NULL; - ckfree(slavePtr); + Unlink(panePtr); + panePtr->tkwin = NULL; + ckfree(panePtr); ComputeGeometry(pwPtr); } } @@ -2177,7 +2177,7 @@ SlaveStructureProc( * ComputeGeometry -- * * Compute geometry for the paned window, including coordinates of all - * slave windows and each sash. + * panes and each sash. * * Results: * None. @@ -2195,7 +2195,7 @@ ComputeGeometry( int i, x, y, doubleBw, internalBw; int sashWidth, sashOffset, handleOffset; int reqWidth, reqHeight, dim; - Slave *slavePtr; + Pane *panePtr; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); pwPtr->flags |= REQUESTED_RELAYOUT; @@ -2221,20 +2221,20 @@ ComputeGeometry( + pwPtr->sashPad; } - for (i = 0; i < pwPtr->numSlaves; i++) { - slavePtr = pwPtr->slaves[i]; + for (i = 0; i < pwPtr->numPanes; i++) { + panePtr = pwPtr->panes[i]; - if (slavePtr->hide) { + if (panePtr->hide) { continue; } /* - * First set the coordinates for the top left corner of the slave's + * First set the coordinates for the top left corner of the pane's * parcel. */ - slavePtr->x = x; - slavePtr->y = y; + panePtr->x = x; + panePtr->y = y; /* * Make sure the pane's paned dimension is at least minsize. This @@ -2243,12 +2243,12 @@ ComputeGeometry( */ if (horizontal) { - if (slavePtr->paneWidth < slavePtr->minSize) { - slavePtr->paneWidth = slavePtr->minSize; + if (panePtr->paneWidth < panePtr->minSize) { + panePtr->paneWidth = panePtr->minSize; } } else { - if (slavePtr->paneHeight < slavePtr->minSize) { - slavePtr->paneHeight = slavePtr->minSize; + if (panePtr->paneHeight < panePtr->minSize) { + panePtr->paneHeight = panePtr->minSize; } } @@ -2258,55 +2258,55 @@ ComputeGeometry( */ if (horizontal) { - x += slavePtr->paneWidth + (2 * slavePtr->padx); - slavePtr->sashx = x + sashOffset; - slavePtr->sashy = y; - slavePtr->handlex = x + handleOffset; - slavePtr->handley = y + pwPtr->handlePad; + x += panePtr->paneWidth + (2 * panePtr->padx); + panePtr->sashx = x + sashOffset; + panePtr->sashy = y; + panePtr->handlex = x + handleOffset; + panePtr->handley = y + pwPtr->handlePad; x += sashWidth; } else { - y += slavePtr->paneHeight + (2 * slavePtr->pady); - slavePtr->sashx = x; - slavePtr->sashy = y + sashOffset; - slavePtr->handlex = x + pwPtr->handlePad; - slavePtr->handley = y + handleOffset; + y += panePtr->paneHeight + (2 * panePtr->pady); + panePtr->sashx = x; + panePtr->sashy = y + sashOffset; + panePtr->handlex = x + pwPtr->handlePad; + panePtr->handley = y + handleOffset; y += sashWidth; } /* - * Find the maximum height/width of the slaves, for computing the + * Find the maximum height/width of the panes, for computing the * requested height/width of the paned window. */ if (horizontal) { /* - * If the slave has an explicit height set, use that; otherwise, - * use the slave's requested height. + * If the pane has an explicit height set, use that; otherwise, + * use the pane's requested height. */ - if (slavePtr->height > 0) { - dim = slavePtr->height; + if (panePtr->height > 0) { + dim = panePtr->height; } else { - doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width; - dim = Tk_ReqHeight(slavePtr->tkwin) + doubleBw; + doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width; + dim = Tk_ReqHeight(panePtr->tkwin) + doubleBw; } - dim += 2 * slavePtr->pady; + dim += 2 * panePtr->pady; if (dim > reqHeight) { reqHeight = dim; } } else { /* - * If the slave has an explicit width set use that; otherwise, use - * the slave's requested width. + * If the pane has an explicit width set use that; otherwise, use + * the pane's requested width. */ - if (slavePtr->width > 0) { - dim = slavePtr->width; + if (panePtr->width > 0) { + dim = panePtr->width; } else { - doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width; - dim = Tk_ReqWidth(slavePtr->tkwin) + doubleBw; + doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width; + dim = Tk_ReqWidth(panePtr->tkwin) + doubleBw; } - dim += 2 * slavePtr->padx; + dim += 2 * panePtr->padx; if (dim > reqWidth) { reqWidth = dim; } @@ -2324,7 +2324,7 @@ ComputeGeometry( * the paned window. * * The height (or width) is equal to the maximum height (or width) of the - * slaves, plus the width of the border of the top and bottom (or left and + * panes, plus the width of the border of the top and bottom (or left and * right) of the paned window. * * If the panedwindow has an explicit width/height set use that; @@ -2535,11 +2535,11 @@ RestoreSticky( * AdjustForSticky -- * * Given the x,y coords of the top-left corner of a pane, the dimensions - * of that pane, and the dimensions of a slave, compute the x,y coords - * and actual dimensions of the slave based on the slave's sticky value. + * of that pane, and the dimensions of a pane, compute the x,y coords + * and actual dimensions of the pane based on the pane's sticky value. * * Results: - * No direct return; sets the x, y, slaveWidth and slaveHeight to correct + * No direct return; sets the x, y, paneWidth and paneHeight to correct * values. * * Side effects: @@ -2556,26 +2556,26 @@ AdjustForSticky( int cavityHeight, /* Height of the cavity. */ int *xPtr, int *yPtr, /* Initially, coordinates of the top-left * corner of cavity; also return values for - * actual x, y coords of slave. */ - int *slaveWidthPtr, /* Slave width. */ - int *slaveHeightPtr) /* Slave height. */ + * actual x, y coords of pane. */ + int *paneWidthPtr, /* Pane width. */ + int *paneHeightPtr) /* Pane height. */ { - int diffx = 0; /* Cavity width - slave width. */ - int diffy = 0; /* Cavity hight - slave height. */ + int diffx = 0; /* Cavity width - pane width. */ + int diffy = 0; /* Cavity hight - pane height. */ - if (cavityWidth > *slaveWidthPtr) { - diffx = cavityWidth - *slaveWidthPtr; + if (cavityWidth > *paneWidthPtr) { + diffx = cavityWidth - *paneWidthPtr; } - if (cavityHeight > *slaveHeightPtr) { - diffy = cavityHeight - *slaveHeightPtr; + if (cavityHeight > *paneHeightPtr) { + diffy = cavityHeight - *paneHeightPtr; } if ((sticky & STICK_EAST) && (sticky & STICK_WEST)) { - *slaveWidthPtr += diffx; + *paneWidthPtr += diffx; } if ((sticky & STICK_NORTH) && (sticky & STICK_SOUTH)) { - *slaveHeightPtr += diffy; + *paneHeightPtr += diffy; } if (!(sticky & STICK_WEST)) { *xPtr += (sticky & STICK_EAST) ? diffx : diffx/2; @@ -2608,8 +2608,8 @@ MoveSash( int diff) { int i; - int expandPane, reduceFirst, reduceLast, reduceIncr, slaveSize, sashOffset; - Slave *slavePtr; + int expandPane, reduceFirst, reduceLast, reduceIncr, paneSize, sashOffset; + Pane *panePtr; int stretchReserve = 0; int nextSash = sash + 1; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); @@ -2618,7 +2618,7 @@ MoveSash( return; /* - * Update the slave sizes with their real sizes. + * Update the pane sizes with their real sizes. */ if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) { @@ -2627,17 +2627,17 @@ MoveSash( } else { sashOffset = pwPtr->sashPad; } - for (i = 0; i < pwPtr->numSlaves; i++) { - slavePtr = pwPtr->slaves[i]; - if (slavePtr->hide) { + for (i = 0; i < pwPtr->numPanes; i++) { + panePtr = pwPtr->panes[i]; + if (panePtr->hide) { continue; } if (horizontal) { - slavePtr->paneWidth = slavePtr->width = slavePtr->sashx - - sashOffset - slavePtr->x - (2 * slavePtr->padx); + panePtr->paneWidth = panePtr->width = panePtr->sashx + - sashOffset - panePtr->x - (2 * panePtr->padx); } else { - slavePtr->paneHeight = slavePtr->height = slavePtr->sashy - - sashOffset - slavePtr->y - (2 * slavePtr->pady); + panePtr->paneHeight = panePtr->height = panePtr->sashy + - sashOffset - panePtr->y - (2 * panePtr->pady); } } @@ -2647,7 +2647,7 @@ MoveSash( * pane to either side of the sash. */ - while (nextSash < pwPtr->numSlaves-1 && pwPtr->slaves[nextSash]->hide) { + while (nextSash < pwPtr->numPanes-1 && pwPtr->panes[nextSash]->hide) { nextSash++; } @@ -2658,7 +2658,7 @@ MoveSash( if (diff > 0) { expandPane = sash; reduceFirst = nextSash; - reduceLast = pwPtr->numSlaves; + reduceLast = pwPtr->numPanes; reduceIncr = 1; } else { diff = abs(diff); @@ -2674,14 +2674,14 @@ MoveSash( */ for (i = reduceFirst; i != reduceLast; i += reduceIncr) { - slavePtr = pwPtr->slaves[i]; - if (slavePtr->hide) { + panePtr = pwPtr->panes[i]; + if (panePtr->hide) { continue; } if (horizontal) { - stretchReserve += slavePtr->width - slavePtr->minSize; + stretchReserve += panePtr->width - panePtr->minSize; } else { - stretchReserve += slavePtr->height - slavePtr->minSize; + stretchReserve += panePtr->height - panePtr->minSize; } } if (stretchReserve <= 0) { @@ -2695,11 +2695,11 @@ MoveSash( * Expand pane by diff amount. */ - slavePtr = pwPtr->slaves[expandPane]; + panePtr = pwPtr->panes[expandPane]; if (horizontal) { - slavePtr->paneWidth = slavePtr->width += diff; + panePtr->paneWidth = panePtr->width += diff; } else { - slavePtr->paneHeight = slavePtr->height += diff; + panePtr->paneHeight = panePtr->height += diff; } /* @@ -2707,26 +2707,26 @@ MoveSash( */ for (i = reduceFirst; i != reduceLast; i += reduceIncr) { - slavePtr = pwPtr->slaves[i]; - if (slavePtr->hide) { + panePtr = pwPtr->panes[i]; + if (panePtr->hide) { continue; } if (horizontal) { - slaveSize = slavePtr->width; + paneSize = panePtr->width; } else { - slaveSize = slavePtr->height; + paneSize = panePtr->height; } - if (diff > (slaveSize - slavePtr->minSize)) { - diff -= slaveSize - slavePtr->minSize; - slaveSize = slavePtr->minSize; + if (diff > (paneSize - panePtr->minSize)) { + diff -= paneSize - panePtr->minSize; + paneSize = panePtr->minSize; } else { - slaveSize -= diff; + paneSize -= diff; i = reduceLast - reduceIncr; } if (horizontal) { - slavePtr->paneWidth = slavePtr->width = slaveSize; + panePtr->paneWidth = panePtr->width = paneSize; } else { - slavePtr->paneHeight = slavePtr->height = slaveSize; + panePtr->paneHeight = panePtr->height = paneSize; } } } @@ -2949,9 +2949,9 @@ PanedWindowProxyCommand( /* * Make sure the proxy window is higher in the stacking order than the - * slaves, so that it will be visible when drawn. It would be more + * panes, so that it will be visible when drawn. It would be more * correct to push the proxy window just high enough to appear above - * the highest slave, but it's much easier to just force it all the + * the highest pane, but it's much easier to just force it all the * way to the top of the stacking order. */ @@ -3101,12 +3101,12 @@ PanedWindowIdentifyCoords( GetFirstLastVisiblePane(pwPtr, &first, &last); isHandle = 0; found = -1; - for (i = 0; i < pwPtr->numSlaves - 1; i++) { - if (pwPtr->slaves[i]->hide || i == last) { + for (i = 0; i < pwPtr->numPanes - 1; i++) { + if (pwPtr->panes[i]->hide || i == last) { continue; } - thisx = pwPtr->slaves[i]->sashx; - thisy = pwPtr->slaves[i]->sashy; + thisx = pwPtr->panes[i]->sashx; + thisy = pwPtr->panes[i]->sashy; if (((thisx - lpad) <= x && x <= (thisx + rpad + sashWidth)) && ((thisy - tpad) <= y && y <= (thisy + bpad + sashHeight))) { @@ -3117,8 +3117,8 @@ PanedWindowIdentifyCoords( */ if (pwPtr->showHandle) { - thisx = pwPtr->slaves[i]->handlex; - thisy = pwPtr->slaves[i]->handley; + thisx = pwPtr->panes[i]->handlex; + thisy = pwPtr->panes[i]->handley; if (pwPtr->orient == ORIENT_HORIZONTAL) { if (thisy <= y && y <= (thisy + pwPtr->handleSize)) { isHandle = 1; diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 59b8a2b..615eb9e 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -17,10 +17,10 @@ * Border modes for relative placement: * * BM_INSIDE: relative distances computed using area inside all - * borders of master window. + * borders of container window. * BM_OUTSIDE: relative distances computed using outside area that - * includes all borders of master. - * BM_IGNORE: border issues are ignored: place relative to master's + * includes all borders of container. + * BM_IGNORE: border issues are ignored: place relative to container's * actual window size. */ @@ -35,16 +35,16 @@ typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode; * structure of the following type: */ -typedef struct Slave { +typedef struct Content { Tk_Window tkwin; /* Tk's token for window. */ Tk_Window inTkwin; /* Token for the -in window. */ - struct Master *masterPtr; /* Pointer to information for window relative + struct Container *containerPtr; /* Pointer to information for window relative * to which tkwin is placed. This isn't * necessarily the logical parent of tkwin. - * NULL means the master was deleted or never + * NULL means the container was deleted or never * assigned. */ - struct Slave *nextPtr; /* Next in list of windows placed relative to - * same master (NULL for end of list). */ + struct Content *nextPtr; /* Next in list of windows placed relative to + * same container (NULL for end of list). */ Tk_OptionTable optionTable; /* Table that defines configuration options * available for this command. */ /* @@ -57,22 +57,22 @@ typedef struct Slave { Tcl_Obj *xPtr, *yPtr; /* Tcl_Obj rep's of x, y coords, to keep pixel * spec. information. */ double relX, relY; /* X and Y coordinates relative to size of - * master. */ + * container. */ int width, height; /* Absolute dimensions for tkwin. */ Tcl_Obj *widthPtr; /* Tcl_Obj rep of width, to keep pixel * spec. */ Tcl_Obj *heightPtr; /* Tcl_Obj rep of height, to keep pixel * spec. */ double relWidth, relHeight; /* Dimensions for tkwin relative to size of - * master. */ + * container. */ Tcl_Obj *relWidthPtr; Tcl_Obj *relHeightPtr; Tk_Anchor anchor; /* Which point on tkwin is placed at the given * position. */ - BorderMode borderMode; /* How to treat borders of master window. */ + BorderMode borderMode; /* How to treat borders of container window. */ int flags; /* Various flags; see below for bit * definitions. */ -} Slave; +} Content; /* * Type masks for options: @@ -82,34 +82,34 @@ typedef struct Slave { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", -1, - Tk_Offset(Slave, anchor), 0, 0, 0}, + Tk_Offset(Content, anchor), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", -1, - Tk_Offset(Slave, borderMode), 0, borderModeStrings, 0}, - {TK_OPTION_PIXELS, "-height", NULL, NULL, "", Tk_Offset(Slave, heightPtr), - Tk_Offset(Slave, height), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_WINDOW, "-in", NULL, NULL, "", -1, Tk_Offset(Slave, inTkwin), + Tk_Offset(Content, borderMode), 0, borderModeStrings, 0}, + {TK_OPTION_PIXELS, "-height", NULL, NULL, "", Tk_Offset(Content, heightPtr), + Tk_Offset(Content, height), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_WINDOW, "-in", NULL, NULL, "", -1, Tk_Offset(Content, inTkwin), 0, 0, IN_MASK}, {TK_OPTION_DOUBLE, "-relheight", NULL, NULL, "", - Tk_Offset(Slave, relHeightPtr), Tk_Offset(Slave, relHeight), + Tk_Offset(Content, relHeightPtr), Tk_Offset(Content, relHeight), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, "", - Tk_Offset(Slave, relWidthPtr), Tk_Offset(Slave, relWidth), + Tk_Offset(Content, relWidthPtr), Tk_Offset(Content, relWidth), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0", -1, - Tk_Offset(Slave, relX), 0, 0, 0}, + Tk_Offset(Content, relX), 0, 0, 0}, {TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0", -1, - Tk_Offset(Slave, relY), 0, 0, 0}, - {TK_OPTION_PIXELS, "-width", NULL, NULL, "", Tk_Offset(Slave, widthPtr), - Tk_Offset(Slave, width), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", Tk_Offset(Slave, xPtr), - Tk_Offset(Slave, x), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", Tk_Offset(Slave, yPtr), - Tk_Offset(Slave, y), TK_OPTION_NULL_OK, 0, 0}, + Tk_Offset(Content, relY), 0, 0, 0}, + {TK_OPTION_PIXELS, "-width", NULL, NULL, "", Tk_Offset(Content, widthPtr), + Tk_Offset(Content, width), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", Tk_Offset(Content, xPtr), + Tk_Offset(Content, x), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", Tk_Offset(Content, yPtr), + Tk_Offset(Content, y), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; /* - * Flag definitions for Slave structures: + * Flag definitions for Content structures: * * CHILD_WIDTH - 1 means -width was specified; * CHILD_REL_WIDTH - 1 means -relwidth was specified. @@ -123,25 +123,25 @@ static const Tk_OptionSpec optionSpecs[] = { #define CHILD_REL_HEIGHT 8 /* - * For each master window that has a slave managed by the placer there is a + * For each container window that has a content managed by the placer there is a * structure of the following form: */ -typedef struct Master { - Tk_Window tkwin; /* Tk's token for master window. */ - struct Slave *slavePtr; /* First in linked list of slaves placed - * relative to this master. */ +typedef struct Container { + Tk_Window tkwin; /* Tk's token for container window. */ + struct Content *contentPtr; /* First in linked list of content placed + * relative to this container. */ int *abortPtr; /* If non-NULL, it means that there is a nested * call to RecomputePlacement already working on * this window. *abortPtr may be set to 1 to * abort that nested call. This happens, for - * example, if tkwin or any of its slaves + * example, if tkwin or any of its content * is deleted. */ int flags; /* See below for bit definitions. */ -} Master; +} Container; /* - * Flag definitions for masters: + * Flag definitions for containers: * * PARENT_RECONFIG_PENDING - 1 means that a call to RecomputePlacement is * already pending via a Do_When_Idle handler. @@ -155,34 +155,34 @@ typedef struct Master { static void PlaceRequestProc(ClientData clientData, Tk_Window tkwin); -static void PlaceLostSlaveProc(ClientData clientData, +static void PlaceLostContentProc(ClientData clientData, Tk_Window tkwin); static const Tk_GeomMgr placerType = { "place", /* name */ PlaceRequestProc, /* requestProc */ - PlaceLostSlaveProc, /* lostSlaveProc */ + PlaceLostContentProc, /* lostContentProc */ }; /* * Forward declarations for functions defined later in this file: */ -static void SlaveStructureProc(ClientData clientData, +static void ContentStructureProc(ClientData clientData, XEvent *eventPtr); -static int ConfigureSlave(Tcl_Interp *interp, Tk_Window tkwin, +static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, Tk_OptionTable table, int objc, Tcl_Obj *const objv[]); static int PlaceInfoCommand(Tcl_Interp *interp, Tk_Window tkwin); -static Slave * CreateSlave(Tk_Window tkwin, Tk_OptionTable table); -static void FreeSlave(Slave *slavePtr); -static Slave * FindSlave(Tk_Window tkwin); -static Master * CreateMaster(Tk_Window tkwin); -static Master * FindMaster(Tk_Window tkwin); -static void MasterStructureProc(ClientData clientData, +static Content * CreateContent(Tk_Window tkwin, Tk_OptionTable table); +static void FreeContent(Content *contentPtr); +static Content * FindContent(Tk_Window tkwin); +static Container * CreateContainer(Tk_Window tkwin); +static Container * FindContainer(Tk_Window tkwin); +static void PlaceStructureProc(ClientData clientData, XEvent *eventPtr); static void RecomputePlacement(ClientData clientData); -static void UnlinkSlave(Slave *slavePtr); +static void UnlinkContent(Content *contentPtr); /* *-------------------------------------------------------------- @@ -208,15 +208,15 @@ Tk_PlaceObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window main_win = clientData; + Tk_Window main_win = (Tk_Window)clientData; Tk_Window tkwin; - Slave *slavePtr; + Content *contentPtr; TkDisplay *dispPtr; Tk_OptionTable optionTable; static const char *const optionStrings[] = { - "configure", "forget", "info", "slaves", NULL + "configure", "content", "forget", "info", "slaves", NULL }; - enum options { PLACE_CONFIGURE, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES }; + enum options { PLACE_CONFIGURE, PLACE_CONTENT, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES }; int index; if (objc < 3) { @@ -252,7 +252,7 @@ Tk_PlaceObjCmd( dispPtr->placeInit = 1; } - return ConfigureSlave(interp, tkwin, optionTable, objc-2, objv+2); + return ConfigureContent(interp, tkwin, optionTable, objc-2, objv+2); } /* @@ -286,11 +286,11 @@ Tk_PlaceObjCmd( if (objc == 3 || objc == 4) { Tcl_Obj *objPtr; - slavePtr = FindSlave(tkwin); - if (slavePtr == NULL) { + contentPtr = FindContent(tkwin); + if (contentPtr == NULL) { return TCL_OK; } - objPtr = Tk_GetOptionInfo(interp, (char *) slavePtr, optionTable, + objPtr = Tk_GetOptionInfo(interp, (char *)contentPtr, optionTable, (objc == 4) ? objv[3] : NULL, tkwin); if (objPtr == NULL) { return TCL_ERROR; @@ -298,29 +298,29 @@ Tk_PlaceObjCmd( Tcl_SetObjResult(interp, objPtr); return TCL_OK; } - return ConfigureSlave(interp, tkwin, optionTable, objc-3, objv+3); + return ConfigureContent(interp, tkwin, optionTable, objc-3, objv+3); case PLACE_FORGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pathName"); return TCL_ERROR; } - slavePtr = FindSlave(tkwin); - if (slavePtr == NULL) { + contentPtr = FindContent(tkwin); + if (contentPtr == NULL) { return TCL_OK; } - if ((slavePtr->masterPtr != NULL) && - (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if ((contentPtr->containerPtr != NULL) && + (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - UnlinkSlave(slavePtr); + UnlinkContent(contentPtr); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, - (char *) tkwin)); - Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, - slavePtr); + (void *)tkwin)); + Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc, + contentPtr); Tk_ManageGeometry(tkwin, NULL, NULL); Tk_UnmapWindow(tkwin); - FreeSlave(slavePtr); + FreeContent(contentPtr); break; case PLACE_INFO: @@ -330,21 +330,22 @@ Tk_PlaceObjCmd( } return PlaceInfoCommand(interp, tkwin); + case PLACE_CONTENT: case PLACE_SLAVES: { - Master *masterPtr; + Container *containerPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pathName"); return TCL_ERROR; } - masterPtr = FindMaster(tkwin); - if (masterPtr != NULL) { + containerPtr = FindContainer(tkwin); + if (containerPtr != NULL) { Tcl_Obj *listPtr = Tcl_NewObj(); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { Tcl_ListObjAppendElement(NULL, listPtr, - TkNewWindowObj(slavePtr->tkwin)); + TkNewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, listPtr); } @@ -358,59 +359,59 @@ Tk_PlaceObjCmd( /* *---------------------------------------------------------------------- * - * CreateSlave -- + * CreateContent -- * - * Given a Tk_Window token, find the Slave structure corresponding to + * Given a Tk_Window token, find the Content structure corresponding to * that token, creating a new one if necessary. * * Results: - * Pointer to the Slave structure. + * Pointer to the Content structure. * * Side effects: - * A new Slave structure may be created. + * A new Content structure may be created. * *---------------------------------------------------------------------- */ -static Slave * -CreateSlave( - Tk_Window tkwin, /* Token for desired slave. */ +static Content * +CreateContent( + Tk_Window tkwin, /* Token for desired content. */ Tk_OptionTable table) { Tcl_HashEntry *hPtr; - register Slave *slavePtr; + Content *contentPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Content *)Tcl_GetHashValue(hPtr); } /* - * No preexisting slave structure for that window, so make a new one and + * No preexisting content structure for that window, so make a new one and * populate it with some default values. */ - slavePtr = ckalloc(sizeof(Slave)); - memset(slavePtr, 0, sizeof(Slave)); - slavePtr->tkwin = tkwin; - slavePtr->inTkwin = NULL; - slavePtr->anchor = TK_ANCHOR_NW; - slavePtr->borderMode = BM_INSIDE; - slavePtr->optionTable = table; - Tcl_SetHashValue(hPtr, slavePtr); - Tk_CreateEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, - slavePtr); - return slavePtr; + contentPtr = (Content *)ckalloc(sizeof(Content)); + memset(contentPtr, 0, sizeof(Content)); + contentPtr->tkwin = tkwin; + contentPtr->inTkwin = NULL; + contentPtr->anchor = TK_ANCHOR_NW; + contentPtr->borderMode = BM_INSIDE; + contentPtr->optionTable = table; + Tcl_SetHashValue(hPtr, contentPtr); + Tk_CreateEventHandler(tkwin, StructureNotifyMask, ContentStructureProc, + contentPtr); + return contentPtr; } /* *---------------------------------------------------------------------- * - * FreeSlave -- + * FreeContent -- * - * Frees the resources held by a Slave structure. + * Frees the resources held by a Content structure. * * Results: * None @@ -422,25 +423,25 @@ CreateSlave( */ static void -FreeSlave( - Slave *slavePtr) +FreeContent( + Content *contentPtr) { - Tk_FreeConfigOptions((char *) slavePtr, slavePtr->optionTable, - slavePtr->tkwin); - ckfree(slavePtr); + Tk_FreeConfigOptions((char *) contentPtr, contentPtr->optionTable, + contentPtr->tkwin); + ckfree(contentPtr); } /* *---------------------------------------------------------------------- * - * FindSlave -- + * FindContent -- * - * Given a Tk_Window token, find the Slave structure corresponding to + * Given a Tk_Window token, find the Content structure corresponding to * that token. This is purely a lookup function; it will not create a * record if one does not yet exist. * * Results: - * Pointer to Slave structure; NULL if none exists. + * Pointer to Content structure; NULL if none exists. * * Side effects: * None. @@ -448,121 +449,121 @@ FreeSlave( *---------------------------------------------------------------------- */ -static Slave * -FindSlave( - Tk_Window tkwin) /* Token for desired slave. */ +static Content * +FindContent( + Tk_Window tkwin) /* Token for desired content. */ { - register Tcl_HashEntry *hPtr; + Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, (char *) tkwin); if (hPtr == NULL) { return NULL; } - return Tcl_GetHashValue(hPtr); + return (Content *)Tcl_GetHashValue(hPtr); } /* *---------------------------------------------------------------------- * - * UnlinkSlave -- + * UnlinkContent -- * - * This function removes a slave window from the chain of slaves in its - * master. + * This function removes a content window from the chain of content in its + * container. * * Results: * None. * * Side effects: - * The slave list of slavePtr's master changes. + * The content list of contentPtr's container changes. * *---------------------------------------------------------------------- */ static void -UnlinkSlave( - Slave *slavePtr) /* Slave structure to be unlinked. */ +UnlinkContent( + Content *contentPtr) /* Content structure to be unlinked. */ { - register Master *masterPtr; - register Slave *prevPtr; + Container *containerPtr; + Content *prevPtr; - masterPtr = slavePtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = contentPtr->containerPtr; + if (containerPtr == NULL) { return; } - if (masterPtr->slavePtr == slavePtr) { - masterPtr->slavePtr = slavePtr->nextPtr; + if (containerPtr->contentPtr == contentPtr) { + containerPtr->contentPtr = contentPtr->nextPtr; } else { - for (prevPtr = masterPtr->slavePtr; ; prevPtr = prevPtr->nextPtr) { + for (prevPtr = containerPtr->contentPtr; ; prevPtr = prevPtr->nextPtr) { if (prevPtr == NULL) { - Tcl_Panic("UnlinkSlave couldn't find slave to unlink"); + Tcl_Panic("UnlinkContent couldn't find slave to unlink"); } - if (prevPtr->nextPtr == slavePtr) { - prevPtr->nextPtr = slavePtr->nextPtr; + if (prevPtr->nextPtr == contentPtr) { + prevPtr->nextPtr = contentPtr->nextPtr; break; } } } - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - slavePtr->masterPtr = NULL; + contentPtr->containerPtr = NULL; } /* *---------------------------------------------------------------------- * - * CreateMaster -- + * CreateContainer -- * - * Given a Tk_Window token, find the Master structure corresponding to + * Given a Tk_Window token, find the Container structure corresponding to * that token, creating a new one if necessary. * * Results: - * Pointer to the Master structure. + * Pointer to the Container structure. * * Side effects: - * A new Master structure may be created. + * A new Container structure may be created. * *---------------------------------------------------------------------- */ -static Master * -CreateMaster( - Tk_Window tkwin) /* Token for desired master. */ +static Container * +CreateContainer( + Tk_Window tkwin) /* Token for desired container. */ { Tcl_HashEntry *hPtr; - register Master *masterPtr; + Container *containerPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew); + hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *)tkwin, &isNew); if (isNew) { - masterPtr = ckalloc(sizeof(Master)); - masterPtr->tkwin = tkwin; - masterPtr->slavePtr = NULL; - masterPtr->abortPtr = NULL; - masterPtr->flags = 0; - Tcl_SetHashValue(hPtr, masterPtr); - Tk_CreateEventHandler(masterPtr->tkwin, StructureNotifyMask, - MasterStructureProc, masterPtr); + containerPtr = (Container *)ckalloc(sizeof(Container)); + containerPtr->tkwin = tkwin; + containerPtr->contentPtr = NULL; + containerPtr->abortPtr = NULL; + containerPtr->flags = 0; + Tcl_SetHashValue(hPtr, containerPtr); + Tk_CreateEventHandler(containerPtr->tkwin, StructureNotifyMask, + PlaceStructureProc, containerPtr); } else { - masterPtr = Tcl_GetHashValue(hPtr); + containerPtr = (Container *)Tcl_GetHashValue(hPtr); } - return masterPtr; + return containerPtr; } /* *---------------------------------------------------------------------- * - * FindMaster -- + * FindContainer -- * - * Given a Tk_Window token, find the Master structure corresponding to + * Given a Tk_Window token, find the Container structure corresponding to * that token. This is simply a lookup function; a new record will not be * created if one does not already exist. * * Results: - * Pointer to the Master structure; NULL if one does not exist for the + * Pointer to the Container structure; NULL if one does not exist for the * given Tk_Window token. * * Side effects: @@ -571,24 +572,24 @@ CreateMaster( *---------------------------------------------------------------------- */ -static Master * -FindMaster( - Tk_Window tkwin) /* Token for desired master. */ +static Container * +FindContainer( + Tk_Window tkwin) /* Token for desired container. */ { - register Tcl_HashEntry *hPtr; + Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, (char *) tkwin); if (hPtr == NULL) { return NULL; } - return Tcl_GetHashValue(hPtr); + return (Container *)Tcl_GetHashValue(hPtr); } /* *---------------------------------------------------------------------- * - * ConfigureSlave -- + * ConfigureContent -- * * This function is called to process an argv/argc list to reconfigure * the placement of a window. @@ -598,26 +599,26 @@ FindMaster( * the interp's result. * * Side effects: - * Information in slavePtr may change, and slavePtr's master is scheduled + * Information in contentPtr may change, and contentPtr's container is scheduled * for reconfiguration. * *---------------------------------------------------------------------- */ static int -ConfigureSlave( +ConfigureContent( Tcl_Interp *interp, /* Used for error reporting. */ Tk_Window tkwin, /* Token for the window to manipulate. */ Tk_OptionTable table, /* Token for option table. */ int objc, /* Number of config arguments. */ Tcl_Obj *const objv[]) /* Object values for arguments. */ { - register Master *masterPtr; + Container *containerPtr; Tk_SavedOptions savedOptions; int mask; - Slave *slavePtr; - Tk_Window masterWin = NULL; - TkWindow *master; + Content *contentPtr; + Tk_Window containerWin = NULL; + TkWindow *container; if (Tk_TopWinHierarchy(tkwin)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -627,71 +628,71 @@ ConfigureSlave( return TCL_ERROR; } - slavePtr = CreateSlave(tkwin, table); + contentPtr = CreateContent(tkwin, table); - if (Tk_SetOptions(interp, (char *) slavePtr, table, objc, objv, - slavePtr->tkwin, &savedOptions, &mask) != TCL_OK) { + if (Tk_SetOptions(interp, (char *)contentPtr, table, objc, objv, + contentPtr->tkwin, &savedOptions, &mask) != TCL_OK) { goto error; } /* - * Set slave flags. First clear the field, then add bits as needed. + * Set content flags. First clear the field, then add bits as needed. */ - slavePtr->flags = 0; - if (slavePtr->heightPtr) { - slavePtr->flags |= CHILD_HEIGHT; + contentPtr->flags = 0; + if (contentPtr->heightPtr) { + contentPtr->flags |= CHILD_HEIGHT; } - if (slavePtr->relHeightPtr) { - slavePtr->flags |= CHILD_REL_HEIGHT; + if (contentPtr->relHeightPtr) { + contentPtr->flags |= CHILD_REL_HEIGHT; } - if (slavePtr->relWidthPtr) { - slavePtr->flags |= CHILD_REL_WIDTH; + if (contentPtr->relWidthPtr) { + contentPtr->flags |= CHILD_REL_WIDTH; } - if (slavePtr->widthPtr) { - slavePtr->flags |= CHILD_WIDTH; + if (contentPtr->widthPtr) { + contentPtr->flags |= CHILD_WIDTH; } - if (!(mask & IN_MASK) && (slavePtr->masterPtr != NULL)) { + if (!(mask & IN_MASK) && (contentPtr->containerPtr != NULL)) { /* - * If no -in option was passed and the slave is already placed then + * If no -in option was passed and the content is already placed then * just recompute the placement. */ - masterPtr = slavePtr->masterPtr; + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } else if (mask & IN_MASK) { /* -in changed */ Tk_Window tkwin; Tk_Window ancestor; - tkwin = slavePtr->inTkwin; + tkwin = contentPtr->inTkwin; /* - * Make sure that the new master is either the logical parent of the - * slave or a descendant of that window, and that the master and slave + * Make sure that the new container is either the logical parent of the + * content or a descendant of that window, and that the container and content * aren't the same. */ for (ancestor = tkwin; ; ancestor = Tk_Parent(ancestor)) { - if (ancestor == Tk_Parent(slavePtr->tkwin)) { + if (ancestor == Tk_Parent(contentPtr->tkwin)) { break; } if (Tk_TopWinHierarchy(ancestor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place %s relative to %s", - Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin))); + Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); goto error; } } - if (slavePtr->tkwin == tkwin) { + if (contentPtr->tkwin == tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place %s relative to itself", - Tk_PathName(slavePtr->tkwin))); + Tk_PathName(contentPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } @@ -700,66 +701,66 @@ ConfigureSlave( * Check for management loops. */ - for (master = (TkWindow *)tkwin; master != NULL; - master = (TkWindow *)TkGetGeomMaster(master)) { - if (master == (TkWindow *)slavePtr->tkwin) { + for (container = (TkWindow *)tkwin; container != NULL; + container = (TkWindow *)TkGetGeomMaster(container)) { + if (container == (TkWindow *)contentPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", - Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin))); + Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } } - if (tkwin != Tk_Parent(slavePtr->tkwin)) { - ((TkWindow *)slavePtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; + if (tkwin != Tk_Parent(contentPtr->tkwin)) { + ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; } - if ((slavePtr->masterPtr != NULL) - && (slavePtr->masterPtr->tkwin == tkwin)) { + if ((contentPtr->containerPtr != NULL) + && (contentPtr->containerPtr->tkwin == tkwin)) { /* - * Re-using same old master. Nothing to do. + * Re-using same old container. Nothing to do. */ - masterPtr = slavePtr->masterPtr; + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } - if ((slavePtr->masterPtr != NULL) && - (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if ((contentPtr->containerPtr != NULL) && + (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - UnlinkSlave(slavePtr); - masterWin = tkwin; + UnlinkContent(contentPtr); + containerWin = tkwin; } /* - * If there's no master specified for this slave, use its Tk_Parent. + * If there's no container specified for this content, use its Tk_Parent. */ - if (masterWin == NULL) { - masterWin = Tk_Parent(slavePtr->tkwin); - slavePtr->inTkwin = masterWin; + if (containerWin == NULL) { + containerWin = Tk_Parent(contentPtr->tkwin); + contentPtr->inTkwin = containerWin; } /* - * Manage the slave window in this master. + * Manage the content window in this container. */ - masterPtr = CreateMaster(masterWin); - slavePtr->masterPtr = masterPtr; - slavePtr->nextPtr = masterPtr->slavePtr; - masterPtr->slavePtr = slavePtr; - Tk_ManageGeometry(slavePtr->tkwin, &placerType, slavePtr); + containerPtr = CreateContainer(containerWin); + contentPtr->containerPtr = containerPtr; + contentPtr->nextPtr = containerPtr->contentPtr; + containerPtr->contentPtr = contentPtr; + Tk_ManageGeometry(contentPtr->tkwin, &placerType, contentPtr); /* - * Arrange for the master to be re-arranged at the first idle moment. + * Arrange for the container to be re-arranged at the first idle moment. */ scheduleLayout: Tk_FreeSavedOptions(&savedOptions); - if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) { - masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, masterPtr); + if (!(containerPtr->flags & PARENT_RECONFIG_PENDING)) { + containerPtr->flags |= PARENT_RECONFIG_PENDING; + Tcl_DoWhenIdle(RecomputePlacement, containerPtr); } return TCL_OK; @@ -795,49 +796,49 @@ PlaceInfoCommand( Tcl_Interp *interp, /* Interp into which to place result. */ Tk_Window tkwin) /* Token for the window to get info on. */ { - Slave *slavePtr; + Content *contentPtr; Tcl_Obj *infoObj; - slavePtr = FindSlave(tkwin); - if (slavePtr == NULL) { + contentPtr = FindContent(tkwin); + if (contentPtr == NULL) { return TCL_OK; } infoObj = Tcl_NewObj(); - if (slavePtr->masterPtr != NULL) { + if (contentPtr->containerPtr != NULL) { Tcl_AppendToObj(infoObj, "-in", -1); Tcl_ListObjAppendElement(NULL, infoObj, - TkNewWindowObj(slavePtr->masterPtr->tkwin)); + TkNewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_AppendToObj(infoObj, " ", -1); } Tcl_AppendPrintfToObj(infoObj, "-x %d -relx %.4g -y %d -rely %.4g", - slavePtr->x, slavePtr->relX, slavePtr->y, slavePtr->relY); - if (slavePtr->flags & CHILD_WIDTH) { - Tcl_AppendPrintfToObj(infoObj, " -width %d", slavePtr->width); + contentPtr->x, contentPtr->relX, contentPtr->y, contentPtr->relY); + if (contentPtr->flags & CHILD_WIDTH) { + Tcl_AppendPrintfToObj(infoObj, " -width %d", contentPtr->width); } else { Tcl_AppendToObj(infoObj, " -width {}", -1); } - if (slavePtr->flags & CHILD_REL_WIDTH) { + if (contentPtr->flags & CHILD_REL_WIDTH) { Tcl_AppendPrintfToObj(infoObj, - " -relwidth %.4g", slavePtr->relWidth); + " -relwidth %.4g", contentPtr->relWidth); } else { Tcl_AppendToObj(infoObj, " -relwidth {}", -1); } - if (slavePtr->flags & CHILD_HEIGHT) { - Tcl_AppendPrintfToObj(infoObj, " -height %d", slavePtr->height); + if (contentPtr->flags & CHILD_HEIGHT) { + Tcl_AppendPrintfToObj(infoObj, " -height %d", contentPtr->height); } else { Tcl_AppendToObj(infoObj, " -height {}", -1); } - if (slavePtr->flags & CHILD_REL_HEIGHT) { + if (contentPtr->flags & CHILD_REL_HEIGHT) { Tcl_AppendPrintfToObj(infoObj, - " -relheight %.4g", slavePtr->relHeight); + " -relheight %.4g", contentPtr->relHeight); } else { Tcl_AppendToObj(infoObj, " -relheight {}", -1); } Tcl_AppendPrintfToObj(infoObj, " -anchor %s -bordermode %s", - Tk_NameOfAnchor(slavePtr->anchor), - borderModeStrings[slavePtr->borderMode]); + Tk_NameOfAnchor(contentPtr->anchor), + borderModeStrings[contentPtr->borderMode]); Tcl_SetObjResult(interp, infoObj); return TCL_OK; } @@ -848,7 +849,7 @@ PlaceInfoCommand( * RecomputePlacement -- * * This function is called as a when-idle handler. It recomputes the - * geometries of all the slaves of a given master. + * geometries of all the content of a given container. * * Results: * None. @@ -861,17 +862,17 @@ PlaceInfoCommand( static void RecomputePlacement( - ClientData clientData) /* Pointer to Master record. */ + ClientData clientData) /* Pointer to Container record. */ { - register Master *masterPtr = clientData; - register Slave *slavePtr; + Container *containerPtr = (Container *)clientData; + Content *contentPtr; int x, y, width, height, tmp; - int masterWidth, masterHeight, masterX, masterY; + int containerWidth, containerHeight, containerX, containerY; double x1, y1, x2, y2; int abort; /* May get set to non-zero to abort this * placement operation. */ - masterPtr->flags &= ~PARENT_RECONFIG_PENDING; + containerPtr->flags &= ~PARENT_RECONFIG_PENDING; /* * Abort any nested call to RecomputePlacement for this window, since @@ -879,57 +880,57 @@ RecomputePlacement( * aborted if necessary. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - masterPtr->abortPtr = &abort; + containerPtr->abortPtr = &abort; abort = 0; - Tcl_Preserve(masterPtr); + Tcl_Preserve(containerPtr); /* - * Iterate over all the slaves for the master. Each slave's geometry can - * be computed independently of the other slaves. Changes to the window's + * Iterate over all the content for the container. Each content's geometry can + * be computed independently of the other content. Changes to the window's * structure could cause almost anything to happen, including deleting the * parent or child. If this happens, we'll be told to abort. */ - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort; - slavePtr = slavePtr->nextPtr) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort; + contentPtr = contentPtr->nextPtr) { /* - * Step 1: compute size and borderwidth of master, taking into account + * Step 1: compute size and borderwidth of container, taking into account * desired border mode. */ - masterX = masterY = 0; - masterWidth = Tk_Width(masterPtr->tkwin); - masterHeight = Tk_Height(masterPtr->tkwin); - if (slavePtr->borderMode == BM_INSIDE) { - masterX = Tk_InternalBorderLeft(masterPtr->tkwin); - masterY = Tk_InternalBorderTop(masterPtr->tkwin); - masterWidth -= masterX + Tk_InternalBorderRight(masterPtr->tkwin); - masterHeight -= masterY + - Tk_InternalBorderBottom(masterPtr->tkwin); - } else if (slavePtr->borderMode == BM_OUTSIDE) { - masterX = masterY = -Tk_Changes(masterPtr->tkwin)->border_width; - masterWidth -= 2 * masterX; - masterHeight -= 2 * masterY; + containerX = containerY = 0; + containerWidth = Tk_Width(containerPtr->tkwin); + containerHeight = Tk_Height(containerPtr->tkwin); + if (contentPtr->borderMode == BM_INSIDE) { + containerX = Tk_InternalBorderLeft(containerPtr->tkwin); + containerY = Tk_InternalBorderTop(containerPtr->tkwin); + containerWidth -= containerX + Tk_InternalBorderRight(containerPtr->tkwin); + containerHeight -= containerY + + Tk_InternalBorderBottom(containerPtr->tkwin); + } else if (contentPtr->borderMode == BM_OUTSIDE) { + containerX = containerY = -Tk_Changes(containerPtr->tkwin)->border_width; + containerWidth -= 2 * containerX; + containerHeight -= 2 * containerY; } /* - * Step 2: compute size of slave (outside dimensions including border) - * and location of anchor point within master. + * Step 2: compute size of content (outside dimensions including border) + * and location of anchor point within container. */ - x1 = slavePtr->x + masterX + (slavePtr->relX*masterWidth); + x1 = contentPtr->x + containerX + (contentPtr->relX*containerWidth); x = (int) (x1 + ((x1 > 0) ? 0.5 : -0.5)); - y1 = slavePtr->y + masterY + (slavePtr->relY*masterHeight); + y1 = contentPtr->y + containerY + (contentPtr->relY*containerHeight); y = (int) (y1 + ((y1 > 0) ? 0.5 : -0.5)); - if (slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) { + if (contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) { width = 0; - if (slavePtr->flags & CHILD_WIDTH) { - width += slavePtr->width; + if (contentPtr->flags & CHILD_WIDTH) { + width += contentPtr->width; } - if (slavePtr->flags & CHILD_REL_WIDTH) { + if (contentPtr->flags & CHILD_REL_WIDTH) { /* * The code below is a bit tricky. In order to round correctly * when both relX and relWidth are specified, compute the @@ -938,40 +939,40 @@ RecomputePlacement( * errors in relX and relWidth accumulate. */ - x2 = x1 + (slavePtr->relWidth*masterWidth); + x2 = x1 + (contentPtr->relWidth*containerWidth); tmp = (int) (x2 + ((x2 > 0) ? 0.5 : -0.5)); width += tmp - x; } } else { - width = Tk_ReqWidth(slavePtr->tkwin) - + 2*Tk_Changes(slavePtr->tkwin)->border_width; + width = Tk_ReqWidth(contentPtr->tkwin) + + 2*Tk_Changes(contentPtr->tkwin)->border_width; } - if (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) { + if (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) { height = 0; - if (slavePtr->flags & CHILD_HEIGHT) { - height += slavePtr->height; + if (contentPtr->flags & CHILD_HEIGHT) { + height += contentPtr->height; } - if (slavePtr->flags & CHILD_REL_HEIGHT) { + if (contentPtr->flags & CHILD_REL_HEIGHT) { /* * See note above for rounding errors in width computation. */ - y2 = y1 + (slavePtr->relHeight*masterHeight); + y2 = y1 + (contentPtr->relHeight*containerHeight); tmp = (int) (y2 + ((y2 > 0) ? 0.5 : -0.5)); height += tmp - y; } } else { - height = Tk_ReqHeight(slavePtr->tkwin) - + 2*Tk_Changes(slavePtr->tkwin)->border_width; + height = Tk_ReqHeight(contentPtr->tkwin) + + 2*Tk_Changes(contentPtr->tkwin)->border_width; } /* * Step 3: adjust the x and y positions so that the desired anchor - * point on the slave appears at that position. Also adjust for the - * border mode and master's border. + * point on the content appears at that position. Also adjust for the + * border mode and container's border. */ - switch (slavePtr->anchor) { + switch (contentPtr->anchor) { case TK_ANCHOR_N: x -= width/2; break; @@ -1010,8 +1011,8 @@ RecomputePlacement( * height aren't zero. */ - width -= 2*Tk_Changes(slavePtr->tkwin)->border_width; - height -= 2*Tk_Changes(slavePtr->tkwin)->border_width; + width -= 2*Tk_Changes(contentPtr->tkwin)->border_width; + height -= 2*Tk_Changes(contentPtr->tkwin)->border_width; if (width <= 0) { width = 1; } @@ -1020,121 +1021,121 @@ RecomputePlacement( } /* - * Step 5: reconfigure the window and map it if needed. If the slave - * is a child of the master, we do this ourselves. If the slave isn't - * a child of the master, let Tk_MaintainGeometry do the work (it will + * Step 5: reconfigure the window and map it if needed. If the content + * is a child of the container, we do this ourselves. If the content isn't + * a child of the container, let Tk_MaintainGeometry do the work (it will * re-adjust things as relevant windows map, unmap, and move). */ - if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { - if ((x != Tk_X(slavePtr->tkwin)) - || (y != Tk_Y(slavePtr->tkwin)) - || (width != Tk_Width(slavePtr->tkwin)) - || (height != Tk_Height(slavePtr->tkwin))) { - Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height); + if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) { + if ((x != Tk_X(contentPtr->tkwin)) + || (y != Tk_Y(contentPtr->tkwin)) + || (width != Tk_Width(contentPtr->tkwin)) + || (height != Tk_Height(contentPtr->tkwin))) { + Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height); } if (abort) { break; } /* - * Don't map the slave unless the master is mapped: the slave will - * get mapped later, when the master is mapped. + * Don't map the content unless the container is mapped: the content will + * get mapped later, when the container is mapped. */ - if (Tk_IsMapped(masterPtr->tkwin)) { - Tk_MapWindow(slavePtr->tkwin); + if (Tk_IsMapped(containerPtr->tkwin)) { + Tk_MapWindow(contentPtr->tkwin); } } else { if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin); - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, + Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y, width, height); } } } - masterPtr->abortPtr = NULL; - Tcl_Release(masterPtr); + containerPtr->abortPtr = NULL; + Tcl_Release(containerPtr); } /* *---------------------------------------------------------------------- * - * MasterStructureProc -- + * PlaceStructureProc -- * * This function is invoked by the Tk event handler when StructureNotify - * events occur for a master window. + * events occur for a container window. * * Results: * None. * * Side effects: * Structures get cleaned up if the window was deleted. If the window was - * resized then slave geometries get recomputed. + * resized then content geometries get recomputed. * *---------------------------------------------------------------------- */ static void -MasterStructureProc( - ClientData clientData, /* Pointer to Master structure for window +PlaceStructureProc( + ClientData clientData, /* Pointer to Container structure for window * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Master *masterPtr = clientData; - register Slave *slavePtr, *nextPtr; - TkDisplay *dispPtr = ((TkWindow *) masterPtr->tkwin)->dispPtr; + Container *containerPtr = (Container *)clientData; + Content *contentPtr, *nextPtr; + TkDisplay *dispPtr = ((TkWindow *) containerPtr->tkwin)->dispPtr; switch (eventPtr->type) { case ConfigureNotify: - if ((masterPtr->slavePtr != NULL) - && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) { - masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, masterPtr); + if ((containerPtr->contentPtr != NULL) + && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) { + containerPtr->flags |= PARENT_RECONFIG_PENDING; + Tcl_DoWhenIdle(RecomputePlacement, containerPtr); } return; case DestroyNotify: - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = nextPtr) { - slavePtr->masterPtr = NULL; - nextPtr = slavePtr->nextPtr; - slavePtr->nextPtr = NULL; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = nextPtr) { + contentPtr->containerPtr = NULL; + nextPtr = contentPtr->nextPtr; + contentPtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable, - (char *) masterPtr->tkwin)); - if (masterPtr->flags & PARENT_RECONFIG_PENDING) { - Tcl_CancelIdleCall(RecomputePlacement, masterPtr); + (char *) containerPtr->tkwin)); + if (containerPtr->flags & PARENT_RECONFIG_PENDING) { + Tcl_CancelIdleCall(RecomputePlacement, containerPtr); } - masterPtr->tkwin = NULL; - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + containerPtr->tkwin = NULL; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - Tcl_EventuallyFree(masterPtr, TCL_DYNAMIC); + Tcl_EventuallyFree(containerPtr, TCL_DYNAMIC); return; case MapNotify: /* - * When a master gets mapped, must redo the geometry computation so - * that all of its slaves get remapped. + * When a container gets mapped, must redo the geometry computation so + * that all of its content get remapped. */ - if ((masterPtr->slavePtr != NULL) - && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) { - masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, masterPtr); + if ((containerPtr->contentPtr != NULL) + && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) { + containerPtr->flags |= PARENT_RECONFIG_PENDING; + Tcl_DoWhenIdle(RecomputePlacement, containerPtr); } return; case UnmapNotify: /* - * Unmap all of the slaves when the master gets unmapped, so that they + * Unmap all of the content when the container gets unmapped, so that they * don't keep redisplaying themselves. */ - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - Tk_UnmapWindow(slavePtr->tkwin); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + Tk_UnmapWindow(contentPtr->tkwin); } return; } @@ -1143,10 +1144,10 @@ MasterStructureProc( /* *---------------------------------------------------------------------- * - * SlaveStructureProc -- + * ContentStructureProc -- * * This function is invoked by the Tk event handler when StructureNotify - * events occur for a slave window. + * events occur for a content window. * * Results: * None. @@ -1158,21 +1159,21 @@ MasterStructureProc( */ static void -SlaveStructureProc( - ClientData clientData, /* Pointer to Slave structure for window +ContentStructureProc( + ClientData clientData, /* Pointer to Content structure for window * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Slave *slavePtr = clientData; - TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; + Content *contentPtr = (Content *)clientData; + TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr; if (eventPtr->type == DestroyNotify) { - if (slavePtr->masterPtr != NULL) { - UnlinkSlave(slavePtr); + if (contentPtr->containerPtr != NULL) { + UnlinkContent(contentPtr); } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, - (char *) slavePtr->tkwin)); - FreeSlave(slavePtr); + (char *) contentPtr->tkwin)); + FreeContent(contentPtr); } } @@ -1181,7 +1182,7 @@ SlaveStructureProc( * * PlaceRequestProc -- * - * This function is invoked by Tk whenever a slave managed by us changes + * This function is invoked by Tk whenever a content managed by us changes * its requested geometry. * * Results: @@ -1194,72 +1195,70 @@ SlaveStructureProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void PlaceRequestProc( - ClientData clientData, /* Pointer to our record for slave. */ - Tk_Window tkwin) /* Window that changed its desired size. */ + ClientData clientData, /* Pointer to our record for content. */ + TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { - Slave *slavePtr = clientData; - Master *masterPtr; + Content *contentPtr = (Content *)clientData; + Container *containerPtr; - if ((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) - && (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) { + if ((contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) + && (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) { /* * Send a ConfigureNotify to indicate that the size change * request was rejected. */ - TkDoConfigureNotify((TkWindow *)(slavePtr->tkwin)); + TkDoConfigureNotify((TkWindow *)(contentPtr->tkwin)); return; } - masterPtr = slavePtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = contentPtr->containerPtr; + if (containerPtr == NULL) { return; } - if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) { - masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, masterPtr); + if (!(containerPtr->flags & PARENT_RECONFIG_PENDING)) { + containerPtr->flags |= PARENT_RECONFIG_PENDING; + Tcl_DoWhenIdle(RecomputePlacement, containerPtr); } } /* *-------------------------------------------------------------- * - * PlaceLostSlaveProc -- + * PlaceLostContentProc -- * * This function is invoked by Tk whenever some other geometry claims - * control over a slave that used to be managed by us. + * control over a content window that used to be managed by us. * * Results: * None. * * Side effects: - * Forgets all placer-related information about the slave. + * Forgets all placer-related information about the content window. * *-------------------------------------------------------------- */ - /* ARGSUSED */ static void -PlaceLostSlaveProc( - ClientData clientData, /* Slave structure for slave window that was +PlaceLostContentProc( + ClientData clientData, /* Content structure for content window that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + Tk_Window tkwin) /* Tk's handle for the content window. */ { - register Slave *slavePtr = clientData; - TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; + Content *contentPtr = (Content *)clientData; + TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr; - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } Tk_UnmapWindow(tkwin); - UnlinkSlave(slavePtr); + UnlinkContent(contentPtr); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, (char *) tkwin)); - Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, - slavePtr); - FreeSlave(slavePtr); + Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc, + contentPtr); + FreeContent(contentPtr); } /* diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h index 3bf8059..bad633f 100644 --- a/generic/tkPlatDecls.h +++ b/generic/tkPlatDecls.h @@ -87,9 +87,8 @@ EXTERN Tk_Window Tk_MacOSXGetTkWindow(void *w); /* 12 */ EXTERN void * Tk_MacOSXGetCGContextForDrawable(Drawable drawable); /* 13 */ -EXTERN void * Tk_MacOSXGetNSViewForDrawable(Drawable drawable); -/* 14 */ EXTERN void * Tk_MacOSXGetNSWindowForDrawable(Drawable drawable); +/* Slot 14 is reserved */ /* Slot 15 is reserved */ /* 16 */ EXTERN void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, @@ -122,8 +121,8 @@ typedef struct TkPlatStubs { int (*tk_MacOSXIsAppInFront) (void); /* 10 */ Tk_Window (*tk_MacOSXGetTkWindow) (void *w); /* 11 */ void * (*tk_MacOSXGetCGContextForDrawable) (Drawable drawable); /* 12 */ - void * (*tk_MacOSXGetNSViewForDrawable) (Drawable drawable); /* 13 */ - void * (*tk_MacOSXGetNSWindowForDrawable) (Drawable drawable); /* 14 */ + void * (*tk_MacOSXGetNSWindowForDrawable) (Drawable drawable); /* 13 */ + void (*reserved14)(void); void (*reserved15)(void); void (*tkGenWMConfigureEvent_) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 16 */ #endif /* AQUA */ @@ -182,10 +181,9 @@ extern const TkPlatStubs *tkPlatStubsPtr; (tkPlatStubsPtr->tk_MacOSXGetTkWindow) /* 11 */ #define Tk_MacOSXGetCGContextForDrawable \ (tkPlatStubsPtr->tk_MacOSXGetCGContextForDrawable) /* 12 */ -#define Tk_MacOSXGetNSViewForDrawable \ - (tkPlatStubsPtr->tk_MacOSXGetNSViewForDrawable) /* 13 */ #define Tk_MacOSXGetNSWindowForDrawable \ - (tkPlatStubsPtr->tk_MacOSXGetNSWindowForDrawable) /* 14 */ + (tkPlatStubsPtr->tk_MacOSXGetNSWindowForDrawable) /* 13 */ +/* Slot 14 is reserved */ /* Slot 15 is reserved */ #define TkGenWMConfigureEvent_ \ (tkPlatStubsPtr->tkGenWMConfigureEvent_) /* 16 */ diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 6e4d306..59c7d0e 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -1016,8 +1016,8 @@ static const TkPlatStubs tkPlatStubs = { Tk_MacOSXIsAppInFront, /* 10 */ Tk_MacOSXGetTkWindow, /* 11 */ Tk_MacOSXGetCGContextForDrawable, /* 12 */ - Tk_MacOSXGetNSViewForDrawable, /* 13 */ - Tk_MacOSXGetNSWindowForDrawable, /* 14 */ + Tk_MacOSXGetNSWindowForDrawable, /* 13 */ + 0, /* 14 */ 0, /* 15 */ TkGenWMConfigureEvent_, /* 16 */ #endif /* AQUA */ diff --git a/generic/tkTest.c b/generic/tkTest.c index 26b3fa5..3c17407 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -50,17 +50,17 @@ #define TCL_STORAGE_CLASS DLLEXPORT EXTERN int Tktest_Init(Tcl_Interp *interp); /* - * The following data structure represents the master for a test image: + * The following data structure represents the model for a test image: */ -typedef struct TImageMaster { - Tk_ImageMaster master; /* Tk's token for image master. */ +typedef struct TImageModel { + Tk_ImageModel model; /* Tk's token for image model. */ Tcl_Interp *interp; /* Interpreter for application. */ int width, height; /* Dimensions of image. */ char *imageName; /* Name of image (malloc-ed). */ char *varName; /* Name of variable in which to log events for * image (malloc-ed). */ -} TImageMaster; +} TImageModel; /* * The following data structure represents a particular use of a particular @@ -68,7 +68,7 @@ typedef struct TImageMaster { */ typedef struct TImageInstance { - TImageMaster *masterPtr; /* Pointer to master for image. */ + TImageModel *modelPtr; /* Pointer to model for image. */ XColor *fg; /* Foreground color for drawing in image. */ GC gc; /* Graphics context for drawing in image. */ Bool displayFailed; /* macOS display attempted out of drawRect. */ @@ -81,7 +81,7 @@ typedef struct TImageInstance { static int ImageCreate(Tcl_Interp *interp, const char *name, int argc, Tcl_Obj *const objv[], - const Tk_ImageType *typePtr, Tk_ImageMaster master, + const Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static ClientData ImageGet(Tk_Window tkwin, ClientData clientData); static void ImageDisplay(ClientData clientData, @@ -1062,14 +1062,14 @@ TestobjconfigObjCmd( } case TWO_WINDOWS: { - typedef struct SlaveRecord { + typedef struct ContentRecord { TrivialCommandHeader header; Tcl_Obj *windowPtr; - } SlaveRecord; - SlaveRecord *recordPtr; - static const Tk_OptionSpec slaveSpecs[] = { + } ContentRecord; + ContentRecord *recordPtr; + static const Tk_OptionSpec contentSpecs[] = { {TK_OPTION_WINDOW, "-window", "window", "Window", ".bar", - Tk_Offset(SlaveRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0}, + Tk_Offset(ContentRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_Window tkwin = Tk_CreateWindowFromPath(interp, @@ -1080,10 +1080,10 @@ TestobjconfigObjCmd( } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(SlaveRecord)); + recordPtr = ckalloc(sizeof(ContentRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = Tk_CreateOptionTable(interp, - slaveSpecs); + contentSpecs); tables[index] = recordPtr->header.optionTable; recordPtr->header.tkwin = tkwin; recordPtr->windowPtr = NULL; @@ -1386,12 +1386,12 @@ ImageCreate( Tcl_Obj *const objv[], /* Argument strings for options (doesn't * include image name or type). */ const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */ - Tk_ImageMaster master, /* Token for image, to be used by us in later + Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - TImageMaster *timPtr; + TImageModel *timPtr; const char *varName; int i; @@ -1410,8 +1410,8 @@ ImageCreate( varName = Tcl_GetString(objv[i+1]); } - timPtr = ckalloc(sizeof(TImageMaster)); - timPtr->master = master; + timPtr = ckalloc(sizeof(TImageModel)); + timPtr->model = model; timPtr->interp = interp; timPtr->width = 30; timPtr->height = 15; @@ -1421,7 +1421,7 @@ ImageCreate( strcpy(timPtr->varName, varName); Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL); *clientDataPtr = timPtr; - Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15); + Tk_ImageChanged(model, 0, 0, 30, 15, 30, 15); return TCL_OK; } @@ -1450,7 +1450,7 @@ ImageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageModel *timPtr = (TImageModel *) clientData; int x, y, width, height; if (objc < 2) { @@ -1471,7 +1471,7 @@ ImageObjCmd( || (Tcl_GetIntFromObj(interp, objv[7], &timPtr->height) != TCL_OK)) { return TCL_ERROR; } - Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width, + Tk_ImageChanged(timPtr->model, x, y, width, height, timPtr->width, timPtr->height); } else { Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]), @@ -1503,9 +1503,9 @@ static ClientData ImageGet( Tk_Window tkwin, /* Token for window in which image will be * used. */ - ClientData clientData) /* Pointer to TImageMaster for image. */ + ClientData clientData) /* Pointer to TImageModel for image. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageModel *timPtr = (TImageModel *) clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -1515,7 +1515,7 @@ ImageGet( TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); instPtr = ckalloc(sizeof(TImageInstance)); - instPtr->masterPtr = timPtr; + instPtr->modelPtr = timPtr; instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues); @@ -1580,9 +1580,9 @@ ImageDisplay( */ sprintf(instPtr->buffer, "%s display %d %d %d %d", - instPtr->masterPtr->imageName, imageX, imageY, width, height); + instPtr->modelPtr->imageName, imageX, imageY, width, height); } - Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, + Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, instPtr->buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); instPtr->displayFailed = False; @@ -1595,15 +1595,15 @@ ImageDisplay( if (instPtr->displayFailed == False) { sprintf(instPtr->buffer, "%s display %d %d %d %d", - instPtr->masterPtr->imageName, imageX, imageY, width, height); + instPtr->modelPtr->imageName, imageX, imageY, width, height); } instPtr->displayFailed = True; } - if (width > (instPtr->masterPtr->width - imageX)) { - width = instPtr->masterPtr->width - imageX; + if (width > (instPtr->modelPtr->width - imageX)) { + width = instPtr->modelPtr->width - imageX; } - if (height > (instPtr->masterPtr->height - imageY)) { - height = instPtr->masterPtr->height - imageY; + if (height > (instPtr->modelPtr->height - imageY)) { + height = instPtr->modelPtr->height - imageY; } XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY, @@ -1640,8 +1640,8 @@ ImageFree( TImageInstance *instPtr = (TImageInstance *) clientData; char buffer[200]; - sprintf(buffer, "%s free", instPtr->masterPtr->imageName); - Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL, + sprintf(buffer, "%s free", instPtr->modelPtr->imageName); + Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); Tk_FreeColor(instPtr->fg); Tk_FreeGC(display, instPtr->gc); @@ -1667,11 +1667,11 @@ ImageFree( static void ImageDelete( - ClientData clientData) /* Pointer to TImageMaster for image. When + ClientData clientData) /* Pointer to TImageModel for image. When * this function is called, no more instances * exist. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageModel *timPtr = (TImageModel *) clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index c9fc20f..a0e7089 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -22,13 +22,13 @@ static void EmbWinRequestProc(ClientData clientData, Tk_Window tkwin); -static void EmbWinLostSlaveProc(ClientData clientData, +static void EmbWinLostContentProc(ClientData clientData, Tk_Window tkwin); static const Tk_GeomMgr textGeomType = { "text", /* name */ EmbWinRequestProc, /* requestProc */ - EmbWinLostSlaveProc, /* lostSlaveProc */ + EmbWinLostContentProc, /* lostSlaveProc */ }; /* @@ -443,7 +443,7 @@ EmbWinConfigure( break; } if (Tk_TopWinHierarchy(ancestor)) { - badMaster: + badContainer: Tcl_SetObjResult(textPtr->interp, Tcl_ObjPrintf( "can't embed %s in %s", Tk_PathName(ewPtr->body.ew.tkwin), @@ -459,7 +459,7 @@ EmbWinConfigure( } if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin) || (ewPtr->body.ew.tkwin == textPtr->tkwin)) { - goto badMaster; + goto badContainer; } if (client == NULL) { @@ -594,9 +594,9 @@ EmbWinRequestProc( /* *-------------------------------------------------------------- * - * EmbWinLostSlaveProc -- + * EmbWinLostContentProc -- * - * This function is invoked by the Tk geometry manager when a slave + * This function is invoked by the Tk geometry manager when a content * window managed by a text widget is claimed away by another geometry * manager. * @@ -611,7 +611,7 @@ EmbWinRequestProc( */ static void -EmbWinLostSlaveProc( +EmbWinLostContentProc( ClientData clientData, /* Pointer to record describing window item. */ Tk_Window tkwin) /* Window that was claimed away by another * geometry manager. */ @@ -936,12 +936,12 @@ EmbWinLayoutProc( break; } if (Tk_TopWinHierarchy(ancestor)) { - goto badMaster; + goto badContainer; } } if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin) || (textPtr->tkwin == ewPtr->body.ew.tkwin)) { - badMaster: + badContainer: Tcl_SetObjResult(textPtr->interp, Tcl_ObjPrintf( "can't embed %s relative to %s", Tk_PathName(ewPtr->body.ew.tkwin), diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c index 706a871..a7d4a9a 100644 --- a/generic/ttk/ttkBlink.c +++ b/generic/ttk/ttkBlink.c @@ -14,7 +14,7 @@ * Add script-level access to configure application-wide blink rate. */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -57,7 +57,7 @@ static CursorManager *GetCursorManager(Tcl_Interp *interp) cm->owner = 0; cm->onTime = DEF_CURSOR_ON_TIME; cm->offTime = DEF_CURSOR_OFF_TIME; - Tcl_SetAssocData(interp,cm_key,CursorManagerDeleteProc,(ClientData)cm); + Tcl_SetAssocData(interp, cm_key, CursorManagerDeleteProc, cm); } return cm; } diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index 43855b2..f4ef7bc 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -4,8 +4,7 @@ * label, button, checkbutton, radiobutton, and menubutton widgets. */ -#include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" @@ -81,9 +80,9 @@ static Tk_OptionSpec BaseOptionSpecs[] = * Compound base/image options */ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", - NULL, Tk_Offset(Base,base.compoundObj), -1, - TK_OPTION_NULL_OK,(ClientData)ttkCompoundStrings, - GEOMETRY_CHANGED }, + NULL, Tk_Offset(Base,base.compoundObj), -1, + TK_OPTION_NULL_OK, (void *)ttkCompoundStrings, + GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, Tk_Offset(Base,base.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED}, @@ -820,7 +819,7 @@ static Tk_OptionSpec MenubuttonOptionSpecs[] = "", Tk_Offset(Menubutton, menubutton.menuObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction", "below", Tk_Offset(Menubutton, menubutton.directionObj), -1, - 0,(ClientData)directionStrings,GEOMETRY_CHANGED}, + 0, (void *)directionStrings, GEOMETRY_CHANGED}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c index 0ae2372..e7f885f 100644 --- a/generic/ttk/ttkCache.c +++ b/generic/ttk/ttkCache.c @@ -29,7 +29,7 @@ */ #include <stdio.h> /* for sprintf */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" struct Ttk_ResourceCache_ { diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index 41a8f6d..733a391 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -4,7 +4,7 @@ * "clam" theme; inspired by the XFCE family of Gnome themes. */ -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" /* diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 5c95dba..c4469dc 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -5,8 +5,7 @@ * */ -#include <tcl.h> -#include <tk.h> +#include "tkInt.h" #include <string.h> #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index 8a15e5b..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 c396f63..8fa7860 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -5,35 +5,35 @@ */ #include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkManager.h" /*------------------------------------------------------------------------ * +++ The Geometry Propagation Dance. * * When a slave window requests a new size or some other parameter changes, - * the manager recomputes the required size for the master window and calls + * the manager recomputes the required size for the container window and calls * Tk_GeometryRequest(). This is scheduled as an idle handler so multiple * updates can be processed as a single batch. * - * If all goes well, the master's manager will process the request - * (and so on up the chain to the toplevel window), and the master + * If all goes well, the container's manager will process the request + * (and so on up the chain to the toplevel window), and the container * window will eventually receive a <Configure> event. At this point * it recomputes the size and position of all slaves and places them. * - * If all does not go well, however, the master's request may be ignored + * If all does not go well, however, the container's request may be ignored * (typically because the top-level window has a fixed, user-specified size). * Tk doesn't provide any notification when this happens; to account for this, * we also schedule an idle handler to call the layout procedure * after making a geometry request. * - * +++ Slave removal <<NOTE-LOSTSLAVE>>. + * +++ Content window removal <<NOTE-LOSTCONTENT>>. * - * There are three conditions under which a slave is removed: + * There are three conditions under which a content window is removed: * * (1) Another GM claims control * (2) Manager voluntarily relinquishes control - * (3) Slave is destroyed + * (3) Content window is destroyed * * In case (1), Tk calls the manager's lostSlaveProc. * Case (2) is performed by calling Tk_ManageGeometry(slave,NULL,0); @@ -46,24 +46,24 @@ */ 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 master is */ +#define CONTENT_MAPPED 0x1 /* content windows to be mapped when container is */ struct TtkManager_ { Ttk_ManagerSpec *managerSpec; void *managerData; - Tk_Window masterWindow; + Tk_Window containerWindow; unsigned flags; - int nSlaves; - Ttk_Slave **slaves; + int nContent; + Ttk_Content **content; }; /* manager->flags bits: @@ -88,7 +88,7 @@ static void ScheduleUpdate(Ttk_Manager *mgr, unsigned flags) } /* ++ RecomputeSize -- - * Recomputes the required size of the master window, + * Recomputes the required size of the container window, * makes geometry request. */ static void RecomputeSize(Ttk_Manager *mgr) @@ -96,7 +96,7 @@ static void RecomputeSize(Ttk_Manager *mgr) int width = 1, height = 1; if (mgr->managerSpec->RequestedSize(mgr->managerData, &width, &height)) { - Tk_GeometryRequest(mgr->masterWindow, width, height); + Tk_GeometryRequest(mgr->containerWindow, width, height); ScheduleUpdate(mgr, MGR_RELAYOUT_REQUIRED); } mgr->flags &= ~MGR_RESIZE_REQUIRED; @@ -136,8 +136,8 @@ static void ManagerIdleProc(ClientData clientData) */ /* ++ ManagerEventHandler -- - * Recompute slave layout when master widget is resized. - * Keep the slave's map state in sync with the master's. + * Recompute slave layout when container widget is resized. + * Keep the slave's map state in sync with the container's. */ static const int ManagerEventMask = StructureNotifyMask; static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) @@ -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); } /*------------------------------------------------------------------------ @@ -208,19 +208,19 @@ static void DeleteSlave(Ttk_Slave *slave) */ Ttk_Manager *Ttk_CreateManager( - Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow) + Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window containerWindow) { Ttk_Manager *mgr = (Ttk_Manager *)ckalloc(sizeof(*mgr)); mgr->managerSpec = managerSpec; mgr->managerData = managerData; - mgr->masterWindow = masterWindow; - mgr->nSlaves = 0; - mgr->slaves = NULL; + mgr->containerWindow = containerWindow; + mgr->nContent = 0; + mgr->content = NULL; mgr->flags = 0; Tk_CreateEventHandler( - mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr); + mgr->containerWindow, ManagerEventMask, ManagerEventHandler, mgr); return mgr; } @@ -228,13 +228,13 @@ Ttk_Manager *Ttk_CreateManager( void Ttk_DeleteManager(Ttk_Manager *mgr) { Tk_DeleteEventHandler( - mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr); + 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->masterWindow); - 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->masterWindow,x,y,width,height); - slave->flags |= SLAVE_MAPPED; - if (Tk_IsMapped(mgr->masterWindow)) { - Tk_MapWindow(slave->slaveWindow); + 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->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->masterWindow); - 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,77 +406,77 @@ void Ttk_ManagerSizeChanged(Ttk_Manager *mgr) /* +++ Accessors. */ -int Ttk_NumberSlaves(Ttk_Manager *mgr) +int Ttk_NumberContent(Ttk_Manager *mgr) { - return mgr->nSlaves; + return mgr->nContent; } -void *Ttk_SlaveData(Ttk_Manager *mgr, int slaveIndex) +void *Ttk_ContentData(Ttk_Manager *mgr, int index) { - return mgr->slaves[slaveIndex]->slaveData; + return mgr->content[index]->data; } -Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, int slaveIndex) +Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, int index) { - return mgr->slaves[slaveIndex]->slaveWindow; + return mgr->content[index]->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; } /* Try interpreting as a slave window name; */ if ((*string == '.') && - (tkwin = Tk_NameToWindow(interp, string, mgr->masterWindow))) { - slaveIndex = Ttk_SlaveIndex(mgr, tkwin); - if (slaveIndex < 0) { + (tkwin = Tk_NameToWindow(interp, string, mgr->containerWindow))) { + index = Ttk_ContentIndex(mgr, tkwin); + if (index < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s is not managed by %s", string, - Tk_PathName(mgr->masterWindow))); + Tk_PathName(mgr->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: @@ -512,22 +512,22 @@ void Ttk_ReorderSlave(Ttk_Manager *mgr, int fromIndex, int toIndex) ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } -/* ++ Ttk_Maintainable(interp, slave, master) -- - * Utility routine. Verifies that 'master' may be used to maintain +/* ++ Ttk_Maintainable(interp, slave, container) -- + * Utility routine. Verifies that 'container' may be used to maintain * the geometry of 'slave' via Tk_MaintainGeometry: * - * + 'master' is either 'slave's parent -OR- - * + 'master is a descendant of 'slave's parent. + * + 'container' is either 'slave's parent -OR- + * + 'container is a descendant of 'slave's parent. * + 'slave' is not a toplevel window - * + 'slave' belongs to the same toplevel as 'master' + * + 'slave' belongs to the same toplevel as 'container' * * Returns: 1 if OK; otherwise 0, leaving an error message in 'interp'. */ -int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master) +int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window container) { - Tk_Window ancestor = master, parent = Tk_Parent(slave); + Tk_Window ancestor = container, parent = Tk_Parent(slave); - if (Tk_IsTopLevel(slave) || slave == master) { + if (Tk_IsTopLevel(slave) || slave == container) { goto badWindow; } @@ -542,7 +542,7 @@ int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master) badWindow: Tcl_SetObjResult(interp, Tcl_ObjPrintf("can't add %s as slave of %s", - Tk_PathName(slave), Tk_PathName(master))); + Tk_PathName(slave), Tk_PathName(container))); Tcl_SetErrorCode(interp, "TTK", "GEOMETRY", "MAINTAINABLE", NULL); return 0; } diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h index 07fcea1..c4c46ed 100644 --- a/generic/ttk/ttkManager.h +++ b/generic/ttk/ttkManager.h @@ -14,10 +14,10 @@ typedef struct TtkManager_ Ttk_Manager; /* * Geometry manager specification record: * - * RequestedSize computes the requested size of the master window. + * RequestedSize computes the requested size of the container window. * * PlaceSlaves sets the position and size of all managed slaves - * by calling Ttk_PlaceSlave(). + * 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,37 +31,43 @@ typedef struct { /* Manager hooks */ int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr); void (*PlaceSlaves)(void *managerData); - int (*SlaveRequest)(void *managerData, int slaveIndex, int w, int h); - void (*SlaveRemoved)(void *managerData, int slaveIndex); + int (*SlaveRequest)(void *managerData, int index, int w, int h); + void (*SlaveRemoved)(void *managerData, int index); } Ttk_ManagerSpec; /* * Default implementations for Tk_GeomMgr hooks: */ +#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: */ MODULE_SCOPE Ttk_Manager *Ttk_CreateManager( - Ttk_ManagerSpec *, void *managerData, Tk_Window masterWindow); + Ttk_ManagerSpec *, void *managerData, Tk_Window window); MODULE_SCOPE void Ttk_DeleteManager(Ttk_Manager *); -MODULE_SCOPE void Ttk_InsertSlave( - Ttk_Manager *, int position, Tk_Window, void *slaveData); +#define Ttk_InsertContent Ttk_InsertSlave +MODULE_SCOPE void Ttk_InsertContent( + Ttk_Manager *, int position, Tk_Window, void *data); -MODULE_SCOPE void Ttk_ForgetSlave(Ttk_Manager *, int slaveIndex); +#define Ttk_ForgetContent Ttk_ForgetSlave +MODULE_SCOPE void Ttk_ForgetContent(Ttk_Manager *, int index); -MODULE_SCOPE void Ttk_ReorderSlave(Ttk_Manager *, int fromIndex, int toIndex); - /* Rearrange slave positions */ +#define Ttk_ReorderContent Ttk_ReorderSlave +MODULE_SCOPE void Ttk_ReorderContent(Ttk_Manager *, int fromIndex, int toIndex); + /* Rearrange content window positions */ -MODULE_SCOPE void Ttk_PlaceSlave( - Ttk_Manager *, int slaveIndex, int x, int y, int width, int height); - /* Position and map the slave */ +#define Ttk_PlaceContent Ttk_PlaceSlave +MODULE_SCOPE void Ttk_PlaceContent( + Ttk_Manager *, int index, int x, int y, int width, int height); + /* Position and map the content window */ -MODULE_SCOPE void Ttk_UnmapSlave(Ttk_Manager *, int slaveIndex); - /* Unmap the slave */ +#define Ttk_UnmapContent Ttk_UnmapSlave +MODULE_SCOPE void Ttk_UnmapContent(Ttk_Manager *, int index); + /* Unmap the content window */ MODULE_SCOPE void Ttk_ManagerSizeChanged(Ttk_Manager *); MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *); @@ -69,24 +75,29 @@ MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *); /* Utilities: */ -MODULE_SCOPE int Ttk_SlaveIndex(Ttk_Manager *, Tk_Window); +#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 slave, Tk_Window master); - /* Returns: 1 if master can manage slave; 0 otherwise leaving error msg */ +MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window content, Tk_Window container); + /* Returns: 1 if container can manage content; 0 otherwise leaving error msg */ #endif /* _TTKMANAGER */ diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 39ed6aa..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 adc2aef..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) { - pos = pane->sashPos; /* Sentinel value == master window size */ + if (i == Ttk_NumberContent(pw->paned.mgr) - 1) { + pos = pane->sashPos; /* Sentinel value == container window size */ } else { - Pane *nextPane = Ttk_SlaveData(pw->paned.mgr,i+1); + Pane *nextPane = 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" |