diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-03 10:08:01 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-03 10:08:01 (GMT) |
commit | dd934a212b23380896103b0f3a1ff1cccfc8718e (patch) | |
tree | 5e8e276649aa2a40644072cbc0c1b21b069df47b /generic | |
parent | 01d0823e8cde70b183341a77526428c573b8fd09 (diff) | |
parent | 1d475e6af22ce0c572da3b7a8235d8a44a89207d (diff) | |
download | tk-dd934a212b23380896103b0f3a1ff1cccfc8718e.zip tk-dd934a212b23380896103b0f3a1ff1cccfc8718e.tar.gz tk-dd934a212b23380896103b0f3a1ff1cccfc8718e.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkGeometry.c | 68 | ||||
-rw-r--r-- | generic/tkGrid.c | 652 | ||||
-rw-r--r-- | generic/tkImgBmap.c | 224 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 636 | ||||
-rw-r--r-- | generic/tkInt.h | 6 | ||||
-rw-r--r-- | generic/tkPack.c | 326 | ||||
-rw-r--r-- | generic/tkPanedWindow.c | 844 | ||||
-rw-r--r-- | generic/tkPlace.c | 296 | ||||
-rw-r--r-- | generic/tkTextWind.c | 8 | ||||
-rw-r--r-- | generic/ttk/ttkFrame.c | 7 | ||||
-rw-r--r-- | generic/ttk/ttkManager.c | 153 | ||||
-rw-r--r-- | generic/ttk/ttkManager.h | 14 | ||||
-rw-r--r-- | generic/ttk/ttkPanedwindow.c | 4 |
13 files changed, 1613 insertions, 1625 deletions
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 30a57a9..2998dda 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -418,7 +418,7 @@ Tk_MaintainGeometry( int width, int height) /* Desired dimensions for slave. */ { Tcl_HashEntry *hPtr; - MaintainMaster *masterPtr; + MaintainMaster *containerPtr; MaintainSlave *slavePtr; int isNew, map; Tk_Window ancestor, parent; @@ -463,13 +463,13 @@ Tk_MaintainGeometry( hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable, (char *) master, &isNew); if (!isNew) { - masterPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr); + containerPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr); } else { - masterPtr = (MaintainMaster *)ckalloc(sizeof(MaintainMaster)); - masterPtr->ancestor = master; - masterPtr->checkScheduled = 0; - masterPtr->slavePtr = NULL; - Tcl_SetHashValue(hPtr, masterPtr); + containerPtr = (MaintainMaster *)ckalloc(sizeof(MaintainMaster)); + containerPtr->ancestor = master; + containerPtr->checkScheduled = 0; + containerPtr->slavePtr = NULL; + Tcl_SetHashValue(hPtr, containerPtr); } /* @@ -477,7 +477,7 @@ Tk_MaintainGeometry( * one. */ - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { if (slavePtr->slave == slave) { goto gotSlave; @@ -486,8 +486,8 @@ Tk_MaintainGeometry( slavePtr = (MaintainSlave *)ckalloc(sizeof(MaintainSlave)); slavePtr->slave = slave; slavePtr->master = master; - slavePtr->nextPtr = masterPtr->slavePtr; - masterPtr->slavePtr = slavePtr; + slavePtr->nextPtr = containerPtr->slavePtr; + containerPtr->slavePtr = slavePtr; Tk_CreateEventHandler(slave, StructureNotifyMask, MaintainSlaveProc, slavePtr); @@ -495,15 +495,15 @@ Tk_MaintainGeometry( * Make sure that there are event handlers registered for all the windows * between master and slave's parent (including master but not slave's * parent). There may already be handlers for master and some of its - * ancestors (masterPtr->ancestor tells how many). + * ancestors (containerPtr->ancestor tells how many). */ for (ancestor = master; ancestor != parent; ancestor = Tk_Parent(ancestor)) { - if (ancestor == masterPtr->ancestor) { + if (ancestor == containerPtr->ancestor) { Tk_CreateEventHandler(ancestor, StructureNotifyMask, - MaintainMasterProc, masterPtr); - masterPtr->ancestor = Tk_Parent(ancestor); + MaintainMasterProc, containerPtr); + containerPtr->ancestor = Tk_Parent(ancestor); } } @@ -567,7 +567,7 @@ Tk_UnmaintainGeometry( * slave's parent. */ { Tcl_HashEntry *hPtr; - MaintainMaster *masterPtr; + MaintainMaster *containerPtr; MaintainSlave *slavePtr, *prevPtr; Tk_Window ancestor; TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr; @@ -596,10 +596,10 @@ Tk_UnmaintainGeometry( if (hPtr == NULL) { return; } - masterPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr); - slavePtr = masterPtr->slavePtr; + containerPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr); + slavePtr = containerPtr->slavePtr; if (slavePtr->slave == slave) { - masterPtr->slavePtr = slavePtr->nextPtr; + containerPtr->slavePtr = slavePtr->nextPtr; } else { for (prevPtr = slavePtr, slavePtr = slavePtr->nextPtr; ; prevPtr = slavePtr, slavePtr = slavePtr->nextPtr) { @@ -615,21 +615,21 @@ Tk_UnmaintainGeometry( Tk_DeleteEventHandler(slavePtr->slave, StructureNotifyMask, MaintainSlaveProc, slavePtr); ckfree(slavePtr); - if (masterPtr->slavePtr == NULL) { - if (masterPtr->ancestor != NULL) { + if (containerPtr->slavePtr == NULL) { + if (containerPtr->ancestor != NULL) { for (ancestor = master; ; ancestor = Tk_Parent(ancestor)) { Tk_DeleteEventHandler(ancestor, StructureNotifyMask, - MaintainMasterProc, masterPtr); - if (ancestor == masterPtr->ancestor) { + MaintainMasterProc, containerPtr); + if (ancestor == containerPtr->ancestor) { break; } } } - if (masterPtr->checkScheduled) { - Tcl_CancelIdleCall(MaintainCheckProc, masterPtr); + if (containerPtr->checkScheduled) { + Tcl_CancelIdleCall(MaintainCheckProc, containerPtr); } Tcl_DeleteHashEntry(hPtr); - ckfree(masterPtr); + ckfree(containerPtr); } } @@ -660,27 +660,27 @@ MaintainMasterProc( * master window. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainMaster *masterPtr = (MaintainMaster *)clientData; + MaintainMaster *containerPtr = (MaintainMaster *)clientData; MaintainSlave *slavePtr; int done; if ((eventPtr->type == ConfigureNotify) || (eventPtr->type == MapNotify) || (eventPtr->type == UnmapNotify)) { - if (!masterPtr->checkScheduled) { - masterPtr->checkScheduled = 1; - Tcl_DoWhenIdle(MaintainCheckProc, masterPtr); + if (!containerPtr->checkScheduled) { + containerPtr->checkScheduled = 1; + Tcl_DoWhenIdle(MaintainCheckProc, containerPtr); } } else if (eventPtr->type == DestroyNotify) { /* * Delete all of the state associated with this master, but be careful - * not to use masterPtr after the last slave is deleted, since its + * not to use containerPtr after the last slave is deleted, since its * memory will have been freed. */ done = 0; do { - slavePtr = masterPtr->slavePtr; + slavePtr = containerPtr->slavePtr; if (slavePtr->nextPtr == NULL) { done = 1; } @@ -746,13 +746,13 @@ MaintainCheckProc( ClientData clientData) /* Pointer to MaintainMaster structure for the * master window. */ { - MaintainMaster *masterPtr = (MaintainMaster *)clientData; + MaintainMaster *containerPtr = (MaintainMaster *)clientData; MaintainSlave *slavePtr; Tk_Window ancestor, parent; int x, y, map; - masterPtr->checkScheduled = 0; - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; + containerPtr->checkScheduled = 0; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { parent = Tk_Parent(slavePtr->slave); x = slavePtr->x; diff --git a/generic/tkGrid.c b/generic/tkGrid.c index eac98cb..c79e269 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. */ @@ -124,7 +124,7 @@ typedef struct GridLayout { } GridLayout; /* - * Keep one of these for each geometry master. + * Keep one of these for each geometry container. */ typedef struct { @@ -139,9 +139,9 @@ typedef struct { 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; @@ -157,15 +157,15 @@ 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; /* Master 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. */ + GridMaster *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. @@ -185,7 +185,7 @@ 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 @@ -238,16 +238,16 @@ typedef struct UniformGroup { * been made to re-arrange all the slaves 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. + * 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: @@ -258,7 +258,7 @@ static void AdjustForSticky(Gridder *slavePtr, int *xPtr, 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, int objc, Tcl_Obj *const objv[]); @@ -284,14 +284,14 @@ 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, Tk_Window tkwin); static void GridReqProc(ClientData clientData, Tk_Window tkwin); -static void InitMasterData(Gridder *masterPtr); +static void InitMasterData(Gridder *containerPtr); static Tcl_Obj * NewPairObj(Tcl_WideInt, Tcl_WideInt); static Tcl_Obj * NewQuadObj(Tcl_WideInt, Tcl_WideInt, Tcl_WideInt, Tcl_WideInt); static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn, @@ -386,15 +386,15 @@ Tk_GridObjCmd( return GridSizeCommand(tkwin, interp, objc, objv); case GRID_CONTENT: case GRID_SLAVES: - return GridSlavesCommand(tkwin, interp, objc, objv); + return GridContentCommand(tkwin, interp, objc, objv); /* * Sample argument combinations: - * grid columnconfigure <master> <index> -option - * grid columnconfigure <master> <index> -option value -option value - * grid rowconfigure <master> <index> - * grid rowconfigure <master> <index> -option - * grid rowconfigure <master> <index> -option value -option value. + * grid columnconfigure <container> <index> -option + * grid columnconfigure <container> <index> -option value -option value + * grid rowconfigure <container> <index> + * grid rowconfigure <container> <index> -option + * grid rowconfigure <container> <index> -option value -option value. */ case GRID_COLUMNCONFIGURE: @@ -432,8 +432,8 @@ GridAnchorCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; + Tk_Window container; + Gridder *containerPtr; GridMaster *gridPtr; Tk_Anchor old; @@ -442,21 +442,21 @@ GridAnchorCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); if (objc == 3) { - gridPtr = masterPtr->masterDataPtr; + gridPtr = containerPtr->containerDataPtr; Tcl_SetObjResult(interp, Tcl_NewStringObj( Tk_NameOfAnchor(gridPtr?gridPtr->anchor:GRID_DEFAULT_ANCHOR), -1)); return TCL_OK; } - InitMasterData(masterPtr); - gridPtr = masterPtr->masterDataPtr; + InitMasterData(containerPtr); + gridPtr = containerPtr->containerDataPtr; old = gridPtr->anchor; if (Tk_GetAnchorFromObj(interp, objv[3], &gridPtr->anchor) != TCL_OK) { return TCL_ERROR; @@ -467,12 +467,12 @@ GridAnchorCommand( */ if (old != gridPtr->anchor) { - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } } return TCL_OK; @@ -501,8 +501,8 @@ GridBboxCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; /* master grid record */ + Tk_Window container; + Gridder *containerPtr; /* container grid record */ GridMaster *gridPtr; /* pointer to grid data */ int row, column; /* origin for bounding box */ int row2, column2; /* end of bounding box */ @@ -511,14 +511,14 @@ GridBboxCommand( int width, height; /* size of the bounding box */ if (objc!=3 && objc != 5 && objc != 7) { - Tcl_WrongNumArgs(interp, 2, objv, "master ?column row ?column row??"); + Tcl_WrongNumArgs(interp, 2, objv, "window ?column row ?column row??"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); if (objc >= 5) { if (Tcl_GetIntFromObj(interp, objv[3], &column) != TCL_OK) { @@ -540,13 +540,13 @@ GridBboxCommand( } } - gridPtr = masterPtr->masterDataPtr; + gridPtr = containerPtr->containerDataPtr; if (gridPtr == NULL) { Tcl_SetObjResult(interp, NewQuadObj(0, 0, 0, 0)); return TCL_OK; } - SetGridSize(masterPtr); + SetGridSize(containerPtr); endX = MAX(gridPtr->columnEnd, gridPtr->columnMax); endY = MAX(gridPtr->rowEnd, gridPtr->rowMax); @@ -643,7 +643,7 @@ GridForgetRemoveCommand( } slavePtr = GetGrid(slave); - if (slavePtr->masterPtr != NULL) { + if (slavePtr->containerPtr != NULL) { /* * For "forget", reset all the settings to their defaults */ @@ -671,24 +671,24 @@ GridForgetRemoveCommand( slavePtr->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 (slavePtr->masterPtr != NULL) { + if (slavePtr->containerPtr != NULL) { slavePtr->in = Tcl_NewStringObj( - Tk_PathName(slavePtr->masterPtr->tkwin), -1); + Tk_PathName(slavePtr->containerPtr->tkwin), -1); Tcl_IncrRefCount(slavePtr->in); } } Tk_ManageGeometry(slave, NULL, NULL); - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { + if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->masterPtr->tkwin); + slavePtr->containerPtr->tkwin); } Unlink(slavePtr); Tk_UnmapWindow(slavePtr->tkwin); @@ -733,14 +733,14 @@ GridInfoCommand( return TCL_ERROR; } slavePtr = GetGrid(slave); - if (slavePtr->masterPtr == NULL) { + if (slavePtr->containerPtr == NULL) { Tcl_ResetResult(interp); return TCL_OK; } infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), - Tk_NewWindowObj(slavePtr->masterPtr->tkwin)); + Tk_NewWindowObj(slavePtr->containerPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1), Tcl_NewWideIntObj(slavePtr->column)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1), @@ -783,36 +783,36 @@ GridLocationCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; /* Master grid record. */ + Tk_Window container; + Gridder *containerPtr; /* Master grid record. */ GridMaster *gridPtr; /* Pointer to grid data. */ SlotInfo *slotPtr; - int x, y; /* Offset in pixels, from edge of master. */ + int x, y; /* Offset in pixels, from edge of container. */ int i, j; /* Corresponding column and row indeces. */ int endX, endY; /* End of grid. */ if (objc != 5) { - Tcl_WrongNumArgs(interp, 2, objv, "master x y"); + Tcl_WrongNumArgs(interp, 2, objv, "window x y"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - if (Tk_GetPixelsFromObj(interp, master, objv[3], &x) != TCL_OK) { + if (Tk_GetPixelsFromObj(interp, container, objv[3], &x) != TCL_OK) { return TCL_ERROR; } - if (Tk_GetPixelsFromObj(interp, master, objv[4], &y) != TCL_OK) { + if (Tk_GetPixelsFromObj(interp, container, objv[4], &y) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); - if (masterPtr->masterDataPtr == NULL) { + containerPtr = GetGrid(container); + if (containerPtr->containerDataPtr == NULL) { Tcl_SetObjResult(interp, NewPairObj(-1, -1)); return TCL_OK; } - gridPtr = masterPtr->masterDataPtr; + gridPtr = containerPtr->containerDataPtr; /* * Update any pending requests. This is not always the steady state value, @@ -820,29 +820,29 @@ GridLocationCommand( * its easy to get. */ - while (masterPtr->flags & REQUESTED_RELAYOUT) { - Tcl_CancelIdleCall(ArrangeGrid, masterPtr); - ArrangeGrid(masterPtr); + while (containerPtr->flags & REQUESTED_RELAYOUT) { + Tcl_CancelIdleCall(ArrangeGrid, containerPtr); + ArrangeGrid(containerPtr); } - SetGridSize(masterPtr); + SetGridSize(containerPtr); endX = MAX(gridPtr->columnEnd, gridPtr->columnMax); endY = MAX(gridPtr->rowEnd, gridPtr->rowMax); - slotPtr = masterPtr->masterDataPtr->columnPtr; - if (x < masterPtr->masterDataPtr->startX) { + slotPtr = containerPtr->containerDataPtr->columnPtr; + if (x < containerPtr->containerDataPtr->startX) { i = -1; } else { - x -= masterPtr->masterDataPtr->startX; + x -= containerPtr->containerDataPtr->startX; for (i = 0; slotPtr[i].offset < x && i < endX; i++) { /* null body */ } } - slotPtr = masterPtr->masterDataPtr->rowPtr; - if (y < masterPtr->masterDataPtr->startY) { + slotPtr = containerPtr->containerDataPtr->rowPtr; + if (y < containerPtr->containerDataPtr->startY) { j = -1; } else { - y -= masterPtr->masterDataPtr->startY; + y -= containerPtr->containerDataPtr->startY; for (j = 0; slotPtr[j].offset < y && j < endY; j++) { /* null body */ } @@ -876,8 +876,8 @@ GridPropagateCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; + Tk_Window container; + Gridder *containerPtr; int propagate, old; if (objc > 4) { @@ -885,13 +885,13 @@ GridPropagateCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); if (objc == 3) { Tcl_SetObjResult(interp, - Tcl_NewBooleanObj(!(masterPtr->flags & DONT_PROPAGATE))); + Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE))); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) { @@ -902,39 +902,39 @@ GridPropagateCommand( * Only request a relayout if the propagation bit changes. */ - old = !(masterPtr->flags & DONT_PROPAGATE); + old = !(containerPtr->flags & DONT_PROPAGATE); if (propagate != old) { if (propagate) { /* - * If we have slaves, we need to register as geometry master. + * If we have slaves, we need to register as geometry container. */ - if (masterPtr->slavePtr != NULL) { - if (TkSetGeometryMaster(interp, master, "grid") != TCL_OK) { + if (containerPtr->slavePtr != NULL) { + if (TkSetGeometryMaster(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) { + TkFreeGeometryMaster(container, "grid"); + containerPtr->flags &= ~ALLOCED_CONTAINER; } - masterPtr->flags |= DONT_PROPAGATE; + containerPtr->flags |= DONT_PROPAGATE; } /* - * Re-arrange the master to allow new geometry information to - * propagate upwards to the master's master. + * Re-arrange the container to allow new geometry information to + * propagate upwards to the container's container. */ - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } } return TCL_OK; @@ -964,8 +964,8 @@ GridRowColumnConfigureCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master, slave; - Gridder *masterPtr, *slavePtr; + Tk_Window container, slave; + Gridder *containerPtr, *slavePtr; SlotInfo *slotPtr = NULL; int slot; /* the column or row number */ int slotType; /* COLUMN or ROW */ @@ -985,11 +985,11 @@ GridRowColumnConfigureCommand( Tcl_Obj *listCopy; if (((objc % 2 != 0) && (objc > 6)) || (objc < 4)) { - Tcl_WrongNumArgs(interp, 2, objv, "master index ?-option value ...?"); + Tcl_WrongNumArgs(interp, 2, objv, "window index ?-option value ...?"); return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } @@ -1010,7 +1010,7 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); first = 0; last = 0; @@ -1030,11 +1030,11 @@ GridRowColumnConfigureCommand( Tcl_DecrRefCount(listCopy); return TCL_ERROR; } - ok = CheckSlotData(masterPtr, slot, slotType, /* checkOnly */ 1); + ok = CheckSlotData(containerPtr, slot, slotType, /* checkOnly */ 1); if (ok == TCL_OK) { slotPtr = (slotType == COLUMN) ? - masterPtr->masterDataPtr->columnPtr : - masterPtr->masterDataPtr->rowPtr; + containerPtr->containerDataPtr->columnPtr : + containerPtr->containerDataPtr->rowPtr; } /* @@ -1110,12 +1110,12 @@ GridRowColumnConfigureCommand( slavePtr = NULL; } else if (strcmp(Tcl_GetString(lObjv[j]), "all") == 0) { /* - * Make sure master is initialised. + * Make sure container is initialised. */ - InitMasterData(masterPtr); + InitMasterData(containerPtr); - slavePtr = masterPtr->slavePtr; + slavePtr = containerPtr->slavePtr; if (slavePtr == NULL) { continue; } @@ -1123,15 +1123,15 @@ GridRowColumnConfigureCommand( } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &slave) == TCL_OK) { /* - * Is it gridded in this master? + * Is it gridded in this container? */ slavePtr = GetGrid(slave); - if (slavePtr->masterPtr != masterPtr) { + if (slavePtr->containerPtr != containerPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the window \"%s\" is not managed by \"%s\"", Tcl_GetString(lObjv[j]), Tcl_GetString(objv[2]))); - Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MASTER", NULL); + Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MANAGED", NULL); Tcl_DecrRefCount(listCopy); return TCL_ERROR; } @@ -1156,7 +1156,7 @@ GridRowColumnConfigureCommand( } for (slot = first; slot <= last; slot++) { - ok = CheckSlotData(masterPtr, slot, slotType, /*checkOnly*/ 0); + ok = CheckSlotData(containerPtr, slot, slotType, /*checkOnly*/ 0); if (ok != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "\"%s\" is out of range", @@ -1167,8 +1167,8 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } slotPtr = (slotType == COLUMN) ? - masterPtr->masterDataPtr->columnPtr : - masterPtr->masterDataPtr->rowPtr; + containerPtr->containerDataPtr->columnPtr : + containerPtr->containerDataPtr->rowPtr; /* * Loop through each option value pair, setting the values as @@ -1182,7 +1182,7 @@ GridRowColumnConfigureCommand( return TCL_ERROR; } if (index == ROWCOL_MINSIZE) { - if (Tk_GetPixelsFromObj(interp, master, objv[i+1], + if (Tk_GetPixelsFromObj(interp, container, objv[i+1], &size) != TCL_OK) { Tcl_DecrRefCount(listCopy); return TCL_ERROR; @@ -1209,7 +1209,7 @@ GridRowColumnConfigureCommand( slotPtr[slot].uniform = NULL; } } else if (index == ROWCOL_PAD) { - if (Tk_GetPixelsFromObj(interp, master, objv[i+1], + if (Tk_GetPixelsFromObj(interp, container, objv[i+1], &size) != TCL_OK) { Tcl_DecrRefCount(listCopy); return TCL_ERROR; @@ -1236,32 +1236,32 @@ GridRowColumnConfigureCommand( if (slotPtr != NULL) { if (slotType == ROW) { - int last = masterPtr->masterDataPtr->rowMax - 1; + int last = containerPtr->containerDataPtr->rowMax - 1; while ((last >= 0) && (slotPtr[last].weight == 0) && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0) && (slotPtr[last].uniform == NULL)) { last--; } - masterPtr->masterDataPtr->rowMax = last+1; + containerPtr->containerDataPtr->rowMax = last+1; } else { - int last = masterPtr->masterDataPtr->columnMax - 1; + int last = containerPtr->containerDataPtr->columnMax - 1; while ((last >= 0) && (slotPtr[last].weight == 0) && (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0) && (slotPtr[last].uniform == NULL)) { last--; } - masterPtr->masterDataPtr->columnMax = last + 1; + containerPtr->containerDataPtr->columnMax = last + 1; } } - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { - masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, masterPtr); + if (!(containerPtr->flags & REQUESTED_RELAYOUT)) { + containerPtr->flags |= REQUESTED_RELAYOUT; + Tcl_DoWhenIdle(ArrangeGrid, containerPtr); } return TCL_OK; @@ -1297,8 +1297,8 @@ GridSizeCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; + Tk_Window container; + Gridder *containerPtr; GridMaster *gridPtr; /* pointer to grid data */ if (objc != 3) { @@ -1306,14 +1306,14 @@ GridSizeCommand( return TCL_ERROR; } - if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { + if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(master); + containerPtr = GetGrid(container); - if (masterPtr->masterDataPtr != NULL) { - SetGridSize(masterPtr); - gridPtr = masterPtr->masterDataPtr; + if (containerPtr->containerDataPtr != NULL) { + SetGridSize(containerPtr); + gridPtr = containerPtr->containerDataPtr; Tcl_SetObjResult(interp, NewPairObj( MAX(gridPtr->columnEnd, gridPtr->columnMax), MAX(gridPtr->rowEnd, gridPtr->rowMax))); @@ -1326,37 +1326,37 @@ GridSizeCommand( /* *---------------------------------------------------------------------- * - * GridSlavesCommand -- + * GridContentCommand -- * - * Implementation of the [grid slaves] subcommand. See the user + * Implementation of the [grid content] subcommand. See the user * documentation for details on what it does. * * Results: * Standard Tcl result. * * Side effects: - * Places a list of slaves of the specified window in the interpreter's - * result field. + * Places a list of content windows of the specified window in the + * interpreter's result field. * *---------------------------------------------------------------------- */ static int -GridSlavesCommand( +GridContentCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window master; - Gridder *masterPtr; /* master grid record */ + Tk_Window container; + Gridder *containerPtr; /* container grid record */ Gridder *slavePtr; int i, value, index; int row = -1, column = -1; static const char *const optionStrings[] = { "-column", "-row", NULL }; - enum options { SLAVES_COLUMN, SLAVES_ROW }; + enum options { CONTENT_COLUMN, CONTENT_ROW }; Tcl_Obj *res; if ((objc < 3) || ((objc % 2) == 0)) { @@ -1378,20 +1378,20 @@ 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; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { if ((column >= 0) && (slavePtr->column > column || slavePtr->column+slavePtr->numCols-1 < column)) { @@ -1435,7 +1435,7 @@ GridReqProc( Gridder *gridPtr = (Gridder *)clientData; (void)tkwin; - gridPtr = gridPtr->masterPtr; + gridPtr = gridPtr->containerPtr; if (gridPtr && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr); @@ -1468,8 +1468,8 @@ GridLostSlaveProc( Gridder *slavePtr = (Gridder *)clientData; (void)tkwin; - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { + Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); } Unlink(slavePtr); Tk_UnmapWindow(slavePtr->tkwin); @@ -1714,25 +1714,25 @@ AdjustForSticky( * None. * * Side effects: - * The slaves of masterPtr may get resized or moved. + * The slaves of containerPtr may get resized or moved. * *---------------------------------------------------------------------- */ static void ArrangeGrid( - ClientData clientData) /* Structure describing master whose slaves + ClientData clientData) /* Structure describing container whose slaves * are to be re-layed out. */ { - Gridder *masterPtr = (Gridder *)clientData; + Gridder *containerPtr = (Gridder *)clientData; Gridder *slavePtr; - GridMaster *slotPtr = masterPtr->masterDataPtr; + GridMaster *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 change the master size. @@ -1740,11 +1740,11 @@ ArrangeGrid( * so another geometry manager can take over. */ - if (masterPtr->slavePtr == NULL) { + if (containerPtr->slavePtr == NULL) { return; } - if (masterPtr->masterDataPtr == NULL) { + if (containerPtr->containerDataPtr == NULL) { return; } @@ -1754,63 +1754,63 @@ 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); /* @@ -1818,7 +1818,7 @@ ArrangeGrid( * cavity size, and adjusting the widget according to its stickyness. */ - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL && !abort; slavePtr = slavePtr->nextPtr) { int x, y; /* Top left coordinate */ int width, height; /* Slot or slave size */ @@ -1838,11 +1838,11 @@ ArrangeGrid( /* * 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 slave 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(slavePtr->tkwin)) { if ((width <= 0) || (height <= 0)) { Tk_UnmapWindow(slavePtr->tkwin); } else { @@ -1857,25 +1857,25 @@ ArrangeGrid( } /* - * Don't map the slave if the master isn't mapped: wait until - * the master gets mapped later. + * Don't map the slave if the container isn't mapped: wait until + * the container gets mapped later. */ - if (Tk_IsMapped(masterPtr->tkwin)) { + if (Tk_IsMapped(containerPtr->tkwin)) { Tk_MapWindow(slavePtr->tkwin); } } } else if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin); + Tk_UnmaintainGeometry(slavePtr->tkwin, containerPtr->tkwin); Tk_UnmapWindow(slavePtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, x, y, + Tk_MaintainGeometry(slavePtr->tkwin, containerPtr->tkwin, x, y, width, height); } } - masterPtr->abortPtr = NULL; - Tcl_Release(masterPtr); + containerPtr->abortPtr = NULL; + Tcl_Release(containerPtr); } /* @@ -1893,14 +1893,14 @@ 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). */ @@ -1943,13 +1943,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; } /* @@ -2011,7 +2011,7 @@ ResolveConstraints( switch (slotType) { case COLUMN: - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { int rightEdge = slavePtr->column + slavePtr->numCols - 1; @@ -2030,7 +2030,7 @@ ResolveConstraints( } break; case ROW: - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { int rightEdge = slavePtr->row + slavePtr->numRows - 1; @@ -2151,7 +2151,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. */ @@ -2386,7 +2386,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++) { @@ -2445,8 +2445,8 @@ GetGrid( } 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->binNextPtr = NULL; @@ -2468,7 +2468,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); @@ -2486,7 +2486,7 @@ GetGrid( * 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. * @@ -2495,20 +2495,20 @@ GetGrid( static void SetGridSize( - Gridder *masterPtr) /* The geometry master for this grid. */ + Gridder *containerPtr) /* The geometry container for this grid. */ { Gridder *slavePtr; /* Current slave window. */ int maxX = 0, maxY = 0; - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { maxX = MAX(maxX, slavePtr->numCols + slavePtr->column); maxY = MAX(maxY, slavePtr->numRows + slavePtr->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); } /* @@ -2605,7 +2605,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. @@ -2615,7 +2615,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. */ @@ -2631,7 +2631,7 @@ CheckSlotData( return TCL_ERROR; } - if ((checkOnly == CHECK_ONLY) && (masterPtr->masterDataPtr == NULL)) { + if ((checkOnly == CHECK_ONLY) && (containerPtr->containerDataPtr == NULL)) { return TCL_ERROR; } @@ -2641,39 +2641,39 @@ CheckSlotData( * of the offsets as well. */ - InitMasterData(masterPtr); - end = (slotType == ROW) ? masterPtr->masterDataPtr->rowMax : - masterPtr->masterDataPtr->columnMax; + InitMasterData(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 = (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; @@ -2686,13 +2686,13 @@ CheckSlotData( * InitMasterData -- * * 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. * *---------------------------------------------------------------------- @@ -2700,10 +2700,10 @@ CheckSlotData( static void InitMasterData( - Gridder *masterPtr) + Gridder *containerPtr) { - if (masterPtr->masterDataPtr == NULL) { - GridMaster *gridPtr = masterPtr->masterDataPtr = (GridMaster *) + if (containerPtr->containerDataPtr == NULL) { + GridMaster *gridPtr = containerPtr->containerDataPtr = (GridMaster *) ckalloc(sizeof(GridMaster)); size_t size = sizeof(SlotInfo) * TYPICAL_SIZE; @@ -2729,13 +2729,13 @@ InitMasterData( * * Unlink -- * - * Remove a grid from its master's list of slaves. + * Remove a grid from its container's list of slaves. * * 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 * *---------------------------------------------------------------------- @@ -2745,17 +2745,17 @@ static void Unlink( Gridder *slavePtr) /* Window to unlink. */ { - Gridder *masterPtr, *slavePtr2; + Gridder *containerPtr, *slavePtr2; - masterPtr = slavePtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = slavePtr->containerPtr; + if (containerPtr == NULL) { return; } - if (masterPtr->slavePtr == slavePtr) { - masterPtr->slavePtr = slavePtr->nextPtr; + if (containerPtr->slavePtr == slavePtr) { + containerPtr->slavePtr = slavePtr->nextPtr; } else { - for (slavePtr2=masterPtr->slavePtr ; ; slavePtr2=slavePtr2->nextPtr) { + for (slavePtr2=containerPtr->slavePtr ; ; slavePtr2=slavePtr2->nextPtr) { if (slavePtr2 == NULL) { Tcl_Panic("Unlink couldn't find previous window"); } @@ -2765,29 +2765,29 @@ Unlink( } } } - 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(slavePtr->containerPtr); + slavePtr->containerPtr = NULL; /* - * If we have emptied this master from slaves it means we are no longer + * If we have emptied this container from slaves it means we are no longer * handling it and should mark it as free. * * Send the event "NoManagedChild" to the master to inform it about there * being no managed children inside it. */ - if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { - TkFreeGeometryMaster(masterPtr->tkwin, "grid"); - masterPtr->flags &= ~ALLOCED_MASTER; - Tk_SendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); + if ((containerPtr->slavePtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { + TkFreeGeometryMaster(containerPtr->tkwin, "grid"); + containerPtr->flags &= ~ALLOCED_CONTAINER; + Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL); } } @@ -2799,7 +2799,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: @@ -2817,14 +2817,14 @@ DestroyGrid( { 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); @@ -2865,25 +2865,25 @@ GridStructureProc( 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) { Gridder *slavePtr, *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; + slavePtr->containerPtr = NULL; nextPtr = slavePtr->nextPtr; slavePtr->nextPtr = NULL; } @@ -2941,10 +2941,10 @@ ConfigureSlaves( * "option value" pairs. Caller must make sure * that there is at least one window name. */ { - Gridder *masterPtr = NULL; + Gridder *containerPtr = NULL; Gridder *slavePtr; Tk_Window other, slave, parent, ancestor; - TkWindow *master; + TkWindow *container; int i, j, tmp; int numWindows; int width; @@ -2987,27 +2987,27 @@ ConfigureSlaves( if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) { return TCL_ERROR; } - if (masterPtr == NULL) { + if (containerPtr == NULL) { /* * Is there any saved -in from a removed slave? * 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) == TCL_OK) { - masterPtr = GetGrid(parent); - InitMasterData(masterPtr); + containerPtr = GetGrid(parent); + InitMasterData(containerPtr); } } } - if (masterPtr == NULL) { + if (containerPtr == NULL) { parent = Tk_Parent(slave); if (parent != NULL) { - masterPtr = GetGrid(parent); - InitMasterData(masterPtr); + containerPtr = GetGrid(parent); + InitMasterData(containerPtr); } } numWindows++; @@ -3075,8 +3075,8 @@ ConfigureSlaves( TCL_OK) { return TCL_ERROR; } - masterPtr = GetGrid(other); - InitMasterData(masterPtr); + containerPtr = GetGrid(other); + InitMasterData(containerPtr); } else if (index == CONF_ROW) { if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK || tmp < 0) { @@ -3092,13 +3092,13 @@ 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; } @@ -3211,8 +3211,8 @@ ConfigureSlaves( return TCL_ERROR; } positionGiven = 1; - masterPtr = GetGrid(other); - InitMasterData(masterPtr); + containerPtr = GetGrid(other); + InitMasterData(containerPtr); break; case CONF_STICKY: { int sticky = StringToSticky(Tcl_GetString(objv[i+1])); @@ -3296,8 +3296,8 @@ ConfigureSlaves( * packed, then leave it in its current location. */ - if (!positionGiven && (slavePtr->masterPtr != NULL)) { - masterPtr = slavePtr->masterPtr; + if (!positionGiven && (slavePtr->containerPtr != NULL)) { + containerPtr = slavePtr->containerPtr; goto scheduleLayout; } @@ -3306,52 +3306,52 @@ ConfigureSlaves( * its current location. */ - if (positionGiven && (masterPtr == slavePtr->masterPtr)) { + if (positionGiven && (containerPtr == slavePtr->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. */ parent = Tk_Parent(slave); - if (masterPtr == NULL) { - masterPtr = GetGrid(parent); - InitMasterData(masterPtr); + if (containerPtr == NULL) { + containerPtr = GetGrid(parent); + InitMasterData(containerPtr); } - if (slavePtr->masterPtr != NULL && slavePtr->masterPtr != masterPtr) { - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (slavePtr->containerPtr != NULL && slavePtr->containerPtr != containerPtr) { + if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { + Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); } Unlink(slavePtr); - slavePtr->masterPtr = NULL; + slavePtr->containerPtr = NULL; } - if (slavePtr->masterPtr == NULL) { - Gridder *tempPtr = masterPtr->slavePtr; + if (slavePtr->containerPtr == NULL) { + Gridder *tempPtr = containerPtr->slavePtr; - slavePtr->masterPtr = masterPtr; - masterPtr->slavePtr = slavePtr; + slavePtr->containerPtr = containerPtr; + containerPtr->slavePtr = slavePtr; slavePtr->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 slave's parent is either the container or an + * ancestor of the container, and that the container and slave 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); return TCL_ERROR; @@ -3362,31 +3362,31 @@ 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 *)slave) { 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); return TCL_ERROR; } } - if (masterPtr->tkwin != Tk_Parent(slave)) { - ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin; + if (containerPtr->tkwin != Tk_Parent(slave)) { + ((TkWindow *)slave)->maintainerPtr = (TkWindow *)containerPtr->tkwin; } Tk_ManageGeometry(slave, &gridMgrType, slavePtr); - if (!(masterPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryMaster(interp, masterPtr->tkwin, "grid") + if (!(containerPtr->flags & DONT_PROPAGATE)) { + if (TkSetGeometryMaster(interp, containerPtr->tkwin, "grid") != TCL_OK) { Tk_ManageGeometry(slave, NULL, NULL); Unlink(slavePtr); return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } /* @@ -3411,16 +3411,16 @@ ConfigureSlaves( 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); } } @@ -3449,7 +3449,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); @@ -3485,7 +3485,7 @@ ConfigureSlaves( lastColumn += numSkip; match = 0; - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { if (slavePtr->column == lastColumn @@ -3511,26 +3511,26 @@ 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 slaves it means we are no longer * handling it and should mark it as free. * * Send the event "NoManagedChild" to the master to inform it about there * being no managed children inside it. */ - if (masterPtr->slavePtr == NULL && masterPtr->flags & ALLOCED_MASTER) { - TkFreeGeometryMaster(masterPtr->tkwin, "grid"); - masterPtr->flags &= ~ALLOCED_MASTER; - Tk_SendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); + if (containerPtr->slavePtr == NULL && containerPtr->flags & ALLOCED_CONTAINER) { + TkFreeGeometryMaster(containerPtr->tkwin, "grid"); + containerPtr->flags &= ~ALLOCED_CONTAINER; + Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL); } return TCL_OK; diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index a43d2b7..d48ad6a 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -51,7 +51,7 @@ typedef struct BitmapMaster { typedef struct BitmapInstance { size_t refCount; /* Number of instances that share this data * structure. */ - BitmapMaster *masterPtr; /* Pointer to master for image. */ + BitmapMaster *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; @@ -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 ImgBmapConfigureMaster(BitmapMaster *modelPtr, int argc, Tcl_Obj *const objv[], int flags); static int NextBitmapWord(ParseInfo *parseInfoPtr); @@ -183,28 +183,28 @@ ImgBmapCreate( ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - BitmapMaster *masterPtr = (BitmapMaster *)ckalloc(sizeof(BitmapMaster)); + BitmapMaster *modelPtr = (BitmapMaster *)ckalloc(sizeof(BitmapMaster)); (void)typePtr; - 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); + modelPtr->tkMaster = master; + 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 (ImgBmapConfigureMaster(modelPtr, argc, argv, 0) != TCL_OK) { + ImgBmapDelete(modelPtr); return TCL_ERROR; } - *clientDataPtr = masterPtr; + *clientDataPtr = modelPtr; return TCL_OK; } @@ -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 @@ -230,7 +230,7 @@ ImgBmapCreate( static int ImgBmapConfigureMaster( - BitmapMaster *masterPtr, /* Pointer to data structure describing + BitmapMaster *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->tkMaster, 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; + BitmapMaster *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->tkMaster))); + 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 = (BitmapMaster *)clientData; + BitmapMaster *modelPtr = (BitmapMaster *)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 ImgBmapConfigureMaster(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 = (BitmapMaster *)masterData; + BitmapMaster *modelPtr = (BitmapMaster *)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 = (BitmapInstance *)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->tkMaster, 0, 0, 0, 0, modelPtr->width, + modelPtr->height); } return instancePtr; @@ -975,10 +975,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 */ } @@ -1009,23 +1009,23 @@ ImgBmapDelete( ClientData masterData) /* Pointer to BitmapMaster structure for * image. Must not have any more instances. */ { - BitmapMaster *masterPtr = (BitmapMaster *)masterData; + BitmapMaster *modelPtr = (BitmapMaster *)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->tkMaster = 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); } /* @@ -1050,11 +1050,11 @@ ImgBmapCmdDeletedProc( ClientData clientData) /* Pointer to BitmapMaster structure for * image. */ { - BitmapMaster *masterPtr = (BitmapMaster *)clientData; + BitmapMaster *modelPtr = (BitmapMaster *)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)); } } @@ -1197,7 +1197,7 @@ ImgBmapPostscript( int x, int y, int width, int height, int prepass) { - BitmapMaster *masterPtr = (BitmapMaster *)clientData; + BitmapMaster *modelPtr = (BitmapMaster *)clientData; Tcl_InterpState interpState; Tcl_Obj *psObj; @@ -1209,7 +1209,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; } @@ -1219,7 +1219,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)); @@ -1258,10 +1258,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) { @@ -1269,13 +1269,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); } } @@ -1283,10 +1283,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) { @@ -1294,8 +1294,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/tkImgPhoto.c b/generic/tkImgPhoto.c index f875a25..2f749c7 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -185,12 +185,12 @@ static int ParseSubcommandOptions( int *indexPtr, int objc, Tcl_Obj *const objv[]); static void ImgPhotoCmdDeletedProc(ClientData clientData); static int ImgPhotoConfigureMaster(Tcl_Interp *interp, - PhotoMaster *masterPtr, int objc, + PhotoMaster *modelPtr, int objc, Tcl_Obj *const objv[], int flags); static int ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr); -static int ImgPhotoSetSize(PhotoMaster *masterPtr, int width, +static int ImgPhotoSetSize(PhotoMaster *modelPtr, int width, int height); -static char * ImgGetPhoto(PhotoMaster *masterPtr, +static char * ImgGetPhoto(PhotoMaster *modelPtr, Tk_PhotoImageBlock *blockPtr, struct SubcommandOptions *optPtr); static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan, @@ -349,34 +349,34 @@ ImgPhotoCreate( ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - PhotoMaster *masterPtr; + PhotoMaster *modelPtr; (void)typePtr; /* * Allocate and initialize the photo image master record. */ - masterPtr = (PhotoMaster *)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 = (PhotoMaster *)ckalloc(sizeof(PhotoMaster)); + memset(modelPtr, 0, sizeof(PhotoMaster)); + modelPtr->tkMaster = master; + 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 (ImgPhotoConfigureMaster(interp, modelPtr, objc, objv, 0) != TCL_OK) { + ImgPhotoDelete(modelPtr); return TCL_ERROR; } - *clientDataPtr = masterPtr; + *clientDataPtr = modelPtr; return TCL_OK; } @@ -415,7 +415,7 @@ ImgPhotoCmd( PHOTO_WRITE }; - PhotoMaster *masterPtr = (PhotoMaster *)clientData; + PhotoMaster *modelPtr = (PhotoMaster *)clientData; int result, index, x, y, width, height; struct SubcommandOptions options; unsigned char *pixelPtr; @@ -445,7 +445,7 @@ ImgPhotoCmd( */ if (objc == 2) { - Tk_PhotoBlank(masterPtr); + Tk_PhotoBlank(modelPtr); return TCL_OK; } else { Tcl_WrongNumArgs(interp, 2, objv, NULL); @@ -461,16 +461,16 @@ ImgPhotoCmd( } arg = TkGetStringFromObj(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; } @@ -484,21 +484,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); } @@ -512,13 +512,13 @@ ImgPhotoCmd( 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); } @@ -526,23 +526,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 ImgPhotoConfigureMaster(interp, modelPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); } @@ -645,7 +645,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, @@ -659,7 +659,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); @@ -670,8 +670,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); } @@ -702,10 +702,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); @@ -717,8 +717,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.options & OPT_FORMAT)) { options.format = Tcl_NewStringObj("default", -1); @@ -772,7 +772,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; @@ -847,8 +847,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]))); @@ -861,7 +861,7 @@ ImgPhotoCmd( * Extract the value of the desired pixel and format it as a list. */ - pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; + pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; channels[0] = Tcl_NewWideIntObj(pixelPtr[0]); channels[1] = Tcl_NewWideIntObj(pixelPtr[1]); channels[2] = Tcl_NewWideIntObj(pixelPtr[2]); @@ -919,7 +919,7 @@ ImgPhotoCmd( } if (imageFormat->stringReadProc(interp, data, format, - (Tk_PhotoHandle) masterPtr, options.toX, options.toY, + (Tk_PhotoHandle) modelPtr, options.toX, options.toY, options.toX2 - options.toX, options.toY2 - options.toY, 0, 0) != TCL_OK) { return TCL_ERROR; @@ -930,7 +930,7 @@ ImgPhotoCmd( * takes care to notify the changed image and to set/unset the * IMAGE_CHANGED bit. */ - masterPtr->flags |= IMAGE_CHANGED; + modelPtr->flags |= IMAGE_CHANGED; return TCL_OK; } @@ -1020,7 +1020,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( @@ -1042,7 +1042,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); @@ -1061,27 +1061,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; @@ -1138,8 +1138,8 @@ ImgPhotoCmd( boolMode = 0; } - 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]))); @@ -1151,7 +1151,7 @@ ImgPhotoCmd( /* * Extract and return the desired value */ - pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; + pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; if (boolMode) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj( ! pixelPtr[3])); } else { @@ -1197,8 +1197,8 @@ ImgPhotoCmd( boolMode = 0; } - 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]))); @@ -1229,7 +1229,7 @@ ImgPhotoCmd( * Set new alpha value for the pixel */ - pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; + pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; if (boolMode) { pixelPtr[3] = newVal ? 0 : 255; } else { @@ -1247,11 +1247,11 @@ ImgPhotoCmd( modRegion = TkCreateRegion(); TkUnionRectWithRegion(&setBox, modRegion, modRegion); if (pixelPtr[3]) { - TkUnionRectWithRegion(&setBox, masterPtr->validRegion, - masterPtr->validRegion); + TkUnionRectWithRegion(&setBox, modelPtr->validRegion, + modelPtr->validRegion); } else { - TkSubtractRegion(masterPtr->validRegion, modRegion, - masterPtr->validRegion); + TkSubtractRegion(modelPtr->validRegion, modRegion, + modelPtr->validRegion); } TkDestroyRegion(modRegion); @@ -1260,9 +1260,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; } @@ -1304,10 +1304,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); @@ -1321,8 +1321,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)); @@ -1399,7 +1399,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); @@ -1751,7 +1751,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 @@ -1763,7 +1763,7 @@ ParseSubcommandOptions( static int ImgPhotoConfigureMaster( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ - PhotoMaster *masterPtr, /* Pointer to data structure describing + PhotoMaster *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. */ @@ -1822,28 +1822,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; } @@ -1853,9 +1853,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) { /* @@ -1870,10 +1870,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) { /* @@ -1887,18 +1887,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); @@ -1910,9 +1910,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. */ @@ -1926,7 +1926,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; } @@ -1937,13 +1937,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( @@ -1951,12 +1951,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) { @@ -1964,26 +1964,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); @@ -1991,26 +1991,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; } /* @@ -2019,7 +2019,7 @@ ImgPhotoConfigureMaster( * everywhere that it is used. */ - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { TkImgPhotoConfigureInstance(instancePtr); } @@ -2028,9 +2028,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); @@ -2039,7 +2039,7 @@ ImgPhotoConfigureMaster( Tcl_DecrRefCount(oldFormat); } - ToggleComplexAlphaIfNeeded(masterPtr); + ToggleComplexAlphaIfNeeded(modelPtr); return TCL_OK; @@ -2121,34 +2121,34 @@ ImgPhotoDelete( ClientData masterData) /* Pointer to PhotoMaster structure for image. * Must not have any more instances. */ { - PhotoMaster *masterPtr = (PhotoMaster *)masterData; + PhotoMaster *modelPtr = (PhotoMaster *)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); } /* @@ -2173,11 +2173,11 @@ ImgPhotoCmdDeletedProc( ClientData clientData) /* Pointer to PhotoMaster structure for * image. */ { - PhotoMaster *masterPtr = (PhotoMaster *)clientData; + PhotoMaster *modelPtr = (PhotoMaster *)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)); } } @@ -2202,7 +2202,7 @@ ImgPhotoCmdDeletedProc( static int ImgPhotoSetSize( - PhotoMaster *masterPtr, + PhotoMaster *modelPtr, int width, int height) { unsigned char *newPix32 = NULL; @@ -2212,11 +2212,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) { @@ -2230,8 +2230,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)) { @@ -2258,7 +2258,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; @@ -2267,10 +2267,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); } /* @@ -2286,8 +2286,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)); } @@ -2299,20 +2299,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)) { @@ -2321,21 +2321,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 @@ -2343,27 +2343,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); } @@ -2764,7 +2764,7 @@ Tk_PhotoPutBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoMaster *modelPtr = (PhotoMaster *) handle; Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -2783,12 +2783,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; @@ -2809,18 +2809,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 + @@ -2842,9 +2842,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)); @@ -2854,14 +2854,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; } /* @@ -2879,7 +2879,7 @@ Tk_PhotoPutBlock( alphaOffset -= sourceBlock.offset[0]; } if ((greenOffset != 0) || (blueOffset != 0)) { - masterPtr->flags |= COLOR_IMAGE; + modelPtr->flags |= COLOR_IMAGE; } /* @@ -2887,8 +2887,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 @@ -2899,7 +2899,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], @@ -3081,8 +3081,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); } @@ -3091,17 +3091,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); } /* @@ -3116,21 +3116,21 @@ Tk_PhotoPutBlock( * [Patch 1539990] */ - if (!(masterPtr->flags & COMPLEX_ALPHA)) { + if (!(modelPtr->flags & COMPLEX_ALPHA)) { int x1; for (x1=x ; x1<x+width ; x1++) { 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 @@ -3138,21 +3138,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); @@ -3202,7 +3202,7 @@ Tk_PhotoPutZoomedBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoMaster *modelPtr = (PhotoMaster *) handle; Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -3230,12 +3230,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; @@ -3255,18 +3255,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 + @@ -3287,9 +3287,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)); @@ -3299,14 +3299,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; } /* @@ -3324,7 +3324,7 @@ Tk_PhotoPutZoomedBlock( alphaOffset -= sourceBlock.offset[0]; } if ((greenOffset != 0) || (blueOffset != 0)) { - masterPtr->flags |= COLOR_IMAGE; + modelPtr->flags |= COLOR_IMAGE; } /* @@ -3353,7 +3353,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; @@ -3362,7 +3362,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; @@ -3449,22 +3449,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); } /* @@ -3477,38 +3477,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); @@ -3533,7 +3533,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. * *---------------------------------------------------------------------- @@ -3547,14 +3547,14 @@ Tk_DitherPhoto( * area to be dithered. */ int width, int height) /* Dimensions of the area to be dithered. */ { - PhotoMaster *masterPtr = (PhotoMaster *) photo; + PhotoMaster *modelPtr = (PhotoMaster *) 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); } @@ -3564,23 +3564,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 @@ -3588,11 +3588,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++; } } } @@ -3620,29 +3620,29 @@ void Tk_PhotoBlank( Tk_PhotoHandle handle) /* Handle for the image to be blanked. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoMaster *modelPtr = (PhotoMaster *) 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); } @@ -3651,8 +3651,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); } /* @@ -3682,17 +3682,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; + PhotoMaster *modelPtr = (PhotoMaster *) 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)); @@ -3700,8 +3700,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; } @@ -3730,10 +3730,10 @@ Tk_PhotoGetSize( /* The dimensions of the image are returned * here. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoMaster *modelPtr = (PhotoMaster *) handle; - *widthPtr = masterPtr->width; - *heightPtr = masterPtr->height; + *widthPtr = modelPtr->width; + *heightPtr = modelPtr->height; } /* @@ -3762,12 +3762,12 @@ Tk_PhotoSetSize( * set. */ int width, int height) /* New dimensions for the image. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoMaster *modelPtr = (PhotoMaster *) 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)); @@ -3775,8 +3775,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; } @@ -3805,9 +3805,9 @@ TkPhotoGetValidRegion( Tk_PhotoHandle handle) /* Handle for the image whose valid region is * to obtained. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoMaster *modelPtr = (PhotoMaster *) handle; - return masterPtr->validRegion; + return modelPtr->validRegion; } /* @@ -3833,7 +3833,7 @@ TkPhotoGetValidRegion( static char * ImgGetPhoto( - PhotoMaster *masterPtr, /* Handle for the photo image from which image + PhotoMaster *modelPtr, /* Handle for the photo image from which image * data is desired. */ Tk_PhotoImageBlock *blockPtr, /* Information about the address and layout of @@ -3843,13 +3843,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)))) { @@ -4030,12 +4030,12 @@ Tk_PhotoGetImage( /* Information about the address and layout of * the image data is returned here. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoMaster *modelPtr = (PhotoMaster *) 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/tkInt.h b/generic/tkInt.h index 9fca326..e98eba8 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -364,9 +364,9 @@ typedef struct TkDisplay { */ Tcl_HashTable maintainHashTable; - /* Hash table that maps from a master's - * Tk_Window token to a list of slaves managed - * by that master. */ + /* Hash table that maps from a container's + * Tk_Window token to a list of windows managed + * by that container. */ int geomInit; #define TkGetGeomMaster(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \ diff --git a/generic/tkPack.c b/generic/tkPack.c index 49ac1e6..475f35c 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -29,7 +29,7 @@ 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; /* Master 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 @@ -87,8 +87,8 @@ typedef struct Packer { * size. 0 means if this window is a master 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. + * ALLOCED_CONTAINER 1 means that Pack has allocated itself as + * geometry master for this window. */ #define REQUESTED_REPACK 1 @@ -97,7 +97,7 @@ 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: @@ -124,7 +124,7 @@ static void DestroyPacker(void *memPtr); static Packer * GetPacker(Tk_Window tkwin); #ifndef TK_NO_DEPRECATED static int PackAfter(Tcl_Interp *interp, Packer *prevPtr, - Packer *masterPtr, int objc,Tcl_Obj *const objv[]); + Packer *containerPtr, int objc,Tcl_Obj *const objv[]); #endif /* !TK_NO_DEPRECATED */ static void PackStructureProc(ClientData clientData, XEvent *eventPtr); @@ -249,33 +249,33 @@ 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; + 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->slavePtr; 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; + Packer *packPtr, *containerPtr; Packer *prevPtr; Tk_Window tkwin2; @@ -283,14 +283,14 @@ Tk_PackObjCmd( 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->slavePtr; if (prevPtr == packPtr) { prevPtr = NULL; } else { @@ -303,7 +303,7 @@ Tk_PackObjCmd( } } } - return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3); + return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3); } #endif /* !TK_NO_DEPRECATED */ case PACK_CONFIGURE: @@ -324,11 +324,11 @@ Tk_PackObjCmd( continue; } slavePtr = GetPacker(slave); - if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) { + if ((slavePtr != NULL) && (slavePtr->containerPtr != NULL)) { Tk_ManageGeometry(slave, NULL, NULL); - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { + if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->masterPtr->tkwin); + slavePtr->containerPtr->tkwin); } Unlink(slavePtr); Tk_UnmapWindow(slavePtr->tkwin); @@ -349,7 +349,7 @@ Tk_PackObjCmd( return TCL_ERROR; } slavePtr = GetPacker(slave); - if (slavePtr->masterPtr == NULL) { + if (slavePtr->containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL); @@ -358,7 +358,7 @@ Tk_PackObjCmd( infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), - Tk_NewWindowObj(slavePtr->masterPtr->tkwin)); + Tk_NewWindowObj(slavePtr->containerPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", -1), Tcl_NewStringObj(Tk_NameOfAnchor(slavePtr->anchor), -1)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", -1), @@ -392,7 +392,7 @@ Tk_PackObjCmd( } case PACK_PROPAGATE: { Tk_Window master; - Packer *masterPtr; + Packer *containerPtr; int propagate; if (objc > 4) { @@ -402,10 +402,10 @@ Tk_PackObjCmd( if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) { return TCL_ERROR; } - masterPtr = GetPacker(master); + containerPtr = GetPacker(master); 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) { @@ -416,39 +416,39 @@ Tk_PackObjCmd( * If we have slaves, we need to register as geometry master. */ - if (masterPtr->slavePtr != NULL) { + if (containerPtr->slavePtr != NULL) { if (TkSetGeometryMaster(interp, master, "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. */ - 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) { + if (containerPtr->flags & ALLOCED_CONTAINER) { TkFreeGeometryMaster(master, "pack"); - masterPtr->flags &= ~ALLOCED_MASTER; + 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; + Packer *containerPtr, *slavePtr; Tcl_Obj *resultObj; if (objc != 3) { @@ -459,8 +459,8 @@ Tk_PackObjCmd( return TCL_ERROR; } resultObj = Tcl_NewObj(); - masterPtr = GetPacker(master); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; + containerPtr = GetPacker(master); + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, Tk_NewWindowObj(slavePtr->tkwin)); @@ -481,11 +481,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); @@ -526,7 +526,7 @@ PackReqProc( Packer *packPtr = (Packer *)clientData; (void)tkwin; - packPtr = packPtr->masterPtr; + packPtr = packPtr->containerPtr; if (!(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; Tcl_DoWhenIdle(ArrangePacking, packPtr); @@ -559,8 +559,8 @@ PackLostSlaveProc( Packer *slavePtr = (Packer *)clientData; (void)tkwin; - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { + Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); } Unlink(slavePtr); Tk_UnmapWindow(slavePtr->tkwin); @@ -580,7 +580,7 @@ PackLostSlaveProc( * None. * * Side effects: - * The packed slaves of masterPtr may get resized or moved. + * The packed slaves of containerPtr may get resized or moved. * *------------------------------------------------------------------------ */ @@ -590,7 +590,7 @@ ArrangePacking( ClientData clientData) /* Structure describing master whose slaves * are to be re-layed out. */ { - Packer *masterPtr = (Packer *)clientData; + Packer *containerPtr = (Packer *)clientData; Packer *slavePtr; int cavityX, cavityY, cavityWidth, cavityHeight; /* These variables keep track of the @@ -608,7 +608,7 @@ ArrangePacking( int borderLeft, borderRight; int maxWidth, maxHeight, tmp; - masterPtr->flags &= ~REQUESTED_REPACK; + containerPtr->flags &= ~REQUESTED_REPACK; /* * If the master has no slaves anymore, then leave the master's size as-is. @@ -616,7 +616,7 @@ ArrangePacking( * so another geometry manager can take over. */ - if (masterPtr->slavePtr == NULL) { + if (containerPtr->slavePtr == NULL) { return; } @@ -626,12 +626,12 @@ 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 @@ -650,11 +650,11 @@ ArrangePacking( * 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; + width = maxWidth = Tk_InternalBorderLeft(containerPtr->tkwin) + + Tk_InternalBorderRight(containerPtr->tkwin); + height = maxHeight = Tk_InternalBorderTop(containerPtr->tkwin) + + Tk_InternalBorderBottom(containerPtr->tkwin); + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) { tmp = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw @@ -681,11 +681,11 @@ 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); } /* @@ -695,12 +695,12 @@ ArrangePacking( * master 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; } @@ -713,15 +713,15 @@ 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; + 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 (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) { frameWidth = cavityWidth; @@ -845,7 +845,7 @@ ArrangePacking( * this here. Otherwise let Tk_MaintainGeometry do the work. */ - if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { + if (containerPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { if ((width <= 0) || (height <= 0)) { Tk_UnmapWindow(slavePtr->tkwin); } else { @@ -864,16 +864,16 @@ ArrangePacking( * the master gets mapped later. */ - if (Tk_IsMapped(masterPtr->tkwin)) { + if (Tk_IsMapped(containerPtr->tkwin)) { Tk_MapWindow(slavePtr->tkwin); } } } else { if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin); + Tk_UnmaintainGeometry(slavePtr->tkwin, containerPtr->tkwin); Tk_UnmapWindow(slavePtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, + Tk_MaintainGeometry(slavePtr->tkwin, containerPtr->tkwin, x, y, width, height); } } @@ -890,8 +890,8 @@ ArrangePacking( } done: - masterPtr->abortPtr = NULL; - Tcl_Release(masterPtr); + containerPtr->abortPtr = NULL; + Tcl_Release(containerPtr); } /* @@ -1065,7 +1065,7 @@ GetPacker( } packPtr = (Packer *)ckalloc(sizeof(Packer)); packPtr->tkwin = tkwin; - packPtr->masterPtr = NULL; + packPtr->containerPtr = NULL; packPtr->nextPtr = NULL; packPtr->slavePtr = NULL; packPtr->side = TOP; @@ -1106,8 +1106,8 @@ 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, /* Master 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 @@ -1139,13 +1139,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; } @@ -1153,7 +1153,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; } @@ -1161,7 +1161,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); @@ -1271,12 +1271,12 @@ 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); } @@ -1286,24 +1286,24 @@ PackAfter( * 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->slavePtr; + containerPtr->slavePtr = 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 (TkSetGeometryMaster(interp, containerPtr->tkwin, "pack") != TCL_OK) { Tk_ManageGeometry(tkwin, NULL, NULL); Unlink(packPtr); return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } } } @@ -1312,12 +1312,12 @@ PackAfter( * Arrange for the master 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; } @@ -1343,16 +1343,16 @@ static void Unlink( Packer *packPtr) /* Window to unlink. */ { - 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->slavePtr == packPtr) { + containerPtr->slavePtr = packPtr->nextPtr; } else { - for (packPtr2 = masterPtr->slavePtr; ; packPtr2 = packPtr2->nextPtr) { + for (packPtr2 = containerPtr->slavePtr; ; packPtr2 = packPtr2->nextPtr) { if (packPtr2 == NULL) { Tcl_Panic("Unlink couldn't find previous window"); } @@ -1362,15 +1362,15 @@ 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 @@ -1380,10 +1380,10 @@ Unlink( * being no managed children inside it. */ - if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { - TkFreeGeometryMaster(masterPtr->tkwin, "pack"); - masterPtr->flags &= ~ALLOCED_MASTER; - Tk_SendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); + if ((containerPtr->slavePtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { + TkFreeGeometryMaster(containerPtr->tkwin, "pack"); + containerPtr->flags &= ~ALLOCED_CONTAINER; + Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL); } } @@ -1448,18 +1448,18 @@ PackStructureProc( 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) { Packer *slavePtr, *nextPtr; - if (packPtr->masterPtr != NULL) { + if (packPtr->containerPtr != NULL) { Unlink(packPtr); } @@ -1467,7 +1467,7 @@ PackStructureProc( slavePtr = nextPtr) { Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL); Tk_UnmapWindow(slavePtr->tkwin); - slavePtr->masterPtr = NULL; + slavePtr->containerPtr = NULL; nextPtr = slavePtr->nextPtr; slavePtr->nextPtr = NULL; } @@ -1539,7 +1539,7 @@ ConfigureSlaves( * "option value" pairs. Caller must make sure * that there is at least one window name. */ { - Packer *masterPtr, *slavePtr, *prevPtr, *otherPtr; + Packer *containerPtr, *slavePtr, *prevPtr, *otherPtr; Tk_Window other, slave, parent, ancestor; TkWindow *master; int i, j, numWindows, tmp, positionGiven; @@ -1573,7 +1573,7 @@ ConfigureSlaves( * options only get processed for the first window. */ - masterPtr = NULL; + containerPtr = NULL; prevPtr = NULL; positionGiven = 0; for (j = 0; j < numWindows; j++) { @@ -1596,7 +1596,7 @@ ConfigureSlaves( * a previous packing). */ - if (slavePtr->masterPtr == NULL) { + if (slavePtr->containerPtr == NULL) { slavePtr->side = TOP; slavePtr->anchor = TK_ANCHOR_CENTER; slavePtr->padX = slavePtr->padY = 0; @@ -1626,7 +1626,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", @@ -1635,7 +1635,7 @@ ConfigureSlaves( NULL); return TCL_ERROR; } - masterPtr = prevPtr->masterPtr; + containerPtr = prevPtr->containerPtr; positionGiven = 1; } break; @@ -1652,11 +1652,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->slavePtr; if (prevPtr == otherPtr) { prevPtr = NULL; } else { @@ -1700,8 +1700,8 @@ ConfigureSlaves( != TCL_OK) { return TCL_ERROR; } - masterPtr = GetPacker(other); - prevPtr = masterPtr->slavePtr; + containerPtr = GetPacker(other); + prevPtr = containerPtr->slavePtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { prevPtr = prevPtr->nextPtr; @@ -1760,8 +1760,8 @@ ConfigureSlaves( * current packing list. */ - if (!positionGiven && (slavePtr->masterPtr != NULL)) { - masterPtr = slavePtr->masterPtr; + if (!positionGiven && (slavePtr->containerPtr != NULL)) { + containerPtr = slavePtr->containerPtr; goto scheduleLayout; } @@ -1772,7 +1772,7 @@ ConfigureSlaves( */ if (prevPtr == slavePtr) { - masterPtr = slavePtr->masterPtr; + containerPtr = slavePtr->containerPtr; goto scheduleLayout; } @@ -1783,8 +1783,8 @@ ConfigureSlaves( */ if (!positionGiven) { - masterPtr = GetPacker(Tk_Parent(slave)); - prevPtr = masterPtr->slavePtr; + containerPtr = GetPacker(Tk_Parent(slave)); + prevPtr = containerPtr->slavePtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { prevPtr = prevPtr->nextPtr; @@ -1799,19 +1799,19 @@ ConfigureSlaves( */ parent = Tk_Parent(slave); - 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 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 (slave == containerPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack %s inside itself", Tcl_GetString(objv[j]))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); @@ -1822,18 +1822,18 @@ ConfigureSlaves( * Check for management loops. */ - for (master = (TkWindow *)masterPtr->tkwin; master != NULL; + for (master = (TkWindow *)containerPtr->tkwin; master != NULL; master = (TkWindow *)TkGetGeomMaster(master)) { if (master == (TkWindow *)slave) { 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(slave)) { + ((TkWindow *)slave)->maintainerPtr = (TkWindow *)containerPtr->tkwin; } /* @@ -1841,20 +1841,20 @@ ConfigureSlaves( * prevPtr. */ - if (slavePtr->masterPtr != NULL) { - if ((slavePtr->masterPtr != masterPtr) && - (slavePtr->masterPtr->tkwin + if (slavePtr->containerPtr != NULL) { + if ((slavePtr->containerPtr != containerPtr) && + (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->masterPtr->tkwin); + slavePtr->containerPtr->tkwin); } Unlink(slavePtr); } - slavePtr->masterPtr = masterPtr; + slavePtr->containerPtr = containerPtr; if (prevPtr == NULL) { - slavePtr->nextPtr = masterPtr->slavePtr; - masterPtr->slavePtr = slavePtr; + slavePtr->nextPtr = containerPtr->slavePtr; + containerPtr->slavePtr = slavePtr; } else { slavePtr->nextPtr = prevPtr->nextPtr; prevPtr->nextPtr = slavePtr; @@ -1862,14 +1862,14 @@ ConfigureSlaves( Tk_ManageGeometry(slave, &packerType, slavePtr); prevPtr = slavePtr; - if (!(masterPtr->flags & DONT_PROPAGATE)) { - if (TkSetGeometryMaster(interp, masterPtr->tkwin, "pack") + if (!(containerPtr->flags & DONT_PROPAGATE)) { + if (TkSetGeometryMaster(interp, containerPtr->tkwin, "pack") != TCL_OK) { Tk_ManageGeometry(slave, NULL, NULL); Unlink(slavePtr); return TCL_ERROR; } - masterPtr->flags |= ALLOCED_MASTER; + containerPtr->flags |= ALLOCED_CONTAINER; } /* @@ -1877,12 +1877,12 @@ ConfigureSlaves( */ 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 d8e149b..2039256 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 void * ComputeSlotAddress(void *recordPtr, TkSizeT 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, TCL_INDEX_NONE, offsetof(Slave, after), + DEF_PANEDWINDOW_PANE_AFTER, TCL_INDEX_NONE, offsetof(Pane, after), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_WINDOW, "-before", NULL, NULL, - DEF_PANEDWINDOW_PANE_BEFORE, TCL_INDEX_NONE, offsetof(Slave, before), + DEF_PANEDWINDOW_PANE_BEFORE, TCL_INDEX_NONE, offsetof(Pane, before), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-height", NULL, NULL, - DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Slave, heightPtr), - offsetof(Slave, height), TK_OPTION_NULL_OK, 0, 0}, + DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Pane, heightPtr), + offsetof(Pane, height), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", - DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Slave, hide), 0,0,GEOMETRY}, + DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY}, {TK_OPTION_PIXELS, "-minsize", NULL, NULL, - DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Slave, minSize), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Pane, minSize), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, - DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Slave, padx), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Pane, padx), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, - DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Slave, pady), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Pane, pady), 0, 0, 0}, {TK_OPTION_CUSTOM, "-sticky", NULL, NULL, - DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Slave, sticky), 0, + DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Pane, sticky), 0, &stickyOption, 0}, {TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch", - DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Slave, stretch), 0, + DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Pane, stretch), 0, (ClientData) stretchStrings, 0}, {TK_OPTION_PIXELS, "-width", NULL, NULL, - DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Slave, widthPtr), - offsetof(Slave, width), TK_OPTION_NULL_OK, 0, 0}, + DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Pane, widthPtr), + offsetof(Pane, width), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; @@ -383,7 +383,7 @@ static const Tk_OptionSpec slaveOptionSpecs[] = { int Tk_PanedWindowObjCmd( - ClientData dummy, /* NULL. */ + TCL_UNUSED(ClientData), /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ @@ -392,7 +392,6 @@ Tk_PanedWindowObjCmd( Tk_Window tkwin, parent; OptionTables *pwOpts; XSetWindowAttributes atts; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -429,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"); @@ -447,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; @@ -472,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); @@ -549,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 ...?"); @@ -570,7 +569,7 @@ PanedWindowWidgetObjCmd( result = TCL_ERROR; break; } - result = ConfigureSlaves(pwPtr, interp, objc, objv); + result = ConfigurePanes(pwPtr, interp, objc, objv); break; case PW_CGET: @@ -617,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); @@ -667,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, - pwPtr->slaves[i], pwPtr->slaveOpts, + 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", @@ -707,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, - pwPtr->slaves[i], pwPtr->slaveOpts, + pwPtr->panes[i], pwPtr->paneOpts, (objc == 4) ? objv[3] : NULL, pwPtr->tkwin); if (resultObj == NULL) { @@ -722,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, - Tk_NewWindowObj(pwPtr->slaves[i]->tkwin)); + Tk_NewWindowObj(pwPtr->panes[i]->tkwin)); } Tcl_SetObjResult(interp, resultObj); break; @@ -750,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.). */ @@ -818,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); @@ -848,8 +847,8 @@ ConfigureSlaves( * extra testing in the for loop below. */ - memset((void *)&options, 0, sizeof(Slave)); - if (Tk_SetOptions(interp, &options, pwPtr->slaveOpts, + memset((void *)&options, 0, sizeof(Pane)); + if (Tk_SetOptions(interp, &options, pwPtr->paneOpts, objc - firstOptionArg, objv + firstOptionArg, pwPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; @@ -866,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; } @@ -875,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; } @@ -893,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 = (Slave **)ckalloc(sizeof(Slave *) * (firstOptionArg - 2)); + inserts = (Pane **)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. @@ -924,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, 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, 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; } @@ -952,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. */ @@ -967,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 = (Slave *)ckalloc(sizeof(Slave)); - memset(slavePtr, 0, sizeof(Slave)); - Tk_InitOptions(interp, slavePtr, pwPtr->slaveOpts, + panePtr = (Pane *)ckalloc(sizeof(Pane)); + memset(panePtr, 0, sizeof(Pane)); + Tk_InitOptions(interp, panePtr, pwPtr->paneOpts, pwPtr->tkwin); - Tk_SetOptions(interp, slavePtr, pwPtr->slaveOpts, + Tk_SetOptions(interp, 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 = (Slave **)ckalloc(i); - memset(newSlaves, 0, i); + i = sizeof(Pane *) * (pwPtr->numPanes + numNewPanes); + newPanes = (Pane **)ckalloc(i); + memset(newPanes, 0, 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; @@ -1102,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 ...?"); @@ -1131,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_NewWideIntObj(slavePtr->sashx); - coords[1] = Tcl_NewWideIntObj(slavePtr->sashy); + coords[0] = Tcl_NewWideIntObj(panePtr->sashx); + coords[1] = Tcl_NewWideIntObj(panePtr->sashy); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); break; @@ -1164,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_NewWideIntObj(pwPtr->slaves[sash]->markx); - coords[1] = Tcl_NewWideIntObj(pwPtr->slaves[sash]->marky); + coords[0] = Tcl_NewWideIntObj(pwPtr->panes[sash]->markx); + coords[1] = Tcl_NewWideIntObj(pwPtr->panes[sash]->marky); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); } break; @@ -1199,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; } } @@ -1370,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); } } } @@ -1444,7 +1443,7 @@ DisplayPanedWindow( ClientData clientData) /* Information about window. */ { PanedWindow *pwPtr = (PanedWindow *)clientData; - Slave *slavePtr; + Pane *panePtr; Pixmap pixmap; Tk_Window tkwin = pwPtr->tkwin; int i, sashWidth, sashHeight; @@ -1497,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); } @@ -1570,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); } /* @@ -1628,12 +1627,11 @@ static void PanedWindowReqProc( ClientData clientData, /* Paned window'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. */ { - Slave *slavePtr = (Slave *)clientData; - PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr; - (void)tkwin; + Pane *panePtr = (Pane *)clientData; + PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr; if (Tk_IsMapped(pwPtr->tkwin)) { if (!(pwPtr->flags & RESIZE_PENDING)) { @@ -1641,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); } @@ -1656,40 +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. */ + TCL_UNUSED(Tk_Window)) /* Tk's handle for the pane. */ { - Slave *slavePtr = (Slave *)clientData; - PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr; - (void)tkwin; - - 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); + Pane *panePtr = (Pane *)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); } @@ -1707,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. */ { PanedWindow *pwPtr = (PanedWindow *)clientData; - Slave *slavePtr; - int i, slaveWidth, slaveHeight, slaveX, slaveY; + Pane *panePtr; + int i, newPaneWidth, newPaneHeight, paneX, paneY; int paneWidth, paneHeight, paneSize, paneMinSize; int doubleBw; int x, y; @@ -1734,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; } @@ -1779,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; @@ -1821,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) { @@ -1877,7 +1874,7 @@ ArrangePanes( } paneDynSize -= paneSize; - paneDynMinSize -= slavePtr->minSize; + paneDynMinSize -= panePtr->minSize; stretchAmount = (int) (frac * stretchReserve); if (paneSize + stretchAmount >= paneMinSize) { stretchReserve -= stretchAmount; @@ -1902,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; } @@ -1932,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 @@ -1948,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--; } @@ -2004,7 +2001,7 @@ ArrangePanes( * * Unlink -- * - * Remove a slave from a paned window. + * Remove a pane from a paned window. * * Results: * None. @@ -2017,57 +2014,57 @@ ArrangePanes( static void Unlink( - Slave *slavePtr) /* Window to unlink. */ + Pane *panePtr) /* Window to unlink. */ { - PanedWindow *masterPtr; + 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--; } /* @@ -2079,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: @@ -2088,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; @@ -2128,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; } @@ -2141,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 @@ -2151,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 = (Slave *)clientData; - PanedWindow *pwPtr = slavePtr->masterPtr; + Pane *panePtr = (Pane *)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); } } @@ -2180,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. @@ -2198,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; @@ -2224,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 @@ -2246,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; } } @@ -2261,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; } @@ -2327,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; @@ -2373,10 +2370,8 @@ ComputeGeometry( static void DestroyOptionTables( ClientData clientData, /* Pointer to the OptionTables struct */ - Tcl_Interp *dummy) /* Pointer to the calling interp */ + TCL_UNUSED(Tcl_Interp *)) /* Pointer to the calling interp */ { - (void)dummy; - ckfree(clientData); } @@ -2399,8 +2394,8 @@ DestroyOptionTables( static Tcl_Obj * GetSticky( - ClientData dummy, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *recordPtr, /* Pointer to widget record. */ TkSizeT internalOffset) /* Offset within *recordPtr containing the * sticky value. */ @@ -2408,8 +2403,6 @@ GetSticky( int sticky = *(int *)(recordPtr + internalOffset); char buffer[5]; char *p = &buffer[0]; - (void)dummy; - (void)tkwin; if (sticky & STICK_NORTH) { *p++ = 'n'; @@ -2449,9 +2442,9 @@ GetSticky( static int SetSticky( - ClientData dummy, + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interp; may be used for errors. */ - Tk_Window tkwin, /* Window for which option is being set. */ + TCL_UNUSED(Tk_Window), /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. * We use a pointer to the pointer because we * may need to return a value (NULL). */ @@ -2465,8 +2458,6 @@ SetSticky( char c; void *internalPtr; const char *string; - (void)dummy; - (void)tkwin; internalPtr = ComputeSlotAddress(recordPtr, internalOffset); @@ -2531,14 +2522,11 @@ SetSticky( static void RestoreSticky( - ClientData dummy, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *internalPtr, /* Pointer to storage for value. */ char *oldInternalPtr) /* Pointer to old value. */ { - (void)dummy; - (void)tkwin; - *(int *)internalPtr = *(int *)oldInternalPtr; } @@ -2548,11 +2536,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: @@ -2569,26 +2557,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; @@ -2621,8 +2609,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); @@ -2631,7 +2619,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) { @@ -2640,17 +2628,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); } } @@ -2660,7 +2648,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++; } @@ -2671,7 +2659,7 @@ MoveSash( if (diff > 0) { expandPane = sash; reduceFirst = nextSash; - reduceLast = pwPtr->numSlaves; + reduceLast = pwPtr->numPanes; reduceIncr = 1; } else { diff = abs(diff); @@ -2687,14 +2675,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) { @@ -2708,11 +2696,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; } /* @@ -2720,26 +2708,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; } } } @@ -2962,9 +2950,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. */ @@ -3114,12 +3102,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))) { @@ -3130,8 +3118,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 2c0a0a3..671f7fc 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. */ @@ -38,13 +38,13 @@ typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode; typedef struct Slave { 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 Master *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). */ + * same container (NULL for end of list). */ Tk_OptionTable optionTable; /* Table that defines configuration options * available for this command. */ /* @@ -57,19 +57,19 @@ 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; @@ -123,14 +123,14 @@ 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 slave managed by the placer there is a * structure of the following form: */ typedef struct Master { - Tk_Window tkwin; /* Tk's token for master window. */ + Tk_Window tkwin; /* Tk's token for container window. */ struct Slave *slavePtr; /* First in linked list of slaves placed - * relative to this master. */ + * 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 @@ -141,7 +141,7 @@ typedef struct Master { } Master; /* - * 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. @@ -309,9 +309,9 @@ Tk_PlaceObjCmd( if (slavePtr == NULL) { return TCL_OK; } - if ((slavePtr->masterPtr != NULL) && - (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if ((slavePtr->containerPtr != NULL) && + (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { + Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); } UnlinkSlave(slavePtr); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, @@ -332,17 +332,17 @@ Tk_PlaceObjCmd( case PLACE_CONTENT: case PLACE_SLAVES: { - Master *masterPtr; + Master *containerPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pathName"); return TCL_ERROR; } - masterPtr = FindMaster(tkwin); - if (masterPtr != NULL) { + containerPtr = FindMaster(tkwin); + if (containerPtr != NULL) { Tcl_Obj *listPtr = Tcl_NewObj(); - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, listPtr, Tk_NewWindowObj(slavePtr->tkwin)); @@ -469,13 +469,13 @@ FindSlave( * UnlinkSlave -- * * This function removes a slave window from the chain of slaves in its - * master. + * container. * * Results: * None. * * Side effects: - * The slave list of slavePtr's master changes. + * The slave list of slavePtr's container changes. * *---------------------------------------------------------------------- */ @@ -484,17 +484,17 @@ static void UnlinkSlave( Slave *slavePtr) /* Slave structure to be unlinked. */ { - Master *masterPtr; + Master *containerPtr; Slave *prevPtr; - masterPtr = slavePtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = slavePtr->containerPtr; + if (containerPtr == NULL) { return; } - if (masterPtr->slavePtr == slavePtr) { - masterPtr->slavePtr = slavePtr->nextPtr; + if (containerPtr->slavePtr == slavePtr) { + containerPtr->slavePtr = slavePtr->nextPtr; } else { - for (prevPtr = masterPtr->slavePtr; ; prevPtr = prevPtr->nextPtr) { + for (prevPtr = containerPtr->slavePtr; ; prevPtr = prevPtr->nextPtr) { if (prevPtr == NULL) { Tcl_Panic("UnlinkSlave couldn't find slave to unlink"); } @@ -505,10 +505,10 @@ UnlinkSlave( } } - if (masterPtr->abortPtr != NULL) { - *masterPtr->abortPtr = 1; + if (containerPtr->abortPtr != NULL) { + *containerPtr->abortPtr = 1; } - slavePtr->masterPtr = NULL; + slavePtr->containerPtr = NULL; } /* @@ -530,27 +530,27 @@ UnlinkSlave( static Master * CreateMaster( - Tk_Window tkwin) /* Token for desired master. */ + Tk_Window tkwin) /* Token for desired container. */ { Tcl_HashEntry *hPtr; - Master *masterPtr; + Master *containerPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew); if (isNew) { - masterPtr = (Master *)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 = (Master *)ckalloc(sizeof(Master)); + containerPtr->tkwin = tkwin; + containerPtr->slavePtr = NULL; + containerPtr->abortPtr = NULL; + containerPtr->flags = 0; + Tcl_SetHashValue(hPtr, containerPtr); + Tk_CreateEventHandler(containerPtr->tkwin, StructureNotifyMask, + MasterStructureProc, containerPtr); } else { - masterPtr = (Master *)Tcl_GetHashValue(hPtr); + containerPtr = (Master *)Tcl_GetHashValue(hPtr); } - return masterPtr; + return containerPtr; } /* @@ -574,7 +574,7 @@ CreateMaster( static Master * FindMaster( - Tk_Window tkwin) /* Token for desired master. */ + Tk_Window tkwin) /* Token for desired container. */ { Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -599,7 +599,7 @@ FindMaster( * the interp's result. * * Side effects: - * Information in slavePtr may change, and slavePtr's master is scheduled + * Information in slavePtr may change, and slavePtr's container is scheduled * for reconfiguration. * *---------------------------------------------------------------------- @@ -613,12 +613,12 @@ ConfigureSlave( int objc, /* Number of config arguments. */ Tcl_Obj *const objv[]) /* Object values for arguments. */ { - Master *masterPtr; + Master *containerPtr; Tk_SavedOptions savedOptions; int mask; Slave *slavePtr; - Tk_Window masterWin = NULL; - TkWindow *master; + Tk_Window containerWin = NULL; + TkWindow *container; if (Tk_TopWinHierarchy(tkwin)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -656,13 +656,13 @@ ConfigureSlave( slavePtr->flags |= CHILD_WIDTH; } - if (!(mask & IN_MASK) && (slavePtr->masterPtr != NULL)) { + if (!(mask & IN_MASK) && (slavePtr->containerPtr != NULL)) { /* * If no -in option was passed and the slave is already placed then * just recompute the placement. */ - masterPtr = slavePtr->masterPtr; + containerPtr = slavePtr->containerPtr; goto scheduleLayout; } else if (mask & IN_MASK) { /* -in changed */ @@ -672,8 +672,8 @@ ConfigureSlave( tkwin = slavePtr->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 + * slave or a descendant of that window, and that the container and slave * aren't the same. */ @@ -701,9 +701,9 @@ 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 *)slavePtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin))); @@ -715,52 +715,52 @@ ConfigureSlave( ((TkWindow *)slavePtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; } - if ((slavePtr->masterPtr != NULL) - && (slavePtr->masterPtr->tkwin == tkwin)) { + if ((slavePtr->containerPtr != NULL) + && (slavePtr->containerPtr->tkwin == tkwin)) { /* - * Re-using same old master. Nothing to do. + * Re-using same old container. Nothing to do. */ - masterPtr = slavePtr->masterPtr; + containerPtr = slavePtr->containerPtr; goto scheduleLayout; } - if ((slavePtr->masterPtr != NULL) && - (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if ((slavePtr->containerPtr != NULL) && + (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { + Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); } UnlinkSlave(slavePtr); - masterWin = tkwin; + containerWin = tkwin; } /* - * If there's no master specified for this slave, use its Tk_Parent. + * If there's no container specified for this slave, use its Tk_Parent. */ - if (masterWin == NULL) { - masterWin = Tk_Parent(slavePtr->tkwin); - slavePtr->inTkwin = masterWin; + if (containerWin == NULL) { + containerWin = Tk_Parent(slavePtr->tkwin); + slavePtr->inTkwin = containerWin; } /* - * Manage the slave window in this master. + * Manage the slave window in this container. */ - masterPtr = CreateMaster(masterWin); - slavePtr->masterPtr = masterPtr; - slavePtr->nextPtr = masterPtr->slavePtr; - masterPtr->slavePtr = slavePtr; + containerPtr = CreateMaster(containerWin); + slavePtr->containerPtr = containerPtr; + slavePtr->nextPtr = containerPtr->slavePtr; + containerPtr->slavePtr = slavePtr; Tk_ManageGeometry(slavePtr->tkwin, &placerType, slavePtr); /* - * 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; @@ -804,10 +804,10 @@ PlaceInfoCommand( return TCL_OK; } infoObj = Tcl_NewObj(); - if (slavePtr->masterPtr != NULL) { + if (slavePtr->containerPtr != NULL) { Tcl_AppendToObj(infoObj, "-in", -1); Tcl_ListObjAppendElement(NULL, infoObj, - Tk_NewWindowObj(slavePtr->masterPtr->tkwin)); + Tk_NewWindowObj(slavePtr->containerPtr->tkwin)); Tcl_AppendToObj(infoObj, " ", -1); } Tcl_AppendPrintfToObj(infoObj, @@ -849,7 +849,7 @@ PlaceInfoCommand( * RecomputePlacement -- * * This function is called as a when-idle handler. It recomputes the - * geometries of all the slaves of a given master. + * geometries of all the slaves of a given container. * * Results: * None. @@ -864,15 +864,15 @@ static void RecomputePlacement( ClientData clientData) /* Pointer to Master record. */ { - Master *masterPtr = (Master *)clientData; + Master *containerPtr = (Master *)clientData; Slave *slavePtr; int x, y, width, height, tmp; - int masterWidth, masterHeight, masterX, masterY; + int containerWidth, containerHeight, containerX, containerY; double x1, y1, x2, y2; int abort; /* May get set to non-zero to abort this * placement operation. */ - masterPtr->flags &= ~PARENT_RECONFIG_PENDING; + containerPtr->flags &= ~PARENT_RECONFIG_PENDING; /* * Abort any nested call to RecomputePlacement for this window, since @@ -880,50 +880,50 @@ 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 + * Iterate over all the slaves for the container. Each slave's geometry can * be computed independently of the other slaves. 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; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL && !abort; slavePtr = slavePtr->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); + containerX = containerY = 0; + containerWidth = Tk_Width(containerPtr->tkwin); + containerHeight = Tk_Height(containerPtr->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); + containerX = Tk_InternalBorderLeft(containerPtr->tkwin); + containerY = Tk_InternalBorderTop(containerPtr->tkwin); + containerWidth -= containerX + Tk_InternalBorderRight(containerPtr->tkwin); + containerHeight -= containerY + + Tk_InternalBorderBottom(containerPtr->tkwin); } else if (slavePtr->borderMode == BM_OUTSIDE) { - masterX = masterY = -Tk_Changes(masterPtr->tkwin)->border_width; - masterWidth -= 2 * masterX; - masterHeight -= 2 * masterY; + 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. + * and location of anchor point within container. */ - x1 = slavePtr->x + masterX + (slavePtr->relX*masterWidth); + x1 = slavePtr->x + containerX + (slavePtr->relX*containerWidth); x = (int) (x1 + ((x1 > 0) ? 0.5 : -0.5)); - y1 = slavePtr->y + masterY + (slavePtr->relY*masterHeight); + y1 = slavePtr->y + containerY + (slavePtr->relY*containerHeight); y = (int) (y1 + ((y1 > 0) ? 0.5 : -0.5)); if (slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) { width = 0; @@ -939,7 +939,7 @@ RecomputePlacement( * errors in relX and relWidth accumulate. */ - x2 = x1 + (slavePtr->relWidth*masterWidth); + x2 = x1 + (slavePtr->relWidth*containerWidth); tmp = (int) (x2 + ((x2 > 0) ? 0.5 : -0.5)); width += tmp - x; } @@ -957,7 +957,7 @@ RecomputePlacement( * See note above for rounding errors in width computation. */ - y2 = y1 + (slavePtr->relHeight*masterHeight); + y2 = y1 + (slavePtr->relHeight*containerHeight); tmp = (int) (y2 + ((y2 > 0) ? 0.5 : -0.5)); height += tmp - y; } @@ -969,7 +969,7 @@ RecomputePlacement( /* * 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. + * border mode and container's border. */ switch (slavePtr->anchor) { @@ -1022,12 +1022,12 @@ 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 + * is a child of the container, we do this ourselves. If the slave 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 (containerPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { if ((x != Tk_X(slavePtr->tkwin)) || (y != Tk_Y(slavePtr->tkwin)) || (width != Tk_Width(slavePtr->tkwin)) @@ -1039,26 +1039,26 @@ RecomputePlacement( } /* - * 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 slave unless the container is mapped: the slave will + * get mapped later, when the container is mapped. */ - if (Tk_IsMapped(masterPtr->tkwin)) { + if (Tk_IsMapped(containerPtr->tkwin)) { Tk_MapWindow(slavePtr->tkwin); } } else { if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin); + Tk_UnmaintainGeometry(slavePtr->tkwin, containerPtr->tkwin); Tk_UnmapWindow(slavePtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, + Tk_MaintainGeometry(slavePtr->tkwin, containerPtr->tkwin, x, y, width, height); } } } - masterPtr->abortPtr = NULL; - Tcl_Release(masterPtr); + containerPtr->abortPtr = NULL; + Tcl_Release(containerPtr); } /* @@ -1067,7 +1067,7 @@ RecomputePlacement( * MasterStructureProc -- * * 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. @@ -1085,55 +1085,55 @@ MasterStructureProc( * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - Master *masterPtr = (Master *)clientData; + Master *containerPtr = (Master *)clientData; Slave *slavePtr, *nextPtr; - TkDisplay *dispPtr = ((TkWindow *) masterPtr->tkwin)->dispPtr; + 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->slavePtr != NULL) + && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) { + containerPtr->flags |= PARENT_RECONFIG_PENDING; + Tcl_DoWhenIdle(RecomputePlacement, containerPtr); } return; case DestroyNotify: - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = nextPtr) { - slavePtr->masterPtr = NULL; + slavePtr->containerPtr = NULL; nextPtr = slavePtr->nextPtr; slavePtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable, - masterPtr->tkwin)); - if (masterPtr->flags & PARENT_RECONFIG_PENDING) { - Tcl_CancelIdleCall(RecomputePlacement, masterPtr); + 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 + * When a container gets mapped, must redo the geometry computation so * that all of its slaves get remapped. */ - if ((masterPtr->slavePtr != NULL) - && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) { - masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, masterPtr); + if ((containerPtr->slavePtr != 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 slaves when the container gets unmapped, so that they * don't keep redisplaying themselves. */ - for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; + for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { Tk_UnmapWindow(slavePtr->tkwin); } @@ -1168,7 +1168,7 @@ SlaveStructureProc( TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; if (eventPtr->type == DestroyNotify) { - if (slavePtr->masterPtr != NULL) { + if (slavePtr->containerPtr != NULL) { UnlinkSlave(slavePtr); } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, @@ -1201,7 +1201,7 @@ PlaceRequestProc( Tk_Window tkwin) /* Window that changed its desired size. */ { Slave *slavePtr = (Slave *)clientData; - Master *masterPtr; + Master *containerPtr; (void)tkwin; if ((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) @@ -1214,13 +1214,13 @@ PlaceRequestProc( TkDoConfigureNotify((TkWindow *)(slavePtr->tkwin)); return; } - masterPtr = slavePtr->masterPtr; - if (masterPtr == NULL) { + containerPtr = slavePtr->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); } } @@ -1250,8 +1250,8 @@ PlaceLostSlaveProc( Slave *slavePtr = (Slave *)clientData; TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; - if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); + if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { + Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); } Tk_UnmapWindow(tkwin); UnlinkSlave(slavePtr); diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index 5b33a84..ccaa556 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -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) { @@ -939,12 +939,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/ttkFrame.c b/generic/ttk/ttkFrame.c index 7c43bce..9ad8257 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -507,12 +507,13 @@ static int LabelRequest(void *managerData, TkSizeT index, int width, int height) * * <<NOTE-LABELREMOVED>>: * This routine is also called when the widget voluntarily forgets - * the slave in LabelframeConfigure. + * the window in LabelframeConfigure. */ -static void LabelRemoved(void *managerData, TkSizeT slaveIndex) +static void LabelRemoved( + void *managerData, + TCL_UNUSED(TkSizeT)) { Labelframe *lframe = (Labelframe *)managerData; - (void)slaveIndex; lframe->label.labelWidget = 0; } diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index c01bc47..4a93566 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -11,22 +11,22 @@ * +++ 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>>. + * +++ Slave removal <<NOTE-LOSTCONTENT>>. * * There are three conditions under which a slave is removed: * @@ -53,15 +53,15 @@ typedef struct /* slave->flags bits: */ -#define SLAVE_MAPPED 0x1 /* slave to be mapped when master is */ +#define SLAVE_MAPPED 0x1 /* slave to be mapped when container is */ struct TtkManager_ { Ttk_ManagerSpec *managerSpec; void *managerData; - Tk_Window masterWindow; + Tk_Window window; unsigned flags; - TkSizeT nSlaves; + TkSizeT nManaged; Ttk_Slave **slaves; }; @@ -87,7 +87,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) @@ -95,7 +95,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->window, width, height); ScheduleUpdate(mgr, MGR_RELAYOUT_REQUIRED); } mgr->flags &= ~MGR_RESIZE_REQUIRED; @@ -135,8 +135,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) @@ -150,7 +150,7 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) RecomputeLayout(mgr); break; case MapNotify: - for (i = 0; i < mgr->nSlaves; ++i) { + for (i = 0; i < mgr->nManaged; ++i) { Ttk_Slave *slave = mgr->slaves[i]; if (slave->flags & SLAVE_MAPPED) { Tk_MapWindow(slave->slaveWindow); @@ -158,7 +158,7 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) } break; case UnmapNotify: - for (i = 0; i < mgr->nSlaves; ++i) { + for (i = 0; i < mgr->nManaged; ++i) { Ttk_Slave *slave = mgr->slaves[i]; Tk_UnmapWindow(slave->slaveWindow); } @@ -166,12 +166,11 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) } } -/* ++ SlaveEventHandler -- - * Notifies manager when a slave is destroyed - * (see <<NOTE-LOSTSLAVE>>). +/* ++ ContentLostEventHandler -- + * Notifies manager when a content window is destroyed + * (see <<NOTE-LOSTCONTENT>>). */ -static const unsigned SlaveEventMask = StructureNotifyMask; -static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr) +static void ContentLostEventHandler(ClientData clientData, XEvent *eventPtr) { Ttk_Slave *slave = (Ttk_Slave *)clientData; if (eventPtr->type == DestroyNotify) { @@ -207,19 +206,19 @@ static void DeleteSlave(Ttk_Slave *slave) */ Ttk_Manager *Ttk_CreateManager( - Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow) + Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)ckalloc(sizeof(*mgr)); mgr->managerSpec = managerSpec; mgr->managerData = managerData; - mgr->masterWindow = masterWindow; - mgr->nSlaves = 0; + mgr->window = window; + mgr->nManaged = 0; mgr->slaves = NULL; mgr->flags = 0; Tk_CreateEventHandler( - mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr); + mgr->window, ManagerEventMask, ManagerEventHandler, mgr); return mgr; } @@ -227,10 +226,10 @@ Ttk_Manager *Ttk_CreateManager( void Ttk_DeleteManager(Ttk_Manager *mgr) { Tk_DeleteEventHandler( - mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr); + mgr->window, ManagerEventMask, ManagerEventHandler, mgr); - while (mgr->nSlaves > 0) { - Ttk_ForgetSlave(mgr, mgr->nSlaves - 1); + while (mgr->nManaged > 0) { + Ttk_ForgetSlave(mgr, mgr->nManaged - 1); } if (mgr->slaves) { ckfree(mgr->slaves); @@ -250,8 +249,8 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) */ static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, TkSizeT index) { - TkSizeT endIndex = mgr->nSlaves++; - mgr->slaves = (Ttk_Slave **)ckrealloc(mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *)); + TkSizeT endIndex = mgr->nManaged++; + mgr->slaves = (Ttk_Slave **)ckrealloc(mgr->slaves, mgr->nManaged * sizeof(Ttk_Slave *)); while (endIndex > index) { mgr->slaves[endIndex] = mgr->slaves[endIndex - 1]; @@ -264,7 +263,7 @@ static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, TkSizeT index) &mgr->managerSpec->tkGeomMgr, mgr); Tk_CreateEventHandler(slave->slaveWindow, - SlaveEventMask, SlaveEventHandler, slave); + StructureNotifyMask, ContentLostEventHandler, slave); ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } @@ -288,18 +287,18 @@ static void RemoveSlave(Ttk_Manager *mgr, TkSizeT index) /* Remove from array: */ - --mgr->nSlaves; - for (i = index ; i < mgr->nSlaves; ++i) { + --mgr->nManaged; + for (i = index ; i < mgr->nManaged; ++i) { mgr->slaves[i] = mgr->slaves[i+1]; } /* Clean up: */ Tk_DeleteEventHandler( - slave->slaveWindow, SlaveEventMask, SlaveEventHandler, slave); + slave->slaveWindow, StructureNotifyMask, ContentLostEventHandler, slave); /* Note [1] */ - Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow); + Tk_UnmaintainGeometry(slave->slaveWindow, mgr->window); Tk_UnmapWindow(slave->slaveWindow); DeleteSlave(slave); @@ -314,12 +313,12 @@ static void RemoveSlave(Ttk_Manager *mgr, TkSizeT index) void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; - int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow); + TkSizeT index = Ttk_SlaveIndex(mgr, slaveWindow); int reqWidth = Tk_ReqWidth(slaveWindow); int reqHeight= Tk_ReqHeight(slaveWindow); if (mgr->managerSpec->SlaveRequest( - mgr->managerData, slaveIndex, reqWidth, reqHeight)) + mgr->managerData, index, reqWidth, reqHeight)) { ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } @@ -328,7 +327,7 @@ void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow) void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; - int index = Ttk_SlaveIndex(mgr, slaveWindow); + TkSizeT index = Ttk_SlaveIndex(mgr, slaveWindow); /* ASSERT: index >= 0 */ RemoveSlave(mgr, index); @@ -351,10 +350,10 @@ void Ttk_InsertSlave( /* ++ Ttk_ForgetSlave -- * Unmanage the specified slave. */ -void Ttk_ForgetSlave(Ttk_Manager *mgr, TkSizeT slaveIndex) +void Ttk_ForgetSlave(Ttk_Manager *mgr, TkSizeT index) { - Tk_Window slaveWindow = mgr->slaves[slaveIndex]->slaveWindow; - RemoveSlave(mgr, slaveIndex); + Tk_Window slaveWindow = mgr->slaves[index]->slaveWindow; + RemoveSlave(mgr, index); Tk_ManageGeometry(slaveWindow, NULL, 0); } @@ -366,12 +365,12 @@ void Ttk_ForgetSlave(Ttk_Manager *mgr, TkSizeT slaveIndex) * map the slave. */ void Ttk_PlaceSlave( - Ttk_Manager *mgr, TkSizeT slaveIndex, int x, int y, int width, int height) + Ttk_Manager *mgr, TkSizeT 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); + Ttk_Slave *slave = mgr->slaves[index]; + Tk_MaintainGeometry(slave->slaveWindow,mgr->window,x,y,width,height); slave->flags |= SLAVE_MAPPED; - if (Tk_IsMapped(mgr->masterWindow)) { + if (Tk_IsMapped(mgr->window)) { Tk_MapWindow(slave->slaveWindow); } } @@ -379,10 +378,10 @@ void Ttk_PlaceSlave( /* ++ Ttk_UnmapSlave -- * Unmap the specified slave, but leave it managed. */ -void Ttk_UnmapSlave(Ttk_Manager *mgr, TkSizeT slaveIndex) +void Ttk_UnmapSlave(Ttk_Manager *mgr, TkSizeT index) { - Ttk_Slave *slave = mgr->slaves[slaveIndex]; - Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow); + Ttk_Slave *slave = mgr->slaves[index]; + Tk_UnmaintainGeometry(slave->slaveWindow, mgr->window); slave->flags &= ~SLAVE_MAPPED; /* Contrary to documentation, Tk_UnmaintainGeometry doesn't always * unmap the slave: @@ -407,15 +406,15 @@ void Ttk_ManagerSizeChanged(Ttk_Manager *mgr) */ TkSizeT Ttk_NumberSlaves(Ttk_Manager *mgr) { - return mgr->nSlaves; + return mgr->nManaged; } -void *Ttk_SlaveData(Ttk_Manager *mgr, TkSizeT slaveIndex) +void *Ttk_SlaveData(Ttk_Manager *mgr, TkSizeT index) { - return mgr->slaves[slaveIndex]->slaveData; + return mgr->slaves[index]->slaveData; } -Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, TkSizeT slaveIndex) +Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, TkSizeT index) { - return mgr->slaves[slaveIndex]->slaveWindow; + return mgr->slaves[index]->slaveWindow; } /*------------------------------------------------------------------------ @@ -428,15 +427,15 @@ Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, TkSizeT slaveIndex) TkSizeT Ttk_SlaveIndex(Ttk_Manager *mgr, Tk_Window slaveWindow) { TkSizeT index; - for (index = 0; index < mgr->nSlaves; ++index) + for (index = 0; index < mgr->nManaged; ++index) if (mgr->slaves[index]->slaveWindow == slaveWindow) return index; return TCL_INDEX_NONE; } /* ++ Ttk_GetSlaveIndexFromObj(interp, mgr, objPtr, indexPtr) -- - * Return the index of the slave specified by objPtr. - * Slaves may be specified as an integer index or + * 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: @@ -447,41 +446,41 @@ int Ttk_GetSlaveIndexFromObj( Tcl_Interp *interp, Ttk_Manager *mgr, Tcl_Obj *objPtr, TkSizeT *indexPtr) { const char *string = Tcl_GetString(objPtr); - TkSizeT slaveIndex = 0; + TkSizeT index = 0; Tk_Window tkwin; /* Try interpreting as an integer first: */ - if (TkGetIntForIndex(objPtr, mgr->nSlaves - 1, 1, &slaveIndex) == TCL_OK) { - if ((size_t)slaveIndex > (size_t)mgr->nSlaves) { + if (TkGetIntForIndex(objPtr, mgr->nManaged - 1, 1, &index) == TCL_OK) { + if (index + 1 > mgr->nManaged + 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "Slave index %d out of bounds", (int)slaveIndex)); - Tcl_SetErrorCode(interp, "TTK", "SLAVE", "INDEX", NULL); + "Managed window index %d out of bounds", (int)index)); + Tcl_SetErrorCode(interp, "TTK", "MANAGED", "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 == TCL_INDEX_NONE) { + (tkwin = Tk_NameToWindow(interp, string, mgr->window))) { + index = Ttk_SlaveIndex(mgr, tkwin); + if (index == TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s is not managed by %s", string, - Tk_PathName(mgr->masterWindow))); - Tcl_SetErrorCode(interp, "TTK", "SLAVE", "MANAGER", NULL); + Tk_PathName(mgr->window))); + Tcl_SetErrorCode(interp, "TTK", "MANAGED", "MANAGER", NULL); return TCL_ERROR; } - *indexPtr = slaveIndex; + *indexPtr = index; return TCL_OK; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "Invalid slave specification %s", string)); - Tcl_SetErrorCode(interp, "TTK", "SLAVE", "SPEC", NULL); + "Invalid managed window specification %s", string)); + Tcl_SetErrorCode(interp, "TTK", "MANAGED", "SPEC", NULL); return TCL_ERROR; } @@ -511,22 +510,22 @@ void Ttk_ReorderSlave(Ttk_Manager *mgr, TkSizeT fromIndex, TkSizeT 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; } @@ -541,7 +540,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 838e261..172e33c 100644 --- a/generic/ttk/ttkManager.h +++ b/generic/ttk/ttkManager.h @@ -14,7 +14,7 @@ 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(). @@ -45,7 +45,7 @@ MODULE_SCOPE void Ttk_LostSlaveProc(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( @@ -78,15 +78,15 @@ MODULE_SCOPE int Ttk_GetSlaveIndexFromObj( /* Accessor functions: */ MODULE_SCOPE TkSizeT Ttk_NumberSlaves(Ttk_Manager *); - /* Returns: number of managed slaves */ + /* Returns: number of managed windows */ -MODULE_SCOPE void *Ttk_SlaveData(Ttk_Manager *, TkSizeT slaveIndex); - /* Returns: client data associated with slave */ +MODULE_SCOPE void *Ttk_SlaveData(Ttk_Manager *, TkSizeT index); + /* Returns: client data associated with managed window */ MODULE_SCOPE Tk_Window Ttk_SlaveWindow(Ttk_Manager *, TkSizeT slaveIndex); /* Returns: slave 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/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 09b633b..946ad48 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -212,7 +212,7 @@ static int ShoveDown(Paned *pw, TkSizeT i, int pos) int sashThickness = pw->paned.sashThickness; if (i == Ttk_NumberSlaves(pw->paned.mgr) - 1) { - pos = pane->sashPos; /* Sentinel value == master window size */ + pos = pane->sashPos; /* Sentinel value == container window size */ } else { Pane *nextPane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i+1); if (pos + sashThickness > nextPane->sashPos) @@ -441,7 +441,7 @@ static int AddPane( /* PaneRequest -- * Only update pane request size if slave is currently unmapped. - * Geometry requests from mapped slaves are not directly honored + * Geometry requests from mapped panes are not directly honored * in order to avoid unexpected pane resizes (esp. while the * user is dragging a sash [#1325286]). */ |