From 1a1f6bb851a8f05fd555d9e28bc01edea61adef5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 3 Sep 2020 20:45:19 +0000 Subject: Consolidate Tk 8.7 error-messages regarding TIP #581. More Master -> Container related (internal) changes --- doc/ManageGeom.3 | 14 +- generic/tk.h | 8 +- generic/tkCanvWind.c | 16 +- generic/tkFrame.c | 16 +- generic/tkGeometry.c | 10 +- generic/tkGrid.c | 488 ++++++++++++++++++++--------------------- generic/tkImage.c | 26 +-- generic/tkImgBmap.c | 42 ++-- generic/tkImgPhInstance.c | 18 +- generic/tkImgPhoto.c | 110 +++++----- generic/tkImgPhoto.h | 10 +- generic/tkInt.h | 4 +- generic/tkOldConfig.c | 2 +- generic/tkPack.c | 322 +++++++++++++-------------- generic/tkPlace.c | 507 +++++++++++++++++++++---------------------- generic/tkTextWind.c | 2 +- generic/ttk/ttkManager.c | 20 +- generic/ttk/ttkManager.h | 4 +- generic/ttk/ttkNotebook.c | 74 +++---- generic/ttk/ttkPanedwindow.c | 66 +++--- library/tk.tcl | 4 +- library/ttk/combobox.tcl | 14 +- macosx/tkMacOSXWm.c | 12 +- tests/grid.test | 10 +- tests/imgPhoto.test | 8 +- tests/packgrid.test | 16 +- tests/unixWm.test | 2 +- tests/wm.test | 16 +- unix/tkUnixWm.c | 14 +- win/tkWinWm.c | 12 +- 30 files changed, 933 insertions(+), 934 deletions(-) diff --git a/doc/ManageGeom.3 b/doc/ManageGeom.3 index ba12aca..25f4886 100644 --- a/doc/ManageGeom.3 +++ b/doc/ManageGeom.3 @@ -44,7 +44,7 @@ the geometry manager: typedef struct { const char *\fIname\fR; Tk_GeomRequestProc *\fIrequestProc\fR; - Tk_GeomLostSlaveProc *\fIlostSlaveProc\fR; + Tk_GeomLostContentProc *\fIlostContentProc\fR; } \fBTk_GeomMgr\fR; .CE The \fIname\fR field is the textual name for the geometry manager, @@ -67,24 +67,24 @@ corresponding parameters passed to \fBTk_ManageGeometry\fR. structure containing application-specific information about how to manage \fItkwin\fR's geometry. .PP -The \fIlostSlaveProc\fR field of \fImgrPtr\fR points to another +The \fIlostContentProc\fR field of \fImgrPtr\fR points to another procedure in the geometry manager. -Tk will invoke \fIlostSlaveProc\fR if some other manager +Tk will invoke \fIlostContentProc\fR if some other manager calls \fBTk_ManageGeometry\fR to claim \fItkwin\fR away from the current geometry manager. -\fIlostSlaveProc\fR is not invoked if \fBTk_ManageGeometry\fR is +\fIlostContentProc\fR is not invoked if \fBTk_ManageGeometry\fR is called with a NULL value for \fImgrPtr\fR (presumably the current geometry manager has made this call, so it already knows that the window is no longer managed), nor is it called if \fImgrPtr\fR is the same as the window's current geometry manager. -\fIlostSlaveProc\fR should have +\fIlostContentProc\fR should have arguments and results that match the following prototype: .CS -typedef void \fBTk_GeomLostSlaveProc\fR( +typedef void \fBTk_GeomLostContentProc\fR( ClientData \fIclientData\fR, Tk_Window \fItkwin\fR); .CE -The parameters to \fIlostSlaveProc\fR will be identical to the +The parameters to \fIlostContentProc\fR will be identical to the corresponding parameters passed to \fBTk_ManageGeometry\fR. .SH KEYWORDS callback, geometry, managed, request, unmanaged diff --git a/generic/tk.h b/generic/tk.h index 8b0619d..9672110 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -122,14 +122,14 @@ extern "C" { * Dummy types that are used by clients: */ -#define Tk_ImageModel Tk_ImageMaster +#define Tk_ImageMaster Tk_ImageModel typedef struct Tk_BindingTable_ *Tk_BindingTable; typedef struct Tk_Canvas_ *Tk_Canvas; typedef struct Tk_Cursor_ *Tk_Cursor; typedef struct Tk_ErrorHandler_ *Tk_ErrorHandler; typedef struct Tk_Font_ *Tk_Font; typedef struct Tk_Image__ *Tk_Image; -typedef struct Tk_ImageMaster_ *Tk_ImageModel; +typedef struct Tk_ImageModel_ *Tk_ImageModel; typedef struct Tk_OptionTable_ *Tk_OptionTable; typedef struct Tk_PostscriptInfo_ *Tk_PostscriptInfo; typedef struct Tk_TextLayout_ *Tk_TextLayout; @@ -651,7 +651,7 @@ typedef struct Tk_ClassProcs { * the geometry manager to carry out certain functions. */ -#define Tk_GeomLostContentProc Tk_GeomLostSlaveProc +#define Tk_GeomLostSlaveProc Tk_GeomLostContentProc typedef void (Tk_GeomRequestProc) (ClientData clientData, Tk_Window tkwin); typedef void (Tk_GeomLostContentProc) (ClientData clientData, Tk_Window tkwin); @@ -662,7 +662,7 @@ typedef struct Tk_GeomMgr { Tk_GeomRequestProc *requestProc; /* Procedure to invoke when a slave's * requested geometry changes. */ - Tk_GeomLostContentProc *lostSlaveProc; + Tk_GeomLostContentProc *lostContentProc; /* Procedure to invoke when a slave is taken * away from one geometry manager by another. * NULL means geometry manager doesn't care diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index 8028c14..2fd799f 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -87,7 +87,7 @@ static void TranslateWinItem(Tk_Canvas canvas, static int WinItemCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); -static void WinItemLostSlaveProc(ClientData clientData, +static void WinItemLostContentProc(ClientData clientData, Tk_Window tkwin); static void WinItemRequestProc(ClientData clientData, Tk_Window tkwin); @@ -144,7 +144,7 @@ Tk_ItemType tkWindowType = { static const Tk_GeomMgr canvasGeomType = { "canvas", /* name */ WinItemRequestProc, /* requestProc */ - WinItemLostSlaveProc, /* lostSlaveProc */ + WinItemLostContentProc, /* lostContentProc */ }; /* @@ -1102,25 +1102,25 @@ WinItemRequestProc( /* *-------------------------------------------------------------- * - * WinItemLostSlaveProc -- + * WinItemLostContentProc -- * * This function is invoked by Tk whenever some other geometry claims - * control over a slave that used to be managed by us. + * control over a content window that used to be managed by us. * * Results: * None. * * Side effects: - * Forgets all canvas-related information about the slave. + * Forgets all canvas-related information about the content window. * *-------------------------------------------------------------- */ static void -WinItemLostSlaveProc( - ClientData clientData, /* WindowItem structure for slave window that +WinItemLostContentProc( + ClientData clientData, /* WindowItem structure for content window window that * was stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + Tk_Window tkwin) /* Tk's handle for the content window window. */ { WindowItem *winItemPtr = (WindowItem *)clientData; Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas); diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 726594a..696d2f5 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -344,7 +344,7 @@ static void FrameBgImageProc(ClientData clientData, static void FrameCmdDeletedProc(ClientData clientData); static void FrameEventProc(ClientData clientData, XEvent *eventPtr); -static void FrameLostSlaveProc(ClientData clientData, +static void FrameLostContentProc(ClientData clientData, Tk_Window tkwin); static void FrameRequestProc(ClientData clientData, Tk_Window tkwin); @@ -376,7 +376,7 @@ static const Tk_ClassProcs frameClass = { static const Tk_GeomMgr frameGeomType = { "labelframe", /* name */ FrameRequestProc, /* requestProc */ - FrameLostSlaveProc /* lostSlaveProc */ + FrameLostContentProc /* lostContentProc */ }; /* @@ -2016,25 +2016,25 @@ FrameRequestProc( /* *-------------------------------------------------------------- * - * FrameLostSlaveProc -- + * FrameLostContentProc -- * * This function is invoked by Tk whenever some other geometry claims - * control over a slave that used to be managed by us. + * control over a content window that used to be managed by us. * * Results: * None. * * Side effects: - * Forgets all frame-related information about the slave. + * Forgets all frame-related information about the content window. * *-------------------------------------------------------------- */ static void -FrameLostSlaveProc( - ClientData clientData, /* Frame structure for slave window that was +FrameLostContentProc( + ClientData clientData, /* Frame structure for content window window that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + Tk_Window tkwin) /* Tk's handle for the content window window. */ { Frame *framePtr = (Frame *)clientData; Labelframe *labelframePtr = (Labelframe *)clientData; diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 3fca474..9bc1ae6 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -75,7 +75,7 @@ static void MaintainSlaveProc(ClientData clientData, * previous geometry manager. The geometry manager will be notified (by * calling procedures in *mgrPtr) when interesting things happen in the * future. If there was an existing geometry manager for tkwin different - * from the new one, it is notified by calling its lostSlaveProc. + * from the new one, it is notified by calling its lostContentProc. * *-------------------------------------------------------------- */ @@ -95,8 +95,8 @@ Tk_ManageGeometry( if ((winPtr->geomMgrPtr != NULL) && (mgrPtr != NULL) && ((winPtr->geomMgrPtr != mgrPtr) || (winPtr->geomData != clientData)) - && (winPtr->geomMgrPtr->lostSlaveProc != NULL)) { - winPtr->geomMgrPtr->lostSlaveProc(winPtr->geomData, tkwin); + && (winPtr->geomMgrPtr->lostContentProc != NULL)) { + winPtr->geomMgrPtr->lostContentProc(winPtr->geomData, tkwin); } winPtr->geomMgrPtr = mgrPtr; @@ -333,8 +333,8 @@ TkSetGeometryContainer( if (winPtr->geomMgrName != NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "cannot use geometry manager %s inside %s which already" - " has slaves managed by %s", + "cannot use geometry manager %s inside %s because" + " %s is already managing it's content windows", name, Tk_PathName(tkwin), winPtr->geomMgrName)); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "FIGHT", NULL); } diff --git a/generic/tkGrid.c b/generic/tkGrid.c index fa2acc5..b016fc8 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -144,7 +144,7 @@ typedef struct { * container. */ Tk_Anchor anchor; /* Value of anchor option: specifies where a * grid without weight should be placed. */ -} GridMaster; +} GridContainer; /* * For each window that the grid cares about (either because the window is @@ -162,9 +162,9 @@ typedef struct Gridder { * managed by the gridder). */ 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 + struct Gridder *contentPtr; /* First in list of slaves managed inside this * window (NULL means no grid slaves). */ - GridMaster *containerDataPtr; /* Additional data for geometry container. */ + GridContainer *containerDataPtr; /* Additional data for geometry container. */ Tcl_Obj *in; /* Store container name when removed. */ int column, row; /* Location in the grid (starting from * zero). */ @@ -253,7 +253,7 @@ typedef struct UniformGroup { * Prototypes for procedures used only in this file: */ -static void AdjustForSticky(Gridder *slavePtr, int *xPtr, +static void AdjustForSticky(Gridder *contentPtr, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); static int AdjustOffsets(int width, int elements, SlotInfo *slotPtr); @@ -288,7 +288,7 @@ static int GridContentCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void GridStructureProc(ClientData clientData, XEvent *eventPtr); -static void GridLostSlaveProc(ClientData clientData, +static void GridLostContentProc(ClientData clientData, Tk_Window tkwin); static void GridReqProc(ClientData clientData, Tk_Window tkwin); static void InitMasterData(Gridder *containerPtr); @@ -297,9 +297,9 @@ static Tcl_Obj * NewQuadObj(Tcl_WideInt, Tcl_WideInt, Tcl_WideInt, Tcl_WideInt); static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn, int maxOffset); static void SetGridSize(Gridder *gridPtr); -static int SetSlaveColumn(Tcl_Interp *interp, Gridder *slavePtr, +static int SetSlaveColumn(Tcl_Interp *interp, Gridder *contentPtr, int column, int numCols); -static int SetSlaveRow(Tcl_Interp *interp, Gridder *slavePtr, +static int SetSlaveRow(Tcl_Interp *interp, Gridder *contentPtr, int row, int numRows); static Tcl_Obj * StickyToObj(int flags); static int StringToSticky(const char *string); @@ -308,7 +308,7 @@ static void Unlink(Gridder *gridPtr); static const Tk_GeomMgr gridMgrType = { "grid", /* name */ GridReqProc, /* requestProc */ - GridLostSlaveProc, /* lostSlaveProc */ + GridLostContentProc, /* lostContentProc */ }; /* @@ -434,7 +434,7 @@ GridAnchorCommand( { Tk_Window container; Gridder *containerPtr; - GridMaster *gridPtr; + GridContainer *gridPtr; Tk_Anchor old; if (objc > 4) { @@ -503,7 +503,7 @@ GridBboxCommand( { Tk_Window container; Gridder *containerPtr; /* container grid record */ - GridMaster *gridPtr; /* pointer to grid data */ + GridContainer *gridPtr; /* pointer to grid data */ int row, column; /* origin for bounding box */ int row2, column2; /* end of bounding box */ int endX, endY; /* last column/row in the layout */ @@ -632,7 +632,7 @@ GridForgetRemoveCommand( Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window slave; - Gridder *slavePtr; + Gridder *contentPtr; int i; const char *string = Tcl_GetString(objv[1]); char c = string[0]; @@ -642,56 +642,56 @@ GridForgetRemoveCommand( return TCL_ERROR; } - slavePtr = GetGrid(slave); - if (slavePtr->containerPtr != NULL) { + contentPtr = GetGrid(slave); + if (contentPtr->containerPtr != NULL) { /* * For "forget", reset all the settings to their defaults */ if (c == 'f') { - slavePtr->column = -1; - slavePtr->row = -1; - slavePtr->numCols = 1; - slavePtr->numRows = 1; - slavePtr->padX = 0; - slavePtr->padY = 0; - slavePtr->padLeft = 0; - slavePtr->padTop = 0; - slavePtr->iPadX = 0; - slavePtr->iPadY = 0; - if (slavePtr->in != NULL) { - Tcl_DecrRefCount(slavePtr->in); - slavePtr->in = NULL; + contentPtr->column = -1; + contentPtr->row = -1; + contentPtr->numCols = 1; + contentPtr->numRows = 1; + contentPtr->padX = 0; + contentPtr->padY = 0; + contentPtr->padLeft = 0; + contentPtr->padTop = 0; + contentPtr->iPadX = 0; + contentPtr->iPadY = 0; + if (contentPtr->in != NULL) { + Tcl_DecrRefCount(contentPtr->in); + contentPtr->in = NULL; } - slavePtr->doubleBw = 2*Tk_Changes(tkwin)->border_width; - if (slavePtr->flags & REQUESTED_RELAYOUT) { - Tcl_CancelIdleCall(ArrangeGrid, slavePtr); + contentPtr->doubleBw = 2*Tk_Changes(tkwin)->border_width; + if (contentPtr->flags & REQUESTED_RELAYOUT) { + Tcl_CancelIdleCall(ArrangeGrid, contentPtr); } - slavePtr->flags = 0; - slavePtr->sticky = 0; + contentPtr->flags = 0; + contentPtr->sticky = 0; } else { /* * When removing, store name of container to be able to * restore it later, even if the container is recreated. */ - if (slavePtr->in != NULL) { - Tcl_DecrRefCount(slavePtr->in); - slavePtr->in = NULL; + if (contentPtr->in != NULL) { + Tcl_DecrRefCount(contentPtr->in); + contentPtr->in = NULL; } - if (slavePtr->containerPtr != NULL) { - slavePtr->in = Tcl_NewStringObj( - Tk_PathName(slavePtr->containerPtr->tkwin), -1); - Tcl_IncrRefCount(slavePtr->in); + if (contentPtr->containerPtr != NULL) { + contentPtr->in = Tcl_NewStringObj( + Tk_PathName(contentPtr->containerPtr->tkwin), -1); + Tcl_IncrRefCount(contentPtr->in); } } Tk_ManageGeometry(slave, NULL, NULL); - if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->containerPtr->tkwin); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, + contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } } return TCL_OK; @@ -721,7 +721,7 @@ GridInfoCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Gridder *slavePtr; + Gridder *contentPtr; Tk_Window slave; Tcl_Obj *infoObj; @@ -732,29 +732,29 @@ GridInfoCommand( if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) { return TCL_ERROR; } - slavePtr = GetGrid(slave); - if (slavePtr->containerPtr == NULL) { + contentPtr = GetGrid(slave); + if (contentPtr->containerPtr == NULL) { Tcl_ResetResult(interp); return TCL_OK; } infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), - Tk_NewWindowObj(slavePtr->containerPtr->tkwin)); + Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1), - Tcl_NewWideIntObj(slavePtr->column)); + Tcl_NewWideIntObj(contentPtr->column)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1), - Tcl_NewWideIntObj(slavePtr->row)); + Tcl_NewWideIntObj(contentPtr->row)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", -1), - Tcl_NewWideIntObj(slavePtr->numCols)); + Tcl_NewWideIntObj(contentPtr->numCols)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", -1), - Tcl_NewWideIntObj(slavePtr->numRows)); - TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX); - TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY); - TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft, slavePtr->padX); - TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY); + Tcl_NewWideIntObj(contentPtr->numRows)); + TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX); + TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY); + TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft, contentPtr->padX); + TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-sticky", -1), - StickyToObj(slavePtr->sticky)); + StickyToObj(contentPtr->sticky)); Tcl_SetObjResult(interp, infoObj); return TCL_OK; } @@ -785,7 +785,7 @@ GridLocationCommand( { Tk_Window container; Gridder *containerPtr; /* Master grid record. */ - GridMaster *gridPtr; /* Pointer to grid data. */ + GridContainer *gridPtr; /* Pointer to grid data. */ SlotInfo *slotPtr; int x, y; /* Offset in pixels, from edge of container. */ int i, j; /* Corresponding column and row indeces. */ @@ -909,7 +909,7 @@ GridPropagateCommand( * If we have slaves, we need to register as geometry container. */ - if (containerPtr->slavePtr != NULL) { + if (containerPtr->contentPtr != NULL) { if (TkSetGeometryContainer(interp, container, "grid") != TCL_OK) { return TCL_ERROR; } @@ -965,7 +965,7 @@ GridRowColumnConfigureCommand( Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window container, slave; - Gridder *containerPtr, *slavePtr; + Gridder *containerPtr, *contentPtr; SlotInfo *slotPtr = NULL; int slot; /* the column or row number */ int slotType; /* COLUMN or ROW */ @@ -1107,7 +1107,7 @@ GridRowColumnConfigureCommand( if (Tcl_GetIntFromObj(NULL, lObjv[j], &slot) == TCL_OK) { first = slot; last = slot; - slavePtr = NULL; + contentPtr = NULL; } else if (strcmp(Tcl_GetString(lObjv[j]), "all") == 0) { /* * Make sure container is initialised. @@ -1115,8 +1115,8 @@ GridRowColumnConfigureCommand( InitMasterData(containerPtr); - slavePtr = containerPtr->slavePtr; - if (slavePtr == NULL) { + contentPtr = containerPtr->contentPtr; + if (contentPtr == NULL) { continue; } allSlaves = 1; @@ -1126,8 +1126,8 @@ GridRowColumnConfigureCommand( * Is it gridded in this container? */ - slavePtr = GetGrid(slave); - if (slavePtr->containerPtr != containerPtr) { + contentPtr = GetGrid(slave); + if (contentPtr->containerPtr != containerPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the window \"%s\" is not managed by \"%s\"", Tcl_GetString(lObjv[j]), Tcl_GetString(objv[2]))); @@ -1148,11 +1148,11 @@ GridRowColumnConfigureCommand( */ do { - if (slavePtr != NULL) { + if (contentPtr != NULL) { first = (slotType == COLUMN) ? - slavePtr->column : slavePtr->row; + contentPtr->column : contentPtr->row; last = first - 1 + ((slotType == COLUMN) ? - slavePtr->numCols : slavePtr->numRows); + contentPtr->numCols : contentPtr->numRows); } for (slot = first; slot <= last; slot++) { @@ -1222,10 +1222,10 @@ GridRowColumnConfigureCommand( } } } - if (slavePtr != NULL) { - slavePtr = slavePtr->nextPtr; + if (contentPtr != NULL) { + contentPtr = contentPtr->nextPtr; } - } while ((allSlaves == 1) && (slavePtr != NULL)); + } while ((allSlaves == 1) && (contentPtr != NULL)); } Tcl_DecrRefCount(listCopy); @@ -1299,7 +1299,7 @@ GridSizeCommand( { Tk_Window container; Gridder *containerPtr; - GridMaster *gridPtr; /* pointer to grid data */ + GridContainer *gridPtr; /* pointer to grid data */ if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -1350,7 +1350,7 @@ GridContentCommand( { Tk_Window container; Gridder *containerPtr; /* container grid record */ - Gridder *slavePtr; + Gridder *contentPtr; int i, value, index; int row = -1, column = -1; static const char *const optionStrings[] = { @@ -1391,17 +1391,17 @@ GridContentCommand( containerPtr = GetGrid(container); res = Tcl_NewListObj(0, NULL); - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - if ((column >= 0) && (slavePtr->column > column - || slavePtr->column+slavePtr->numCols-1 < column)) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + if ((column >= 0) && (contentPtr->column > column + || contentPtr->column+contentPtr->numCols-1 < column)) { continue; } - if ((row >= 0) && (slavePtr->row > row || - slavePtr->row+slavePtr->numRows-1 < row)) { + if ((row >= 0) && (contentPtr->row > row || + contentPtr->row+contentPtr->numRows-1 < row)) { continue; } - Tcl_ListObjAppendElement(interp,res, Tk_NewWindowObj(slavePtr->tkwin)); + Tcl_ListObjAppendElement(interp,res, Tk_NewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, res); return TCL_OK; @@ -1444,7 +1444,7 @@ GridReqProc( /* *---------------------------------------------------------------------- * - * GridLostSlaveProc -- + * GridLostContentProc -- * * This procedure is invoked by Tk whenever some other geometry claims * control over a slave that used to be managed by us. @@ -1459,18 +1459,18 @@ GridReqProc( */ static void -GridLostSlaveProc( +GridLostContentProc( ClientData clientData, /* Grid structure for content window that was * stolen away. */ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */ { - Gridder *slavePtr = (Gridder *)clientData; + Gridder *contentPtr = (Gridder *)clientData; - if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } /* @@ -1659,7 +1659,7 @@ AdjustOffsets( static void AdjustForSticky( - Gridder *slavePtr, /* Slave window to arrange in its cavity. */ + Gridder *contentPtr, /* Slave window to arrange in its cavity. */ int *xPtr, /* Pixel location of the left edge of the cavity. */ int *yPtr, /* Pixel location of the top edge of the cavity. */ int *widthPtr, /* Width of the cavity (in pixels). */ @@ -1667,21 +1667,21 @@ AdjustForSticky( { int diffx = 0; /* Cavity width - slave width. */ int diffy = 0; /* Cavity hight - slave height. */ - int sticky = slavePtr->sticky; + int sticky = contentPtr->sticky; - *xPtr += slavePtr->padLeft; - *widthPtr -= slavePtr->padX; - *yPtr += slavePtr->padTop; - *heightPtr -= slavePtr->padY; + *xPtr += contentPtr->padLeft; + *widthPtr -= contentPtr->padX; + *yPtr += contentPtr->padTop; + *heightPtr -= contentPtr->padY; - if (*widthPtr > (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX)) { - diffx = *widthPtr - (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX); - *widthPtr = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX; + if (*widthPtr > (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX)) { + diffx = *widthPtr - (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX); + *widthPtr = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX; } - if (*heightPtr > (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY)) { - diffy = *heightPtr - (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY); - *heightPtr = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY; + if (*heightPtr > (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY)) { + diffy = *heightPtr - (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY); + *heightPtr = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY; } if (sticky&STICK_EAST && sticky&STICK_WEST) { @@ -1723,8 +1723,8 @@ ArrangeGrid( * are to be re-layed out. */ { Gridder *containerPtr = (Gridder *)clientData; - Gridder *slavePtr; - GridMaster *slotPtr = containerPtr->containerDataPtr; + Gridder *contentPtr; + GridContainer *slotPtr = containerPtr->containerDataPtr; int abort; int width, height; /* Requested size of layout, in pixels. */ int realWidth, realHeight; /* Actual size layout should take-up. */ @@ -1738,7 +1738,7 @@ ArrangeGrid( * so another geometry manager can take over. */ - if (containerPtr->slavePtr == NULL) { + if (containerPtr->contentPtr == NULL) { return; } @@ -1816,23 +1816,23 @@ ArrangeGrid( * cavity size, and adjusting the widget according to its stickyness. */ - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL && !abort; - slavePtr = slavePtr->nextPtr) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort; + contentPtr = contentPtr->nextPtr) { int x, y; /* Top left coordinate */ int width, height; /* Slot or slave size */ - int col = slavePtr->column; - int row = slavePtr->row; + int col = contentPtr->column; + int row = contentPtr->row; x = (col>0) ? slotPtr->columnPtr[col-1].offset : 0; y = (row>0) ? slotPtr->rowPtr[row-1].offset : 0; - width = slotPtr->columnPtr[slavePtr->numCols+col-1].offset - x; - height = slotPtr->rowPtr[slavePtr->numRows+row-1].offset - y; + width = slotPtr->columnPtr[contentPtr->numCols+col-1].offset - x; + height = slotPtr->rowPtr[contentPtr->numRows+row-1].offset - y; x += slotPtr->startX; y += slotPtr->startY; - AdjustForSticky(slavePtr, &x, &y, &width, &height); + AdjustForSticky(contentPtr, &x, &y, &width, &height); /* * Now put the window in the proper spot. (This was taken directly @@ -1840,15 +1840,15 @@ ArrangeGrid( * here. Otherwise let Tk_MaintainGeometry do the work. */ - if (containerPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { + if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) { if ((width <= 0) || (height <= 0)) { - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - if ((x != Tk_X(slavePtr->tkwin)) - || (y != Tk_Y(slavePtr->tkwin)) - || (width != Tk_Width(slavePtr->tkwin)) - || (height != Tk_Height(slavePtr->tkwin))) { - Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height); + if ((x != Tk_X(contentPtr->tkwin)) + || (y != Tk_Y(contentPtr->tkwin)) + || (width != Tk_Width(contentPtr->tkwin)) + || (height != Tk_Height(contentPtr->tkwin))) { + Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height); } if (abort) { break; @@ -1860,14 +1860,14 @@ ArrangeGrid( */ if (Tk_IsMapped(containerPtr->tkwin)) { - Tk_MapWindow(slavePtr->tkwin); + Tk_MapWindow(contentPtr->tkwin); } } } else if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, containerPtr->tkwin); - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, containerPtr->tkwin, x, y, + Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y, width, height); } } @@ -1904,7 +1904,7 @@ ResolveConstraints( * pixels, or 0 (not currently used). */ { SlotInfo *slotPtr; /* Pointer to row/col constraints. */ - Gridder *slavePtr; /* List of slave windows in this grid. */ + Gridder *contentPtr; /* List of slave windows in this grid. */ int constraintCount; /* Count of rows or columns that have * constraints. */ int slotCount; /* Last occupied row or column. */ @@ -2009,17 +2009,17 @@ ResolveConstraints( switch (slotType) { case COLUMN: - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - int rightEdge = slavePtr->column + slavePtr->numCols - 1; - - slavePtr->size = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->padX - + slavePtr->iPadX + slavePtr->doubleBw; - if (slavePtr->numCols > 1) { - slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; - layoutPtr[rightEdge].binNextPtr = slavePtr; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + int rightEdge = contentPtr->column + contentPtr->numCols - 1; + + contentPtr->size = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->padX + + contentPtr->iPadX + contentPtr->doubleBw; + if (contentPtr->numCols > 1) { + contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; + layoutPtr[rightEdge].binNextPtr = contentPtr; } else if (rightEdge >= 0) { - int size = slavePtr->size + layoutPtr[rightEdge].pad; + int size = contentPtr->size + layoutPtr[rightEdge].pad; if (size > layoutPtr[rightEdge].minSize) { layoutPtr[rightEdge].minSize = size; @@ -2028,17 +2028,17 @@ ResolveConstraints( } break; case ROW: - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - int rightEdge = slavePtr->row + slavePtr->numRows - 1; - - slavePtr->size = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->padY - + slavePtr->iPadY + slavePtr->doubleBw; - if (slavePtr->numRows > 1) { - slavePtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; - layoutPtr[rightEdge].binNextPtr = slavePtr; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + int rightEdge = contentPtr->row + contentPtr->numRows - 1; + + contentPtr->size = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->padY + + contentPtr->iPadY + contentPtr->doubleBw; + if (contentPtr->numRows > 1) { + contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr; + layoutPtr[rightEdge].binNextPtr = contentPtr; } else if (rightEdge >= 0) { - int size = slavePtr->size + layoutPtr[rightEdge].pad; + int size = contentPtr->size + layoutPtr[rightEdge].pad; if (size > layoutPtr[rightEdge].minSize) { layoutPtr[rightEdge].minSize = size; @@ -2134,11 +2134,11 @@ ResolveConstraints( for (offset=0,slot=0; slot < gridCount; slot++) { layoutPtr[slot].minOffset = layoutPtr[slot].minSize + offset; - for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL; - slavePtr = slavePtr->binNextPtr) { + for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL; + contentPtr = contentPtr->binNextPtr) { int span = (slotType == COLUMN) ? - slavePtr->numCols : slavePtr->numRows; - int required = slavePtr->size + layoutPtr[slot - span].minOffset; + contentPtr->numCols : contentPtr->numRows; + int required = contentPtr->size + layoutPtr[slot - span].minOffset; if (required > layoutPtr[slot].minOffset) { layoutPtr[slot].minOffset = required; @@ -2170,11 +2170,11 @@ ResolveConstraints( layoutPtr[slot].maxOffset = offset; } for (slot=gridCount-1; slot > 0;) { - for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL; - slavePtr = slavePtr->binNextPtr) { + for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL; + contentPtr = contentPtr->binNextPtr) { int span = (slotType == COLUMN) ? - slavePtr->numCols : slavePtr->numRows; - int require = offset - slavePtr->size; + contentPtr->numCols : contentPtr->numRows; + int require = offset - contentPtr->size; int startSlot = slot - span; if (startSlot >=0 && require < layoutPtr[startSlot].maxOffset) { @@ -2446,7 +2446,7 @@ GetGrid( gridPtr->containerPtr = NULL; gridPtr->containerDataPtr = NULL; gridPtr->nextPtr = NULL; - gridPtr->slavePtr = NULL; + gridPtr->contentPtr = NULL; gridPtr->binNextPtr = NULL; gridPtr->column = -1; @@ -2495,13 +2495,13 @@ static void SetGridSize( Gridder *containerPtr) /* The geometry container for this grid. */ { - Gridder *slavePtr; /* Current slave window. */ + Gridder *contentPtr; /* Current slave window. */ int maxX = 0, maxY = 0; - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - maxX = MAX(maxX, slavePtr->numCols + slavePtr->column); - maxY = MAX(maxY, slavePtr->numRows + slavePtr->row); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + maxX = MAX(maxX, contentPtr->numCols + contentPtr->column); + maxY = MAX(maxY, contentPtr->numRows + contentPtr->row); } containerPtr->containerDataPtr->columnEnd = maxX; containerPtr->containerDataPtr->rowEnd = maxY; @@ -2529,14 +2529,14 @@ SetGridSize( static int SetSlaveColumn( Tcl_Interp *interp, /* Interp for error message. */ - Gridder *slavePtr, /* Slave to be updated. */ + Gridder *contentPtr, /* Slave to be updated. */ int column, /* New column or -1 to be unchanged. */ int numCols) /* New columnspan or -1 to be unchanged. */ { int newColumn, newNumCols, lastCol; - newColumn = (column >= 0) ? column : slavePtr->column; - newNumCols = (numCols >= 1) ? numCols : slavePtr->numCols; + newColumn = (column >= 0) ? column : contentPtr->column; + newNumCols = (numCols >= 1) ? numCols : contentPtr->numCols; lastCol = ((newColumn >= 0) ? newColumn : 0) + newNumCols; if (lastCol >= MAX_ELEMENT) { @@ -2545,8 +2545,8 @@ SetSlaveColumn( return TCL_ERROR; } - slavePtr->column = newColumn; - slavePtr->numCols = newNumCols; + contentPtr->column = newColumn; + contentPtr->numCols = newNumCols; return TCL_OK; } @@ -2570,14 +2570,14 @@ SetSlaveColumn( static int SetSlaveRow( Tcl_Interp *interp, /* Interp for error message. */ - Gridder *slavePtr, /* Slave to be updated. */ + Gridder *contentPtr, /* Slave to be updated. */ int row, /* New row or -1 to be unchanged. */ int numRows) /* New rowspan or -1 to be unchanged. */ { int newRow, newNumRows, lastRow; - newRow = (row >= 0) ? row : slavePtr->row; - newNumRows = (numRows >= 1) ? numRows : slavePtr->numRows; + newRow = (row >= 0) ? row : contentPtr->row; + newNumRows = (numRows >= 1) ? numRows : contentPtr->numRows; lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows; if (lastRow >= MAX_ELEMENT) { @@ -2586,8 +2586,8 @@ SetSlaveRow( return TCL_ERROR; } - slavePtr->row = newRow; - slavePtr->numRows = newNumRows; + contentPtr->row = newRow; + contentPtr->numRows = newNumRows; return TCL_OK; } @@ -2701,8 +2701,8 @@ InitMasterData( Gridder *containerPtr) { if (containerPtr->containerDataPtr == NULL) { - GridMaster *gridPtr = containerPtr->containerDataPtr = (GridMaster *) - ckalloc(sizeof(GridMaster)); + GridContainer *gridPtr = containerPtr->containerDataPtr = (GridContainer *) + ckalloc(sizeof(GridContainer)); size_t size = sizeof(SlotInfo) * TYPICAL_SIZE; gridPtr->columnEnd = 0; @@ -2741,24 +2741,24 @@ InitMasterData( static void Unlink( - Gridder *slavePtr) /* Window to unlink. */ + Gridder *contentPtr) /* Window to unlink. */ { - Gridder *containerPtr, *slavePtr2; + Gridder *containerPtr, *contentPtr2; - containerPtr = slavePtr->containerPtr; + containerPtr = contentPtr->containerPtr; if (containerPtr == NULL) { return; } - if (containerPtr->slavePtr == slavePtr) { - containerPtr->slavePtr = slavePtr->nextPtr; + if (containerPtr->contentPtr == contentPtr) { + containerPtr->contentPtr = contentPtr->nextPtr; } else { - for (slavePtr2=containerPtr->slavePtr ; ; slavePtr2=slavePtr2->nextPtr) { - if (slavePtr2 == NULL) { + for (contentPtr2=containerPtr->contentPtr ; ; contentPtr2=contentPtr2->nextPtr) { + if (contentPtr2 == NULL) { Tcl_Panic("Unlink couldn't find previous window"); } - if (slavePtr2->nextPtr == slavePtr) { - slavePtr2->nextPtr = slavePtr->nextPtr; + if (contentPtr2->nextPtr == contentPtr) { + contentPtr2->nextPtr = contentPtr->nextPtr; break; } } @@ -2771,8 +2771,8 @@ Unlink( *containerPtr->abortPtr = 1; } - SetGridSize(slavePtr->containerPtr); - slavePtr->containerPtr = NULL; + SetGridSize(contentPtr->containerPtr); + contentPtr->containerPtr = NULL; /* * If we have emptied this container from slaves it means we are no longer @@ -2782,7 +2782,7 @@ Unlink( * being no managed children inside it. */ - if ((containerPtr->slavePtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { + if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { TkFreeGeometryContainer(containerPtr->tkwin, "grid"); containerPtr->flags &= ~ALLOCED_CONTAINER; Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL); @@ -2858,7 +2858,7 @@ GridStructureProc( TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr; if (eventPtr->type == ConfigureNotify) { - if ((gridPtr->slavePtr != NULL) + if ((gridPtr->contentPtr != NULL) && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr); @@ -2872,18 +2872,18 @@ GridStructureProc( } } } else if (eventPtr->type == DestroyNotify) { - Gridder *slavePtr, *nextPtr; + Gridder *contentPtr, *nextPtr; 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->containerPtr = NULL; - nextPtr = slavePtr->nextPtr; - slavePtr->nextPtr = NULL; + for (contentPtr = gridPtr->contentPtr; contentPtr != NULL; + contentPtr = nextPtr) { + Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL); + Tk_UnmapWindow(contentPtr->tkwin); + contentPtr->containerPtr = NULL; + nextPtr = contentPtr->nextPtr; + contentPtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable, gridPtr->tkwin)); @@ -2893,17 +2893,17 @@ GridStructureProc( gridPtr->tkwin = NULL; Tcl_EventuallyFree(gridPtr, (Tcl_FreeProc *)DestroyGrid); } else if (eventPtr->type == MapNotify) { - if ((gridPtr->slavePtr != NULL) + if ((gridPtr->contentPtr != NULL) && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } } else if (eventPtr->type == UnmapNotify) { - Gridder *slavePtr; + Gridder *contentPtr; - for (slavePtr = gridPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - Tk_UnmapWindow(slavePtr->tkwin); + for (contentPtr = gridPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + Tk_UnmapWindow(contentPtr->tkwin); } } } @@ -2940,7 +2940,7 @@ ConfigureContent( * that there is at least one window name. */ { Gridder *containerPtr = NULL; - Gridder *slavePtr; + Gridder *contentPtr; Tk_Window other, slave, parent, ancestor; TkWindow *container; int i, j, tmp; @@ -2992,9 +2992,9 @@ ConfigureContent( * If the stored container does not exist, just ignore it. */ - struct Gridder *slavePtr = GetGrid(slave); - if (slavePtr->in != NULL) { - if (TkGetWindowFromObj(interp, slave, slavePtr->in, &parent) + struct Gridder *contentPtr = GetGrid(slave); + if (contentPtr->in != NULL) { + if (TkGetWindowFromObj(interp, slave, contentPtr->in, &parent) == TCL_OK) { containerPtr = GetGrid(parent); InitMasterData(containerPtr); @@ -3150,7 +3150,7 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL); return TCL_ERROR; } - slavePtr = GetGrid(slave); + contentPtr = GetGrid(slave); /* * The following statement is taken from tkPack.c: @@ -3180,7 +3180,7 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL); return TCL_ERROR; } - if (SetSlaveColumn(interp, slavePtr, tmp, -1) != TCL_OK) { + if (SetSlaveColumn(interp, contentPtr, tmp, -1) != TCL_OK) { return TCL_ERROR; } break; @@ -3193,7 +3193,7 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL); return TCL_ERROR; } - if (SetSlaveColumn(interp, slavePtr, -1, tmp) != TCL_OK) { + if (SetSlaveColumn(interp, contentPtr, -1, tmp) != TCL_OK) { return TCL_ERROR; } break; @@ -3223,7 +3223,7 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "VALUE", "STICKY", NULL); return TCL_ERROR; } - slavePtr->sticky = sticky; + contentPtr->sticky = sticky; break; } case CONF_IPADX: @@ -3235,7 +3235,7 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadX = tmp * 2; + contentPtr->iPadX = tmp * 2; break; case CONF_IPADY: if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1], @@ -3246,17 +3246,17 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadY = tmp * 2; + contentPtr->iPadY = tmp * 2; break; case CONF_PADX: if (TkParsePadAmount(interp, tkwin, objv[i+1], - &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) { + &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) { return TCL_ERROR; } break; case CONF_PADY: if (TkParsePadAmount(interp, tkwin, objv[i+1], - &slavePtr->padTop, &slavePtr->padY) != TCL_OK) { + &contentPtr->padTop, &contentPtr->padY) != TCL_OK) { return TCL_ERROR; } break; @@ -3269,7 +3269,7 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL); return TCL_ERROR; } - if (SetSlaveRow(interp, slavePtr, tmp, -1) != TCL_OK) { + if (SetSlaveRow(interp, contentPtr, tmp, -1) != TCL_OK) { return TCL_ERROR; } break; @@ -3282,7 +3282,7 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL); return TCL_ERROR; } - if (SetSlaveRow(interp, slavePtr, -1, tmp) != TCL_OK) { + if (SetSlaveRow(interp, contentPtr, -1, tmp) != TCL_OK) { return TCL_ERROR; } break; @@ -3294,8 +3294,8 @@ ConfigureContent( * packed, then leave it in its current location. */ - if (!positionGiven && (slavePtr->containerPtr != NULL)) { - containerPtr = slavePtr->containerPtr; + if (!positionGiven && (contentPtr->containerPtr != NULL)) { + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } @@ -3304,7 +3304,7 @@ ConfigureContent( * its current location. */ - if (positionGiven && (containerPtr == slavePtr->containerPtr)) { + if (positionGiven && (containerPtr == contentPtr->containerPtr)) { goto scheduleLayout; } @@ -3320,20 +3320,20 @@ ConfigureContent( InitMasterData(containerPtr); } - if (slavePtr->containerPtr != NULL && slavePtr->containerPtr != containerPtr) { - if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); + if (contentPtr->containerPtr != NULL && contentPtr->containerPtr != containerPtr) { + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - slavePtr->containerPtr = NULL; + Unlink(contentPtr); + contentPtr->containerPtr = NULL; } - if (slavePtr->containerPtr == NULL) { - Gridder *tempPtr = containerPtr->slavePtr; + if (contentPtr->containerPtr == NULL) { + Gridder *tempPtr = containerPtr->contentPtr; - slavePtr->containerPtr = containerPtr; - containerPtr->slavePtr = slavePtr; - slavePtr->nextPtr = tempPtr; + contentPtr->containerPtr = containerPtr; + containerPtr->contentPtr = contentPtr; + contentPtr->nextPtr = tempPtr; } /* @@ -3351,7 +3351,7 @@ ConfigureContent( "can't put %s inside %s", Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); - Unlink(slavePtr); + Unlink(contentPtr); return TCL_ERROR; } } @@ -3367,7 +3367,7 @@ ConfigureContent( "can't put %s inside %s, would cause management loop", Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); - Unlink(slavePtr); + Unlink(contentPtr); return TCL_ERROR; } } @@ -3375,13 +3375,13 @@ ConfigureContent( ((TkWindow *)slave)->maintainerPtr = (TkWindow *)containerPtr->tkwin; } - Tk_ManageGeometry(slave, &gridMgrType, slavePtr); + Tk_ManageGeometry(slave, &gridMgrType, contentPtr); if (!(containerPtr->flags & DONT_PROPAGATE)) { if (TkSetGeometryContainer(interp, containerPtr->tkwin, "grid") != TCL_OK) { Tk_ManageGeometry(slave, NULL, NULL); - Unlink(slavePtr); + Unlink(contentPtr); return TCL_ERROR; } containerPtr->flags |= ALLOCED_CONTAINER; @@ -3391,21 +3391,21 @@ ConfigureContent( * Assign default position information. */ - if (slavePtr->column == -1) { - if (SetSlaveColumn(interp, slavePtr, defaultColumn,-1) != TCL_OK){ + if (contentPtr->column == -1) { + if (SetSlaveColumn(interp, contentPtr, defaultColumn,-1) != TCL_OK){ return TCL_ERROR; } } - if (SetSlaveColumn(interp, slavePtr, -1, - slavePtr->numCols + defaultColumnSpan - 1) != TCL_OK) { + if (SetSlaveColumn(interp, contentPtr, -1, + contentPtr->numCols + defaultColumnSpan - 1) != TCL_OK) { return TCL_ERROR; } - if (slavePtr->row == -1) { - if (SetSlaveRow(interp, slavePtr, defaultRow, -1) != TCL_OK) { + if (contentPtr->row == -1) { + if (SetSlaveRow(interp, contentPtr, defaultRow, -1) != TCL_OK) { return TCL_ERROR; } } - defaultColumn += slavePtr->numCols; + defaultColumn += contentPtr->numCols; defaultColumnSpan = 1; /* @@ -3449,7 +3449,7 @@ ConfigureContent( if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't use '^', cant find master", -1)); + "can't use '^', can't find container window", -1)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } @@ -3483,19 +3483,19 @@ ConfigureContent( lastColumn += numSkip; match = 0; - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - - if (slavePtr->column == lastColumn - && slavePtr->row + slavePtr->numRows - 1 == lastRow) { - if (slavePtr->numCols <= width) { - if (SetSlaveRow(interp, slavePtr, -1, - slavePtr->numRows + 1) != TCL_OK) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + + if (contentPtr->column == lastColumn + && contentPtr->row + contentPtr->numRows - 1 == lastRow) { + if (contentPtr->numCols <= width) { + if (SetSlaveRow(interp, contentPtr, -1, + contentPtr->numRows + 1) != TCL_OK) { return TCL_ERROR; } match++; - j += slavePtr->numCols - 1; - lastWindow = Tk_PathName(slavePtr->tkwin); + j += contentPtr->numCols - 1; + lastWindow = Tk_PathName(contentPtr->tkwin); numSkip = 0; break; } @@ -3503,7 +3503,7 @@ ConfigureContent( } if (!match) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't find slave to extend with \"^\"", -1)); + "can't find content to extend with \"^\"", -1)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } @@ -3511,7 +3511,7 @@ ConfigureContent( if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't determine master window", -1)); + "can't determine container window", -1)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } @@ -3525,7 +3525,7 @@ ConfigureContent( * being no managed children inside it. */ - if (containerPtr->slavePtr == NULL && containerPtr->flags & ALLOCED_CONTAINER) { + if (containerPtr->contentPtr == NULL && containerPtr->flags & ALLOCED_CONTAINER) { TkFreeGeometryContainer(containerPtr->tkwin, "grid"); containerPtr->flags &= ~ALLOCED_CONTAINER; Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL); diff --git a/generic/tkImage.c b/generic/tkImage.c index 8c58c78..e4015fd 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -27,7 +27,7 @@ typedef struct Image { * image is eventually freed tkwin may not * exist anymore. */ struct ImageModel *modelPtr; - /* Master for this image (identifiers image + /* Model for this image (identifiers image * manager, for example). */ ClientData instanceData; /* One word argument to pass to image manager * when dealing with this image instance. */ @@ -40,7 +40,7 @@ typedef struct Image { } Image; /* - * For each image master there is one of the following structures, which + * For each image model there is one of the following structures, which * represents a name in the image table and all of the images instantiated * from it. Entries in mainPtr->imageTable point to these structures. */ @@ -50,7 +50,7 @@ typedef struct ImageModel { * that no image manager owns this image: the * image was deleted. */ ClientData modelData; /* One-word argument to pass to image mgr when - * dealing with the master, as opposed to + * dealing with the model, as opposed to * instances. */ int width, height; /* Last known dimensions for image. */ Tcl_HashTable *tablePtr; /* Pointer to hash table containing image (the @@ -298,7 +298,7 @@ Tk_ImageObjCmd( /* * Need to check if the _command_ that we are about to create is - * the name of the current master widget command (normally "." but + * the name of the current model widget command (normally "." but * could have been renamed) and fail in that case before a really * nasty and hard to stop crash happens. */ @@ -333,7 +333,7 @@ Tk_ImageObjCmd( } else { /* * An image already exists by this name. Disconnect the instances - * from the master. + * from the model. */ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr); @@ -450,7 +450,7 @@ Tk_ImageObjCmd( case IMAGE_WIDTH: /* * These operations all parse virtually identically. First check to - * see if three args are given. Then get a non-deleted master from the + * see if three args are given. Then get a non-deleted model from the * third arg. */ @@ -552,7 +552,7 @@ Tk_ImageChanged( * * Tk_NameOfImage -- * - * Given a token for an image master, this function returns the name of + * Given a token for an image model, this function returns the name of * the image. * * Results: @@ -693,8 +693,8 @@ Tk_FreeImage( ckfree(imagePtr); /* - * If there are no more instances left for the master, and if the master - * image has been deleted, then delete the master too. + * If there are no more instances left for the model, and if the model + * image has been deleted, then delete the model too. */ if ((modelPtr->typePtr == NULL) && (modelPtr->instancePtr == NULL)) { @@ -744,7 +744,7 @@ Tk_PostscriptImage( if (imagePtr->modelPtr->typePtr == NULL) { /* - * No master for image, so nothing to display on postscript. + * No model for image, so nothing to display on postscript. */ return TCL_OK; @@ -840,7 +840,7 @@ Tk_RedrawImage( if (imagePtr->modelPtr->typePtr == NULL) { /* - * No master for image, so nothing to display. + * No model for image, so nothing to display. */ return; @@ -949,7 +949,7 @@ Tk_DeleteImage( * * Side effects: * The connection is dropped between instances of this image and an image - * master. Image instances will redisplay themselves as empty areas, but + * model. Image instances will redisplay themselves as empty areas, but * existing instances will not be deleted. * *---------------------------------------------------------------------- @@ -1057,7 +1057,7 @@ TkDeleteAllImages( * Tk_GetImageModelData -- * * Given the name of an image, this function returns the type of the - * image and the clientData associated with its master. + * image and the clientData associated with its model. * * Results: * If there is no image by the given name, then NULL is returned and a diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index ad8ce8c..a77b9b8 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -14,12 +14,12 @@ #include "tkInt.h" /* - * The following data structure represents the master for a bitmap + * The following data structure represents the model for a bitmap * image: */ typedef struct { - Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the + Tk_ImageModel tkModel; /* Tk's token for image model. NULL means the * image is being deleted. */ Tcl_Interp *interp; /* Interpreter for application that is using * image. */ @@ -40,7 +40,7 @@ typedef struct { char *maskDataString; /* Value of -maskdata option (malloc'ed). */ struct BitmapInstance *instancePtr; /* First in list of all instances associated - * with this master. */ + * with this model. */ } BitmapModel; /* @@ -51,7 +51,7 @@ typedef struct { typedef struct BitmapInstance { size_t refCount; /* Number of instances that share this data * structure. */ - BitmapModel *modelPtr; /* Pointer to master for image. */ + BitmapModel *modelPtr; /* Pointer to model for image. */ Tk_Window tkwin; /* Window in which the instances will be * displayed. */ XColor *fg; /* Foreground color for displaying image. */ @@ -76,7 +76,7 @@ typedef struct BitmapInstance { static int GetByte(Tcl_Channel chan); static int ImgBmapCreate(Tcl_Interp *interp, const char *name, int argc, Tcl_Obj *const objv[], - const Tk_ImageType *typePtr, Tk_ImageMaster master, + const Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData); static void ImgBmapDisplay(ClientData clientData, @@ -178,7 +178,7 @@ ImgBmapCreate( Tcl_Obj *const argv[], /* Argument objects for options (doesn't * include image name or type). */ const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */ - Tk_ImageMaster master, /* Token for image, to be used by us in later + Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ @@ -186,7 +186,7 @@ ImgBmapCreate( BitmapModel *modelPtr = (BitmapModel *)ckalloc(sizeof(BitmapModel)); (void)typePtr; - modelPtr->tkMaster = master; + modelPtr->tkModel = model; modelPtr->interp = interp; modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd, modelPtr, ImgBmapCmdDeletedProc); @@ -311,7 +311,7 @@ ImgBmapConfigureModel( instancePtr = instancePtr->nextPtr) { ImgBmapConfigureInstance(instancePtr); } - Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width, + Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width, modelPtr->height, modelPtr->width, modelPtr->height); return TCL_OK; } @@ -322,8 +322,8 @@ ImgBmapConfigureModel( * ImgBmapConfigureInstance -- * * This procedure is called to create displaying information for a bitmap - * image instance based on the configuration information in the master. - * It is invoked both when new instances are created and when the master + * image instance based on the configuration information in the model. + * It is invoked both when new instances are created and when the model * is reconfigured. * * Results: @@ -447,7 +447,7 @@ ImgBmapConfigureInstance( instancePtr->gc = NULL; Tcl_AppendObjToErrorInfo(modelPtr->interp, Tcl_ObjPrintf( "\n (while configuring image \"%s\")", Tk_NameOfImage( - modelPtr->tkMaster))); + modelPtr->tkModel))); Tcl_BackgroundException(modelPtr->interp, TCL_ERROR); } @@ -751,7 +751,7 @@ NextBitmapWord( static int ImgBmapCmd( - ClientData clientData, /* Information about the image master. */ + ClientData clientData, /* Information about the image model. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -816,10 +816,10 @@ static ClientData ImgBmapGet( Tk_Window tkwin, /* Window in which the instance will be * used. */ - ClientData masterData) /* Pointer to our master structure for the + ClientData modelData) /* Pointer to our model structure for the * image. */ { - BitmapModel *modelPtr = (BitmapModel *)masterData; + BitmapModel *modelPtr = (BitmapModel *)modelData; BitmapInstance *instancePtr; /* @@ -858,7 +858,7 @@ ImgBmapGet( */ if (instancePtr->nextPtr == NULL) { - Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, modelPtr->width, + Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width, modelPtr->height); } @@ -992,7 +992,7 @@ ImgBmapFree( * * ImgBmapDelete -- * - * This procedure is called by the image code to delete the master + * This procedure is called by the image code to delete the model * structure for an image. * * Results: @@ -1006,15 +1006,15 @@ ImgBmapFree( static void ImgBmapDelete( - ClientData masterData) /* Pointer to BitmapModel structure for + ClientData modelData) /* Pointer to BitmapModel structure for * image. Must not have any more instances. */ { - BitmapModel *modelPtr = (BitmapModel *)masterData; + BitmapModel *modelPtr = (BitmapModel *)modelData; if (modelPtr->instancePtr != NULL) { Tcl_Panic("tried to delete bitmap image when instances still exist"); } - modelPtr->tkMaster = NULL; + modelPtr->tkModel = NULL; if (modelPtr->imageCmd != NULL) { Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd); } @@ -1053,8 +1053,8 @@ ImgBmapCmdDeletedProc( BitmapModel *modelPtr = (BitmapModel *)clientData; modelPtr->imageCmd = NULL; - if (modelPtr->tkMaster != NULL) { - Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkMaster)); + if (modelPtr->tkModel != NULL) { + Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel)); } } diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index b47f21c..11dc251 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -66,8 +66,8 @@ static int imgPhotoColorHashInitialized; * TkImgPhotoConfigureInstance -- * * This function is called to create displaying information for a photo - * image instance based on the configuration information in the master. - * It is invoked both when new instances are created and when the master + * image instance based on the configuration information in the model. + * It is invoked both when new instances are created and when the model * is reconfigured. * * Results: @@ -91,9 +91,9 @@ TkImgPhotoConfigureInstance( XRectangle validBox; /* - * If the -palette configuration option has been set for the master, use + * If the -palette configuration option has been set for the model, use * the value specified for our palette, but only if it is a valid palette - * for our windows. Use the gamma value specified the master. + * for our windows. Use the gamma value specified the model. */ if ((modelPtr->palette && modelPtr->palette[0]) @@ -166,7 +166,7 @@ TkImgPhotoConfigureInstance( } /* - * If the user has specified a width and/or height for the master which is + * If the user has specified a width and/or height for the model which is * different from our current width/height, set the size to the values * specified by the user. If we have no pixmap, we do this also, since it * has the side effect of allocating a pixmap for us. @@ -214,7 +214,7 @@ ClientData TkImgPhotoGet( Tk_Window tkwin, /* Window in which the instance will be * used. */ - ClientData modelData) /* Pointer to our master structure for the + ClientData modelData) /* Pointer to our model structure for the * image. */ { PhotoModel *modelPtr = (PhotoModel *)modelData; @@ -380,7 +380,7 @@ TkImgPhotoGet( */ if (instancePtr->nextPtr == NULL) { - Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, + Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width, modelPtr->height); } @@ -1624,7 +1624,7 @@ TkImgDisposeInstance( * TkImgDitherInstance -- * * This function is called to update an area of an instance's pixmap by - * dithering the corresponding area of the master. + * dithering the corresponding area of the model. * * Results: * None. @@ -1827,7 +1827,7 @@ TkImgDitherInstance( /* * Multibit monochrome window. The operation here is similar * to the color window case above, except that there is only - * one component. If the master image is in color, use the + * one component. If the model image is in color, use the * luminance computed as * 0.344 * red + 0.5 * green + 0.156 * blue. */ diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 01e188a..db810d8 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -107,7 +107,7 @@ static const char *const optionNames[] = { static int ImgPhotoCreate(Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], - const Tk_ImageType *typePtr, Tk_ImageMaster master, + const Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static void ImgPhotoDelete(ClientData clientData); static int ImgPhotoPostscript(ClientData clientData, @@ -160,15 +160,15 @@ static Tcl_ThreadDataKey dataKey; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-file", NULL, NULL, - NULL, offsetof(PhotoMaster, fileString), TK_CONFIG_NULL_OK, NULL}, + NULL, offsetof(PhotoModel, fileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_DOUBLE, "-gamma", NULL, NULL, - DEF_PHOTO_GAMMA, offsetof(PhotoMaster, gamma), 0, NULL}, + DEF_PHOTO_GAMMA, offsetof(PhotoModel, gamma), 0, NULL}, {TK_CONFIG_INT, "-height", NULL, NULL, - DEF_PHOTO_HEIGHT, offsetof(PhotoMaster, userHeight), 0, NULL}, + DEF_PHOTO_HEIGHT, offsetof(PhotoModel, userHeight), 0, NULL}, {TK_CONFIG_UID, "-palette", NULL, NULL, - DEF_PHOTO_PALETTE, offsetof(PhotoMaster, palette), 0, NULL}, + DEF_PHOTO_PALETTE, offsetof(PhotoModel, palette), 0, NULL}, {TK_CONFIG_INT, "-width", NULL, NULL, - DEF_PHOTO_WIDTH, offsetof(PhotoMaster, userWidth), 0, NULL}, + DEF_PHOTO_WIDTH, offsetof(PhotoModel, userWidth), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; @@ -185,12 +185,12 @@ static int ParseSubcommandOptions( int *indexPtr, int objc, Tcl_Obj *const objv[]); static void ImgPhotoCmdDeletedProc(ClientData clientData); static int ImgPhotoConfigureModel(Tcl_Interp *interp, - PhotoMaster *modelPtr, int objc, + PhotoModel *modelPtr, int objc, Tcl_Obj *const objv[], int flags); -static int ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr); -static int ImgPhotoSetSize(PhotoMaster *modelPtr, int width, +static int ToggleComplexAlphaIfNeeded(PhotoModel *mPtr); +static int ImgPhotoSetSize(PhotoModel *modelPtr, int width, int height); -static char * ImgGetPhoto(PhotoMaster *modelPtr, +static char * ImgGetPhoto(PhotoModel *modelPtr, Tk_PhotoImageBlock *blockPtr, struct SubcommandOptions *optPtr); static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan, @@ -344,21 +344,21 @@ ImgPhotoCreate( Tcl_Obj *const objv[], /* Argument objects for options (doesn't * include image name or type). */ const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */ - Tk_ImageMaster master, /* Token for image, to be used by us in later + Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - PhotoMaster *modelPtr; + PhotoModel *modelPtr; (void)typePtr; /* - * Allocate and initialize the photo image master record. + * Allocate and initialize the photo image model record. */ - modelPtr = (PhotoMaster *)ckalloc(sizeof(PhotoMaster)); - memset(modelPtr, 0, sizeof(PhotoMaster)); - modelPtr->tkMaster = master; + modelPtr = (PhotoModel *)ckalloc(sizeof(PhotoModel)); + memset(modelPtr, 0, sizeof(PhotoModel)); + modelPtr->tkModel = model; modelPtr->interp = interp; modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd, modelPtr, ImgPhotoCmdDeletedProc); @@ -400,7 +400,7 @@ ImgPhotoCreate( static int ImgPhotoCmd( - ClientData clientData, /* Information about photo master. */ + ClientData clientData, /* Information about photo model. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -415,7 +415,7 @@ ImgPhotoCmd( PHOTO_WRITE }; - PhotoMaster *modelPtr = (PhotoMaster *)clientData; + PhotoModel *modelPtr = (PhotoModel *)clientData; int result, index, x, y, width, height; struct SubcommandOptions options; unsigned char *pixelPtr; @@ -601,7 +601,7 @@ ImgPhotoCmd( * has a simple alpha channel. */ - if (!(((PhotoMaster *) srcHandle)->flags & COMPLEX_ALPHA)) { + if (!(((PhotoModel *) srcHandle)->flags & COMPLEX_ALPHA)) { options.compositingRule |= SOURCE_IS_SIMPLE_ALPHA_PHOTO; } @@ -670,7 +670,7 @@ ImgPhotoCmd( return TCL_ERROR; } } - Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, + Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width, modelPtr->height); if (options.background) { Tk_FreeColor(options.background); @@ -1079,7 +1079,7 @@ ImgPhotoCmd( * Tell the core image code that part of the image has changed. */ - Tk_ImageChanged(modelPtr->tkMaster, x, y, + Tk_ImageChanged(modelPtr->tkModel, x, y, (modelPtr->width - x), (modelPtr->height - y), modelPtr->width, modelPtr->height); } @@ -1260,7 +1260,7 @@ ImgPhotoCmd( * has (potentially) changed. */ - Tk_ImageChanged(modelPtr->tkMaster, x, y, 1, 1, + Tk_ImageChanged(modelPtr->tkModel, x, y, 1, 1, modelPtr->width, modelPtr->height); modelPtr->flags &= ~IMAGE_CHANGED; return TCL_OK; @@ -1763,7 +1763,7 @@ ParseSubcommandOptions( static int ImgPhotoConfigureModel( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ - PhotoMaster *modelPtr, /* Pointer to data structure describing + PhotoModel *modelPtr, /* Pointer to data structure describing * overall photo image to (re)configure. */ int objc, /* Number of entries in objv. */ Tcl_Obj *const objv[], /* Pairs of configuration options for image. */ @@ -2028,7 +2028,7 @@ ImgPhotoConfigureModel( * Inform the generic image code that the image has (potentially) changed. */ - Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width, + Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width, modelPtr->height, modelPtr->width, modelPtr->height); modelPtr->flags &= ~IMAGE_CHANGED; @@ -2066,14 +2066,14 @@ ImgPhotoConfigureModel( * None. * * Side effects: - * (Re)sets COMPLEX_ALPHA flag of master. + * (Re)sets COMPLEX_ALPHA flag of model. * *---------------------------------------------------------------------- */ static int ToggleComplexAlphaIfNeeded( - PhotoMaster *mPtr) + PhotoModel *mPtr) { size_t len = (size_t)MAX(mPtr->userWidth, mPtr->width) * (size_t)MAX(mPtr->userHeight, mPtr->height) * 4; @@ -2104,7 +2104,7 @@ ToggleComplexAlphaIfNeeded( * * ImgPhotoDelete -- * - * This function is called by the image code to delete the master + * This function is called by the image code to delete the model * structure for an image. * * Results: @@ -2118,10 +2118,10 @@ ToggleComplexAlphaIfNeeded( static void ImgPhotoDelete( - ClientData masterData) /* Pointer to PhotoMaster structure for image. + ClientData modelData) /* Pointer to PhotoModel structure for image. * Must not have any more instances. */ { - PhotoMaster *modelPtr = (PhotoMaster *)masterData; + PhotoModel *modelPtr = (PhotoModel *)modelData; PhotoInstance *instancePtr; while ((instancePtr = modelPtr->instancePtr) != NULL) { @@ -2131,7 +2131,7 @@ ImgPhotoDelete( Tcl_CancelIdleCall(TkImgDisposeInstance, instancePtr); TkImgDisposeInstance(instancePtr); } - modelPtr->tkMaster = NULL; + modelPtr->tkModel = NULL; if (modelPtr->imageCmd != NULL) { Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd); } @@ -2170,14 +2170,14 @@ ImgPhotoDelete( static void ImgPhotoCmdDeletedProc( - ClientData clientData) /* Pointer to PhotoMaster structure for + ClientData clientData) /* Pointer to PhotoModel structure for * image. */ { - PhotoMaster *modelPtr = (PhotoMaster *)clientData; + PhotoModel *modelPtr = (PhotoModel *)clientData; modelPtr->imageCmd = NULL; - if (modelPtr->tkMaster != NULL) { - Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkMaster)); + if (modelPtr->tkModel != NULL) { + Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel)); } } @@ -2195,14 +2195,14 @@ ImgPhotoCmdDeletedProc( * with memory allocation.) * * Side effects: - * Storage gets reallocated, for the master and all its instances. + * Storage gets reallocated, for the model and all its instances. * *---------------------------------------------------------------------- */ static int ImgPhotoSetSize( - PhotoMaster *modelPtr, + PhotoModel *modelPtr, int width, int height) { unsigned char *newPix32 = NULL; @@ -2699,7 +2699,7 @@ MatchStringFormat( * Tk_FindPhoto -- * * This function is called to get an opaque handle (actually a - * PhotoMaster *) for a given image, which can be used in subsequent + * PhotoModel *) for a given image, which can be used in subsequent * calls to Tk_PhotoPutBlock, etc. The `name' parameter is the name of * the image. * @@ -2721,7 +2721,7 @@ Tk_FindPhoto( { const Tk_ImageType *typePtr; ClientData clientData = - Tk_GetImageMasterData(interp, imageName, &typePtr); + Tk_GetImageModelData(interp, imageName, &typePtr); if ((typePtr == NULL) || (typePtr->name != tkPhotoImageType.name)) { return NULL; @@ -2764,7 +2764,7 @@ Tk_PhotoPutBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - PhotoMaster *modelPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -3151,7 +3151,7 @@ Tk_PhotoPutBlock( * Tell the core image code that this image has changed. */ - Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height, + Tk_ImageChanged(modelPtr->tkModel, 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 *modelPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -3507,7 +3507,7 @@ Tk_PhotoPutZoomedBlock( * Tell the core image code that this image has changed. */ - Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height, modelPtr->width, + Tk_ImageChanged(modelPtr->tkModel, x, y, width, height, modelPtr->width, modelPtr->height); if (memToFree) ckfree(memToFree); @@ -3526,7 +3526,7 @@ Tk_PhotoPutZoomedBlock( * Tk_DitherPhoto -- * * This function is called to update an area of each instance's pixmap by - * dithering the corresponding area of the image master. + * dithering the corresponding area of the image model. * * Results: * None. @@ -3541,13 +3541,13 @@ Tk_PhotoPutZoomedBlock( void Tk_DitherPhoto( - Tk_PhotoHandle photo, /* Image master whose instances are to be + Tk_PhotoHandle photo, /* Image model whose instances are to be * updated. */ int x, int y, /* Coordinates of the top-left pixel in the * area to be dithered. */ int width, int height) /* Dimensions of the area to be dithered. */ { - PhotoMaster *modelPtr = (PhotoMaster *) photo; + PhotoModel *modelPtr = (PhotoModel *) photo; PhotoInstance *instancePtr; if ((width <= 0) || (height <= 0)) { @@ -3620,7 +3620,7 @@ void Tk_PhotoBlank( Tk_PhotoHandle handle) /* Handle for the image to be blanked. */ { - PhotoMaster *modelPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; PhotoInstance *instancePtr; modelPtr->ditherX = modelPtr->ditherY = 0; @@ -3651,7 +3651,7 @@ Tk_PhotoBlank( * Tell the core image code that this image has changed. */ - Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width, + Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width, modelPtr->height, modelPtr->width, modelPtr->height); } @@ -3682,7 +3682,7 @@ Tk_PhotoExpand( Tk_PhotoHandle handle, /* Handle for the image to be expanded. */ int width, int height) /* Desired minimum dimensions of the image. */ { - PhotoMaster *modelPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; if (width <= modelPtr->width) { width = modelPtr->width; @@ -3700,7 +3700,7 @@ Tk_PhotoExpand( } return TCL_ERROR; } - Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, modelPtr->width, + Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width, modelPtr->height); } return TCL_OK; @@ -3730,7 +3730,7 @@ Tk_PhotoGetSize( /* The dimensions of the image are returned * here. */ { - PhotoMaster *modelPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; *widthPtr = modelPtr->width; *heightPtr = modelPtr->height; @@ -3762,7 +3762,7 @@ Tk_PhotoSetSize( * set. */ int width, int height) /* New dimensions for the image. */ { - PhotoMaster *modelPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; modelPtr->userWidth = width; modelPtr->userHeight = height; @@ -3775,7 +3775,7 @@ Tk_PhotoSetSize( } return TCL_ERROR; } - Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, + Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width, modelPtr->height); return TCL_OK; } @@ -3805,7 +3805,7 @@ TkPhotoGetValidRegion( Tk_PhotoHandle handle) /* Handle for the image whose valid region is * to obtained. */ { - PhotoMaster *modelPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; return modelPtr->validRegion; } @@ -3833,7 +3833,7 @@ TkPhotoGetValidRegion( static char * ImgGetPhoto( - PhotoMaster *modelPtr, /* Handle for the photo image from which image + PhotoModel *modelPtr, /* Handle for the photo image from which image * data is desired. */ Tk_PhotoImageBlock *blockPtr, /* Information about the address and layout of @@ -4030,7 +4030,7 @@ Tk_PhotoGetImage( /* Information about the address and layout of * the image data is returned here. */ { - PhotoMaster *modelPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; blockPtr->pixelPtr = modelPtr->pix32; blockPtr->width = modelPtr->width; diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h index c6e32e3..e65893f 100644 --- a/generic/tkImgPhoto.h +++ b/generic/tkImgPhoto.h @@ -145,11 +145,11 @@ struct ColorTable { #define MAP_COLORS 8 /* - * Definition of the data associated with each photo image master. + * Definition of the data associated with each photo image model. */ struct PhotoModel { - Tk_ImageModel tkMaster; /* Tk's token for image model. NULL means the + Tk_ImageModel tkModel; /* Tk's token for image model. NULL means the * image is being deleted. */ Tcl_Interp *interp; /* Interpreter associated with the application * using this image. */ @@ -172,7 +172,7 @@ struct PhotoModel { TkRegion validRegion; /* Tk region indicating which parts of the * image have valid image data. */ PhotoInstance *instancePtr; /* First in the list of instances associated - * with this master. */ + * with this model. */ }; /* @@ -208,7 +208,7 @@ struct PhotoInstance { Colormap colormap; /* The image may only be used in windows with * this particular colormap. */ PhotoInstance *nextPtr; /* Pointer to the next instance in the list of - * instances associated with this master. */ + * instances associated with this model. */ #if TCL_MAJOR_VERSION > 8 size_t refCount; /* Number of instances using this structure. */ #else @@ -217,7 +217,7 @@ struct PhotoInstance { Tk_Uid palette; /* Palette for these particular instances. */ double gamma; /* Gamma value for these instances. */ Tk_Uid defaultPalette; /* Default palette to use if a palette is not - * specified for the master. */ + * specified for the model. */ ColorTable *colorTablePtr; /* Pointer to information about colors * allocated for image display in windows like * this one. */ diff --git a/generic/tkInt.h b/generic/tkInt.h index 48eeca2..2f336d0 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -447,9 +447,9 @@ typedef struct TkDisplay { */ int placeInit; /* 0 means tables below need initializing. */ - Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master + Tcl_HashTable containerTable; /* Maps from Tk_Window token to the Container * structure for the window, if it exists. */ - Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave + Tcl_HashTable contentTable; /* Maps from Tk_Window token to the Content * structure for the window, if it exists. */ /* diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 7400b32..96d386b 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -1108,7 +1108,7 @@ GetCachedSpecs( /* * Now allocate our working copy's space and copy over the contents - * from the master copy. + * from the main copy. */ cachedSpecs = (Tk_ConfigSpec *)ckalloc(entrySpace); diff --git a/generic/tkPack.c b/generic/tkPack.c index 999bdd7..ed9624f 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -35,7 +35,7 @@ typedef struct Packer { struct Packer *nextPtr; /* Next window packed within same master. List * is priority-ordered: first on list gets * packed first. */ - struct Packer *slavePtr; /* First in list of slaves packed inside this + struct Packer *contentPtr; /* First in list of slaves packed inside this * window (NULL means no packed slaves). */ Side side; /* Side of master against which this window is * packed. */ @@ -110,7 +110,7 @@ static void PackLostContentProc(ClientData clientData, static const Tk_GeomMgr packerType = { "pack", /* name */ PackReqProc, /* requestProc */ - PackLostContentProc, /* lostSlaveProc */ + PackLostContentProc, /* lostContentProc */ }; /* @@ -129,8 +129,8 @@ static int PackAfter(Tcl_Interp *interp, Packer *prevPtr, static void PackStructureProc(ClientData clientData, XEvent *eventPtr); static void Unlink(Packer *packPtr); -static int XExpansion(Packer *slavePtr, int cavityWidth); -static int YExpansion(Packer *slavePtr, int cavityHeight); +static int XExpansion(Packer *contentPtr, int cavityWidth); +static int YExpansion(Packer *contentPtr, int cavityHeight); /* *------------------------------------------------------------------------ @@ -266,7 +266,7 @@ Tk_PackObjCmd( return TCL_ERROR; } containerPtr = GetPacker(tkwin2); - prevPtr = containerPtr->slavePtr; + prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { prevPtr = prevPtr->nextPtr; @@ -290,7 +290,7 @@ Tk_PackObjCmd( return TCL_ERROR; } containerPtr = packPtr->containerPtr; - prevPtr = containerPtr->slavePtr; + prevPtr = containerPtr->contentPtr; if (prevPtr == packPtr) { prevPtr = NULL; } else { @@ -316,28 +316,28 @@ Tk_PackObjCmd( return ConfigureContent(interp, tkwin, objc-2, objv+2); case PACK_FORGET: { Tk_Window slave; - Packer *slavePtr; + Packer *contentPtr; int i; for (i = 2; i < objc; i++) { if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) { continue; } - slavePtr = GetPacker(slave); - if ((slavePtr != NULL) && (slavePtr->containerPtr != NULL)) { + contentPtr = GetPacker(slave); + if ((contentPtr != NULL) && (contentPtr->containerPtr != NULL)) { Tk_ManageGeometry(slave, NULL, NULL); - if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->containerPtr->tkwin); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, + contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } } break; } case PACK_INFO: { - Packer *slavePtr; + Packer *contentPtr; Tk_Window slave; Tcl_Obj *infoObj; @@ -348,8 +348,8 @@ Tk_PackObjCmd( if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) { return TCL_ERROR; } - slavePtr = GetPacker(slave); - if (slavePtr->containerPtr == NULL) { + contentPtr = GetPacker(slave); + if (contentPtr->containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't packed", argv2)); Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL); @@ -358,12 +358,12 @@ Tk_PackObjCmd( infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), - Tk_NewWindowObj(slavePtr->containerPtr->tkwin)); + Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", -1), - Tcl_NewStringObj(Tk_NameOfAnchor(slavePtr->anchor), -1)); + Tcl_NewStringObj(Tk_NameOfAnchor(contentPtr->anchor), -1)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", -1), - Tcl_NewBooleanObj(slavePtr->flags & EXPAND)); - switch (slavePtr->flags & (FILLX|FILLY)) { + Tcl_NewBooleanObj(contentPtr->flags & EXPAND)); + switch (contentPtr->flags & (FILLX|FILLY)) { case 0: Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", -1), Tcl_NewStringObj("none", -1)); @@ -381,12 +381,12 @@ Tk_PackObjCmd( Tcl_NewStringObj("both", -1)); break; } - TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX); - TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY); - TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft,slavePtr->padX); - TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY); + TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX); + TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY); + TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft,contentPtr->padX); + TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-side", -1), - Tcl_NewStringObj(sideNames[slavePtr->side], -1)); + Tcl_NewStringObj(sideNames[contentPtr->side], -1)); Tcl_SetObjResult(interp, infoObj); break; } @@ -416,7 +416,7 @@ Tk_PackObjCmd( * If we have content windows, we need to register as geometry container. */ - if (containerPtr->slavePtr != NULL) { + if (containerPtr->contentPtr != NULL) { if (TkSetGeometryContainer(interp, master, "pack") != TCL_OK) { return TCL_ERROR; } @@ -448,7 +448,7 @@ Tk_PackObjCmd( case PACK_CONTENT: case PACK_SLAVES: { Tk_Window master; - Packer *containerPtr, *slavePtr; + Packer *containerPtr, *contentPtr; Tcl_Obj *resultObj; if (objc != 3) { @@ -460,10 +460,10 @@ Tk_PackObjCmd( } resultObj = Tcl_NewObj(); containerPtr = GetPacker(master); - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, - Tk_NewWindowObj(slavePtr->tkwin)); + Tk_NewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, resultObj); break; @@ -555,13 +555,13 @@ PackLostContentProc( * stolen away. */ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */ { - Packer *slavePtr = (Packer *)clientData; + Packer *contentPtr = (Packer *)clientData; - if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); - Tk_UnmapWindow(slavePtr->tkwin); + Unlink(contentPtr); + Tk_UnmapWindow(contentPtr->tkwin); } /* @@ -589,7 +589,7 @@ ArrangePacking( * are to be re-layed out. */ { Packer *containerPtr = (Packer *)clientData; - Packer *slavePtr; + Packer *contentPtr; int cavityX, cavityY, cavityWidth, cavityHeight; /* These variables keep track of the * as-yet-unallocated space remaining in the @@ -614,7 +614,7 @@ ArrangePacking( * so another geometry manager can take over. */ - if (containerPtr->slavePtr == NULL) { + if (containerPtr->contentPtr == NULL) { return; } @@ -652,24 +652,24 @@ ArrangePacking( 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 - + slavePtr->padX + slavePtr->iPadX + width; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) { + tmp = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX + width; if (tmp > maxWidth) { maxWidth = tmp; } - height += Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY; + height += Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY; } else { - tmp = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY + height; + tmp = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY + height; if (tmp > maxHeight) { maxHeight = tmp; } - width += Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padX + slavePtr->iPadX; + width += Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX; } } if (width > maxWidth) { @@ -719,14 +719,14 @@ ArrangePacking( 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)) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) { frameWidth = cavityWidth; - frameHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY; - if (slavePtr->flags & EXPAND) { - frameHeight += YExpansion(slavePtr, cavityHeight); + frameHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY; + if (contentPtr->flags & EXPAND) { + frameHeight += YExpansion(contentPtr, cavityHeight); } cavityHeight -= frameHeight; if (cavityHeight < 0) { @@ -734,7 +734,7 @@ ArrangePacking( cavityHeight = 0; } frameX = cavityX; - if (slavePtr->side == TOP) { + if (contentPtr->side == TOP) { frameY = cavityY; cavityY += frameHeight; } else { @@ -742,10 +742,10 @@ ArrangePacking( } } else { frameHeight = cavityHeight; - frameWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padX + slavePtr->iPadX; - if (slavePtr->flags & EXPAND) { - frameWidth += XExpansion(slavePtr, cavityWidth); + frameWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX; + if (contentPtr->flags & EXPAND) { + frameWidth += XExpansion(contentPtr, cavityWidth); } cavityWidth -= frameWidth; if (cavityWidth < 0) { @@ -753,7 +753,7 @@ ArrangePacking( cavityWidth = 0; } frameY = cavityY; - if (slavePtr->side == LEFT) { + if (contentPtr->side == LEFT) { frameX = cavityX; cavityX += frameWidth; } else { @@ -770,31 +770,31 @@ ArrangePacking( * completely ignored except when computing frame size). */ - if (slavePtr->flags & OLD_STYLE) { + if (contentPtr->flags & OLD_STYLE) { borderX = borderY = 0; borderTop = borderBtm = 0; borderLeft = borderRight = 0; } else { - borderX = slavePtr->padX; - borderY = slavePtr->padY; - borderLeft = slavePtr->padLeft; + borderX = contentPtr->padX; + borderY = contentPtr->padY; + borderLeft = contentPtr->padLeft; borderRight = borderX - borderLeft; - borderTop = slavePtr->padTop; + borderTop = contentPtr->padTop; borderBtm = borderY - borderTop; } - width = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->iPadX; - if ((slavePtr->flags & FILLX) + width = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->iPadX; + if ((contentPtr->flags & FILLX) || (width > (frameWidth - borderX))) { width = frameWidth - borderX; } - height = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->iPadY; - if ((slavePtr->flags & FILLY) + height = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->iPadY; + if ((contentPtr->flags & FILLY) || (height > (frameHeight - borderY))) { height = frameHeight - borderY; } - switch (slavePtr->anchor) { + switch (contentPtr->anchor) { case TK_ANCHOR_N: x = frameX + (borderLeft + frameWidth - width - borderRight)/2; y = frameY + borderTop; @@ -834,8 +834,8 @@ ArrangePacking( default: Tcl_Panic("bad frame factor in ArrangePacking"); } - width -= slavePtr->doubleBw; - height -= slavePtr->doubleBw; + width -= contentPtr->doubleBw; + height -= contentPtr->doubleBw; /* * The final step is to set the position, size, and mapped/unmapped @@ -843,15 +843,15 @@ ArrangePacking( * this here. Otherwise let Tk_MaintainGeometry do the work. */ - if (containerPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { + if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) { if ((width <= 0) || (height <= 0)) { - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - if ((x != Tk_X(slavePtr->tkwin)) - || (y != Tk_Y(slavePtr->tkwin)) - || (width != Tk_Width(slavePtr->tkwin)) - || (height != Tk_Height(slavePtr->tkwin))) { - Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height); + if ((x != Tk_X(contentPtr->tkwin)) + || (y != Tk_Y(contentPtr->tkwin)) + || (width != Tk_Width(contentPtr->tkwin)) + || (height != Tk_Height(contentPtr->tkwin))) { + Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height); } if (abort) { goto done; @@ -863,15 +863,15 @@ ArrangePacking( */ if (Tk_IsMapped(containerPtr->tkwin)) { - Tk_MapWindow(slavePtr->tkwin); + Tk_MapWindow(contentPtr->tkwin); } } } else { if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, containerPtr->tkwin); - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, containerPtr->tkwin, + Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y, width, height); } } @@ -912,7 +912,7 @@ ArrangePacking( static int XExpansion( - Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *contentPtr, /* First in list of remaining slaves. */ int cavityWidth) /* Horizontal space left for all remaining * slaves. */ { @@ -932,10 +932,10 @@ XExpansion( minExpand = cavityWidth; numExpand = 0; - for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { - childWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padX + slavePtr->iPadX; - if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) { + for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) { + childWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padX + contentPtr->iPadX; + if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) { if (numExpand) { curExpand = (cavityWidth - childWidth)/numExpand; if (curExpand < minExpand) { @@ -944,7 +944,7 @@ XExpansion( } } else { cavityWidth -= childWidth; - if (slavePtr->flags & EXPAND) { + if (contentPtr->flags & EXPAND) { numExpand++; } } @@ -978,7 +978,7 @@ XExpansion( static int YExpansion( - Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *contentPtr, /* First in list of remaining slaves. */ int cavityHeight) /* Vertical space left for all remaining * slaves. */ { @@ -991,10 +991,10 @@ YExpansion( minExpand = cavityHeight; numExpand = 0; - for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { - childHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw - + slavePtr->padY + slavePtr->iPadY; - if ((slavePtr->side == LEFT) || (slavePtr->side == RIGHT)) { + for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) { + childHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw + + contentPtr->padY + contentPtr->iPadY; + if ((contentPtr->side == LEFT) || (contentPtr->side == RIGHT)) { if (numExpand) { curExpand = (cavityHeight - childHeight)/numExpand; if (curExpand < minExpand) { @@ -1003,7 +1003,7 @@ YExpansion( } } else { cavityHeight -= childHeight; - if (slavePtr->flags & EXPAND) { + if (contentPtr->flags & EXPAND) { numExpand++; } } @@ -1065,7 +1065,7 @@ GetPacker( packPtr->tkwin = tkwin; packPtr->containerPtr = NULL; packPtr->nextPtr = NULL; - packPtr->slavePtr = NULL; + packPtr->contentPtr = NULL; packPtr->side = TOP; packPtr->anchor = TK_ANCHOR_CENTER; packPtr->padX = packPtr->padY = 0; @@ -1286,8 +1286,8 @@ PackAfter( packPtr->containerPtr = containerPtr; if (prevPtr == NULL) { - packPtr->nextPtr = containerPtr->slavePtr; - containerPtr->slavePtr = packPtr; + packPtr->nextPtr = containerPtr->contentPtr; + containerPtr->contentPtr = packPtr; } else { packPtr->nextPtr = prevPtr->nextPtr; prevPtr->nextPtr = packPtr; @@ -1347,10 +1347,10 @@ Unlink( if (containerPtr == NULL) { return; } - if (containerPtr->slavePtr == packPtr) { - containerPtr->slavePtr = packPtr->nextPtr; + if (containerPtr->contentPtr == packPtr) { + containerPtr->contentPtr = packPtr->nextPtr; } else { - for (packPtr2 = containerPtr->slavePtr; ; packPtr2 = packPtr2->nextPtr) { + for (packPtr2 = containerPtr->contentPtr; ; packPtr2 = packPtr2->nextPtr) { if (packPtr2 == NULL) { Tcl_Panic("Unlink couldn't find previous window"); } @@ -1378,7 +1378,7 @@ Unlink( * being no managed children inside it. */ - if ((containerPtr->slavePtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { + if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) { TkFreeGeometryContainer(containerPtr->tkwin, "pack"); containerPtr->flags &= ~ALLOCED_CONTAINER; Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL); @@ -1441,7 +1441,7 @@ PackStructureProc( Packer *packPtr = (Packer *)clientData; if (eventPtr->type == ConfigureNotify) { - if ((packPtr->slavePtr != NULL) + if ((packPtr->contentPtr != NULL) && !(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; Tcl_DoWhenIdle(ArrangePacking, packPtr); @@ -1455,19 +1455,19 @@ PackStructureProc( } } } else if (eventPtr->type == DestroyNotify) { - Packer *slavePtr, *nextPtr; + Packer *contentPtr, *nextPtr; if (packPtr->containerPtr != NULL) { Unlink(packPtr); } - for (slavePtr = packPtr->slavePtr; slavePtr != NULL; - slavePtr = nextPtr) { - Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL); - Tk_UnmapWindow(slavePtr->tkwin); - slavePtr->containerPtr = NULL; - nextPtr = slavePtr->nextPtr; - slavePtr->nextPtr = NULL; + for (contentPtr = packPtr->contentPtr; contentPtr != NULL; + contentPtr = nextPtr) { + Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL); + Tk_UnmapWindow(contentPtr->tkwin); + contentPtr->containerPtr = NULL; + nextPtr = contentPtr->nextPtr; + contentPtr->nextPtr = NULL; } if (packPtr->tkwin != NULL) { @@ -1487,7 +1487,7 @@ PackStructureProc( * that all of its slaves get remapped. */ - if ((packPtr->slavePtr != NULL) + if ((packPtr->contentPtr != NULL) && !(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; Tcl_DoWhenIdle(ArrangePacking, packPtr); @@ -1500,7 +1500,7 @@ PackStructureProc( * don't bother to keep redisplaying themselves. */ - for (packPtr2 = packPtr->slavePtr; packPtr2 != NULL; + for (packPtr2 = packPtr->contentPtr; packPtr2 != NULL; packPtr2 = packPtr2->nextPtr) { Tk_UnmapWindow(packPtr2->tkwin); } @@ -1537,7 +1537,7 @@ ConfigureContent( * "option value" pairs. Caller must make sure * that there is at least one window name. */ { - Packer *containerPtr, *slavePtr, *prevPtr, *otherPtr; + Packer *containerPtr, *contentPtr, *prevPtr, *otherPtr; Tk_Window other, slave, parent, ancestor; TkWindow *master; int i, j, numWindows, tmp, positionGiven; @@ -1585,8 +1585,8 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL); return TCL_ERROR; } - slavePtr = GetPacker(slave); - slavePtr->flags &= ~OLD_STYLE; + contentPtr = GetPacker(slave); + contentPtr->flags &= ~OLD_STYLE; /* * If the slave isn't currently packed, reset all of its configuration @@ -1594,13 +1594,13 @@ ConfigureContent( * a previous packing). */ - if (slavePtr->containerPtr == NULL) { - slavePtr->side = TOP; - slavePtr->anchor = TK_ANCHOR_CENTER; - slavePtr->padX = slavePtr->padY = 0; - slavePtr->padLeft = slavePtr->padTop = 0; - slavePtr->iPadX = slavePtr->iPadY = 0; - slavePtr->flags &= ~(FILLX|FILLY|EXPAND); + if (contentPtr->containerPtr == NULL) { + contentPtr->side = TOP; + contentPtr->anchor = TK_ANCHOR_CENTER; + contentPtr->padX = contentPtr->padY = 0; + contentPtr->padLeft = contentPtr->padTop = 0; + contentPtr->iPadX = contentPtr->iPadY = 0; + contentPtr->flags &= ~(FILLX|FILLY|EXPAND); } for (i = numWindows; i < objc; i+=2) { @@ -1638,7 +1638,7 @@ ConfigureContent( } break; case CONF_ANCHOR: - if (Tk_GetAnchorFromObj(interp, objv[i+1], &slavePtr->anchor) + if (Tk_GetAnchorFromObj(interp, objv[i+1], &contentPtr->anchor) != TCL_OK) { return TCL_ERROR; } @@ -1654,7 +1654,7 @@ ConfigureContent( goto notPacked; } containerPtr = otherPtr->containerPtr; - prevPtr = containerPtr->slavePtr; + prevPtr = containerPtr->contentPtr; if (prevPtr == otherPtr) { prevPtr = NULL; } else { @@ -1669,21 +1669,21 @@ ConfigureContent( if (Tcl_GetBooleanFromObj(interp, objv[i+1], &tmp) != TCL_OK) { return TCL_ERROR; } - slavePtr->flags &= ~EXPAND; + contentPtr->flags &= ~EXPAND; if (tmp) { - slavePtr->flags |= EXPAND; + contentPtr->flags |= EXPAND; } break; case CONF_FILL: string = Tcl_GetString(objv[i+1]); if (strcmp(string, "none") == 0) { - slavePtr->flags &= ~(FILLX|FILLY); + contentPtr->flags &= ~(FILLX|FILLY); } else if (strcmp(string, "x") == 0) { - slavePtr->flags = (slavePtr->flags & ~FILLY) | FILLX; + contentPtr->flags = (contentPtr->flags & ~FILLY) | FILLX; } else if (strcmp(string, "y") == 0) { - slavePtr->flags = (slavePtr->flags & ~FILLX) | FILLY; + contentPtr->flags = (contentPtr->flags & ~FILLX) | FILLY; } else if (strcmp(string, "both") == 0) { - slavePtr->flags |= FILLX|FILLY; + contentPtr->flags |= FILLX|FILLY; } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad fill style \"%s\": must be " @@ -1699,7 +1699,7 @@ ConfigureContent( return TCL_ERROR; } containerPtr = GetPacker(other); - prevPtr = containerPtr->slavePtr; + prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { prevPtr = prevPtr->nextPtr; @@ -1717,7 +1717,7 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadX = tmp * 2; + contentPtr->iPadX = tmp * 2; break; case CONF_IPADY: if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp) @@ -1728,17 +1728,17 @@ ConfigureContent( Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL); return TCL_ERROR; } - slavePtr->iPadY = tmp * 2; + contentPtr->iPadY = tmp * 2; break; case CONF_PADX: if (TkParsePadAmount(interp, slave, objv[i+1], - &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) { + &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) { return TCL_ERROR; } break; case CONF_PADY: if (TkParsePadAmount(interp, slave, objv[i+1], - &slavePtr->padTop, &slavePtr->padY) != TCL_OK) { + &contentPtr->padTop, &contentPtr->padY) != TCL_OK) { return TCL_ERROR; } break; @@ -1747,7 +1747,7 @@ ConfigureContent( sizeof(char *), "side", TCL_EXACT, &side) != TCL_OK) { return TCL_ERROR; } - slavePtr->side = (Side) side; + contentPtr->side = (Side) side; break; } } @@ -1758,8 +1758,8 @@ ConfigureContent( * current packing list. */ - if (!positionGiven && (slavePtr->containerPtr != NULL)) { - containerPtr = slavePtr->containerPtr; + if (!positionGiven && (contentPtr->containerPtr != NULL)) { + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } @@ -1769,8 +1769,8 @@ ConfigureContent( * since it won't work anyway. */ - if (prevPtr == slavePtr) { - containerPtr = slavePtr->containerPtr; + if (prevPtr == contentPtr) { + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } @@ -1782,7 +1782,7 @@ ConfigureContent( if (!positionGiven) { containerPtr = GetPacker(Tk_Parent(slave)); - prevPtr = containerPtr->slavePtr; + prevPtr = containerPtr->contentPtr; if (prevPtr != NULL) { while (prevPtr->nextPtr != NULL) { prevPtr = prevPtr->nextPtr; @@ -1839,32 +1839,32 @@ ConfigureContent( * prevPtr. */ - if (slavePtr->containerPtr != NULL) { - if ((slavePtr->containerPtr != containerPtr) && - (slavePtr->containerPtr->tkwin - != Tk_Parent(slavePtr->tkwin))) { - Tk_UnmaintainGeometry(slavePtr->tkwin, - slavePtr->containerPtr->tkwin); + if (contentPtr->containerPtr != NULL) { + if ((contentPtr->containerPtr != containerPtr) && + (contentPtr->containerPtr->tkwin + != Tk_Parent(contentPtr->tkwin))) { + Tk_UnmaintainGeometry(contentPtr->tkwin, + contentPtr->containerPtr->tkwin); } - Unlink(slavePtr); + Unlink(contentPtr); } - slavePtr->containerPtr = containerPtr; + contentPtr->containerPtr = containerPtr; if (prevPtr == NULL) { - slavePtr->nextPtr = containerPtr->slavePtr; - containerPtr->slavePtr = slavePtr; + contentPtr->nextPtr = containerPtr->contentPtr; + containerPtr->contentPtr = contentPtr; } else { - slavePtr->nextPtr = prevPtr->nextPtr; - prevPtr->nextPtr = slavePtr; + contentPtr->nextPtr = prevPtr->nextPtr; + prevPtr->nextPtr = contentPtr; } - Tk_ManageGeometry(slave, &packerType, slavePtr); - prevPtr = slavePtr; + Tk_ManageGeometry(slave, &packerType, contentPtr); + prevPtr = contentPtr; if (!(containerPtr->flags & DONT_PROPAGATE)) { if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack") != TCL_OK) { Tk_ManageGeometry(slave, NULL, NULL); - Unlink(slavePtr); + Unlink(contentPtr); return TCL_ERROR; } containerPtr->flags |= ALLOCED_CONTAINER; diff --git a/generic/tkPlace.c b/generic/tkPlace.c index f113a49..b4b358f 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -35,15 +35,15 @@ typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode; * structure of the following type: */ -typedef struct Slave { +typedef struct Content { Tk_Window tkwin; /* Tk's token for window. */ Tk_Window inTkwin; /* Token for the -in window. */ - struct Master *containerPtr; /* Pointer to information for window relative + struct Container *containerPtr; /* Pointer to information for window relative * to which tkwin is placed. This isn't * necessarily the logical parent of tkwin. * NULL means the container was deleted or never * assigned. */ - struct Slave *nextPtr; /* Next in list of windows placed relative to + struct Content *nextPtr; /* Next in list of windows placed relative to * same container (NULL for end of list). */ Tk_OptionTable optionTable; /* Table that defines configuration options * available for this command. */ @@ -72,7 +72,7 @@ typedef struct Slave { BorderMode borderMode; /* How to treat borders of container window. */ int flags; /* Various flags; see below for bit * definitions. */ -} Slave; +} Content; /* * Type masks for options: @@ -82,34 +82,34 @@ typedef struct Slave { static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", TCL_INDEX_NONE, - offsetof(Slave, anchor), 0, 0, 0}, + offsetof(Content, anchor), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", TCL_INDEX_NONE, - offsetof(Slave, borderMode), 0, borderModeStrings, 0}, - {TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Slave, heightPtr), - offsetof(Slave, height), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Slave, inTkwin), + offsetof(Content, borderMode), 0, borderModeStrings, 0}, + {TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Content, heightPtr), + offsetof(Content, height), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Content, inTkwin), 0, 0, IN_MASK}, {TK_OPTION_DOUBLE, "-relheight", NULL, NULL, "", - offsetof(Slave, relHeightPtr), offsetof(Slave, relHeight), + offsetof(Content, relHeightPtr), offsetof(Content, relHeight), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, "", - offsetof(Slave, relWidthPtr), offsetof(Slave, relWidth), + offsetof(Content, relWidthPtr), offsetof(Content, relWidth), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0", TCL_INDEX_NONE, - offsetof(Slave, relX), 0, 0, 0}, + offsetof(Content, relX), 0, 0, 0}, {TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0", TCL_INDEX_NONE, - offsetof(Slave, relY), 0, 0, 0}, - {TK_OPTION_PIXELS, "-width", NULL, NULL, "", offsetof(Slave, widthPtr), - offsetof(Slave, width), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Slave, xPtr), - offsetof(Slave, x), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Slave, yPtr), - offsetof(Slave, y), TK_OPTION_NULL_OK, 0, 0}, + offsetof(Content, relY), 0, 0, 0}, + {TK_OPTION_PIXELS, "-width", NULL, NULL, "", offsetof(Content, widthPtr), + offsetof(Content, width), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Content, xPtr), + offsetof(Content, x), TK_OPTION_NULL_OK, 0, 0}, + {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Content, yPtr), + offsetof(Content, y), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0} }; /* - * Flag definitions for Slave structures: + * Flag definitions for Content structures: * * CHILD_WIDTH - 1 means -width was specified; * CHILD_REL_WIDTH - 1 means -relwidth was specified. @@ -127,9 +127,9 @@ static const Tk_OptionSpec optionSpecs[] = { * structure of the following form: */ -typedef struct Master { +typedef struct Container { Tk_Window tkwin; /* Tk's token for container window. */ - struct Slave *slavePtr; /* First in linked list of slaves placed + struct Content *contentPtr; /* First in linked list of slaves placed * relative to this container. */ int *abortPtr; /* If non-NULL, it means that there is a nested * call to RecomputePlacement already working on @@ -138,7 +138,7 @@ typedef struct Master { * example, if tkwin or any of its slaves * is deleted. */ int flags; /* See below for bit definitions. */ -} Master; +} Container; /* * Flag definitions for containers: @@ -161,28 +161,28 @@ static void PlaceLostContentProc(ClientData clientData, static const Tk_GeomMgr placerType = { "place", /* name */ PlaceRequestProc, /* requestProc */ - PlaceLostContentProc, /* lostSlaveProc */ + PlaceLostContentProc, /* lostContentProc */ }; /* * Forward declarations for functions defined later in this file: */ -static void SlaveStructureProc(ClientData clientData, +static void ContentStructureProc(ClientData clientData, XEvent *eventPtr); static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, Tk_OptionTable table, int objc, Tcl_Obj *const objv[]); static int PlaceInfoCommand(Tcl_Interp *interp, Tk_Window tkwin); -static Slave * CreateSlave(Tk_Window tkwin, Tk_OptionTable table); -static void FreeSlave(Slave *slavePtr); -static Slave * FindSlave(Tk_Window tkwin); -static Master * CreateMaster(Tk_Window tkwin); -static Master * FindMaster(Tk_Window tkwin); +static Content * CreateContent(Tk_Window tkwin, Tk_OptionTable table); +static void FreeContent(Content *contentPtr); +static Content * FindContent(Tk_Window tkwin); +static Container * CreateContainer(Tk_Window tkwin); +static Container * FindContainer(Tk_Window tkwin); static void PlaceStructureProc(ClientData clientData, XEvent *eventPtr); static void RecomputePlacement(ClientData clientData); -static void UnlinkSlave(Slave *slavePtr); +static void UnlinkContent(Content *contentPtr); /* *-------------------------------------------------------------- @@ -210,7 +210,7 @@ Tk_PlaceObjCmd( { Tk_Window main_win = (Tk_Window)clientData; Tk_Window tkwin; - Slave *slavePtr; + Content *contentPtr; TkDisplay *dispPtr; Tk_OptionTable optionTable; static const char *const optionStrings[] = { @@ -247,8 +247,8 @@ Tk_PlaceObjCmd( dispPtr = ((TkWindow *) tkwin)->dispPtr; if (!dispPtr->placeInit) { - Tcl_InitHashTable(&dispPtr->masterTable, TCL_ONE_WORD_KEYS); - Tcl_InitHashTable(&dispPtr->slaveTable, TCL_ONE_WORD_KEYS); + Tcl_InitHashTable(&dispPtr->containerTable, TCL_ONE_WORD_KEYS); + Tcl_InitHashTable(&dispPtr->contentTable, TCL_ONE_WORD_KEYS); dispPtr->placeInit = 1; } @@ -271,8 +271,8 @@ Tk_PlaceObjCmd( dispPtr = ((TkWindow *) tkwin)->dispPtr; if (!dispPtr->placeInit) { - Tcl_InitHashTable(&dispPtr->masterTable, TCL_ONE_WORD_KEYS); - Tcl_InitHashTable(&dispPtr->slaveTable, TCL_ONE_WORD_KEYS); + Tcl_InitHashTable(&dispPtr->containerTable, TCL_ONE_WORD_KEYS); + Tcl_InitHashTable(&dispPtr->contentTable, TCL_ONE_WORD_KEYS); dispPtr->placeInit = 1; } @@ -286,11 +286,11 @@ Tk_PlaceObjCmd( if (objc == 3 || objc == 4) { Tcl_Obj *objPtr; - slavePtr = FindSlave(tkwin); - if (slavePtr == NULL) { + contentPtr = FindContent(tkwin); + if (contentPtr == NULL) { return TCL_OK; } - objPtr = Tk_GetOptionInfo(interp, slavePtr, optionTable, + objPtr = Tk_GetOptionInfo(interp, contentPtr, optionTable, (objc == 4) ? objv[3] : NULL, tkwin); if (objPtr == NULL) { return TCL_ERROR; @@ -305,22 +305,22 @@ Tk_PlaceObjCmd( Tcl_WrongNumArgs(interp, 2, objv, "pathName"); return TCL_ERROR; } - slavePtr = FindSlave(tkwin); - if (slavePtr == NULL) { + contentPtr = FindContent(tkwin); + if (contentPtr == NULL) { return TCL_OK; } - if ((slavePtr->containerPtr != NULL) && - (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); + if ((contentPtr->containerPtr != NULL) && + (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - UnlinkSlave(slavePtr); - Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, + UnlinkContent(contentPtr); + Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable, tkwin)); - Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, - slavePtr); + Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc, + contentPtr); Tk_ManageGeometry(tkwin, NULL, NULL); Tk_UnmapWindow(tkwin); - FreeSlave(slavePtr); + FreeContent(contentPtr); break; case PLACE_INFO: @@ -332,20 +332,20 @@ Tk_PlaceObjCmd( case PLACE_CONTENT: case PLACE_SLAVES: { - Master *containerPtr; + Container *containerPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pathName"); return TCL_ERROR; } - containerPtr = FindMaster(tkwin); + containerPtr = FindContainer(tkwin); if (containerPtr != NULL) { Tcl_Obj *listPtr = Tcl_NewObj(); - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { Tcl_ListObjAppendElement(NULL, listPtr, - Tk_NewWindowObj(slavePtr->tkwin)); + Tk_NewWindowObj(contentPtr->tkwin)); } Tcl_SetObjResult(interp, listPtr); } @@ -359,33 +359,33 @@ Tk_PlaceObjCmd( /* *---------------------------------------------------------------------- * - * CreateSlave -- + * CreateContent -- * - * Given a Tk_Window token, find the Slave structure corresponding to + * Given a Tk_Window token, find the Content structure corresponding to * that token, creating a new one if necessary. * * Results: - * Pointer to the Slave structure. + * Pointer to the Content structure. * * Side effects: - * A new Slave structure may be created. + * A new Content structure may be created. * *---------------------------------------------------------------------- */ -static Slave * -CreateSlave( +static Content * +CreateContent( Tk_Window tkwin, /* Token for desired slave. */ Tk_OptionTable table) { Tcl_HashEntry *hPtr; - Slave *slavePtr; + Content *contentPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew); + hPtr = Tcl_CreateHashEntry(&dispPtr->contentTable, (char *) tkwin, &isNew); if (!isNew) { - return (Slave *)Tcl_GetHashValue(hPtr); + return (Content *)Tcl_GetHashValue(hPtr); } /* @@ -393,25 +393,25 @@ CreateSlave( * populate it with some default values. */ - slavePtr = (Slave *)ckalloc(sizeof(Slave)); - memset(slavePtr, 0, sizeof(Slave)); - slavePtr->tkwin = tkwin; - slavePtr->inTkwin = NULL; - slavePtr->anchor = TK_ANCHOR_NW; - slavePtr->borderMode = BM_INSIDE; - slavePtr->optionTable = table; - Tcl_SetHashValue(hPtr, slavePtr); - Tk_CreateEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, - slavePtr); - return slavePtr; + contentPtr = (Content *)ckalloc(sizeof(Content)); + memset(contentPtr, 0, sizeof(Content)); + contentPtr->tkwin = tkwin; + contentPtr->inTkwin = NULL; + contentPtr->anchor = TK_ANCHOR_NW; + contentPtr->borderMode = BM_INSIDE; + contentPtr->optionTable = table; + Tcl_SetHashValue(hPtr, contentPtr); + Tk_CreateEventHandler(tkwin, StructureNotifyMask, ContentStructureProc, + contentPtr); + return contentPtr; } /* *---------------------------------------------------------------------- * - * FreeSlave -- + * FreeContent -- * - * Frees the resources held by a Slave structure. + * Frees the resources held by a Content structure. * * Results: * None @@ -423,25 +423,25 @@ CreateSlave( */ static void -FreeSlave( - Slave *slavePtr) +FreeContent( + Content *contentPtr) { - Tk_FreeConfigOptions((char *) slavePtr, slavePtr->optionTable, - slavePtr->tkwin); - ckfree(slavePtr); + Tk_FreeConfigOptions((char *) contentPtr, contentPtr->optionTable, + contentPtr->tkwin); + ckfree(contentPtr); } /* *---------------------------------------------------------------------- * - * FindSlave -- + * FindContent -- * - * Given a Tk_Window token, find the Slave structure corresponding to + * Given a Tk_Window token, find the Content structure corresponding to * that token. This is purely a lookup function; it will not create a * record if one does not yet exist. * * Results: - * Pointer to Slave structure; NULL if none exists. + * Pointer to Content structure; NULL if none exists. * * Side effects: * None. @@ -449,24 +449,24 @@ FreeSlave( *---------------------------------------------------------------------- */ -static Slave * -FindSlave( +static Content * +FindContent( Tk_Window tkwin) /* Token for desired slave. */ { Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, tkwin); + hPtr = Tcl_FindHashEntry(&dispPtr->contentTable, tkwin); if (hPtr == NULL) { return NULL; } - return (Slave *)Tcl_GetHashValue(hPtr); + return (Content *)Tcl_GetHashValue(hPtr); } /* *---------------------------------------------------------------------- * - * UnlinkSlave -- + * UnlinkContent -- * * This function removes a slave window from the chain of slaves in its * container. @@ -475,31 +475,31 @@ FindSlave( * None. * * Side effects: - * The slave list of slavePtr's container changes. + * The slave list of contentPtr's container changes. * *---------------------------------------------------------------------- */ static void -UnlinkSlave( - Slave *slavePtr) /* Slave structure to be unlinked. */ +UnlinkContent( + Content *contentPtr) /* Content structure to be unlinked. */ { - Master *containerPtr; - Slave *prevPtr; + Container *containerPtr; + Content *prevPtr; - containerPtr = slavePtr->containerPtr; + containerPtr = contentPtr->containerPtr; if (containerPtr == NULL) { return; } - if (containerPtr->slavePtr == slavePtr) { - containerPtr->slavePtr = slavePtr->nextPtr; + if (containerPtr->contentPtr == contentPtr) { + containerPtr->contentPtr = contentPtr->nextPtr; } else { - for (prevPtr = containerPtr->slavePtr; ; prevPtr = prevPtr->nextPtr) { + for (prevPtr = containerPtr->contentPtr; ; prevPtr = prevPtr->nextPtr) { if (prevPtr == NULL) { - Tcl_Panic("UnlinkSlave couldn't find slave to unlink"); + Tcl_Panic("UnlinkContent couldn't find slave to unlink"); } - if (prevPtr->nextPtr == slavePtr) { - prevPtr->nextPtr = slavePtr->nextPtr; + if (prevPtr->nextPtr == contentPtr) { + prevPtr->nextPtr = contentPtr->nextPtr; break; } } @@ -508,47 +508,47 @@ UnlinkSlave( if (containerPtr->abortPtr != NULL) { *containerPtr->abortPtr = 1; } - slavePtr->containerPtr = NULL; + contentPtr->containerPtr = NULL; } /* *---------------------------------------------------------------------- * - * CreateMaster -- + * CreateContainer -- * - * Given a Tk_Window token, find the Master structure corresponding to + * Given a Tk_Window token, find the Container structure corresponding to * that token, creating a new one if necessary. * * Results: - * Pointer to the Master structure. + * Pointer to the Container structure. * * Side effects: - * A new Master structure may be created. + * A new Container structure may be created. * *---------------------------------------------------------------------- */ -static Master * -CreateMaster( +static Container * +CreateContainer( Tk_Window tkwin) /* Token for desired container. */ { Tcl_HashEntry *hPtr; - Master *containerPtr; + Container *containerPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew); + hPtr = Tcl_CreateHashEntry(&dispPtr->containerTable, (char *)tkwin, &isNew); if (isNew) { - containerPtr = (Master *)ckalloc(sizeof(Master)); + containerPtr = (Container *)ckalloc(sizeof(Container)); containerPtr->tkwin = tkwin; - containerPtr->slavePtr = NULL; + containerPtr->contentPtr = NULL; containerPtr->abortPtr = NULL; containerPtr->flags = 0; Tcl_SetHashValue(hPtr, containerPtr); Tk_CreateEventHandler(containerPtr->tkwin, StructureNotifyMask, PlaceStructureProc, containerPtr); } else { - containerPtr = (Master *)Tcl_GetHashValue(hPtr); + containerPtr = (Container *)Tcl_GetHashValue(hPtr); } return containerPtr; } @@ -556,14 +556,14 @@ CreateMaster( /* *---------------------------------------------------------------------- * - * FindMaster -- + * FindContainer -- * - * Given a Tk_Window token, find the Master structure corresponding to + * Given a Tk_Window token, find the Container structure corresponding to * that token. This is simply a lookup function; a new record will not be * created if one does not already exist. * * Results: - * Pointer to the Master structure; NULL if one does not exist for the + * Pointer to the Container structure; NULL if one does not exist for the * given Tk_Window token. * * Side effects: @@ -572,18 +572,18 @@ CreateMaster( *---------------------------------------------------------------------- */ -static Master * -FindMaster( +static Container * +FindContainer( Tk_Window tkwin) /* Token for desired container. */ { Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, tkwin); + hPtr = Tcl_FindHashEntry(&dispPtr->containerTable, tkwin); if (hPtr == NULL) { return NULL; } - return (Master *)Tcl_GetHashValue(hPtr); + return (Container *)Tcl_GetHashValue(hPtr); } /* @@ -599,7 +599,7 @@ FindMaster( * the interp's result. * * Side effects: - * Information in slavePtr may change, and slavePtr's container is scheduled + * Information in contentPtr may change, and contentPtr's container is scheduled * for reconfiguration. * *---------------------------------------------------------------------- @@ -613,10 +613,10 @@ ConfigureContent( int objc, /* Number of config arguments. */ Tcl_Obj *const objv[]) /* Object values for arguments. */ { - Master *containerPtr; + Container *containerPtr; Tk_SavedOptions savedOptions; int mask; - Slave *slavePtr; + Content *contentPtr; Tk_Window containerWin = NULL; TkWindow *container; @@ -628,10 +628,10 @@ ConfigureContent( return TCL_ERROR; } - slavePtr = CreateSlave(tkwin, table); + contentPtr = CreateContent(tkwin, table); - if (Tk_SetOptions(interp, slavePtr, table, objc, objv, - slavePtr->tkwin, &savedOptions, &mask) != TCL_OK) { + if (Tk_SetOptions(interp, contentPtr, table, objc, objv, + contentPtr->tkwin, &savedOptions, &mask) != TCL_OK) { goto error; } @@ -639,37 +639,37 @@ ConfigureContent( * Set slave flags. First clear the field, then add bits as needed. */ - slavePtr->flags = 0; - if (slavePtr->heightPtr) { - slavePtr->flags |= CHILD_HEIGHT; + contentPtr->flags = 0; + if (contentPtr->heightPtr) { + contentPtr->flags |= CHILD_HEIGHT; } - if (slavePtr->relHeightPtr) { - slavePtr->flags |= CHILD_REL_HEIGHT; + if (contentPtr->relHeightPtr) { + contentPtr->flags |= CHILD_REL_HEIGHT; } - if (slavePtr->relWidthPtr) { - slavePtr->flags |= CHILD_REL_WIDTH; + if (contentPtr->relWidthPtr) { + contentPtr->flags |= CHILD_REL_WIDTH; } - if (slavePtr->widthPtr) { - slavePtr->flags |= CHILD_WIDTH; + if (contentPtr->widthPtr) { + contentPtr->flags |= CHILD_WIDTH; } - if (!(mask & IN_MASK) && (slavePtr->containerPtr != NULL)) { + if (!(mask & IN_MASK) && (contentPtr->containerPtr != NULL)) { /* * If no -in option was passed and the slave is already placed then * just recompute the placement. */ - containerPtr = slavePtr->containerPtr; + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } else if (mask & IN_MASK) { /* -in changed */ Tk_Window tkwin; Tk_Window ancestor; - tkwin = slavePtr->inTkwin; + tkwin = contentPtr->inTkwin; /* * Make sure that the new container is either the logical parent of the @@ -678,21 +678,21 @@ ConfigureContent( */ for (ancestor = tkwin; ; ancestor = Tk_Parent(ancestor)) { - if (ancestor == Tk_Parent(slavePtr->tkwin)) { + if (ancestor == Tk_Parent(contentPtr->tkwin)) { break; } if (Tk_TopWinHierarchy(ancestor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place %s relative to %s", - Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin))); + Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); goto error; } } - if (slavePtr->tkwin == tkwin) { + if (contentPtr->tkwin == tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place %s relative to itself", - Tk_PathName(slavePtr->tkwin))); + Tk_PathName(contentPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } @@ -703,32 +703,32 @@ ConfigureContent( for (container = (TkWindow *)tkwin; container != NULL; container = (TkWindow *)TkGetGeomMaster(container)) { - if (container == (TkWindow *)slavePtr->tkwin) { + if (container == (TkWindow *)contentPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", - Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin))); + Tk_PathName(contentPtr->tkwin), Tk_PathName(tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } } - if (tkwin != Tk_Parent(slavePtr->tkwin)) { - ((TkWindow *)slavePtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; + if (tkwin != Tk_Parent(contentPtr->tkwin)) { + ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; } - if ((slavePtr->containerPtr != NULL) - && (slavePtr->containerPtr->tkwin == tkwin)) { + if ((contentPtr->containerPtr != NULL) + && (contentPtr->containerPtr->tkwin == tkwin)) { /* * Re-using same old container. Nothing to do. */ - containerPtr = slavePtr->containerPtr; + containerPtr = contentPtr->containerPtr; goto scheduleLayout; } - if ((slavePtr->containerPtr != NULL) && - (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); + if ((contentPtr->containerPtr != NULL) && + (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } - UnlinkSlave(slavePtr); + UnlinkContent(contentPtr); containerWin = tkwin; } @@ -737,19 +737,19 @@ ConfigureContent( */ if (containerWin == NULL) { - containerWin = Tk_Parent(slavePtr->tkwin); - slavePtr->inTkwin = containerWin; + containerWin = Tk_Parent(contentPtr->tkwin); + contentPtr->inTkwin = containerWin; } /* * Manage the slave window in this container. */ - containerPtr = CreateMaster(containerWin); - slavePtr->containerPtr = containerPtr; - slavePtr->nextPtr = containerPtr->slavePtr; - containerPtr->slavePtr = slavePtr; - Tk_ManageGeometry(slavePtr->tkwin, &placerType, slavePtr); + containerPtr = CreateContainer(containerWin); + contentPtr->containerPtr = containerPtr; + contentPtr->nextPtr = containerPtr->contentPtr; + containerPtr->contentPtr = contentPtr; + Tk_ManageGeometry(contentPtr->tkwin, &placerType, contentPtr); /* * Arrange for the container to be re-arranged at the first idle moment. @@ -796,49 +796,49 @@ PlaceInfoCommand( Tcl_Interp *interp, /* Interp into which to place result. */ Tk_Window tkwin) /* Token for the window to get info on. */ { - Slave *slavePtr; + Content *contentPtr; Tcl_Obj *infoObj; - slavePtr = FindSlave(tkwin); - if (slavePtr == NULL) { + contentPtr = FindContent(tkwin); + if (contentPtr == NULL) { return TCL_OK; } infoObj = Tcl_NewObj(); - if (slavePtr->containerPtr != NULL) { + if (contentPtr->containerPtr != NULL) { Tcl_AppendToObj(infoObj, "-in", -1); Tcl_ListObjAppendElement(NULL, infoObj, - Tk_NewWindowObj(slavePtr->containerPtr->tkwin)); + Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); Tcl_AppendToObj(infoObj, " ", -1); } Tcl_AppendPrintfToObj(infoObj, "-x %d -relx %.4g -y %d -rely %.4g", - slavePtr->x, slavePtr->relX, slavePtr->y, slavePtr->relY); - if (slavePtr->flags & CHILD_WIDTH) { - Tcl_AppendPrintfToObj(infoObj, " -width %d", slavePtr->width); + contentPtr->x, contentPtr->relX, contentPtr->y, contentPtr->relY); + if (contentPtr->flags & CHILD_WIDTH) { + Tcl_AppendPrintfToObj(infoObj, " -width %d", contentPtr->width); } else { Tcl_AppendToObj(infoObj, " -width {}", -1); } - if (slavePtr->flags & CHILD_REL_WIDTH) { + if (contentPtr->flags & CHILD_REL_WIDTH) { Tcl_AppendPrintfToObj(infoObj, - " -relwidth %.4g", slavePtr->relWidth); + " -relwidth %.4g", contentPtr->relWidth); } else { Tcl_AppendToObj(infoObj, " -relwidth {}", -1); } - if (slavePtr->flags & CHILD_HEIGHT) { - Tcl_AppendPrintfToObj(infoObj, " -height %d", slavePtr->height); + if (contentPtr->flags & CHILD_HEIGHT) { + Tcl_AppendPrintfToObj(infoObj, " -height %d", contentPtr->height); } else { Tcl_AppendToObj(infoObj, " -height {}", -1); } - if (slavePtr->flags & CHILD_REL_HEIGHT) { + if (contentPtr->flags & CHILD_REL_HEIGHT) { Tcl_AppendPrintfToObj(infoObj, - " -relheight %.4g", slavePtr->relHeight); + " -relheight %.4g", contentPtr->relHeight); } else { Tcl_AppendToObj(infoObj, " -relheight {}", -1); } Tcl_AppendPrintfToObj(infoObj, " -anchor %s -bordermode %s", - Tk_NameOfAnchor(slavePtr->anchor), - borderModeStrings[slavePtr->borderMode]); + Tk_NameOfAnchor(contentPtr->anchor), + borderModeStrings[contentPtr->borderMode]); Tcl_SetObjResult(interp, infoObj); return TCL_OK; } @@ -862,10 +862,10 @@ PlaceInfoCommand( static void RecomputePlacement( - ClientData clientData) /* Pointer to Master record. */ + ClientData clientData) /* Pointer to Container record. */ { - Master *containerPtr = (Master *)clientData; - Slave *slavePtr; + Container *containerPtr = (Container *)clientData; + Content *contentPtr; int x, y, width, height, tmp; int containerWidth, containerHeight, containerX, containerY; double x1, y1, x2, y2; @@ -894,8 +894,8 @@ RecomputePlacement( * parent or child. If this happens, we'll be told to abort. */ - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL && !abort; - slavePtr = slavePtr->nextPtr) { + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort; + contentPtr = contentPtr->nextPtr) { /* * Step 1: compute size and borderwidth of container, taking into account * desired border mode. @@ -904,13 +904,13 @@ RecomputePlacement( containerX = containerY = 0; containerWidth = Tk_Width(containerPtr->tkwin); containerHeight = Tk_Height(containerPtr->tkwin); - if (slavePtr->borderMode == BM_INSIDE) { + if (contentPtr->borderMode == BM_INSIDE) { containerX = Tk_InternalBorderLeft(containerPtr->tkwin); containerY = Tk_InternalBorderTop(containerPtr->tkwin); containerWidth -= containerX + Tk_InternalBorderRight(containerPtr->tkwin); containerHeight -= containerY + Tk_InternalBorderBottom(containerPtr->tkwin); - } else if (slavePtr->borderMode == BM_OUTSIDE) { + } else if (contentPtr->borderMode == BM_OUTSIDE) { containerX = containerY = -Tk_Changes(containerPtr->tkwin)->border_width; containerWidth -= 2 * containerX; containerHeight -= 2 * containerY; @@ -921,16 +921,16 @@ RecomputePlacement( * and location of anchor point within container. */ - x1 = slavePtr->x + containerX + (slavePtr->relX*containerWidth); + x1 = contentPtr->x + containerX + (contentPtr->relX*containerWidth); x = (int) (x1 + ((x1 > 0) ? 0.5 : -0.5)); - y1 = slavePtr->y + containerY + (slavePtr->relY*containerHeight); + y1 = contentPtr->y + containerY + (contentPtr->relY*containerHeight); y = (int) (y1 + ((y1 > 0) ? 0.5 : -0.5)); - if (slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) { + if (contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) { width = 0; - if (slavePtr->flags & CHILD_WIDTH) { - width += slavePtr->width; + if (contentPtr->flags & CHILD_WIDTH) { + width += contentPtr->width; } - if (slavePtr->flags & CHILD_REL_WIDTH) { + if (contentPtr->flags & CHILD_REL_WIDTH) { /* * The code below is a bit tricky. In order to round correctly * when both relX and relWidth are specified, compute the @@ -939,31 +939,31 @@ RecomputePlacement( * errors in relX and relWidth accumulate. */ - x2 = x1 + (slavePtr->relWidth*containerWidth); + x2 = x1 + (contentPtr->relWidth*containerWidth); tmp = (int) (x2 + ((x2 > 0) ? 0.5 : -0.5)); width += tmp - x; } } else { - width = Tk_ReqWidth(slavePtr->tkwin) - + 2*Tk_Changes(slavePtr->tkwin)->border_width; + width = Tk_ReqWidth(contentPtr->tkwin) + + 2*Tk_Changes(contentPtr->tkwin)->border_width; } - if (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) { + if (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) { height = 0; - if (slavePtr->flags & CHILD_HEIGHT) { - height += slavePtr->height; + if (contentPtr->flags & CHILD_HEIGHT) { + height += contentPtr->height; } - if (slavePtr->flags & CHILD_REL_HEIGHT) { + if (contentPtr->flags & CHILD_REL_HEIGHT) { /* * See note above for rounding errors in width computation. */ - y2 = y1 + (slavePtr->relHeight*containerHeight); + y2 = y1 + (contentPtr->relHeight*containerHeight); tmp = (int) (y2 + ((y2 > 0) ? 0.5 : -0.5)); height += tmp - y; } } else { - height = Tk_ReqHeight(slavePtr->tkwin) - + 2*Tk_Changes(slavePtr->tkwin)->border_width; + height = Tk_ReqHeight(contentPtr->tkwin) + + 2*Tk_Changes(contentPtr->tkwin)->border_width; } /* @@ -972,7 +972,7 @@ RecomputePlacement( * border mode and container's border. */ - switch (slavePtr->anchor) { + switch (contentPtr->anchor) { case TK_ANCHOR_N: x -= width/2; break; @@ -1011,8 +1011,8 @@ RecomputePlacement( * height aren't zero. */ - width -= 2*Tk_Changes(slavePtr->tkwin)->border_width; - height -= 2*Tk_Changes(slavePtr->tkwin)->border_width; + width -= 2*Tk_Changes(contentPtr->tkwin)->border_width; + height -= 2*Tk_Changes(contentPtr->tkwin)->border_width; if (width <= 0) { width = 1; } @@ -1027,12 +1027,12 @@ RecomputePlacement( * re-adjust things as relevant windows map, unmap, and move). */ - if (containerPtr->tkwin == Tk_Parent(slavePtr->tkwin)) { - if ((x != Tk_X(slavePtr->tkwin)) - || (y != Tk_Y(slavePtr->tkwin)) - || (width != Tk_Width(slavePtr->tkwin)) - || (height != Tk_Height(slavePtr->tkwin))) { - Tk_MoveResizeWindow(slavePtr->tkwin, x, y, width, height); + if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) { + if ((x != Tk_X(contentPtr->tkwin)) + || (y != Tk_Y(contentPtr->tkwin)) + || (width != Tk_Width(contentPtr->tkwin)) + || (height != Tk_Height(contentPtr->tkwin))) { + Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height); } if (abort) { break; @@ -1044,14 +1044,14 @@ RecomputePlacement( */ if (Tk_IsMapped(containerPtr->tkwin)) { - Tk_MapWindow(slavePtr->tkwin); + Tk_MapWindow(contentPtr->tkwin); } } else { if ((width <= 0) || (height <= 0)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, containerPtr->tkwin); - Tk_UnmapWindow(slavePtr->tkwin); + Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin); + Tk_UnmapWindow(contentPtr->tkwin); } else { - Tk_MaintainGeometry(slavePtr->tkwin, containerPtr->tkwin, + Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y, width, height); } } @@ -1081,30 +1081,30 @@ RecomputePlacement( static void PlaceStructureProc( - ClientData clientData, /* Pointer to Master structure for window + ClientData clientData, /* Pointer to Container structure for window * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - Master *containerPtr = (Master *)clientData; - Slave *slavePtr, *nextPtr; + Container *containerPtr = (Container *)clientData; + Content *contentPtr, *nextPtr; TkDisplay *dispPtr = ((TkWindow *) containerPtr->tkwin)->dispPtr; switch (eventPtr->type) { case ConfigureNotify: - if ((containerPtr->slavePtr != NULL) + if ((containerPtr->contentPtr != NULL) && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) { containerPtr->flags |= PARENT_RECONFIG_PENDING; Tcl_DoWhenIdle(RecomputePlacement, containerPtr); } return; case DestroyNotify: - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; - slavePtr = nextPtr) { - slavePtr->containerPtr = NULL; - nextPtr = slavePtr->nextPtr; - slavePtr->nextPtr = NULL; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = nextPtr) { + contentPtr->containerPtr = NULL; + nextPtr = contentPtr->nextPtr; + contentPtr->nextPtr = NULL; } - Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable, + Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->containerTable, containerPtr->tkwin)); if (containerPtr->flags & PARENT_RECONFIG_PENDING) { Tcl_CancelIdleCall(RecomputePlacement, containerPtr); @@ -1121,7 +1121,7 @@ PlaceStructureProc( * that all of its slaves get remapped. */ - if ((containerPtr->slavePtr != NULL) + if ((containerPtr->contentPtr != NULL) && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) { containerPtr->flags |= PARENT_RECONFIG_PENDING; Tcl_DoWhenIdle(RecomputePlacement, containerPtr); @@ -1133,9 +1133,9 @@ PlaceStructureProc( * don't keep redisplaying themselves. */ - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - Tk_UnmapWindow(slavePtr->tkwin); + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + Tk_UnmapWindow(contentPtr->tkwin); } return; } @@ -1144,7 +1144,7 @@ PlaceStructureProc( /* *---------------------------------------------------------------------- * - * SlaveStructureProc -- + * ContentStructureProc -- * * This function is invoked by the Tk event handler when StructureNotify * events occur for a slave window. @@ -1159,21 +1159,21 @@ PlaceStructureProc( */ static void -SlaveStructureProc( - ClientData clientData, /* Pointer to Slave structure for window +ContentStructureProc( + ClientData clientData, /* Pointer to Content structure for window * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - Slave *slavePtr = (Slave *)clientData; - TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; + Content *contentPtr = (Content *)clientData; + TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr; if (eventPtr->type == DestroyNotify) { - if (slavePtr->containerPtr != NULL) { - UnlinkSlave(slavePtr); + if (contentPtr->containerPtr != NULL) { + UnlinkContent(contentPtr); } - Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, - slavePtr->tkwin)); - FreeSlave(slavePtr); + Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable, + contentPtr->tkwin)); + FreeContent(contentPtr); } } @@ -1198,23 +1198,22 @@ SlaveStructureProc( static void PlaceRequestProc( ClientData clientData, /* Pointer to our record for slave. */ - Tk_Window tkwin) /* Window that changed its desired size. */ + TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { - Slave *slavePtr = (Slave *)clientData; - Master *containerPtr; - (void)tkwin; + Content *contentPtr = (Content *)clientData; + Container *containerPtr; - if ((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) - && (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) { + if ((contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) + && (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) { /* * Send a ConfigureNotify to indicate that the size change * request was rejected. */ - TkDoConfigureNotify((TkWindow *)(slavePtr->tkwin)); + TkDoConfigureNotify((TkWindow *)(contentPtr->tkwin)); return; } - containerPtr = slavePtr->containerPtr; + containerPtr = contentPtr->containerPtr; if (containerPtr == NULL) { return; } @@ -1243,23 +1242,23 @@ PlaceRequestProc( static void PlaceLostContentProc( - ClientData clientData, /* Slave structure for slave window that was + ClientData clientData, /* Content structure for slave window that was * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - Slave *slavePtr = (Slave *)clientData; - TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; + Content *contentPtr = (Content *)clientData; + TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr; - if (slavePtr->containerPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { - Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->containerPtr->tkwin); + if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) { + Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin); } Tk_UnmapWindow(tkwin); - UnlinkSlave(slavePtr); - Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, + UnlinkContent(contentPtr); + Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable, tkwin)); - Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, - slavePtr); - FreeSlave(slavePtr); + Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc, + contentPtr); + FreeContent(contentPtr); } /* diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index b9c69d7..b9f64e0 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -28,7 +28,7 @@ static void EmbWinLostContentProc(ClientData clientData, static const Tk_GeomMgr textGeomType = { "text", /* name */ EmbWinRequestProc, /* requestProc */ - EmbWinLostContentProc, /* lostSlaveProc */ + EmbWinLostContentProc, /* lostContentProc */ }; /* diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index b58be39..0a3f13c 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -34,9 +34,9 @@ * (2) Manager voluntarily relinquishes control * (3) Content window is destroyed * - * In case (1), Tk calls the manager's lostSlaveProc. + * In case (1), Tk calls the manager's lostContentProc. * Case (2) is performed by calling Tk_ManageGeometry(slave,NULL,0); - * in this case Tk does _not_ call the LostSlaveProc (documented behavior). + * in this case Tk does _not_ call the lostContentProc (documented behavior). * Tk doesn't handle case (3) either; to account for that we * register an event handler on the slave widget to track events. */ @@ -174,7 +174,7 @@ static void ContentLostEventHandler(void *clientData, XEvent *eventPtr) { Ttk_Content *slave = (Ttk_Content *)clientData; if (eventPtr->type == DestroyNotify) { - slave->manager->managerSpec->tkGeomMgr.lostSlaveProc( + slave->manager->managerSpec->tkGeomMgr.lostContentProc( slave->manager, slave->contentWindow); } } @@ -229,7 +229,7 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) mgr->window, ManagerEventMask, ManagerEventHandler, mgr); while (mgr->nManaged > 0) { - Ttk_ForgetSlave(mgr, mgr->nManaged - 1); + Ttk_ForgetContent(mgr, mgr->nManaged - 1); } if (mgr->content) { ckfree(mgr->content); @@ -350,7 +350,7 @@ void Ttk_InsertContent( /* ++ Ttk_ForgetContent -- * Unmanage the specified content window. */ -void Ttk_ForgetSlave(Ttk_Manager *mgr, TkSizeT index) +void Ttk_ForgetContent(Ttk_Manager *mgr, TkSizeT index) { Tk_Window contentWindow = mgr->content[index]->contentWindow; RemoveSlave(mgr, index); @@ -364,7 +364,7 @@ void Ttk_ForgetSlave(Ttk_Manager *mgr, TkSizeT index) * Contrary to documentation, Tk_MaintainGeometry doesn't always * map the content window. */ -void Ttk_PlaceSlave( +void Ttk_PlaceContent( Ttk_Manager *mgr, TkSizeT index, int x, int y, int width, int height) { Ttk_Content *slave = mgr->content[index]; @@ -378,7 +378,7 @@ void Ttk_PlaceSlave( /* ++ Ttk_UnmapContent -- * Unmap the specified content window, but leave it managed. */ -void Ttk_UnmapSlave(Ttk_Manager *mgr, TkSizeT index) +void Ttk_UnmapContent(Ttk_Manager *mgr, TkSizeT index) { Ttk_Content *slave = mgr->content[index]; Tk_UnmaintainGeometry(slave->contentWindow, mgr->window); @@ -404,7 +404,7 @@ void Ttk_ManagerSizeChanged(Ttk_Manager *mgr) /* +++ Accessors. */ -TkSizeT Ttk_NumberSlaves(Ttk_Manager *mgr) +TkSizeT Ttk_NumberContent(Ttk_Manager *mgr) { return mgr->nManaged; } @@ -433,7 +433,7 @@ TkSizeT Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window contentWindow) return TCL_INDEX_NONE; } -/* ++ Ttk_GetSlaveIndexFromObj(interp, mgr, objPtr, indexPtr) -- +/* ++ Ttk_GetContentIndexFromObj(interp, mgr, objPtr, indexPtr) -- * Return the index of the content window specified by objPtr. * Content windows may be specified as an integer index or * as the name of the managed window. @@ -487,7 +487,7 @@ int Ttk_GetContentIndexFromObj( /* ++ Ttk_ReorderContent(mgr, fromIndex, toIndex) -- * Change content window order. */ -void Ttk_ReorderSlave(Ttk_Manager *mgr, TkSizeT fromIndex, TkSizeT toIndex) +void Ttk_ReorderContent(Ttk_Manager *mgr, TkSizeT fromIndex, TkSizeT toIndex) { Ttk_Content *moved = mgr->content[fromIndex]; diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h index 7fd8c84..edcbb09 100644 --- a/generic/ttk/ttkManager.h +++ b/generic/ttk/ttkManager.h @@ -38,7 +38,7 @@ typedef struct { /* Manager hooks */ /* * Default implementations for Tk_GeomMgr hooks: */ -#define Ttk_LostContentProc Ttk_LostSlaveProc +#define Ttk_LostSlaveProc Ttk_LostContentProc MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window slave); MODULE_SCOPE void Ttk_LostContentProc(ClientData, Tk_Window slave); @@ -79,7 +79,7 @@ MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *); MODULE_SCOPE TkSizeT Ttk_ContentIndex(Ttk_Manager *, Tk_Window); /* Returns: index in content array of specified window, TCL_INDEX_NONE if not found */ -#define Ttk_GetContentIndexFromObj Ttk_GetSlaveIndexFromObj +#define Ttk_GetSlaveIndexFromObj Ttk_GetContentIndexFromObj MODULE_SCOPE int Ttk_GetContentIndexFromObj( Tcl_Interp *, Ttk_Manager *, Tcl_Obj *, TkSizeT *indexPtr); diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 384d620..fa3881e 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -257,8 +257,8 @@ error: static TkSizeT IdentifyTab(Notebook *nb, int x, int y) { TkSizeT index; - for (index = 0; index < Ttk_NumberSlaves(nb->notebook.mgr); ++index) { - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,index); + for (index = 0; index < Ttk_NumberContent(nb->notebook.mgr); ++index) { + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,index); if ( tab->state != TAB_STATE_HIDDEN && Ttk_BoxContains(tab->parcel, x,y)) { @@ -290,7 +290,7 @@ static void ActivateTab(Notebook *nb, TkSizeT index) static Ttk_State TabState(Notebook *nb, TkSizeT index) { Ttk_State state = nb->core.state; - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); TkSizeT i = 0; if (index == nb->notebook.currentIndex) { @@ -302,8 +302,8 @@ static Ttk_State TabState(Notebook *nb, TkSizeT index) if (index == nb->notebook.activeIndex) { state |= TTK_STATE_ACTIVE; } - for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); + for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } @@ -312,8 +312,8 @@ static Ttk_State TabState(Notebook *nb, TkSizeT index) } break; } - for (i = Ttk_NumberSlaves(nb->notebook.mgr) - 1; i != TCL_INDEX_NONE; --i) { - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); + for (i = Ttk_NumberContent(nb->notebook.mgr) - 1; i != TCL_INDEX_NONE; --i) { + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } @@ -353,8 +353,8 @@ static void TabrowSize( int tabrowWidth = 0, tabrowHeight = 0; TkSizeT i; - for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); + for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb,i); Ttk_RebindSublayout(tabLayout, tab); @@ -397,9 +397,9 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) /* Compute max requested size of all slaves: */ - for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { - Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, i); - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); + for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { + Tk_Window slaveWindow = Ttk_ContentWindow(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); int slaveWidth = Tk_ReqWidth(slaveWindow) + Ttk_PaddingWidth(tab->padding); int slaveHeight @@ -470,7 +470,7 @@ static void SqueezeTabs( int i; for (i = 0; i < nTabs; ++i) { - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,i); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,i); double ad = slack + tab->width * delta; tab->width += (int)ad; slack = ad - (int)ad; @@ -489,7 +489,7 @@ static void PlaceTabs( int i; for (i = 0; i < nTabs; ++i) { - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb, i); if (tab->state != TAB_STATE_HIDDEN) { @@ -573,8 +573,8 @@ static void NotebookDoLayout(void *recordPtr) */ static void NotebookPlaceContent(Notebook *nb, TkSizeT index) { - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); - Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); + Tk_Window slaveWindow = Ttk_ContentWindow(nb->notebook.mgr, index); Ttk_Box slaveBox = Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding), Tk_ReqWidth(slaveWindow), Tk_ReqHeight(slaveWindow),tab->sticky); @@ -602,7 +602,7 @@ static void NotebookPlaceContents(void *recordPtr) */ static void SelectTab(Notebook *nb, TkSizeT index) { - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); TkSizeT currentIndex = nb->notebook.currentIndex; if (index == currentIndex) { @@ -641,13 +641,13 @@ static void SelectTab(Notebook *nb, TkSizeT index) */ static int NextTab(Notebook *nb, int index) { - TkSizeT nTabs = Ttk_NumberSlaves(nb->notebook.mgr); + TkSizeT nTabs = Ttk_NumberContent(nb->notebook.mgr); TkSizeT nextIndex; /* Scan forward for following usable tab: */ for (nextIndex = index + 1; nextIndex + 1 < nTabs + 1; ++nextIndex) { - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, nextIndex); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } @@ -656,7 +656,7 @@ static int NextTab(Notebook *nb, int index) /* Not found -- scan backwards. */ for (nextIndex = index - 1; nextIndex != TCL_INDEX_NONE; --nextIndex) { - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, nextIndex); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } @@ -698,7 +698,7 @@ static void SelectNearestTab(Notebook *nb) static void TabRemoved(void *managerData, TkSizeT index) { Notebook *nb = (Notebook *)managerData; - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -736,7 +736,7 @@ static int AddTab( return TCL_ERROR; } #if 0 /* can't happen */ - if (Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow) != TCL_INDEX_NONE) { + if (Ttk_ContentIndex(nb->notebook.mgr, slaveWindow) != TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s already added", Tk_PathName(slaveWindow))); Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "PRESENT", NULL); @@ -852,7 +852,7 @@ static int FindTabIndex( { return TCL_OK; } - if (*index_rtn == Ttk_NumberSlaves(nb->notebook.mgr)) { + if (*index_rtn == Ttk_NumberContent(nb->notebook.mgr)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Invalid slave specification %s", string)); Tcl_SetErrorCode(interp, "TTK", "SLAVE", "SPEC", NULL); @@ -873,7 +873,7 @@ static int GetTabIndex( Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, TkSizeT *index_rtn) { int status = FindTabIndex(interp, nb, objPtr, index_rtn); - if (status == TCL_OK && *index_rtn + 1 >= Ttk_NumberSlaves(nb->notebook.mgr) + 1) { + if (status == TCL_OK && *index_rtn + 1 >= Ttk_NumberContent(nb->notebook.mgr) + 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Slave index %s out of bounds", Tcl_GetString(objPtr))); Tcl_SetErrorCode(interp, "TTK", "SLAVE", "INDEX", NULL); @@ -918,7 +918,7 @@ static int NotebookAddCommand( return AddTab(interp, nb, Ttk_NumberContent(nb->notebook.mgr), slaveWindow, objc-3,objv+3); } - tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); + tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); if (tab->state == TAB_STATE_HIDDEN) { tab->state = TAB_STATE_NORMAL; } @@ -939,7 +939,7 @@ static int NotebookInsertCommand( { Notebook *nb = (Notebook *)recordPtr; TkSizeT current = nb->notebook.currentIndex; - TkSizeT nSlaves = Ttk_NumberSlaves(nb->notebook.mgr); + TkSizeT nSlaves = Ttk_NumberContent(nb->notebook.mgr); TkSizeT srcIndex, destIndex; if (objc < 4) { @@ -947,7 +947,7 @@ static int NotebookInsertCommand( return TCL_ERROR; } - if (TCL_OK != Ttk_GetSlaveIndexFromObj( + if (TCL_OK != Ttk_GetContentIndexFromObj( interp, nb->notebook.mgr, objv[2], &destIndex)) { return TCL_ERROR; } @@ -970,15 +970,15 @@ static int NotebookInsertCommand( interp, nb->notebook.mgr, objv[3], &srcIndex) != TCL_OK) { return TCL_ERROR; - } else if (srcIndex + 1 >= Ttk_NumberSlaves(nb->notebook.mgr) + 1) { - srcIndex = Ttk_NumberSlaves(nb->notebook.mgr) - 1; + } else if (srcIndex + 1 >= Ttk_NumberContent(nb->notebook.mgr) + 1) { + srcIndex = Ttk_NumberContent(nb->notebook.mgr) - 1; } /* Move existing slave: */ if (ConfigureTab(interp, nb, - (Tab *)Ttk_SlaveData(nb->notebook.mgr, srcIndex), - Ttk_SlaveWindow(nb->notebook.mgr, srcIndex), + (Tab *)Ttk_ContentData(nb->notebook.mgr, srcIndex), + Ttk_ContentWindow(nb->notebook.mgr, srcIndex), objc-4,objv+4) != TCL_OK) { return TCL_ERROR; @@ -1048,7 +1048,7 @@ static int NotebookHideCommand( return TCL_ERROR; } - tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); + tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); tab->state = TAB_STATE_HIDDEN; if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -1088,7 +1088,7 @@ static int NotebookIdentifyCommand( tabIndex = IdentifyTab(nb, x, y); if (tabIndex != TCL_INDEX_NONE) { - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, tabIndex); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, tabIndex); Ttk_State state = TabState(nb, tabIndex); Ttk_Layout tabLayout = nb->notebook.tabLayout; @@ -1214,8 +1214,8 @@ static int NotebookTabCommand( return TCL_ERROR; } - tab = (Tab *)Ttk_SlaveData(mgr, index); - slaveWindow = Ttk_SlaveWindow(mgr, index); + tab = (Tab *)Ttk_ContentData(mgr, index); + slaveWindow = Ttk_ContentWindow(mgr, index); if (objc == 3) { return TtkEnumerateOptions(interp, tab, @@ -1345,7 +1345,7 @@ static Ttk_Layout NotebookGetLayout( static void DisplayTab(Notebook *nb, int index, Drawable d) { Ttk_Layout tabLayout = nb->notebook.tabLayout; - Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); Ttk_State state = TabState(nb, index); if (tab->state != TAB_STATE_HIDDEN) { @@ -1358,7 +1358,7 @@ static void DisplayTab(Notebook *nb, int index, Drawable d) static void NotebookDisplay(void *clientData, Drawable d) { Notebook *nb = (Notebook *)clientData; - TkSizeT nContent = Ttk_NumberSlaves(nb->notebook.mgr); + TkSizeT nContent = Ttk_NumberContent(nb->notebook.mgr); TkSizeT index; /* Draw notebook background (base layout): diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index eb5142b..5c67ace 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -188,14 +188,14 @@ error: static int ShoveUp(Paned *pw, int i, int pos) { - Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, i); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, i); int sashThickness = pw->paned.sashThickness; if (i == 0) { if (pos < 0) pos = 0; } else { - Pane *prevPane = (Pane *)Ttk_SlaveData(pw->paned.mgr, i-1); + Pane *prevPane = (Pane *)Ttk_ContentData(pw->paned.mgr, i-1); if (pos < prevPane->sashPos + sashThickness) pos = ShoveUp(pw, i-1, pos - sashThickness) + sashThickness; } @@ -208,13 +208,13 @@ static int ShoveUp(Paned *pw, int i, int pos) */ static int ShoveDown(Paned *pw, TkSizeT i, int pos) { - Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr,i); int sashThickness = pw->paned.sashThickness; if (i == Ttk_NumberContent(pw->paned.mgr) - 1) { pos = pane->sashPos; /* Sentinel value == container window size */ } else { - Pane *nextPane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i+1); + Pane *nextPane = (Pane *)Ttk_ContentData(pw->paned.mgr,i+1); if (pos + sashThickness > nextPane->sashPos) pos = ShoveDown(pw, i+1, pos + sashThickness) - sashThickness; } @@ -238,8 +238,8 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) if (pw->paned.orient == TTK_ORIENT_HORIZONTAL) { for (index = 0; index < nPanes; ++index) { - Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); + Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); if (height < Tk_ReqHeight(slaveWindow)) height = Tk_ReqHeight(slaveWindow); @@ -248,8 +248,8 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) width += nSashes * sashThickness; } else { for (index = 0; index < nPanes; ++index) { - Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); + Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); if (width < Tk_ReqWidth(slaveWindow)) width = Tk_ReqWidth(slaveWindow); @@ -277,8 +277,8 @@ static void AdjustPanes(Paned *pw) int pos = 0; TkSizeT index; - for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) { - Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); + for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) { + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); int size = pane->sashPos - pos; pane->reqSize = size >= 0 ? size : 0; pos = pane->sashPos + sashThickness; @@ -316,7 +316,7 @@ static void PlaceSashes(Paned *pw, int width, int height) /* Compute total required size and total available weight: */ for (i = 0; i < nPanes; ++i) { - Pane *pane = (Pane *)Ttk_SlaveData(mgr, i); + Pane *pane = (Pane *)Ttk_ContentData(mgr, i); reqSize += pane->reqSize; totalWeight += pane->weight * (pane->reqSize != 0); } @@ -340,7 +340,7 @@ static void PlaceSashes(Paned *pw, int width, int height) */ pos = 0; for (i = 0; i < nPanes; ++i) { - Pane *pane = (Pane *)Ttk_SlaveData(mgr, i); + Pane *pane = (Pane *)Ttk_ContentData(mgr, i); int weight = pane->weight * (pane->reqSize != 0); int size = pane->reqSize + delta * weight; @@ -374,8 +374,8 @@ static void PlacePanes(Paned *pw) int pos = 0; TkSizeT index; - for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) { - Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); + for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) { + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); int size = pane->sashPos - pos; if (size > 0) { @@ -406,7 +406,7 @@ static void PanedPlaceContent(void *managerData) static void PaneRemoved(void *managerData, TkSizeT index) { Paned *pw = (Paned *)managerData; - Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); DestroyPane(pw, pane); } @@ -419,7 +419,7 @@ static int AddPane( if (!Ttk_Maintainable(interp, slaveWindow, pw->core.tkwin)) { return TCL_ERROR; } - if (Ttk_SlaveIndex(pw->paned.mgr, slaveWindow) != TCL_INDEX_NONE) { + if (Ttk_ContentIndex(pw->paned.mgr, slaveWindow) != TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s already added", Tk_PathName(slaveWindow))); Tcl_SetErrorCode(interp, "TTK", "PANE", "PRESENT", NULL); @@ -448,8 +448,8 @@ static int AddPane( static int PaneRequest(void *managerData, TkSizeT index, int width, int height) { Paned *pw = (Paned *)managerData; - Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); + Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; if (!Tk_IsMapped(slaveWindow)) { @@ -581,7 +581,7 @@ static Ttk_Layout PanedGetLayout( */ static Ttk_Layout SashLayout(Paned *pw, int index) { - Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); int thickness = pw->paned.sashThickness, height = Tk_Height(pw->core.tkwin), width = Tk_Width(pw->core.tkwin), @@ -604,7 +604,7 @@ static void DrawSash(Paned *pw, int index, Drawable d) static void PanedDisplay(void *recordPtr, Drawable d) { Paned *pw = (Paned *)recordPtr; - TkSizeT i, nSlaves = Ttk_NumberSlaves(pw->paned.mgr); + TkSizeT i, nSlaves = Ttk_NumberContent(pw->paned.mgr); TtkWidgetDisplay(recordPtr, d); for (i = 1; i < nSlaves; ++i) { @@ -647,7 +647,7 @@ static int PanedInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Paned *pw = (Paned *)recordPtr; - TkSizeT nSlaves = Ttk_NumberSlaves(pw->paned.mgr); + TkSizeT nSlaves = Ttk_NumberContent(pw->paned.mgr); TkSizeT srcIndex, destIndex; Tk_Window slaveWindow; @@ -662,7 +662,7 @@ static int PanedInsertCommand( return TCL_ERROR; } - if (TCL_OK != Ttk_GetSlaveIndexFromObj( + if (TCL_OK != Ttk_GetContentIndexFromObj( interp,pw->paned.mgr, objv[2], &destIndex)) { return TCL_ERROR; @@ -675,12 +675,12 @@ static int PanedInsertCommand( if (destIndex + 1 >= nSlaves + 1) destIndex = nSlaves - 1; - Ttk_ReorderSlave(pw->paned.mgr, srcIndex, destIndex); + Ttk_ReorderContent(pw->paned.mgr, srcIndex, destIndex); return objc == 4 ? TCL_OK : ConfigurePane(interp, pw, - (Pane *)Ttk_SlaveData(pw->paned.mgr, destIndex), - Ttk_SlaveWindow(pw->paned.mgr, destIndex), + (Pane *)Ttk_ContentData(pw->paned.mgr, destIndex), + Ttk_ContentWindow(pw->paned.mgr, destIndex), objc-4, objv+4); } @@ -701,8 +701,8 @@ static int PanedForgetCommand( interp, pw->paned.mgr, objv[2], &paneIndex)) { return TCL_ERROR; - } else if (paneIndex + 1 >= Ttk_NumberSlaves(pw->paned.mgr) + 1) { - paneIndex = Ttk_NumberSlaves(pw->paned.mgr) - 1; + } else if (paneIndex + 1 >= Ttk_NumberContent(pw->paned.mgr) + 1) { + paneIndex = Ttk_NumberContent(pw->paned.mgr) - 1; } Ttk_ForgetContent(pw->paned.mgr, paneIndex); @@ -739,7 +739,7 @@ static int PanedIdentifyCommand( pos = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? x : y; for (index = 0; index < nSashes; ++index) { - Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); if (pane->sashPos <= pos && pos <= pane->sashPos + sashThickness) { /* Found it. */ switch (what) { @@ -783,12 +783,12 @@ static int PanedPaneCommand( interp,pw->paned.mgr, objv[2], &paneIndex)) { return TCL_ERROR; - } else if (paneIndex + 1 >= Ttk_NumberSlaves(pw->paned.mgr) + 1) { - paneIndex = Ttk_NumberSlaves(pw->paned.mgr) - 1; + } else if (paneIndex + 1 >= Ttk_NumberContent(pw->paned.mgr) + 1) { + paneIndex = Ttk_NumberContent(pw->paned.mgr) - 1; } - pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, paneIndex); - slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, paneIndex); + pane = (Pane *)Ttk_ContentData(pw->paned.mgr, paneIndex); + slaveWindow = Ttk_ContentWindow(pw->paned.mgr, paneIndex); switch (objc) { case 3: @@ -846,7 +846,7 @@ static int PanedSashposCommand( if (Tcl_GetIntFromObj(interp, objv[2], &sashIndex) != TCL_OK) { return TCL_ERROR; } - if (sashIndex < 0 || (TkSizeT)sashIndex + 1 >= Ttk_NumberSlaves(pw->paned.mgr)) { + if (sashIndex < 0 || (TkSizeT)sashIndex + 1 >= Ttk_NumberContent(pw->paned.mgr)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "sash index %d out of range", sashIndex)); Tcl_SetErrorCode(interp, "TTK", "PANE", "SASH_INDEX", NULL); diff --git a/library/tk.tcl b/library/tk.tcl index 441bd25..85421ef 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -627,8 +627,8 @@ proc ::tk::FindAltKeyTarget {path char} { [string index [$path cget -text] [$path cget -underline]]]} { return $path } - set subwins [concat [grid slaves $path] [pack slaves $path] \ - [place slaves $path]] + set subwins [concat [grid content $path] [pack content $path] \ + [place content $path]] if {$class eq "Canvas"} { foreach item [$path find all] { if {[$path type $item] eq "window"} { diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index e339f97..0a7e519 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -197,7 +197,7 @@ proc ttk::combobox::Scroll {cb dir} { # and unpost the listbox. # proc ttk::combobox::LBSelected {lb} { - set cb [LBMaster $lb] + set cb [LBMain $lb] LBSelect $lb Unpost $cb focus $cb @@ -207,14 +207,14 @@ proc ttk::combobox::LBSelected {lb} { # Unpost the listbox. # proc ttk::combobox::LBCancel {lb} { - Unpost [LBMaster $lb] + Unpost [LBMain $lb] } ## LBTab -- Tab key binding for combobox listbox. # Set the selection, and navigate to next/prev widget. # proc ttk::combobox::LBTab {lb dir} { - set cb [LBMaster $lb] + set cb [LBMain $lb] switch -- $dir { next { set newFocus [tk_focusNext $cb] } prev { set newFocus [tk_focusPrev $cb] } @@ -414,10 +414,10 @@ proc ttk::combobox::Unpost {cb} { grab release $cb.popdown ;# in case of stuck or unexpected grab [#1239190] } -## LBMaster $lb -- +## LBMain $lb -- # Return the combobox main widget that owns the listbox. # -proc ttk::combobox::LBMaster {lb} { +proc ttk::combobox::LBMain {lb} { winfo parent [winfo parent [winfo parent $lb]] } @@ -425,7 +425,7 @@ proc ttk::combobox::LBMaster {lb} { # Transfer listbox selection to combobox value. # proc ttk::combobox::LBSelect {lb} { - set cb [LBMaster $lb] + set cb [LBMain $lb] set selection [$lb curselection] if {[llength $selection] == 1} { SelectEntry $cb [lindex $selection 0] @@ -442,7 +442,7 @@ proc ttk::combobox::LBSelect {lb} { # proc ttk::combobox::LBCleanup {lb} { variable Values - unset Values([LBMaster $lb]) + unset Values([LBMain $lb]) } #*EOF* diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index d4020ca..3f4869b 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -183,7 +183,7 @@ static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin); static const Tk_GeomMgr wmMgrType = { "wm", /* name */ TopLevelReqProc, /* requestProc */ - NULL, /* lostSlaveProc */ + NULL, /* lostContentProc */ }; /* @@ -2357,13 +2357,13 @@ WmIconifyCmd( return TCL_ERROR; } else if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't iconify %s: it is an icon for %s", + "can't iconify \"%s\": it is an icon for \"%s\"", winPtr->pathName, Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL); return TCL_ERROR; } else if (winPtr->flags & TK_EMBEDDED) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't iconify %s: it is an embedded window", + "can't iconify \"%s\": it is an embedded window", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL); return TCL_ERROR; @@ -3643,7 +3643,7 @@ WmTransientCmd( if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't make \"%s\" a transient: it is an icon for %s", + "can't make \"%s\" a transient, it is an icon for %s", Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; @@ -3657,7 +3657,7 @@ WmTransientCmd( if (wmPtr2 != NULL && wmPtr2->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't make \"%s\" a container: it is an icon for %s", + "can't make \"%s\" a container, it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; @@ -3667,7 +3667,7 @@ WmTransientCmd( w = (TkWindow *)w->wmInfoPtr->container) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "setting \"%s\" as container creates a transient/container cycle", + "can't set \"%s\" as container, would cause management loop", Tk_PathName(containerPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; diff --git a/tests/grid.test b/tests/grid.test index 7651193..22a2214 100644 --- a/tests/grid.test +++ b/tests/grid.test @@ -63,10 +63,10 @@ test grid-1.5 {basic argument checking} -body { } -returnCodes error -result {can't manage ".": it's a top-level window} test grid-1.6 {basic argument checking} -body { grid x -} -returnCodes error -result {can't determine master window} +} -returnCodes error -result {can't determine container window} test grid-1.7 {basic argument checking} -body { grid configure x -} -returnCodes error -result {can't determine master window} +} -returnCodes error -result {can't determine container window} test grid-1.8 {basic argument checking} -body { button .b grid x .b @@ -856,13 +856,13 @@ test grid-11.1 {default widget placement} -body { grid ^ } -cleanup { grid_reset 11.1 -} -returnCodes error -result {can't use '^', cant find master} +} -returnCodes error -result {can't use '^', can't find container window} test grid-11.2 {default widget placement} -body { button .b grid .b ^ } -cleanup { grid_reset 11.2 -} -returnCodes error -result {can't find slave to extend with "^"} +} -returnCodes error -result {can't find content to extend with "^"} test grid-11.3 {default widget placement} -body { button .b grid .b - - .c @@ -917,7 +917,7 @@ test grid-11.9 {default widget placement} -body { grid .f x ^ } -cleanup { grid_reset 11.9 -} -returnCodes error -result {can't find slave to extend with "^"} +} -returnCodes error -result {can't find content to extend with "^"} test grid-11.10 {default widget placement} -body { foreach i {1 2 3} { frame .f$i -width 100 -height 50 -highlightthickness 0 -bg red diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test index 88e4662..35b6ddb 100644 --- a/tests/imgPhoto.test +++ b/tests/imgPhoto.test @@ -32,7 +32,7 @@ # ImgPhotoCmd imgPhoto-4.*, imgPhoto-17.* # GetExtension: no tests # ParseSubcommandOptions: imgPhoto-1.* -# ImgPhotoConfigureMaster: imgPhoto-3.*, imgPhoto-15.* +# ImgPhotoConfigureModel: imgPhoto-3.*, imgPhoto-15.* # toggleComplexAlphaIfNeeded: no tests # ImgPhotoDelete: imgPhoto-8.* # ImgPhotoCmdDeleteProc: imgPhoto-9.* @@ -253,7 +253,7 @@ test imgPhoto-3.3 {ImgPhotoConfigureModel procedure} -constraints { destroy .c image delete photo1 } -result {256 256 {10 10 266 266} {300 10 556 266}} -test imgPhoto-3.4 {ImgPhotoConfigureMaster: -data } -constraints { +test imgPhoto-3.4 {ImgPhotoConfigureModel: -data } -constraints { hasTeapotPhoto } -setup { image create photo photo1 -file $teapotPhotoFile @@ -264,7 +264,7 @@ test imgPhoto-3.4 {ImgPhotoConfigureMaster: -data } -constraints { } -cleanup { imageCleanup } -result {20 20} -test imgPhoto-3.5 {ImgPhotoConfigureMaster: -data } -constraints { +test imgPhoto-3.5 {ImgPhotoConfigureModel: -data } -constraints { hasTeapotPhoto } -setup { image create photo photo1 -file $teapotPhotoFile @@ -275,7 +275,7 @@ test imgPhoto-3.5 {ImgPhotoConfigureMaster: -data } -constraints { } -cleanup { imageCleanup } -result {20 20} -test imgPhoto-3.6 {ImgPhotoConfigureMaster: -data } -constraints { +test imgPhoto-3.6 {ImgPhotoConfigureModel: -data } -constraints { hasTeapotPhoto } -setup { image create photo photo1 -file $teapotPhotoFile diff --git a/tests/packgrid.test b/tests/packgrid.test index 6dfba25..d0ad855 100644 --- a/tests/packgrid.test +++ b/tests/packgrid.test @@ -22,7 +22,7 @@ test packgrid-1.1 {pack and grid in same container window} -setup { } -returnCodes error -cleanup { destroy .p destroy .g -} -result {cannot use geometry manager pack inside . which already has slaves managed by grid} +} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows} test packgrid-1.2 {pack and grid in same container window} -setup { grid propagate . true @@ -36,7 +36,7 @@ test packgrid-1.2 {pack and grid in same container window} -setup { } -returnCodes error -cleanup { destroy .p destroy .g -} -result {cannot use geometry manager grid inside . which already has slaves managed by pack} +} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows} test packgrid-1.3 {pack and grid in same container window} -setup { grid propagate . false @@ -137,7 +137,7 @@ test packgrid-2.1 {pack and grid in same container window, change propagation} - } -returnCodes error -cleanup { destroy .p destroy .g -} -result {cannot use geometry manager grid inside . which already has slaves managed by pack} +} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows} test packgrid-2.2 {pack and grid in same container window, change propagation} -setup { grid propagate . true @@ -153,7 +153,7 @@ test packgrid-2.2 {pack and grid in same container window, change propagation} - destroy .p update destroy .g -} -result {cannot use geometry manager pack inside . which already has slaves managed by grid} +} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows} test packgrid-2.3 {pack and grid in same container window, change propagation} -setup { grid propagate . false @@ -170,7 +170,7 @@ test packgrid-2.3 {pack and grid in same container window, change propagation} - } -returnCodes error -cleanup { destroy .p destroy .g -} -result {cannot use geometry manager pack inside . which already has slaves managed by grid} +} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows} test packgrid-2.4 {pack and grid in same container window, change propagation} -setup { grid propagate . false @@ -186,7 +186,7 @@ test packgrid-2.4 {pack and grid in same container window, change propagation} - } -returnCodes error -cleanup { destroy .p destroy .g -} -result {cannot use geometry manager grid inside . which already has slaves managed by pack} +} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows} test packgrid-3.1 {stealing content} -setup { grid propagate . true @@ -229,7 +229,7 @@ test packgrid-3.3 {stealing content} -setup { } -returnCodes error -cleanup { destroy .p destroy .g -} -result {cannot use geometry manager pack inside . which already has slaves managed by grid} +} -result {cannot use geometry manager pack inside . because grid is already managing it's content windows} test packgrid-3.4 {stealing content} -setup { grid propagate . true @@ -244,7 +244,7 @@ test packgrid-3.4 {stealing content} -setup { } -returnCodes error -cleanup { destroy .p destroy .g -} -result {cannot use geometry manager grid inside . which already has slaves managed by pack} +} -result {cannot use geometry manager grid inside . because pack is already managing it's content windows} test packgrid-4.1 {content stolen after container destruction - bug [aa7679685e]} -setup { frame .f diff --git a/tests/unixWm.test b/tests/unixWm.test index c7b10d0..dbb0ea4 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -850,7 +850,7 @@ test unixWm-23.4 {Tk_WmCmd procedure, "iconify" option} unix { set result [list [catch {wm iconify .t2} msg] $msg] destroy .t2 set result -} {1 {can't iconify .t2: it is an icon for .t}} +} {1 {can't iconify ".t2": it is an icon for ".t"}} test unixWm-23.5 {Tk_WmCmd procedure, "iconify" option} unix { destroy .t2 toplevel .t2 diff --git a/tests/wm.test b/tests/wm.test index 285ea9b..ddc395c 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -785,7 +785,7 @@ test wm-iconify-2.3 {Misc errors} -body { wm iconify .t2 } -returnCodes error -cleanup { destroy .t2 -} -result {can't iconify .t2: it is an icon for .t} +} -result {can't iconify ".t2": it is an icon for ".t"} # test embedded window for Windows test wm-iconify-2.4.1 {Misc errors} -constraints win -setup { destroy .t2 @@ -795,7 +795,7 @@ test wm-iconify-2.4.1 {Misc errors} -constraints win -setup { wm iconify .t2 } -returnCodes error -cleanup { destroy .t2 .r.f -} -result {can't iconify .t2: the container does not support the request} +} -result {can't iconify ".t2": the container does not support the request} # test embedded window for other platforms test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup { destroy .t2 @@ -805,7 +805,7 @@ test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup { wm iconify .t2 } -returnCodes error -cleanup { destroy .t2 .r.f -} -result {can't iconify .t2: it is an embedded window} +} -result {can't iconify ".t2": it is an embedded window} test wm-iconify-3.1 {iconify behavior} -body { toplevel .t2 @@ -1623,7 +1623,7 @@ test wm-transient-1.5 {usage} -returnCodes error -body { wm transient .icon .dummy } -cleanup { deleteWindows -} -result {can't make ".icon" a transient: it is an icon for .top} +} -result {can't make ".icon" a transient, it is an icon for .top} test wm-transient-1.6 {usage} -returnCodes error -body { toplevel .icon -bg blue toplevel .top @@ -1632,13 +1632,13 @@ test wm-transient-1.6 {usage} -returnCodes error -body { wm transient .dummy .icon } -cleanup { deleteWindows -} -result {can't make ".icon" a container: it is an icon for .top} +} -result {can't make ".icon" a container, it is an icon for .top} test wm-transient-1.7 {usage} -returnCodes error -body { toplevel .top wm transient .top .top } -cleanup { deleteWindows -} -result {setting ".top" as container creates a transient/container cycle} +} -result {can't set ".top" as container, would cause management loop} test wm-transient-1.8 {usage} -returnCodes error -body { toplevel .t1 toplevel .t2 @@ -1648,14 +1648,14 @@ test wm-transient-1.8 {usage} -returnCodes error -body { wm transient .t1 .t3 } -cleanup { deleteWindows -} -result {setting ".t3" as container creates a transient/container cycle} +} -result {can't set ".t3" as container, would cause management loop} test wm-transient-1.9 {usage} -returnCodes error -body { toplevel .top frame .top.f wm transient .top .top.f } -cleanup { deleteWindows -} -result {setting ".top" as container creates a transient/container cycle} +} -result {can't set ".top" as container, would cause management loop} test wm-transient-2.1 {basic get/set of toplevel} -setup { set results [list] diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 795a1c5..5e1ed6c 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -312,12 +312,12 @@ static void MenubarReqProc(ClientData clientData, static const Tk_GeomMgr wmMgrType = { "wm", /* name */ TopLevelReqProc, /* requestProc */ - NULL, /* lostSlaveProc */ + NULL, /* lostContentProc */ }; static const Tk_GeomMgr menubarMgrType = { "menubar", /* name */ MenubarReqProc, /* requestProc */ - NULL, /* lostSlaveProc */ + NULL, /* lostContentProc */ }; /* @@ -2240,14 +2240,14 @@ WmIconifyCmd( } if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't iconify %s: it is an icon for %s", + "can't iconify \"%s\": it is an icon for \"%s\"", winPtr->pathName, Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL); return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't iconify %s: it is an embedded window", + "can't iconify \"%s\": it is an embedded window", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL); return TCL_ERROR; @@ -3606,7 +3606,7 @@ WmTransientCmd( if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't make \"%s\" a transient: it is an icon for %s", + "can't make \"%s\" a transient, it is an icon for %s", Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; @@ -3619,7 +3619,7 @@ WmTransientCmd( if (wmPtr2->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't make \"%s\" a container: it is an icon for %s", + "can't make \"%s\" a container, it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; @@ -3629,7 +3629,7 @@ WmTransientCmd( w = (TkWindow *)w->wmInfoPtr->masterPtr) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "setting \"%s\" as container creates a transient/container cycle", + "can't set \"%s\" as container, would cause management loop", Tk_PathName(masterPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; diff --git a/win/tkWinWm.c b/win/tkWinWm.c index fa04c3b..6241f37 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -364,7 +364,7 @@ static void RemapWindows(TkWindow *winPtr, HWND parentHWND); static const Tk_GeomMgr wmMgrType = { "wm", /* name */ TopLevelReqProc, /* requestProc */ - NULL, /* lostSlaveProc */ + NULL, /* lostContentProc */ }; typedef struct { @@ -4140,7 +4140,7 @@ WmIconifyCmd( if (winPtr->flags & TK_EMBEDDED) { if (!SendMessageW(wmPtr->wrapper, TK_ICONIFY, 0, 0)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't iconify %s: the container does not support the request", + "can't iconify \"%s\": the container does not support the request", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "EMBEDDED", NULL); return TCL_ERROR; @@ -4163,7 +4163,7 @@ WmIconifyCmd( } if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't iconify %s: it is an icon for %s", + "can't iconify \"%s\": it is an icon for \"%s\"", winPtr->pathName, Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "ICON", NULL); return TCL_ERROR; @@ -5592,7 +5592,7 @@ WmTransientCmd( if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't make \"%s\" a transient: it is an icon for %s", + "can't make \"%s\" a transient, it is an icon for %s", Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; @@ -5602,7 +5602,7 @@ WmTransientCmd( if (wmPtr2->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't make \"%s\" a container: it is an icon for %s", + "can't make \"%s\" a container, it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; @@ -5611,7 +5611,7 @@ WmTransientCmd( w = (TkWindow *)w->wmInfoPtr->masterPtr) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "setting \"%s\" as container creates a transient/container cycle", + "can't set \"%s\" as container, would cause management loop", Tk_PathName(masterPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; -- cgit v0.12