diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-08 07:57:20 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-08 07:57:20 (GMT) |
commit | c1d50f8302f80ab1939467c61bea379dd6035b1d (patch) | |
tree | 8f3c70c5dbf1d316e82522e520a455c6c902dd81 /generic | |
parent | 78780eac5b472e24d78dd946ca88ec4dc6ddbef5 (diff) | |
parent | 3b31d9630f305b2f6b73e57e147541bc13aa1057 (diff) | |
download | tk-c1d50f8302f80ab1939467c61bea379dd6035b1d.zip tk-c1d50f8302f80ab1939467c61bea379dd6035b1d.tar.gz tk-c1d50f8302f80ab1939467c61bea379dd6035b1d.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tk.decls | 8 | ||||
-rw-r--r-- | generic/tkCanvWind.c | 2 | ||||
-rw-r--r-- | generic/tkDecls.h | 17 | ||||
-rw-r--r-- | generic/tkGeometry.c | 308 | ||||
-rw-r--r-- | generic/tkImgPhoto.h | 2 | ||||
-rw-r--r-- | generic/tkInt.h | 2 | ||||
-rw-r--r-- | generic/ttk/ttkFrame.c | 33 | ||||
-rw-r--r-- | generic/ttk/ttkManager.c | 172 | ||||
-rw-r--r-- | generic/ttk/ttkManager.h | 36 | ||||
-rw-r--r-- | generic/ttk/ttkNotebook.c | 123 | ||||
-rw-r--r-- | generic/ttk/ttkPanedwindow.c | 111 | ||||
-rw-r--r-- | generic/ttk/ttkTheme.c | 26 |
12 files changed, 421 insertions, 419 deletions
diff --git a/generic/tk.decls b/generic/tk.decls index df51b31..3fc5e77 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -486,8 +486,8 @@ declare 120 { int width, int height) } declare 121 { - void Tk_MaintainGeometry(Tk_Window slave, - Tk_Window model, int x, int y, int width, int height) + void Tk_MaintainGeometry(Tk_Window window, + Tk_Window container, int x, int y, int width, int height) } declare 122 { Tk_Window Tk_MainWindow(Tcl_Interp *interp) @@ -539,7 +539,7 @@ declare 136 { const char *Tk_NameOfFont(Tk_Font font) } declare 137 { - const char *Tk_NameOfImage(Tk_ImageModel imageModel) + const char *Tk_NameOfImage(Tk_ImageModel model) } declare 138 { const char *Tk_NameOfJoinStyle(int join) @@ -692,7 +692,7 @@ declare 180 { void Tk_Ungrab(Tk_Window tkwin) } declare 181 { - void Tk_UnmaintainGeometry(Tk_Window slave, Tk_Window master) + void Tk_UnmaintainGeometry(Tk_Window window, Tk_Window container) } declare 182 { void Tk_UnmapWindow(Tk_Window tkwin) diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index 2fd799f..37530dd 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -1120,7 +1120,7 @@ static void WinItemLostContentProc( ClientData clientData, /* WindowItem structure for content window window that * was stolen away. */ - Tk_Window tkwin) /* Tk's handle for the content window window. */ + Tk_Window tkwin) /* Tk's handle for the content window. */ { WindowItem *winItemPtr = (WindowItem *)clientData; Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas); diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 5d5fcd2..07d3699 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -422,8 +422,9 @@ EXTERN Atom Tk_InternAtom(Tk_Window tkwin, const char *name); EXTERN int Tk_IntersectTextLayout(Tk_TextLayout layout, int x, int y, int width, int height); /* 121 */ -EXTERN void Tk_MaintainGeometry(Tk_Window slave, Tk_Window model, - int x, int y, int width, int height); +EXTERN void Tk_MaintainGeometry(Tk_Window window, + Tk_Window container, int x, int y, int width, + int height); /* 122 */ EXTERN Tk_Window Tk_MainWindow(Tcl_Interp *interp); /* 123 */ @@ -460,7 +461,7 @@ EXTERN const char * Tk_NameOfCursor(Display *display, Tk_Cursor cursor); /* 136 */ EXTERN const char * Tk_NameOfFont(Tk_Font font); /* 137 */ -EXTERN const char * Tk_NameOfImage(Tk_ImageModel imageModel); +EXTERN const char * Tk_NameOfImage(Tk_ImageModel model); /* 138 */ EXTERN const char * Tk_NameOfJoinStyle(int join); /* 139 */ @@ -593,8 +594,8 @@ EXTERN void Tk_UnderlineTextLayout(Display *display, /* 180 */ EXTERN void Tk_Ungrab(Tk_Window tkwin); /* 181 */ -EXTERN void Tk_UnmaintainGeometry(Tk_Window slave, - Tk_Window master); +EXTERN void Tk_UnmaintainGeometry(Tk_Window window, + Tk_Window container); /* 182 */ EXTERN void Tk_UnmapWindow(Tk_Window tkwin); /* 183 */ @@ -1025,7 +1026,7 @@ typedef struct TkStubs { int (*tk_Init) (Tcl_Interp *interp); /* 118 */ Atom (*tk_InternAtom) (Tk_Window tkwin, const char *name); /* 119 */ int (*tk_IntersectTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height); /* 120 */ - void (*tk_MaintainGeometry) (Tk_Window slave, Tk_Window model, int x, int y, int width, int height); /* 121 */ + void (*tk_MaintainGeometry) (Tk_Window window, Tk_Window container, int x, int y, int width, int height); /* 121 */ Tk_Window (*tk_MainWindow) (Tcl_Interp *interp); /* 122 */ void (*tk_MakeWindowExist) (Tk_Window tkwin); /* 123 */ void (*tk_ManageGeometry) (Tk_Window tkwin, const Tk_GeomMgr *mgrPtr, ClientData clientData); /* 124 */ @@ -1041,7 +1042,7 @@ typedef struct TkStubs { const char * (*tk_NameOfColor) (XColor *colorPtr); /* 134 */ const char * (*tk_NameOfCursor) (Display *display, Tk_Cursor cursor); /* 135 */ const char * (*tk_NameOfFont) (Tk_Font font); /* 136 */ - const char * (*tk_NameOfImage) (Tk_ImageModel imageModel); /* 137 */ + const char * (*tk_NameOfImage) (Tk_ImageModel model); /* 137 */ const char * (*tk_NameOfJoinStyle) (int join); /* 138 */ const char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */ const char * (*tk_NameOfRelief) (int relief); /* 140 */ @@ -1085,7 +1086,7 @@ typedef struct TkStubs { void (*tk_UnderlineChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int x, int y, int firstByte, int lastByte); /* 178 */ void (*tk_UnderlineTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int underline); /* 179 */ void (*tk_Ungrab) (Tk_Window tkwin); /* 180 */ - void (*tk_UnmaintainGeometry) (Tk_Window slave, Tk_Window master); /* 181 */ + void (*tk_UnmaintainGeometry) (Tk_Window window, Tk_Window container); /* 181 */ void (*tk_UnmapWindow) (Tk_Window tkwin); /* 182 */ void (*tk_UnsetGrid) (Tk_Window tkwin); /* 183 */ void (*tk_UpdatePointer) (Tk_Window tkwin, int x, int y, int state); /* 184 */ diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 9bc1ae6..31944ca 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -15,29 +15,29 @@ /* * Data structures of the following type are used by Tk_MaintainGeometry. For - * each slave managed by Tk_MaintainGeometry, there is one of these structures - * associated with its master. + * each content managed by Tk_MaintainGeometry, there is one of these structures + * associated with its container. */ -typedef struct MaintainSlave { - Tk_Window slave; /* The slave window being positioned. */ - Tk_Window master; /* The master that determines slave's +typedef struct MaintainContent { + Tk_Window content; /* The content window being positioned. */ + Tk_Window container; /* The container that determines content's * position; it must be a descendant of - * slave's parent. */ - int x, y; /* Desired position of slave relative to - * master. */ - int width, height; /* Desired dimensions of slave. */ - struct MaintainSlave *nextPtr; + * content's parent. */ + int x, y; /* Desired position of content relative to + * container. */ + int width, height; /* Desired dimensions of content. */ + struct MaintainContent *nextPtr; /* Next in list of Maintains associated with - * master. */ -} MaintainSlave; + * container. */ +} MaintainContent; /* - * For each window that has been specified as a master to Tk_MaintainGeometry, + * For each window that has been specified as a content to Tk_MaintainGeometry, * there is a structure of the following type: */ -typedef struct MaintainMaster { +typedef struct MaintainContainer { Tk_Window ancestor; /* The lowest ancestor of this window for * which we have *not* created a * StructureNotify handler. May be the same as @@ -45,18 +45,18 @@ typedef struct MaintainMaster { int checkScheduled; /* Non-zero means that there is already a call * to MaintainCheckProc scheduled as an idle * handler. */ - MaintainSlave *slavePtr; /* First in list of all slaves associated with - * this master. */ -} MaintainMaster; + MaintainContent *contentPtr; /* First in list of all content associated with + * this container. */ +} MaintainContainer; /* * Prototypes for static procedures in this file: */ static void MaintainCheckProc(ClientData clientData); -static void MaintainMasterProc(ClientData clientData, +static void MaintainContainerProc(ClientData clientData, XEvent *eventPtr); -static void MaintainSlaveProc(ClientData clientData, +static void MaintainContentProc(ClientData clientData, XEvent *eventPtr); /* @@ -65,7 +65,7 @@ static void MaintainSlaveProc(ClientData clientData, * Tk_ManageGeometry -- * * Arrange for a particular procedure to manage the geometry of a given - * slave window. + * content window. * * Results: * None. @@ -218,7 +218,7 @@ Tk_SetInternalBorderEx( } /* - * All the slaves for which this is the master window must now be + * All the content for which this is the container window must now be * repositioned to take account of the new internal border width. To * signal all the geometry managers to do this, trigger a ConfigureNotify * event. This will cause geometry managers to recompute everything. @@ -387,12 +387,12 @@ TkFreeGeometryContainer( * * Tk_MaintainGeometry -- * - * This procedure is invoked by geometry managers to handle slaves whose - * master's are not their parents. It translates the desired geometry for - * the slave into the coordinate system of the parent and respositions - * the slave if it isn't already at the right place. Furthermore, it sets - * up event handlers so that if the master (or any of its ancestors up to - * the slave's parent) is mapped, unmapped, or moved, then the slave will + * This procedure is invoked by geometry managers to handle content whose + * container's are not their parents. It translates the desired geometry for + * the content into the coordinate system of the parent and respositions + * the content if it isn't already at the right place. Furthermore, it sets + * up event handlers so that if the container (or any of its ancestors up to + * the content's parent) is mapped, unmapped, or moved, then the content will * be adjusted to match. * * Results: @@ -400,7 +400,7 @@ TkFreeGeometryContainer( * * Side effects: * Event handlers are created and state is allocated to keep track of - * slave. Note: if slave was already managed for master by + * content. Note: if content was already managed for container by * Tk_MaintainGeometry, then the previous information is replaced with * the new information. The caller must eventually call * Tk_UnmaintainGeometry to eliminate the correspondence (or, the state @@ -411,40 +411,40 @@ TkFreeGeometryContainer( void Tk_MaintainGeometry( - Tk_Window slave, /* Slave for geometry management. */ - Tk_Window master, /* Master for slave; must be a descendant of - * slave's parent. */ - int x, int y, /* Desired position of slave within master. */ - int width, int height) /* Desired dimensions for slave. */ + Tk_Window window, /* Window for geometry management. */ + Tk_Window container, /* Container for window; must be a descendant of + * window's parent. */ + int x, int y, /* Desired position of window within container. */ + int width, int height) /* Desired dimensions for window. */ { Tcl_HashEntry *hPtr; - MaintainMaster *containerPtr; - MaintainSlave *slavePtr; + MaintainContainer *containerPtr; + MaintainContent *contentPtr; int isNew, map; Tk_Window ancestor, parent; - TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr; + TkDisplay *dispPtr = ((TkWindow *) container)->dispPtr; - ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master; + ((TkWindow *)window)->maintainerPtr = (TkWindow *)container; - ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master; - if (master == Tk_Parent(slave)) { + ((TkWindow *)window)->maintainerPtr = (TkWindow *)container; + if (container == Tk_Parent(window)) { /* - * If the slave is a direct descendant of the master, don't bother + * If the window is a direct descendant of the container, don't bother * setting up the extra infrastructure for management, just make a * call to Tk_MoveResizeWindow; the parent/child relationship will * take care of the rest. */ - Tk_MoveResizeWindow(slave, x, y, width, height); + Tk_MoveResizeWindow(window, x, y, width, height); /* - * Map the slave if the master is already mapped; otherwise, wait - * until the master is mapped later (in which case mapping the slave + * Map the window if the container is already mapped; otherwise, wait + * until the container is mapped later (in which case mapping the window * is taken care of elsewhere). */ - if (Tk_IsMapped(master)) { - Tk_MapWindow(slave); + if (Tk_IsMapped(container)) { + Tk_MapWindow(window); } return; } @@ -455,54 +455,54 @@ Tk_MaintainGeometry( } /* - * See if there is already a MaintainMaster structure for the master; if + * See if there is already a MaintainContainer structure for the container; if * not, then create one. */ - parent = Tk_Parent(slave); + parent = Tk_Parent(window); hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable, - (char *) master, &isNew); + (char *) container, &isNew); if (!isNew) { - containerPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr); + containerPtr = (MaintainContainer *)Tcl_GetHashValue(hPtr); } else { - containerPtr = (MaintainMaster *)ckalloc(sizeof(MaintainMaster)); - containerPtr->ancestor = master; + containerPtr = (MaintainContainer *)ckalloc(sizeof(MaintainContainer)); + containerPtr->ancestor = container; containerPtr->checkScheduled = 0; - containerPtr->slavePtr = NULL; + containerPtr->contentPtr = NULL; Tcl_SetHashValue(hPtr, containerPtr); } /* - * Create a MaintainSlave structure for the slave if there isn't already + * Create a MaintainContent structure for the window if there isn't already * one. */ - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - if (slavePtr->slave == slave) { - goto gotSlave; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + if (contentPtr->content == window) { + goto gotContent; } } - slavePtr = (MaintainSlave *)ckalloc(sizeof(MaintainSlave)); - slavePtr->slave = slave; - slavePtr->master = master; - slavePtr->nextPtr = containerPtr->slavePtr; - containerPtr->slavePtr = slavePtr; - Tk_CreateEventHandler(slave, StructureNotifyMask, MaintainSlaveProc, - slavePtr); + contentPtr = (MaintainContent *)ckalloc(sizeof(MaintainContent)); + contentPtr->content = window; + contentPtr->container = container; + contentPtr->nextPtr = containerPtr->contentPtr; + containerPtr->contentPtr = contentPtr; + Tk_CreateEventHandler(window, StructureNotifyMask, MaintainContentProc, + contentPtr); /* * Make sure that there are event handlers registered for all the windows - * between master and slave's parent (including master but not slave's - * parent). There may already be handlers for master and some of its + * between container and windows's parent (including container but not window's + * parent). There may already be handlers for container and some of its * ancestors (containerPtr->ancestor tells how many). */ - for (ancestor = master; ancestor != parent; + for (ancestor = container; ancestor != parent; ancestor = Tk_Parent(ancestor)) { if (ancestor == containerPtr->ancestor) { Tk_CreateEventHandler(ancestor, StructureNotifyMask, - MaintainMasterProc, containerPtr); + MaintainContainerProc, containerPtr); containerPtr->ancestor = Tk_Parent(ancestor); } } @@ -512,27 +512,27 @@ Tk_MaintainGeometry( * if it's not currently in the right place or state. */ - gotSlave: - slavePtr->x = x; - slavePtr->y = y; - slavePtr->width = width; - slavePtr->height = height; + gotContent: + contentPtr->x = x; + contentPtr->y = y; + contentPtr->width = width; + contentPtr->height = height; map = 1; - for (ancestor = slavePtr->master; ; ancestor = Tk_Parent(ancestor)) { + for (ancestor = contentPtr->container; ; ancestor = Tk_Parent(ancestor)) { if (!Tk_IsMapped(ancestor) && (ancestor != parent)) { map = 0; } if (ancestor == parent) { - if ((x != Tk_X(slavePtr->slave)) - || (y != Tk_Y(slavePtr->slave)) - || (width != Tk_Width(slavePtr->slave)) - || (height != Tk_Height(slavePtr->slave))) { - Tk_MoveResizeWindow(slavePtr->slave, x, y, width, height); + if ((x != Tk_X(contentPtr->content)) + || (y != Tk_Y(contentPtr->content)) + || (width != Tk_Width(contentPtr->content)) + || (height != Tk_Height(contentPtr->content))) { + Tk_MoveResizeWindow(contentPtr->content, x, y, width, height); } if (map) { - Tk_MapWindow(slavePtr->slave); + Tk_MapWindow(contentPtr->content); } else { - Tk_UnmapWindow(slavePtr->slave); + Tk_UnmapWindow(contentPtr->content); } break; } @@ -547,37 +547,37 @@ Tk_MaintainGeometry( * Tk_UnmaintainGeometry -- * * This procedure cancels a previous Tk_MaintainGeometry call, so that - * the relationship between slave and master is no longer maintained. + * the relationship between window and container is no longer maintained. * * Results: * None. * * Side effects: - * The slave is unmapped and state is released, so that slave won't track - * master any more. If we weren't previously managing slave relative to - * master, then this procedure has no effect. + * The window is unmapped and state is released, so that window won't track + * container any more. If we weren't previously managing window relative to + * container, then this procedure has no effect. * *---------------------------------------------------------------------- */ void Tk_UnmaintainGeometry( - Tk_Window slave, /* Slave for geometry management. */ - Tk_Window master) /* Master for slave; must be a descendant of - * slave's parent. */ + Tk_Window window, /* WIndow for geometry management. */ + Tk_Window container) /* Container for window; must be a descendant of + * window's parent. */ { Tcl_HashEntry *hPtr; - MaintainMaster *containerPtr; - MaintainSlave *slavePtr, *prevPtr; + MaintainContainer *containerPtr; + MaintainContent *contentPtr, *prevPtr; Tk_Window ancestor; - TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr; + TkDisplay *dispPtr = ((TkWindow *) window)->dispPtr; - ((TkWindow *)slave)->maintainerPtr = NULL; + ((TkWindow *)window)->maintainerPtr = NULL; - ((TkWindow *)slave)->maintainerPtr = NULL; - if (master == Tk_Parent(slave)) { + ((TkWindow *)window)->maintainerPtr = NULL; + if (container == Tk_Parent(window)) { /* - * If the slave is a direct descendant of the master, + * If the window is a direct descendant of the container, * Tk_MaintainGeometry will not have set up any of the extra * infrastructure. Don't even bother to look for it, just return. */ @@ -589,37 +589,37 @@ Tk_UnmaintainGeometry( Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS); } - if (!(((TkWindow *) slave)->flags & TK_ALREADY_DEAD)) { - Tk_UnmapWindow(slave); + if (!(((TkWindow *) window)->flags & TK_ALREADY_DEAD)) { + Tk_UnmapWindow(window); } - hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, master); + hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, container); if (hPtr == NULL) { return; } - containerPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr); - slavePtr = containerPtr->slavePtr; - if (slavePtr->slave == slave) { - containerPtr->slavePtr = slavePtr->nextPtr; + containerPtr = (MaintainContainer *)Tcl_GetHashValue(hPtr); + contentPtr = containerPtr->contentPtr; + if (contentPtr->content == window) { + containerPtr->contentPtr = contentPtr->nextPtr; } else { - for (prevPtr = slavePtr, slavePtr = slavePtr->nextPtr; ; - prevPtr = slavePtr, slavePtr = slavePtr->nextPtr) { - if (slavePtr == NULL) { + for (prevPtr = contentPtr, contentPtr = contentPtr->nextPtr; ; + prevPtr = contentPtr, contentPtr = contentPtr->nextPtr) { + if (contentPtr == NULL) { return; } - if (slavePtr->slave == slave) { - prevPtr->nextPtr = slavePtr->nextPtr; + if (contentPtr->content == window) { + prevPtr->nextPtr = contentPtr->nextPtr; break; } } } - Tk_DeleteEventHandler(slavePtr->slave, StructureNotifyMask, - MaintainSlaveProc, slavePtr); - ckfree(slavePtr); - if (containerPtr->slavePtr == NULL) { + Tk_DeleteEventHandler(contentPtr->content, StructureNotifyMask, + MaintainContentProc, contentPtr); + ckfree(contentPtr); + if (containerPtr->contentPtr == NULL) { if (containerPtr->ancestor != NULL) { - for (ancestor = master; ; ancestor = Tk_Parent(ancestor)) { + for (ancestor = container; ; ancestor = Tk_Parent(ancestor)) { Tk_DeleteEventHandler(ancestor, StructureNotifyMask, - MaintainMasterProc, containerPtr); + MaintainContainerProc, containerPtr); if (ancestor == containerPtr->ancestor) { break; } @@ -636,10 +636,10 @@ Tk_UnmaintainGeometry( /* *---------------------------------------------------------------------- * - * MaintainMasterProc -- + * MaintainContainerProc -- * * This procedure is invoked by the Tk event dispatcher in response to - * StructureNotify events on the master or one of its ancestors, on + * StructureNotify events on the container or one of its ancestors, on * behalf of Tk_MaintainGeometry. * * Results: @@ -648,20 +648,20 @@ Tk_UnmaintainGeometry( * Side effects: * It schedules a call to MaintainCheckProc, which will eventually caused * the postions and mapped states to be recalculated for all the - * maintained slaves of the master. Or, if the master window is being + * maintained windows of the container. Or, if the container window is being * deleted then state is cleaned up. * *---------------------------------------------------------------------- */ static void -MaintainMasterProc( - ClientData clientData, /* Pointer to MaintainMaster structure for the - * master window. */ +MaintainContainerProc( + ClientData clientData, /* Pointer to MaintainContainer structure for the + * container window. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainMaster *containerPtr = (MaintainMaster *)clientData; - MaintainSlave *slavePtr; + MaintainContainer *containerPtr = (MaintainContainer *)clientData; + MaintainContent *contentPtr; int done; if ((eventPtr->type == ConfigureNotify) @@ -673,18 +673,18 @@ MaintainMasterProc( } } else if (eventPtr->type == DestroyNotify) { /* - * Delete all of the state associated with this master, but be careful - * not to use containerPtr after the last slave is deleted, since its + * Delete all of the state associated with this container, but be careful + * not to use containerPtr after the last window is deleted, since its * memory will have been freed. */ done = 0; do { - slavePtr = containerPtr->slavePtr; - if (slavePtr->nextPtr == NULL) { + contentPtr = containerPtr->contentPtr; + if (contentPtr->nextPtr == NULL) { done = 1; } - Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master); + Tk_UnmaintainGeometry(contentPtr->content, contentPtr->container); } while (!done); } } @@ -692,10 +692,10 @@ MaintainMasterProc( /* *---------------------------------------------------------------------- * - * MaintainSlaveProc -- + * MaintainContentProc -- * * This procedure is invoked by the Tk event dispatcher in response to - * StructureNotify events on a slave being managed by + * StructureNotify events on a window being managed by * Tk_MaintainGeometry. * * Results: @@ -703,21 +703,21 @@ MaintainMasterProc( * * Side effects: * If the event is a DestroyNotify event then the Maintain state and - * event handlers for this slave are deleted. + * event handlers for this window are deleted. * *---------------------------------------------------------------------- */ static void -MaintainSlaveProc( - ClientData clientData, /* Pointer to MaintainSlave structure for - * master-slave pair. */ +MaintainContentProc( + ClientData clientData, /* Pointer to MaintainContent structure for + * container-window pair. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainSlave *slavePtr = (MaintainSlave *)clientData; + MaintainContent *contentPtr = (MaintainContent *)clientData; if (eventPtr->type == DestroyNotify) { - Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master); + Tk_UnmaintainGeometry(contentPtr->content, contentPtr->container); } } @@ -727,50 +727,50 @@ MaintainSlaveProc( * MaintainCheckProc -- * * This procedure is invoked by the Tk event dispatcher as an idle - * handler, when a master or one of its ancestors has been reconfigured, - * mapped, or unmapped. Its job is to scan all of the slaves for the - * master and reposition them, map them, or unmap them as needed to - * maintain their geometry relative to the master. + * handler, when a container or one of its ancestors has been reconfigured, + * mapped, or unmapped. Its job is to scan all of the windows for the + * container and reposition them, map them, or unmap them as needed to + * maintain their geometry relative to the container. * * Results: * None. * * Side effects: - * Slaves can get repositioned, mapped, or unmapped. + * Windows can get repositioned, mapped, or unmapped. * *---------------------------------------------------------------------- */ static void MaintainCheckProc( - ClientData clientData) /* Pointer to MaintainMaster structure for the - * master window. */ + ClientData clientData) /* Pointer to MaintainContainer structure for the + * container window. */ { - MaintainMaster *containerPtr = (MaintainMaster *)clientData; - MaintainSlave *slavePtr; + MaintainContainer *containerPtr = (MaintainContainer *)clientData; + MaintainContent *contentPtr; Tk_Window ancestor, parent; int x, y, map; containerPtr->checkScheduled = 0; - for (slavePtr = containerPtr->slavePtr; slavePtr != NULL; - slavePtr = slavePtr->nextPtr) { - parent = Tk_Parent(slavePtr->slave); - x = slavePtr->x; - y = slavePtr->y; + for (contentPtr = containerPtr->contentPtr; contentPtr != NULL; + contentPtr = contentPtr->nextPtr) { + parent = Tk_Parent(contentPtr->content); + x = contentPtr->x; + y = contentPtr->y; map = 1; - for (ancestor = slavePtr->master; ; ancestor = Tk_Parent(ancestor)) { + for (ancestor = contentPtr->container; ; ancestor = Tk_Parent(ancestor)) { if (!Tk_IsMapped(ancestor) && (ancestor != parent)) { map = 0; } if (ancestor == parent) { - if ((x != Tk_X(slavePtr->slave)) - || (y != Tk_Y(slavePtr->slave))) { - Tk_MoveWindow(slavePtr->slave, x, y); + if ((x != Tk_X(contentPtr->content)) + || (y != Tk_Y(contentPtr->content))) { + Tk_MoveWindow(contentPtr->content, x, y); } if (map) { - Tk_MapWindow(slavePtr->slave); + Tk_MapWindow(contentPtr->content); } else { - Tk_UnmapWindow(slavePtr->slave); + Tk_UnmapWindow(contentPtr->content); } break; } diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h index 1e3a91f..e65893f 100644 --- a/generic/tkImgPhoto.h +++ b/generic/tkImgPhoto.h @@ -176,7 +176,7 @@ struct PhotoModel { }; /* - * Bit definitions for the flags field of a PhotoMaster. + * Bit definitions for the flags field of a PhotoModel. * COLOR_IMAGE: 1 means that the image has different color * components. * IMAGE_CHANGED: 1 means that the instances of this image need diff --git a/generic/tkInt.h b/generic/tkInt.h index 2f336d0..354573f 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1267,10 +1267,8 @@ MODULE_SCOPE int Tk_WinfoObjCmd(ClientData clientData, MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -#define TkSetGeometryContainer TkSetGeometryMaster MODULE_SCOPE int TkSetGeometryContainer(Tcl_Interp *interp, Tk_Window tkwin, const char *name); -#define TkFreeGeometryContainer TkFreeGeometryMaster MODULE_SCOPE void TkFreeGeometryContainer(Tk_Window tkwin, const char *name); diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index 9e8fc82..d7563a0 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -88,12 +88,12 @@ static Ttk_Padding FrameMargins(Frame *framePtr) * The frame doesn't request a size of its own by default, * but it does have an internal border. See also <<NOTE-SIZE>> */ -static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr) +static int FrameSize( + void *recordPtr, + TCL_UNUSED(int *), + TCL_UNUSED(int *)) { Frame *framePtr = (Frame *)recordPtr; - (void)widthPtr; - (void)heightPtr; - Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr)); return 0; } @@ -340,15 +340,16 @@ LabelframeLabelSize(Labelframe *lframePtr, int *widthPtr, int *heightPtr) * Like the frame, this doesn't request a size of its own * but it does have internal padding and a minimum size. */ -static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr) +static int LabelframeSize( + void *recordPtr, + TCL_UNUSED(int *), + TCL_UNUSED(int *)) { Labelframe *lframePtr = (Labelframe *)recordPtr; WidgetCore *corePtr = &lframePtr->core; Ttk_Padding margins; LabelframeStyle style; int labelWidth, labelHeight; - (void)widthPtr; - (void)heightPtr; LabelframeStyleOptions(lframePtr, &style); @@ -487,18 +488,17 @@ static void LabelframePlaceContent(void *recordPtr) Ttk_Box b; LabelframeDoLayout(recordPtr); b = lframe->label.labelParcel; - /* ASSERT: slave #0 is lframe->label.labelWidget */ + /* ASSERT: content #0 is lframe->label.labelWidget */ Ttk_PlaceContent(lframe->label.mgr, 0, b.x,b.y,b.width,b.height); } } -static int LabelRequest(void *managerData, TkSizeT index, int width, int height) +static int LabelRequest( + TCL_UNUSED(void *), + TCL_UNUSED(TkSizeT), + TCL_UNUSED(int), + TCL_UNUSED(int)) { - (void)managerData; - (void)index; - (void)width; - (void)height; - return 1; } @@ -529,10 +529,11 @@ static Ttk_ManagerSpec LabelframeManagerSpec = { /* LabelframeInitialize -- * Initialization hook. */ -static void LabelframeInitialize(Tcl_Interp *dummy, void *recordPtr) +static void LabelframeInitialize( + TCL_UNUSED(Tcl_Interp *), + void *recordPtr) { Labelframe *lframe = (Labelframe *)recordPtr; - (void)dummy; lframe->label.mgr = Ttk_CreateManager( &LabelframeManagerSpec, lframe, lframe->core.tkwin); diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index 0a3f13c..9ea70ec 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -10,7 +10,7 @@ /*------------------------------------------------------------------------ * +++ The Geometry Propagation Dance. * - * When a slave window requests a new size or some other parameter changes, + * When a content window requests a new size or some other parameter changes, * the manager recomputes the required size for the container window and calls * Tk_GeometryRequest(). This is scheduled as an idle handler so multiple * updates can be processed as a single batch. @@ -18,7 +18,7 @@ * If all goes well, the container's manager will process the request * (and so on up the chain to the toplevel window), and the container * window will eventually receive a <Configure> event. At this point - * it recomputes the size and position of all slaves and places them. + * it recomputes the size and position of all content windows and places them. * * If all does not go well, however, the container's request may be ignored * (typically because the top-level window has a fixed, user-specified size). @@ -35,23 +35,23 @@ * (3) Content window is destroyed * * In case (1), Tk calls the manager's lostContentProc. - * Case (2) is performed by calling Tk_ManageGeometry(slave,NULL,0); + * Case (2) is performed by calling Tk_ManageGeometry(window,NULL,0); * 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 <Destroy> events. + * register an event handler on the content window to track <Destroy> events. */ /* ++ Data structures. */ typedef struct { - Tk_Window contentWindow; + Tk_Window window; Ttk_Manager *manager; void *data; unsigned flags; } Ttk_Content; -/* slave->flags bits: +/* content->flags bits: */ #define CONTENT_MAPPED 0x1 /* content windows to be mapped when container is */ @@ -61,7 +61,7 @@ struct TtkManager_ void *managerData; Tk_Window window; unsigned flags; - TkSizeT nManaged; + TkSizeT nContent; Ttk_Content **content; }; @@ -102,11 +102,11 @@ static void RecomputeSize(Ttk_Manager *mgr) } /* ++ RecomputeLayout -- - * Recompute geometry of all slaves. + * Recompute geometry of all content windows. */ static void RecomputeLayout(Ttk_Manager *mgr) { - mgr->managerSpec->PlaceSlaves(mgr->managerData); + mgr->managerSpec->PlaceContent(mgr->managerData); mgr->flags &= ~MGR_RELAYOUT_REQUIRED; } @@ -135,8 +135,8 @@ static void ManagerIdleProc(ClientData clientData) */ /* ++ ManagerEventHandler -- - * Recompute slave layout when container widget is resized. - * Keep the slave's map state in sync with the container's. + * Recompute content layout when container widget is resized. + * Keep the content's map state in sync with the container's. */ static const int ManagerEventMask = StructureNotifyMask; static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) @@ -150,17 +150,17 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) RecomputeLayout(mgr); break; case MapNotify: - for (i = 0; i < mgr->nManaged; ++i) { - Ttk_Content *slave = mgr->content[i]; - if (slave->flags & CONTENT_MAPPED) { - Tk_MapWindow(slave->contentWindow); + for (i = 0; i < mgr->nContent; ++i) { + Ttk_Content *content = mgr->content[i]; + if (content->flags & CONTENT_MAPPED) { + Tk_MapWindow(content->window); } } break; case UnmapNotify: - for (i = 0; i < mgr->nManaged; ++i) { - Ttk_Content *slave = mgr->content[i]; - Tk_UnmapWindow(slave->contentWindow); + for (i = 0; i < mgr->nContent; ++i) { + Ttk_Content *content = mgr->content[i]; + Tk_UnmapWindow(content->window); } break; } @@ -172,23 +172,23 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) */ static void ContentLostEventHandler(void *clientData, XEvent *eventPtr) { - Ttk_Content *slave = (Ttk_Content *)clientData; + Ttk_Content *content = (Ttk_Content *)clientData; if (eventPtr->type == DestroyNotify) { - slave->manager->managerSpec->tkGeomMgr.lostContentProc( - slave->manager, slave->contentWindow); + content->manager->managerSpec->tkGeomMgr.lostContentProc( + content->manager, content->window); } } /*------------------------------------------------------------------------ - * +++ Slave initialization and cleanup. + * +++ Content initialization and cleanup. */ static Ttk_Content *NewContent( - Ttk_Manager *mgr, Tk_Window contentWindow, void *data) + Ttk_Manager *mgr, Tk_Window window, void *data) { Ttk_Content *content = (Ttk_Content *)ckalloc(sizeof(Ttk_Content)); - content->contentWindow = contentWindow; + content->window = window; content->manager = mgr; content->flags = 0; content->data = data; @@ -196,7 +196,7 @@ static Ttk_Content *NewContent( return content; } -static void DeleteSlave(Ttk_Content *content) +static void DeleteContent(Ttk_Content *content) { ckfree(content); } @@ -213,7 +213,7 @@ Ttk_Manager *Ttk_CreateManager( mgr->managerSpec = managerSpec; mgr->managerData = managerData; mgr->window = window; - mgr->nManaged = 0; + mgr->nContent = 0; mgr->content = NULL; mgr->flags = 0; @@ -228,8 +228,8 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) Tk_DeleteEventHandler( mgr->window, ManagerEventMask, ManagerEventHandler, mgr); - while (mgr->nManaged > 0) { - Ttk_ForgetContent(mgr, mgr->nManaged - 1); + while (mgr->nContent > 0) { + Ttk_ForgetContent(mgr, mgr->nContent - 1); } if (mgr->content) { ckfree(mgr->content); @@ -241,7 +241,7 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) } /*------------------------------------------------------------------------ - * +++ Slave management. + * +++ Content window management. */ /* ++ InsertContent -- @@ -249,8 +249,8 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) */ static void InsertContent(Ttk_Manager *mgr, Ttk_Content *content, TkSizeT index) { - TkSizeT endIndex = mgr->nManaged++; - mgr->content = (Ttk_Content **)ckrealloc(mgr->content, mgr->nManaged * sizeof(Ttk_Content *)); + TkSizeT endIndex = mgr->nContent++; + mgr->content = (Ttk_Content **)ckrealloc(mgr->content, mgr->nContent * sizeof(Ttk_Content *)); while (endIndex > index) { mgr->content[endIndex] = mgr->content[endIndex - 1]; @@ -259,49 +259,49 @@ static void InsertContent(Ttk_Manager *mgr, Ttk_Content *content, TkSizeT index) mgr->content[index] = content; - Tk_ManageGeometry(content->contentWindow, + Tk_ManageGeometry(content->window, &mgr->managerSpec->tkGeomMgr, mgr); - Tk_CreateEventHandler(content->contentWindow, + Tk_CreateEventHandler(content->window, StructureNotifyMask, ContentLostEventHandler, content); ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } -/* RemoveSlave -- - * Unmanage and delete the slave. +/* RemoveContent -- + * Unmanage and delete the content window. * * NOTES/ASSUMPTIONS: * * [1] It's safe to call Tk_UnmapWindow / Tk_UnmaintainGeometry even if this - * routine is called from the slave's DestroyNotify event handler. + * routine is called from the content window's DestroyNotify event handler. */ -static void RemoveSlave(Ttk_Manager *mgr, TkSizeT index) +static void RemoveContent(Ttk_Manager *mgr, TkSizeT index) { - Ttk_Content *slave = mgr->content[index]; + Ttk_Content *content = mgr->content[index]; TkSizeT i; /* Notify manager: */ - mgr->managerSpec->SlaveRemoved(mgr->managerData, index); + mgr->managerSpec->ContentRemoved(mgr->managerData, index); /* Remove from array: */ - --mgr->nManaged; - for (i = index ; i < mgr->nManaged; ++i) { + --mgr->nContent; + for (i = index ; i < mgr->nContent; ++i) { mgr->content[i] = mgr->content[i+1]; } /* Clean up: */ Tk_DeleteEventHandler( - slave->contentWindow, StructureNotifyMask, ContentLostEventHandler, slave); + content->window, StructureNotifyMask, ContentLostEventHandler, content); /* Note [1] */ - Tk_UnmaintainGeometry(slave->contentWindow, mgr->window); - Tk_UnmapWindow(slave->contentWindow); + Tk_UnmaintainGeometry(content->window, mgr->window); + Tk_UnmapWindow(content->window); - DeleteSlave(slave); + DeleteContent(content); ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } @@ -310,27 +310,27 @@ static void RemoveSlave(Ttk_Manager *mgr, TkSizeT index) * +++ Tk_GeomMgr hooks. */ -void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window contentWindow) +void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; - TkSizeT index = Ttk_ContentIndex(mgr, contentWindow); - int reqWidth = Tk_ReqWidth(contentWindow); - int reqHeight= Tk_ReqHeight(contentWindow); + TkSizeT index = Ttk_ContentIndex(mgr, window); + int reqWidth = Tk_ReqWidth(window); + int reqHeight= Tk_ReqHeight(window); - if (mgr->managerSpec->SlaveRequest( + if (mgr->managerSpec->ContentRequest( mgr->managerData, index, reqWidth, reqHeight)) { ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } } -void Ttk_LostContentProc(ClientData clientData, Tk_Window contentWindow) +void Ttk_LostContentProc(ClientData clientData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; - TkSizeT index = Ttk_ContentIndex(mgr, contentWindow); + TkSizeT index = Ttk_ContentIndex(mgr, window); /* ASSERT: index >= 0 */ - RemoveSlave(mgr, index); + RemoveContent(mgr, index); } /*------------------------------------------------------------------------ @@ -343,8 +343,8 @@ void Ttk_LostContentProc(ClientData clientData, Tk_Window contentWindow) void Ttk_InsertContent( Ttk_Manager *mgr, TkSizeT index, Tk_Window tkwin, void *data) { - Ttk_Content *slave = NewContent(mgr, tkwin, data); - InsertContent(mgr, slave, index); + Ttk_Content *content = NewContent(mgr, tkwin, data); + InsertContent(mgr, content, index); } /* ++ Ttk_ForgetContent -- @@ -352,9 +352,9 @@ void Ttk_InsertContent( */ void Ttk_ForgetContent(Ttk_Manager *mgr, TkSizeT index) { - Tk_Window contentWindow = mgr->content[index]->contentWindow; - RemoveSlave(mgr, index); - Tk_ManageGeometry(contentWindow, NULL, 0); + Tk_Window window = mgr->content[index]->window; + RemoveContent(mgr, index); + Tk_ManageGeometry(window, NULL, 0); } /* ++ Ttk_PlaceContent -- @@ -367,11 +367,11 @@ void Ttk_ForgetContent(Ttk_Manager *mgr, TkSizeT index) void Ttk_PlaceContent( Ttk_Manager *mgr, TkSizeT index, int x, int y, int width, int height) { - Ttk_Content *slave = mgr->content[index]; - Tk_MaintainGeometry(slave->contentWindow,mgr->window,x,y,width,height); - slave->flags |= CONTENT_MAPPED; + Ttk_Content *content = mgr->content[index]; + Tk_MaintainGeometry(content->window,mgr->window,x,y,width,height); + content->flags |= CONTENT_MAPPED; if (Tk_IsMapped(mgr->window)) { - Tk_MapWindow(slave->contentWindow); + Tk_MapWindow(content->window); } } @@ -380,13 +380,13 @@ void Ttk_PlaceContent( */ void Ttk_UnmapContent(Ttk_Manager *mgr, TkSizeT index) { - Ttk_Content *slave = mgr->content[index]; - Tk_UnmaintainGeometry(slave->contentWindow, mgr->window); - slave->flags &= ~CONTENT_MAPPED; + Ttk_Content *content = mgr->content[index]; + Tk_UnmaintainGeometry(content->window, mgr->window); + content->flags &= ~CONTENT_MAPPED; /* Contrary to documentation, Tk_UnmaintainGeometry doesn't always * unmap the content window: */ - Tk_UnmapWindow(slave->contentWindow); + Tk_UnmapWindow(content->window); } /* LayoutChanged, SizeChanged -- @@ -406,7 +406,7 @@ void Ttk_ManagerSizeChanged(Ttk_Manager *mgr) */ TkSizeT Ttk_NumberContent(Ttk_Manager *mgr) { - return mgr->nManaged; + return mgr->nContent; } void *Ttk_ContentData(Ttk_Manager *mgr, TkSizeT index) { @@ -414,7 +414,7 @@ void *Ttk_ContentData(Ttk_Manager *mgr, TkSizeT index) } Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, TkSizeT index) { - return mgr->content[index]->contentWindow; + return mgr->content[index]->window; } /*------------------------------------------------------------------------ @@ -424,11 +424,11 @@ Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, TkSizeT index) /* ++ Ttk_ContentIndex -- * Returns the index of specified content window, -1 if not found. */ -TkSizeT Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window contentWindow) +TkSizeT Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window) { TkSizeT index; - for (index = 0; index < mgr->nManaged; ++index) - if (mgr->content[index]->contentWindow == contentWindow) + for (index = 0; index < mgr->nContent; ++index) + if (mgr->content[index]->window == window) return index; return TCL_INDEX_NONE; } @@ -451,8 +451,8 @@ int Ttk_GetContentIndexFromObj( /* Try interpreting as an integer first: */ - if (TkGetIntForIndex(objPtr, mgr->nManaged - 1, 1, &index) == TCL_OK) { - if (index + 1 > mgr->nManaged + 1) { + if (TkGetIntForIndex(objPtr, mgr->nContent - 1, 1, &index) == TCL_OK) { + if (index + 1 > mgr->nContent + 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Managed window index %d out of bounds", (int)index)); Tcl_SetErrorCode(interp, "TTK", "MANAGED", "INDEX", NULL); @@ -462,7 +462,7 @@ int Ttk_GetContentIndexFromObj( return TCL_OK; } - /* Try interpreting as a slave window name; + /* Try interpreting as a content window name; */ if ((*string == '.') && (tkwin = Tk_NameToWindow(interp, string, mgr->window))) { @@ -504,28 +504,28 @@ void Ttk_ReorderContent(Ttk_Manager *mgr, TkSizeT fromIndex, TkSizeT toIndex) /* ASSERT: fromIndex == toIndex */ mgr->content[fromIndex] = moved; - /* Schedule a relayout. In general, rearranging slaves + /* Schedule a relayout. In general, rearranging contents * may also change the size: */ ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } -/* ++ Ttk_Maintainable(interp, slave, container) -- +/* ++ Ttk_Maintainable(interp, content, container) -- * Utility routine. Verifies that 'container' may be used to maintain - * the geometry of 'slave' via Tk_MaintainGeometry: + * the geometry of 'content' via Tk_MaintainGeometry: * - * + 'container' is either 'slave's parent -OR- - * + 'container is a descendant of 'slave's parent. - * + 'slave' is not a toplevel window - * + 'slave' belongs to the same toplevel as 'container' + * + 'container' is either 'content's parent -OR- + * + 'container is a descendant of 'content's parent. + * + 'content' is not a toplevel window + * + 'content' belongs to the same toplevel as 'container' * * Returns: 1 if OK; otherwise 0, leaving an error message in 'interp'. */ -int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window container) +int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window window, Tk_Window container) { - Tk_Window ancestor = container, parent = Tk_Parent(slave); + Tk_Window ancestor = container, parent = Tk_Parent(window); - if (Tk_IsTopLevel(slave) || slave == container) { + if (Tk_IsTopLevel(window) || window == container) { goto badWindow; } @@ -539,8 +539,8 @@ int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window container) return 1; badWindow: - Tcl_SetObjResult(interp, Tcl_ObjPrintf("can't add %s as slave of %s", - Tk_PathName(slave), Tk_PathName(container))); + Tcl_SetObjResult(interp, Tcl_ObjPrintf("can't add %s as content of %s", + Tk_PathName(window), Tk_PathName(container))); Tcl_SetErrorCode(interp, "TTK", "GEOMETRY", "MAINTAINABLE", NULL); return 0; } diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h index edcbb09..07b0ade 100644 --- a/generic/ttk/ttkManager.h +++ b/generic/ttk/ttkManager.h @@ -16,31 +16,31 @@ typedef struct TtkManager_ Ttk_Manager; * * RequestedSize computes the requested size of the container window. * - * PlaceSlaves sets the position and size of all managed slaves + * PlaceContent sets the position and size of all managed content windows * by calling Ttk_PlaceContent(). * - * SlaveRemoved() is called immediately before a slave is removed. - * NB: the associated slave window may have been destroyed when this + * ContentRemoved() is called immediately before a content window is removed. + * NB: the associated content window may have been destroyed when this * routine is called. * - * SlaveRequest() is called when a slave requests a size change. + * ContentRequest() is called when a content window requests a size change. * It should return 1 if the request should propagate, 0 otherwise. */ typedef struct { /* Manager hooks */ Tk_GeomMgr tkGeomMgr; /* "real" Tk Geometry Manager */ int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr); - void (*PlaceSlaves)(void *managerData); - int (*SlaveRequest)(void *managerData, TkSizeT index, int w, int h); - void (*SlaveRemoved)(void *managerData, TkSizeT index); + void (*PlaceContent)(void *managerData); + int (*ContentRequest)(void *managerData, TkSizeT index, int w, int h); + void (*ContentRemoved)(void *managerData, TkSizeT index); } Ttk_ManagerSpec; /* * Default implementations for Tk_GeomMgr hooks: */ #define Ttk_LostSlaveProc Ttk_LostContentProc -MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window slave); -MODULE_SCOPE void Ttk_LostContentProc(ClientData, Tk_Window slave); +MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window window); +MODULE_SCOPE void Ttk_LostContentProc(ClientData, Tk_Window window); /* * Public API: @@ -51,23 +51,23 @@ MODULE_SCOPE void Ttk_DeleteManager(Ttk_Manager *); #define Ttk_InsertSlave Ttk_InsertContent MODULE_SCOPE void Ttk_InsertContent( - Ttk_Manager *, TkSizeT position, Tk_Window, void *slaveData); + Ttk_Manager *, TkSizeT position, Tk_Window, void *clientData); #define Ttk_ForgetSlave Ttk_ForgetContent -MODULE_SCOPE void Ttk_ForgetContent(Ttk_Manager *, TkSizeT slaveIndex); +MODULE_SCOPE void Ttk_ForgetContent(Ttk_Manager *, TkSizeT index); #define Ttk_ReorderSlave Ttk_ReorderContent MODULE_SCOPE void Ttk_ReorderContent(Ttk_Manager *, TkSizeT fromIndex, TkSizeT toIndex); - /* Rearrange content positions */ + /* Rearrange content window positions */ #define Ttk_PlaceSlave Ttk_PlaceContent MODULE_SCOPE void Ttk_PlaceContent( Ttk_Manager *, TkSizeT index, int x, int y, int width, int height); - /* Position and map the slave */ + /* Position and map the content window */ #define Ttk_UnmapSlave Ttk_UnmapContent -MODULE_SCOPE void Ttk_UnmapContent(Ttk_Manager *, TkSizeT slaveIndex); - /* Unmap the slave */ +MODULE_SCOPE void Ttk_UnmapContent(Ttk_Manager *, TkSizeT index); + /* Unmap the content window */ MODULE_SCOPE void Ttk_ManagerSizeChanged(Ttk_Manager *); MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *); @@ -87,14 +87,14 @@ MODULE_SCOPE int Ttk_GetContentIndexFromObj( */ #define Ttk_NumberSlaves Ttk_NumberContent MODULE_SCOPE TkSizeT Ttk_NumberContent(Ttk_Manager *); - /* Returns: number of managed windows */ + /* Returns: number of managed content windows */ #define Ttk_SlaveData Ttk_ContentData MODULE_SCOPE void *Ttk_ContentData(Ttk_Manager *, TkSizeT index); - /* Returns: client data associated with managed window */ + /* Returns: client data associated with content window */ #define Ttk_SlaveWindow Ttk_ContentWindow -MODULE_SCOPE Tk_Window Ttk_ContentWindow(Ttk_Manager *, TkSizeT slaveIndex); +MODULE_SCOPE Tk_Window Ttk_ContentWindow(Ttk_Manager *, TkSizeT index); /* Returns: content window */ MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window content, Tk_Window container); diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index fa3881e..216f236 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -53,7 +53,7 @@ typedef struct * relevant to the tab. * * PaneOptionSpecs includes additional options for child window placement - * and is used to configure the slave. + * and is used to configure the pane. */ static const Tk_OptionSpec TabOptionSpecs[] = { @@ -98,7 +98,7 @@ typedef struct TkSizeT activeIndex; /* index of currently active tab */ Ttk_Layout tabLayout; /* Sublayout for tabs */ - Ttk_Box clientArea; /* Where to pack slave widgets */ + Ttk_Box clientArea; /* Where to pack content windows */ } NotebookPart; typedef struct @@ -187,13 +187,13 @@ static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle) * +++ Tab management. */ -static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window slaveWindow) +static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window window) { Tk_OptionTable optionTable = nb->notebook.paneOptionTable; Tab *record = (Tab *)ckalloc(sizeof(Tab)); memset(record, 0, sizeof(Tab)); - if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) { + if (Tk_InitOptions(interp, record, optionTable, window) != TCL_OK) { ckfree(record); return NULL; } @@ -209,7 +209,7 @@ static void DestroyTab(Notebook *nb, Tab *tab) } static int ConfigureTab( - Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window slaveWindow, + Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window window, int objc, Tcl_Obj *const objv[]) { Ttk_Sticky sticky = tab->sticky; @@ -218,7 +218,7 @@ static int ConfigureTab( int mask = 0; if (Tk_SetOptions(interp, tab, nb->notebook.paneOptionTable, - objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) + objc, objv, window, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } @@ -230,7 +230,7 @@ static int ConfigureTab( { goto error; } - if (Ttk_GetPaddingFromObj(interp, slaveWindow, tab->paddingObj, &padding) + if (Ttk_GetPaddingFromObj(interp, window, tab->paddingObj, &padding) != TCL_OK) { goto error; @@ -378,7 +378,7 @@ static void TabrowSize( * * Total height is tab height + client area height + pane internal padding * Total width is max(client width, tab width) + pane internal padding - * Client area size determined by max size of slaves, + * Client area size determined by max size of content windows, * overridden by -width and/or -height if nonzero. */ @@ -395,18 +395,18 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) NotebookStyleOptions(nb, &nbstyle); - /* Compute max requested size of all slaves: + /* Compute max requested size of all content windows: */ for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { - Tk_Window slaveWindow = Ttk_ContentWindow(nb->notebook.mgr, i); + Tk_Window window = 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 - = Tk_ReqHeight(slaveWindow) + Ttk_PaddingHeight(tab->padding); + int width + = Tk_ReqWidth(window) + Ttk_PaddingWidth(tab->padding); + int height + = Tk_ReqHeight(window) + Ttk_PaddingHeight(tab->padding); - clientWidth = MAX(clientWidth, slaveWidth); - clientHeight = MAX(clientHeight, slaveHeight); + clientWidth = MAX(clientWidth, width); + clientHeight = MAX(clientHeight, height); } /* Client width/height overridable by widget options: @@ -513,7 +513,7 @@ static void PlaceTabs( * Computes notebook layout and places tabs. * * Side effects: - * Sets clientArea, used to place slave panes. + * Sets clientArea, used to place panes. */ static void NotebookDoLayout(void *recordPtr) { @@ -574,13 +574,13 @@ static void NotebookDoLayout(void *recordPtr) static void NotebookPlaceContent(Notebook *nb, TkSizeT index) { Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); - Tk_Window slaveWindow = Ttk_ContentWindow(nb->notebook.mgr, index); - Ttk_Box slaveBox = + Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, index); + Ttk_Box box = Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding), - Tk_ReqWidth(slaveWindow), Tk_ReqHeight(slaveWindow),tab->sticky); + Tk_ReqWidth(window), Tk_ReqHeight(window),tab->sticky); Ttk_PlaceContent(nb->notebook.mgr, index, - slaveBox.x, slaveBox.y, slaveBox.width, slaveBox.height); + box.x, box.y, box.width, box.height); } /* NotebookPlaceContents -- @@ -693,7 +693,7 @@ static void SelectNearestTab(Notebook *nb) /* TabRemoved -- GM TabRemoved hook. * Select the next tab if the current one is being removed. - * Adjust currentIndex to account for removed slave. + * Adjust currentIndex to account for removed content window. */ static void TabRemoved(void *managerData, TkSizeT index) { @@ -713,13 +713,12 @@ static void TabRemoved(void *managerData, TkSizeT index) TtkRedisplayWidget(&nb->core); } -static int TabRequest(void *managerData, TkSizeT index, int width, int height) +static int TabRequest( + TCL_UNUSED(void *), + TCL_UNUSED(TkSizeT), + TCL_UNUSED(int), + TCL_UNUSED(int)) { - (void)managerData; - (void)index; - (void)width; - (void)height; - return 1; } @@ -728,17 +727,17 @@ static int TabRequest(void *managerData, TkSizeT index, int width, int height) */ static int AddTab( Tcl_Interp *interp, Notebook *nb, - TkSizeT destIndex, Tk_Window slaveWindow, + TkSizeT destIndex, Tk_Window window, int objc, Tcl_Obj *const objv[]) { Tab *tab; - if (!Ttk_Maintainable(interp, slaveWindow, nb->core.tkwin)) { + if (!Ttk_Maintainable(interp, window, nb->core.tkwin)) { return TCL_ERROR; } #if 0 /* can't happen */ - if (Ttk_ContentIndex(nb->notebook.mgr, slaveWindow) != TCL_INDEX_NONE) { + if (Ttk_ContentIndex(nb->notebook.mgr, window) != TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s already added", - Tk_PathName(slaveWindow))); + Tk_PathName(window))); Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "PRESENT", NULL); return TCL_ERROR; } @@ -746,16 +745,16 @@ static int AddTab( /* Create and insert tab. */ - tab = CreateTab(interp, nb, slaveWindow); + tab = CreateTab(interp, nb, window); if (!tab) { return TCL_ERROR; } - if (ConfigureTab(interp, nb, tab, slaveWindow, objc, objv) != TCL_OK) { + if (ConfigureTab(interp, nb, tab, window, objc, objv) != TCL_OK) { DestroyTab(nb, tab); return TCL_ERROR; } - Ttk_InsertContent(nb->notebook.mgr, destIndex, slaveWindow, tab); + Ttk_InsertContent(nb->notebook.mgr, destIndex, window, tab); /* Adjust indices and/or autoselect first tab: */ @@ -814,7 +813,7 @@ static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr) * + positional specifications @x,y, * + "current", * + numeric indices [0..nTabs], - * + slave window names + * + content window names * * Stores index of specified tab in *index_rtn, -1 if not found. * @@ -854,8 +853,8 @@ static int FindTabIndex( } 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); + "Invalid tab specification %s", string)); + Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "SPEC", NULL); return TCL_ERROR; } @@ -875,8 +874,8 @@ static int GetTabIndex( int status = FindTabIndex(interp, nb, objPtr, index_rtn); 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); + "tab index %s out of bounds", Tcl_GetString(objPtr))); + Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "INDEX", NULL); return TCL_ERROR; } @@ -899,7 +898,7 @@ static int NotebookAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Notebook *nb = (Notebook *)recordPtr; - Tk_Window slaveWindow; + Tk_Window window; int index; Tab *tab; @@ -908,21 +907,21 @@ static int NotebookAddCommand( return TCL_ERROR; } - slaveWindow = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin); - if (!slaveWindow) { + window = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin); + if (!window) { return TCL_ERROR; } - index = Ttk_ContentIndex(nb->notebook.mgr, slaveWindow); + index = Ttk_ContentIndex(nb->notebook.mgr, window); if (index < 0) { /* New tab */ - return AddTab(interp, nb, Ttk_NumberContent(nb->notebook.mgr), slaveWindow, objc-3,objv+3); + return AddTab(interp, nb, Ttk_NumberContent(nb->notebook.mgr), window, objc-3,objv+3); } tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); if (tab->state == TAB_STATE_HIDDEN) { tab->state = TAB_STATE_NORMAL; } - if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) { + if (ConfigureTab(interp, nb, tab, window, objc-3,objv+3) != TCL_OK) { return TCL_ERROR; } @@ -939,11 +938,11 @@ static int NotebookInsertCommand( { Notebook *nb = (Notebook *)recordPtr; TkSizeT current = nb->notebook.currentIndex; - TkSizeT nSlaves = Ttk_NumberContent(nb->notebook.mgr); + TkSizeT nContent = Ttk_NumberContent(nb->notebook.mgr); TkSizeT srcIndex, destIndex; if (objc < 4) { - Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?"); + Tcl_WrongNumArgs(interp, 2,objv, "index window ?-option value ...?"); return TCL_ERROR; } @@ -953,18 +952,18 @@ static int NotebookInsertCommand( } if (Tcl_GetString(objv[3])[0] == '.') { - /* Window name -- could be new or existing slave. + /* Window name -- could be new or existing content window. */ - Tk_Window slaveWindow = + Tk_Window window = Tk_NameToWindow(interp,Tcl_GetString(objv[3]),nb->core.tkwin); - if (!slaveWindow) { + if (!window) { return TCL_ERROR; } - srcIndex = Ttk_ContentIndex(nb->notebook.mgr, slaveWindow); - if (srcIndex == TCL_INDEX_NONE) { /* New slave */ - return AddTab(interp, nb, destIndex, slaveWindow, objc-4,objv+4); + srcIndex = Ttk_ContentIndex(nb->notebook.mgr, window); + if (srcIndex == TCL_INDEX_NONE) { /* New content window */ + return AddTab(interp, nb, destIndex, window, objc-4,objv+4); } } else if (Ttk_GetContentIndexFromObj( interp, nb->notebook.mgr, objv[3], &srcIndex) != TCL_OK) @@ -974,7 +973,7 @@ static int NotebookInsertCommand( srcIndex = Ttk_NumberContent(nb->notebook.mgr) - 1; } - /* Move existing slave: + /* Move existing content window: */ if (ConfigureTab(interp, nb, (Tab *)Ttk_ContentData(nb->notebook.mgr, srcIndex), @@ -984,8 +983,8 @@ static int NotebookInsertCommand( return TCL_ERROR; } - if (destIndex + 1 >= nSlaves + 1) { - destIndex = nSlaves - 1; + if (destIndex + 1 >= nContent + 1) { + destIndex = nContent - 1; } Ttk_ReorderContent(nb->notebook.mgr, srcIndex, destIndex); @@ -1202,7 +1201,7 @@ static int NotebookTabCommand( Notebook *nb = (Notebook *)recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; TkSizeT index; - Tk_Window slaveWindow; + Tk_Window window; Tab *tab; if (objc < 3) { @@ -1215,17 +1214,17 @@ static int NotebookTabCommand( } tab = (Tab *)Ttk_ContentData(mgr, index); - slaveWindow = Ttk_ContentWindow(mgr, index); + window = Ttk_ContentWindow(mgr, index); if (objc == 3) { return TtkEnumerateOptions(interp, tab, - PaneOptionSpecs, nb->notebook.paneOptionTable, slaveWindow); + PaneOptionSpecs, nb->notebook.paneOptionTable, window); } else if (objc == 4) { return TtkGetOptionValue(interp, tab, objv[3], - nb->notebook.paneOptionTable, slaveWindow); + nb->notebook.paneOptionTable, window); } /* else */ - if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) { + if (ConfigureTab(interp, nb, tab, window, objc-3,objv+3) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 5c67ace..ae7bf11 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -28,7 +28,7 @@ * gives the same result as changing the size by X+Y pixels * in one step). * - * The request size is initially set to the slave window's requested size. + * The request size is initially set to the content window's requested size. * When the user drags a sash, each pane's request size is set to its * actual size. This ensures that panes "stay put" on the next resize. * @@ -107,21 +107,21 @@ static const Tk_OptionSpec PaneOptionSpecs[] = { /* CreatePane -- * Create a new pane record. */ -static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window slaveWindow) +static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window window) { Tk_OptionTable optionTable = pw->paned.paneOptionTable; void *record = ckalloc(sizeof(Pane)); Pane *pane = (Pane *)record; memset(record, 0, sizeof(Pane)); - if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) { + if (Tk_InitOptions(interp, record, optionTable, window) != TCL_OK) { ckfree(record); return NULL; } pane->reqSize = pw->paned.orient == TTK_ORIENT_HORIZONTAL - ? Tk_ReqWidth(slaveWindow) : Tk_ReqHeight(slaveWindow); + ? Tk_ReqWidth(window) : Tk_ReqHeight(window); return pane; } @@ -140,7 +140,7 @@ static void DestroyPane(Paned *pw, Pane *pane) * Set pane options. */ static int ConfigurePane( - Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window slaveWindow, + Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window window, int objc, Tcl_Obj *const objv[]) { Ttk_Manager *mgr = pw->paned.mgr; @@ -148,7 +148,7 @@ static int ConfigurePane( int mask = 0; if (Tk_SetOptions(interp, pane, pw->paned.paneOptionTable, - objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) + objc, objv, window, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } @@ -239,20 +239,20 @@ 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_ContentData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); + Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index); - if (height < Tk_ReqHeight(slaveWindow)) - height = Tk_ReqHeight(slaveWindow); + if (height < Tk_ReqHeight(window)) + height = Tk_ReqHeight(window); width += pane->reqSize; } width += nSashes * sashThickness; } else { for (index = 0; index < nPanes; ++index) { Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); + Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index); - if (width < Tk_ReqWidth(slaveWindow)) - width = Tk_ReqWidth(slaveWindow); + if (width < Tk_ReqWidth(window)) + width = Tk_ReqWidth(window); height += pane->reqSize; } height += nSashes * sashThickness; @@ -364,7 +364,7 @@ static void PlaceSashes(Paned *pw, int width, int height) } /* PlacePanes -- - * Places slave panes based on sash positions. + * Places panes based on sash positions. */ static void PlacePanes(Paned *pw) { @@ -412,35 +412,35 @@ static void PaneRemoved(void *managerData, TkSizeT index) static int AddPane( Tcl_Interp *interp, Paned *pw, - int destIndex, Tk_Window slaveWindow, + int destIndex, Tk_Window window, int objc, Tcl_Obj *const objv[]) { Pane *pane; - if (!Ttk_Maintainable(interp, slaveWindow, pw->core.tkwin)) { + if (!Ttk_Maintainable(interp, window, pw->core.tkwin)) { return TCL_ERROR; } - if (Ttk_ContentIndex(pw->paned.mgr, slaveWindow) != TCL_INDEX_NONE) { + if (Ttk_ContentIndex(pw->paned.mgr, window) != TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "%s already added", Tk_PathName(slaveWindow))); + "%s already added", Tk_PathName(window))); Tcl_SetErrorCode(interp, "TTK", "PANE", "PRESENT", NULL); return TCL_ERROR; } - pane = CreatePane(interp, pw, slaveWindow); + pane = CreatePane(interp, pw, window); if (!pane) { return TCL_ERROR; } - if (ConfigurePane(interp, pw, pane, slaveWindow, objc, objv) != TCL_OK) { + if (ConfigurePane(interp, pw, pane, window, objc, objv) != TCL_OK) { DestroyPane(pw, pane); return TCL_ERROR; } - Ttk_InsertContent(pw->paned.mgr, destIndex, slaveWindow, pane); + Ttk_InsertContent(pw->paned.mgr, destIndex, window, pane); return TCL_OK; } /* PaneRequest -- - * Only update pane request size if slave is currently unmapped. + * Only update pane request size if pane is currently unmapped. * Geometry requests from mapped panes are not directly honored * in order to avoid unexpected pane resizes (esp. while the * user is dragging a sash [#1325286]). @@ -449,10 +449,10 @@ static int PaneRequest(void *managerData, TkSizeT index, int width, int height) { Paned *pw = (Paned *)managerData; Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); + Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index); int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; - if (!Tk_IsMapped(slaveWindow)) { + if (!Tk_IsMapped(window)) { pane->reqSize = horizontal ? width : height; } return 1; @@ -519,10 +519,12 @@ static void PanedCleanup(void *recordPtr) /* Post-configuration hook. */ -static int PanedPostConfigure(Tcl_Interp *dummy, void *clientData, int mask) +static int PanedPostConfigure( + TCL_UNUSED(Tcl_Interp *), + void *clientData, + int mask) { Paned *pw = (Paned *)clientData; - (void)dummy; if (mask & GEOMETRY_CHANGED) { /* User has changed -width or -height. @@ -604,10 +606,10 @@ static void DrawSash(Paned *pw, int index, Drawable d) static void PanedDisplay(void *recordPtr, Drawable d) { Paned *pw = (Paned *)recordPtr; - TkSizeT i, nSlaves = Ttk_NumberContent(pw->paned.mgr); + TkSizeT i, nContent = Ttk_NumberContent(pw->paned.mgr); TtkWidgetDisplay(recordPtr, d); - for (i = 1; i < nSlaves; ++i) { + for (i = 1; i < nContent; ++i) { DrawSash(pw, i - 1, d); } } @@ -622,43 +624,43 @@ static int PanedAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Paned *pw = (Paned *)recordPtr; - Tk_Window slaveWindow; + Tk_Window window; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - slaveWindow = Tk_NameToWindow( + window = Tk_NameToWindow( interp, Tcl_GetString(objv[2]), pw->core.tkwin); - if (!slaveWindow) { + if (!window) { return TCL_ERROR; } - return AddPane(interp, pw, Ttk_NumberContent(pw->paned.mgr), slaveWindow, + return AddPane(interp, pw, Ttk_NumberContent(pw->paned.mgr), window, objc - 3, objv + 3); } -/* $pw insert $index $slave ?-option value ...? - * Insert new slave, or move existing one. +/* $pw insert $index $window ?-option value ...? + * Insert new content window, or move existing one. */ static int PanedInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Paned *pw = (Paned *)recordPtr; - TkSizeT nSlaves = Ttk_NumberContent(pw->paned.mgr); + TkSizeT nContent = Ttk_NumberContent(pw->paned.mgr); TkSizeT srcIndex, destIndex; - Tk_Window slaveWindow; + Tk_Window window; if (objc < 4) { - Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?"); + Tcl_WrongNumArgs(interp, 2,objv, "index window ?-option value ...?"); return TCL_ERROR; } - slaveWindow = Tk_NameToWindow( + window = Tk_NameToWindow( interp, Tcl_GetString(objv[3]), pw->core.tkwin); - if (!slaveWindow) { + if (!window) { return TCL_ERROR; } @@ -668,13 +670,13 @@ static int PanedInsertCommand( return TCL_ERROR; } - srcIndex = Ttk_ContentIndex(pw->paned.mgr, slaveWindow); - if (srcIndex == TCL_INDEX_NONE) { /* New slave: */ - return AddPane(interp, pw, destIndex, slaveWindow, objc-4, objv+4); - } /* else -- move existing slave: */ + srcIndex = Ttk_ContentIndex(pw->paned.mgr, window); + if (srcIndex == TCL_INDEX_NONE) { /* New content: */ + return AddPane(interp, pw, destIndex, window, objc-4, objv+4); + } /* else -- move existing content: */ - if (destIndex + 1 >= nSlaves + 1) - destIndex = nSlaves - 1; + if (destIndex + 1 >= nContent + 1) + destIndex = nContent - 1; Ttk_ReorderContent(pw->paned.mgr, srcIndex, destIndex); return objc == 4 ? TCL_OK : @@ -771,7 +773,7 @@ static int PanedPaneCommand( { Paned *pw = (Paned *)recordPtr; TkSizeT paneIndex; - Tk_Window slaveWindow; + Tk_Window window; Pane *pane; if (objc < 3) { @@ -788,17 +790,17 @@ static int PanedPaneCommand( } pane = (Pane *)Ttk_ContentData(pw->paned.mgr, paneIndex); - slaveWindow = Ttk_ContentWindow(pw->paned.mgr, paneIndex); + window = Ttk_ContentWindow(pw->paned.mgr, paneIndex); switch (objc) { case 3: return TtkEnumerateOptions(interp, pane, PaneOptionSpecs, - pw->paned.paneOptionTable, slaveWindow); + pw->paned.paneOptionTable, window); case 4: return TtkGetOptionValue(interp, pane, objv[3], - pw->paned.paneOptionTable, slaveWindow); + pw->paned.paneOptionTable, window); default: - return ConfigurePane(interp, pw, pane, slaveWindow, objc-3,objv+3); + return ConfigurePane(interp, pw, pane, window, objc-3,objv+3); } } @@ -930,14 +932,15 @@ static const Ttk_ElementOptionSpec SashElementOptions[] = { }; static void SashElementSize( - void *dummy, void *elementRecord, Tk_Window tkwin, - int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) + TCL_UNUSED(void *), + void *elementRecord, + TCL_UNUSED(Tk_Window), + int *widthPtr, + int *heightPtr, + TCL_UNUSED(Ttk_Padding *)) { SashElement *sash = (SashElement *)elementRecord; int thickness = DEFAULT_SASH_THICKNESS; - (void)dummy; - (void)tkwin; - (void)paddingPtr; Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness); *widthPtr = *heightPtr = thickness; diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index d06426f..eaea800 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -291,13 +291,12 @@ static void FreeElementClass(Ttk_ElementClass *elementClass) * +++ Themes. */ -static int ThemeEnabled(Ttk_Theme theme, void *dummy) +static int ThemeEnabled( + TCL_UNUSED(Ttk_Theme), + TCL_UNUSED(void *)) { - (void)theme; - (void)dummy; - /* Default ThemeEnabledProc -- always return true */ - return 1; + return 1; } typedef struct Ttk_Theme_ @@ -409,13 +408,14 @@ static void ThemeChangedProc(void *); /* Forward */ /* Ttk_StylePkgFree -- * Cleanup procedure for StylePackageData. */ -static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *dummy) +static void Ttk_StylePkgFree( + ClientData clientData, + TCL_UNUSED(Tcl_Interp *)) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr; Cleanup *cleanup; - (void)dummy; /* * Cancel any pending ThemeChanged calls: @@ -590,7 +590,7 @@ void Ttk_SetThemeEnabledProc( static Ttk_Theme LookupTheme( Tcl_Interp *interp, /* where to leave error messages */ - StylePackageData *pkgPtr, /* style package master record */ + StylePackageData *pkgPtr, /* style package record */ const char *name) /* theme name */ { Tcl_HashEntry *entryPtr; @@ -827,13 +827,12 @@ int Ttk_RegisterElementFactory( * (style element create $name) "from" $theme ?$element? */ static int Ttk_CloneElement( - Tcl_Interp *interp, void *dummy, + Tcl_Interp *interp, TCL_UNUSED(void *), Ttk_Theme theme, const char *elementName, int objc, Tcl_Obj *const objv[]) { Ttk_Theme fromTheme; Ttk_ElementClass *fromElement; - (void)dummy; if (objc <= 0 || objc > 2) { Tcl_WrongNumArgs(interp, 0, objv, "theme ?element?"); @@ -1443,11 +1442,12 @@ static int StyleThemeCreateCmd( * Return list of registered themes. */ static int StyleThemeNamesCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) + ClientData clientData, + Tcl_Interp *interp, + TCL_UNUSED(int), + TCL_UNUSED(Tcl_Obj *const *)) { StylePackageData *pkgPtr = (StylePackageData *)clientData; - (void)objc; - (void)objv; return TtkEnumerateHashTable(interp, &pkgPtr->themeTable); } |