diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-08 06:25:09 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-08 06:25:09 (GMT) |
commit | 3b31d9630f305b2f6b73e57e147541bc13aa1057 (patch) | |
tree | 9e87a5fc11cedd72b8337bf57a660307be55557d | |
parent | dc2c36cea500db6933ade16c3252cef0a66ab26d (diff) | |
download | tk-3b31d9630f305b2f6b73e57e147541bc13aa1057.zip tk-3b31d9630f305b2f6b73e57e147541bc13aa1057.tar.gz tk-3b31d9630f305b2f6b73e57e147541bc13aa1057.tar.bz2 |
TIP #581: master -> container and slave -> content in ttk (mainly)
-rw-r--r-- | doc/ImgChanged.3 | 6 | ||||
-rw-r--r-- | doc/MaintGeom.3 | 86 | ||||
-rw-r--r-- | doc/grid.n | 5 | ||||
-rw-r--r-- | generic/tk.decls | 10 | ||||
-rw-r--r-- | generic/tkCanvWind.c | 16 | ||||
-rw-r--r-- | generic/tkDecls.h | 20 | ||||
-rw-r--r-- | generic/tkFrame.c | 16 | ||||
-rw-r--r-- | generic/tkGeometry.c | 72 | ||||
-rw-r--r-- | generic/tkImgPhInstance.c | 146 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 18 | ||||
-rw-r--r-- | generic/tkImgPhoto.h | 10 | ||||
-rw-r--r-- | generic/ttk/ttkFrame.c | 49 | ||||
-rw-r--r-- | generic/ttk/ttkGenStubs.tcl | 59 | ||||
-rw-r--r-- | generic/ttk/ttkManager.c | 141 | ||||
-rw-r--r-- | generic/ttk/ttkManager.h | 14 | ||||
-rw-r--r-- | generic/ttk/ttkNotebook.c | 190 | ||||
-rw-r--r-- | generic/ttk/ttkPanedwindow.c | 184 | ||||
-rw-r--r-- | generic/ttk/ttkTheme.c | 117 |
18 files changed, 618 insertions, 541 deletions
diff --git a/doc/ImgChanged.3 b/doc/ImgChanged.3 index aa56548..6d8ae91 100644 --- a/doc/ImgChanged.3 +++ b/doc/ImgChanged.3 @@ -14,10 +14,10 @@ Tk_ImageChanged \- notify widgets that image needs to be redrawn .nf \fB#include <tk.h>\fR .sp -\fBTk_ImageChanged\fR(\fIimageMaster, x, y, width, height, imageWidth, imageHeight\fR) +\fBTk_ImageChanged\fR(\fImodel, x, y, width, height, imageWidth, imageHeight\fR) .SH ARGUMENTS .AS Tk_ImageMaster imageHeight -.AP Tk_ImageMaster imageMaster in +.AP Tk_ImageMaster model in Token for image, which was passed to image's \fIcreateProc\fR when the image was created. .AP int x in @@ -42,7 +42,7 @@ whenever anything happens that requires the image to be redrawn. As a result of calling \fBTk_ImageChanged\fR, any widgets using the image are notified so that they can redisplay themselves appropriately. -The \fIimageMaster\fR argument identifies the image, and +The \fImodel\fR argument identifies the image, and \fIx\fR, \fIy\fR, \fIwidth\fR, and \fIheight\fR specify a rectangular region within the image that needs to be redrawn. diff --git a/doc/MaintGeom.3 b/doc/MaintGeom.3 index d1c2d1c..a509b0b 100644 --- a/doc/MaintGeom.3 +++ b/doc/MaintGeom.3 @@ -14,67 +14,67 @@ Tk_MaintainGeometry, Tk_UnmaintainGeometry \- maintain geometry of one window re .nf \fB#include <tk.h>\fR .sp -\fBTk_MaintainGeometry\fR(\fIslave, master, x, y, width, height\fR) +\fBTk_MaintainGeometry\fR(\fIwindow, container, x, y, width, height\fR) .sp -\fBTk_UnmaintainGeometry\fR(\fIslave, master\fR) +\fBTk_UnmaintainGeometry\fR(\fIwindow, container\fR) .SH ARGUMENTS -.AS Tk_Window master -.AP Tk_Window slave in +.AS Tk_Window container +.AP Tk_Window window in Window whose geometry is to be controlled. -.AP Tk_Window master in -Window relative to which \fIslave\fR's geometry will be controlled. +.AP Tk_Window container in +Window relative to which \fIwindow\fR's geometry will be controlled. .AP int x in -Desired x-coordinate of \fIslave\fR in \fImaster\fR, measured in pixels -from the inside of \fImaster\fR's left border to the outside of -\fIslave\fR's left border. +Desired x-coordinate of \fIwindow\fR in \fIcontainer\fR, measured in pixels +from the inside of \fIcontainer\fR's left border to the outside of +\fIwindow\fR's left border. .AP int y in -Desired y-coordinate of \fIslave\fR in \fImaster\fR, measured in pixels -from the inside of \fImaster\fR's top border to the outside of -\fIslave\fR's top border. +Desired y-coordinate of \fIwindow\fR in \fIcontainer\fR, measured in pixels +from the inside of \fIcontainer\fR's top border to the outside of +\fIwindow\fR's top border. .AP int width in -Desired width for \fIslave\fR, in pixels. +Desired width for \fIwindow\fR, in pixels. .AP int height in -Desired height for \fIslave\fR, in pixels. +Desired height for \fIwindow\fR, in pixels. .BE .SH DESCRIPTION .PP \fBTk_MaintainGeometry\fR and \fBTk_UnmaintainGeometry\fR make it -easier for geometry managers to deal with slaves whose masters are not +easier for geometry managers to deal with windows whose containers are not their parents. -Three problems arise if the master for a slave is not its parent: +Three problems arise if the container for a window is not its parent: .IP [1] -The x- and y-position of the slave must be translated from the -coordinate system of the master to that of the parent before -positioning the slave. +The x- and y-position of the window must be translated from the +coordinate system of the container to that of the parent before +positioning the window. .IP [2] -If the master window, or any of its ancestors up to the slave's -parent, is moved, then the slave must be repositioned within its +If the container window, or any of its ancestors up to the window's +parent, is moved, then the window must be repositioned within its parent in order to maintain the correct position relative to the -master. +container. .IP [3] -If the master or one of its ancestors is mapped or unmapped, then -the slave must be mapped or unmapped to correspond. +If the container or one of its ancestors is mapped or unmapped, then +the window must be mapped or unmapped to correspond. .LP -None of these problems is an issue if the parent and master are -the same. For example, if the master or one of its ancestors -is unmapped, the slave is automatically removed by the screen +None of these problems is an issue if the parent and container are +the same. For example, if the container or one of its ancestors +is unmapped, the window is automatically removed by the screen by X. .PP -\fBTk_MaintainGeometry\fR deals with these problems for slaves -whose masters are not their parents, as well as handling the simpler -case of slaves whose masters are their parents. +\fBTk_MaintainGeometry\fR deals with these problems for windows +whose containers are not their parents, as well as handling the simpler +case of windows whose container are their parents. \fBTk_MaintainGeometry\fR is typically called by a window manager -once it has decided where a slave should be positioned relative -to its master. +once it has decided where a window should be positioned relative +to its container. \fBTk_MaintainGeometry\fR translates the coordinates to the -coordinate system of \fIslave\fR's parent and then moves and -resizes the slave appropriately. +coordinate system of \fIwindow\fR's parent and then moves and +resizes the window appropriately. Furthermore, it remembers the desired position and creates event -handlers to monitor the master and all of its ancestors up -to (but not including) the slave's parent. +handlers to monitor the container and all of its ancestors up +to (but not including) the window's parent. If any of these windows is moved, mapped, or unmapped, -the slave will be adjusted so that it is mapped only when the -master is mapped and its geometry relative to the master +the window will be adjusted so that it is mapped only when the +container is mapped and its geometry relative to the container remains as specified by \fIx\fR, \fIy\fR, \fIwidth\fR, and \fIheight\fR. .PP @@ -83,17 +83,17 @@ if it decides that it does not want the window to appear on the screen under any conditions, it calls \fBTk_UnmaintainGeometry\fR. \fBTk_UnmaintainGeometry\fR unmaps the window and cancels any previous calls to \fBTk_MaintainGeometry\fR for the -\fImaster\fR\-\fIslave\fR pair, so that the slave's +\fIcontainer\fR\-\fIwindow\fR pair, so that the window's geometry and mapped state are no longer maintained automatically. \fBTk_UnmaintainGeometry\fR need not be called by a geometry -manager if the slave, the master, or any of the master's ancestors +manager if the window, the container, or any of the container's ancestors is destroyed: Tk will call it automatically. .PP If \fBTk_MaintainGeometry\fR is called repeatedly for the same -\fImaster\fR\-\fIslave\fR pair, the information from the most +\fIcontainer\fR\-\fIwindow\fR pair, the information from the most recent call supersedes any older information. -If \fBTk_UnmaintainGeometry\fR is called for a \fImaster\fR\-\fIslave\fR +If \fBTk_UnmaintainGeometry\fR is called for a \fIcontainer\fR\-\fIwindow\fR pair that is is not currently managed, the call has no effect. .SH KEYWORDS -geometry manager, map, master, parent, position, slave, unmap +geometry manager, map, container, parent, position, window, unmap @@ -275,9 +275,8 @@ Removes each of the \fIwindow\fRs from grid for its container and unmaps their windows. The content will no longer be managed by the grid geometry manager. However, the configuration options for that window are remembered, -so that if the -slave is managed once more by the grid geometry manager, the previous -values are retained. +so that if the content window is managed once more by the grid +geometry manager, the previous values are retained. .TP \fBgrid size \fIcontainer\fR . diff --git a/generic/tk.decls b/generic/tk.decls index 3e64878..1a26d27 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -472,7 +472,7 @@ declare 116 { Tk_Window Tk_IdToWindow(Display *display, Window window) } declare 117 { - void Tk_ImageChanged(Tk_ImageMaster master, int x, int y, + void Tk_ImageChanged(Tk_ImageMaster model, int x, int y, int width, int height, int imageWidth, int imageHeight) } declare 118 { @@ -486,8 +486,8 @@ declare 120 { int width, int height) } declare 121 { - void Tk_MaintainGeometry(Tk_Window slave, - Tk_Window master, 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 { CONST84_RETURN char *Tk_NameOfFont(Tk_Font font) } declare 137 { - CONST84_RETURN char *Tk_NameOfImage(Tk_ImageMaster imageMaster) + CONST84_RETURN char *Tk_NameOfImage(Tk_ImageMaster model) } declare 138 { CONST84_RETURN 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 f73546f..4047b0f 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -85,7 +85,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); @@ -141,7 +141,7 @@ Tk_ItemType tkWindowType = { static const Tk_GeomMgr canvasGeomType = { "canvas", /* name */ WinItemRequestProc, /* requestProc */ - WinItemLostSlaveProc, /* lostSlaveProc */ + WinItemLostContentProc, /* lostSlaveProc */ }; /* @@ -1053,26 +1053,26 @@ 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. * *-------------------------------------------------------------- */ /* ARGSUSED */ static void -WinItemLostSlaveProc( - ClientData clientData, /* WindowItem structure for slave window that +WinItemLostContentProc( + ClientData clientData, /* WindowItem structure for content window that * was stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + Tk_Window tkwin) /* Tk's handle for the content window. */ { WindowItem *winItemPtr = clientData; Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas); diff --git a/generic/tkDecls.h b/generic/tkDecls.h index b02f286..38114c0 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -402,7 +402,7 @@ EXTERN void Tk_HandleEvent(XEvent *eventPtr); /* 116 */ EXTERN Tk_Window Tk_IdToWindow(Display *display, Window window); /* 117 */ -EXTERN void Tk_ImageChanged(Tk_ImageMaster master, int x, int y, +EXTERN void Tk_ImageChanged(Tk_ImageMaster model, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 118 */ @@ -413,8 +413,8 @@ 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 master, int x, int y, int width, +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); @@ -453,7 +453,7 @@ EXTERN CONST84_RETURN char * Tk_NameOfCursor(Display *display, /* 136 */ EXTERN CONST84_RETURN char * Tk_NameOfFont(Tk_Font font); /* 137 */ -EXTERN CONST84_RETURN char * Tk_NameOfImage(Tk_ImageMaster imageMaster); +EXTERN CONST84_RETURN char * Tk_NameOfImage(Tk_ImageMaster model); /* 138 */ EXTERN CONST84_RETURN char * Tk_NameOfJoinStyle(int join); /* 139 */ @@ -582,8 +582,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 */ @@ -993,11 +993,11 @@ typedef struct TkStubs { int (*tk_Grab) (Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal); /* 114 */ void (*tk_HandleEvent) (XEvent *eventPtr); /* 115 */ Tk_Window (*tk_IdToWindow) (Display *display, Window window); /* 116 */ - void (*tk_ImageChanged) (Tk_ImageMaster master, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */ + void (*tk_ImageChanged) (Tk_ImageMaster model, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 117 */ 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 master, 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 */ @@ -1013,7 +1013,7 @@ typedef struct TkStubs { CONST84_RETURN char * (*tk_NameOfColor) (XColor *colorPtr); /* 134 */ CONST84_RETURN char * (*tk_NameOfCursor) (Display *display, Tk_Cursor cursor); /* 135 */ CONST84_RETURN char * (*tk_NameOfFont) (Tk_Font font); /* 136 */ - CONST84_RETURN char * (*tk_NameOfImage) (Tk_ImageMaster imageMaster); /* 137 */ + CONST84_RETURN char * (*tk_NameOfImage) (Tk_ImageMaster model); /* 137 */ CONST84_RETURN char * (*tk_NameOfJoinStyle) (int join); /* 138 */ CONST84_RETURN char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */ CONST84_RETURN char * (*tk_NameOfRelief) (int relief); /* 140 */ @@ -1057,7 +1057,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/tkFrame.c b/generic/tkFrame.c index ce7dc8c..1112f81 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -314,7 +314,7 @@ static void DisplayFrame(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); @@ -346,7 +346,7 @@ static const Tk_ClassProcs frameClass = { static const Tk_GeomMgr frameGeomType = { "labelframe", /* name */ FrameRequestProc, /* requestProc */ - FrameLostSlaveProc /* lostSlaveProc */ + FrameLostContentProc /* lostSlaveProc */ }; /* @@ -1914,25 +1914,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 that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the slave window. */ + Tk_Window tkwin) /* Tk's handle for the content window. */ { Frame *framePtr = clientData; Labelframe *labelframePtr = clientData; diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index a8c3f2b..b70e66a 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -15,11 +15,11 @@ /* * 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 { +typedef struct MaintainContent { Tk_Window slave; /* The slave window being positioned. */ Tk_Window master; /* The master that determines slave's * position; it must be a descendant of @@ -27,17 +27,17 @@ typedef struct MaintainSlave { int x, y; /* Desired position of slave relative to * master. */ int width, height; /* Desired dimensions of slave. */ - struct MaintainSlave *nextPtr; + struct MaintainContent *nextPtr; /* Next in list of Maintains associated with * master. */ -} MaintainSlave; +} 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 *slavePtr; /* 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); /* @@ -418,8 +418,8 @@ Tk_MaintainGeometry( int width, int height) /* Desired dimensions for slave. */ { Tcl_HashEntry *hPtr; - MaintainMaster *masterPtr; - MaintainSlave *slavePtr; + MaintainContainer *masterPtr; + MaintainContent *slavePtr; int isNew, map; Tk_Window ancestor, parent; TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr; @@ -455,7 +455,7 @@ Tk_MaintainGeometry( } /* - * See if there is already a MaintainMaster structure for the master; if + * See if there is already a MaintainContainer structure for the master; if * not, then create one. */ @@ -465,7 +465,7 @@ Tk_MaintainGeometry( if (!isNew) { masterPtr = Tcl_GetHashValue(hPtr); } else { - masterPtr = ckalloc(sizeof(MaintainMaster)); + masterPtr = ckalloc(sizeof(MaintainContainer)); masterPtr->ancestor = master; masterPtr->checkScheduled = 0; masterPtr->slavePtr = NULL; @@ -473,7 +473,7 @@ Tk_MaintainGeometry( } /* - * Create a MaintainSlave structure for the slave if there isn't already + * Create a MaintainContent structure for the slave if there isn't already * one. */ @@ -483,12 +483,12 @@ Tk_MaintainGeometry( goto gotSlave; } } - slavePtr = ckalloc(sizeof(MaintainSlave)); + slavePtr = ckalloc(sizeof(MaintainContent)); slavePtr->slave = slave; slavePtr->master = master; slavePtr->nextPtr = masterPtr->slavePtr; masterPtr->slavePtr = slavePtr; - Tk_CreateEventHandler(slave, StructureNotifyMask, MaintainSlaveProc, + Tk_CreateEventHandler(slave, StructureNotifyMask, MaintainContentProc, slavePtr); /* @@ -502,7 +502,7 @@ Tk_MaintainGeometry( ancestor = Tk_Parent(ancestor)) { if (ancestor == masterPtr->ancestor) { Tk_CreateEventHandler(ancestor, StructureNotifyMask, - MaintainMasterProc, masterPtr); + MaintainContainerProc, masterPtr); masterPtr->ancestor = Tk_Parent(ancestor); } } @@ -567,8 +567,8 @@ Tk_UnmaintainGeometry( * slave's parent. */ { Tcl_HashEntry *hPtr; - MaintainMaster *masterPtr; - MaintainSlave *slavePtr, *prevPtr; + MaintainContainer *masterPtr; + MaintainContent *slavePtr, *prevPtr; Tk_Window ancestor; TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr; @@ -613,13 +613,13 @@ Tk_UnmaintainGeometry( } } Tk_DeleteEventHandler(slavePtr->slave, StructureNotifyMask, - MaintainSlaveProc, slavePtr); + MaintainContentProc, slavePtr); ckfree(slavePtr); if (masterPtr->slavePtr == NULL) { if (masterPtr->ancestor != NULL) { for (ancestor = master; ; ancestor = Tk_Parent(ancestor)) { Tk_DeleteEventHandler(ancestor, StructureNotifyMask, - MaintainMasterProc, masterPtr); + MaintainContainerProc, masterPtr); if (ancestor == masterPtr->ancestor) { break; } @@ -636,7 +636,7 @@ 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 @@ -655,13 +655,13 @@ Tk_UnmaintainGeometry( */ static void -MaintainMasterProc( - ClientData clientData, /* Pointer to MaintainMaster structure for the +MaintainContainerProc( + ClientData clientData, /* Pointer to MaintainContainer structure for the * master window. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainMaster *masterPtr = clientData; - MaintainSlave *slavePtr; + MaintainContainer *masterPtr = clientData; + MaintainContent *slavePtr; int done; if ((eventPtr->type == ConfigureNotify) @@ -692,7 +692,7 @@ MaintainMasterProc( /* *---------------------------------------------------------------------- * - * MaintainSlaveProc -- + * MaintainContentProc -- * * This procedure is invoked by the Tk event dispatcher in response to * StructureNotify events on a slave being managed by @@ -709,12 +709,12 @@ MaintainMasterProc( */ static void -MaintainSlaveProc( - ClientData clientData, /* Pointer to MaintainSlave structure for +MaintainContentProc( + ClientData clientData, /* Pointer to MaintainContent structure for * master-slave pair. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainSlave *slavePtr = clientData; + MaintainContent *slavePtr = clientData; if (eventPtr->type == DestroyNotify) { Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master); @@ -743,11 +743,11 @@ MaintainSlaveProc( static void MaintainCheckProc( - ClientData clientData) /* Pointer to MaintainMaster structure for the + ClientData clientData) /* Pointer to MaintainContainer structure for the * master window. */ { - MaintainMaster *masterPtr = clientData; - MaintainSlave *slavePtr; + MaintainContainer *masterPtr = clientData; + MaintainContent *slavePtr; Tk_Window ancestor, parent; int x, y, map; diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index a8e5b5e..a40ee7f 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -59,8 +59,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: @@ -77,25 +77,25 @@ void TkImgPhotoConfigureInstance( PhotoInstance *instancePtr) /* Instance to reconfigure. */ { - PhotoModel *masterPtr = instancePtr->masterPtr; + PhotoModel *modelPtr = instancePtr->masterPtr; XImage *imagePtr; int bitsPerPixel; ColorTable *colorTablePtr; 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 ((masterPtr->palette && masterPtr->palette[0]) - && IsValidPalette(instancePtr, masterPtr->palette)) { - instancePtr->palette = masterPtr->palette; + if ((modelPtr->palette && modelPtr->palette[0]) + && IsValidPalette(instancePtr, modelPtr->palette)) { + instancePtr->palette = modelPtr->palette; } else { instancePtr->palette = instancePtr->defaultPalette; } - instancePtr->gamma = masterPtr->gamma; + instancePtr->gamma = modelPtr->gamma; /* * If we don't currently have a color table, or if the one we have no @@ -159,15 +159,15 @@ 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. */ if ((instancePtr->pixels == None) || (instancePtr->error == NULL) - || (instancePtr->width != masterPtr->width) - || (instancePtr->height != masterPtr->height)) { + || (instancePtr->width != modelPtr->width) + || (instancePtr->height != modelPtr->height)) { TkImgPhotoInstanceSetSize(instancePtr); } @@ -175,9 +175,9 @@ TkImgPhotoConfigureInstance( * Redither this instance if necessary. */ - if ((masterPtr->flags & IMAGE_CHANGED) + if ((modelPtr->flags & IMAGE_CHANGED) || (instancePtr->colorTablePtr != colorTablePtr)) { - TkClipBox(masterPtr->validRegion, &validBox); + TkClipBox(modelPtr->validRegion, &validBox); if ((validBox.width > 0) && (validBox.height > 0)) { TkImgDitherInstance(instancePtr, validBox.x, validBox.y, validBox.width, validBox.height); @@ -207,10 +207,10 @@ ClientData TkImgPhotoGet( 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. */ { - PhotoModel *masterPtr = masterData; + PhotoModel *modelPtr = modelData; PhotoInstance *instancePtr; Colormap colormap; int mono, nRed, nGreen, nBlue, numVisuals; @@ -247,7 +247,7 @@ TkImgPhotoGet( */ colormap = Tk_Colormap(tkwin); - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { if ((colormap == instancePtr->colormap) && (Tk_Display(tkwin) == instancePtr->display)) { @@ -277,7 +277,7 @@ TkImgPhotoGet( */ instancePtr = ckalloc(sizeof(PhotoInstance)); - instancePtr->masterPtr = masterPtr; + instancePtr->masterPtr = modelPtr; instancePtr->display = Tk_Display(tkwin); instancePtr->colormap = Tk_Colormap(tkwin); Tk_PreserveColormap(instancePtr->display, instancePtr->colormap); @@ -288,8 +288,8 @@ TkImgPhotoGet( instancePtr->width = 0; instancePtr->height = 0; instancePtr->imagePtr = 0; - instancePtr->nextPtr = masterPtr->instancePtr; - masterPtr->instancePtr = instancePtr; + instancePtr->nextPtr = modelPtr->instancePtr; + modelPtr->instancePtr = instancePtr; /* * Obtain information about the visual and decide on the default palette. @@ -349,8 +349,8 @@ TkImgPhotoGet( * Make a GC with background = black and foreground = white. */ - white = Tk_GetColor(masterPtr->interp, tkwin, "white"); - black = Tk_GetColor(masterPtr->interp, tkwin, "black"); + white = Tk_GetColor(modelPtr->interp, tkwin, "white"); + black = Tk_GetColor(modelPtr->interp, tkwin, "black"); gcValues.foreground = (white != NULL)? white->pixel: WhitePixelOfScreen(Tk_Screen(tkwin)); gcValues.background = (black != NULL)? black->pixel: @@ -373,8 +373,8 @@ TkImgPhotoGet( */ if (instancePtr->nextPtr == NULL) { - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, - masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, + modelPtr->width, modelPtr->height); } return instancePtr; @@ -434,7 +434,7 @@ BlendComplexAlpha( { int x, y, line; unsigned long pixel; - unsigned char r, g, b, alpha, unalpha, *masterPtr; + unsigned char r, g, b, alpha, unalpha, *modelPtr; unsigned char *alphaAr = iPtr->masterPtr->pix32; /* @@ -494,8 +494,8 @@ BlendComplexAlpha( for (y = 0; y < height; y++) { line = (y + yOffset) * iPtr->masterPtr->width; for (x = 0; x < width; x++) { - masterPtr = alphaAr + ((line + x + xOffset) * 4); - alpha = masterPtr[3]; + modelPtr = alphaAr + ((line + x + xOffset) * 4); + alpha = modelPtr[3]; /* * Ignore pixels that are fully transparent @@ -507,9 +507,9 @@ BlendComplexAlpha( * 24 and 32 bit displays, but this seems "fast enough". */ - r = masterPtr[0]; - g = masterPtr[1]; - b = masterPtr[2]; + r = modelPtr[0]; + g = modelPtr[1]; + b = modelPtr[2]; if (alpha != 255) { /* * Only blend pixels that have some transparency @@ -537,8 +537,8 @@ BlendComplexAlpha( for (y = 0; y < height; y++) { line = (y + yOffset) * iPtr->masterPtr->width; for (x = 0; x < width; x++) { - masterPtr = alphaAr + ((line + x + xOffset) * 4); - alpha = masterPtr[3]; + modelPtr = alphaAr + ((line + x + xOffset) * 4); + alpha = modelPtr[3]; /* * Ignore pixels that are fully transparent @@ -550,9 +550,9 @@ BlendComplexAlpha( * and 32 bit displays, but this seems "fast enough". */ - r = masterPtr[0]; - g = masterPtr[1]; - b = masterPtr[2]; + r = modelPtr[0]; + g = modelPtr[1]; + b = modelPtr[2]; if (alpha != 255) { /* * Only blend pixels that have some transparency @@ -679,7 +679,7 @@ TkImgPhotoDisplay( Tk_DeleteErrorHandler(handler); } else { /* - * masterPtr->region describes which parts of the image contain valid + * modelPtr->region describes which parts of the image contain valid * data. We set this region as the clip mask for the gc, setting its * origin appropriately, and use it when drawing the image. */ @@ -768,23 +768,23 @@ void TkImgPhotoInstanceSetSize( PhotoInstance *instancePtr) /* Instance whose size is to be changed. */ { - PhotoModel *masterPtr; + PhotoModel *modelPtr; schar *newError, *errSrcPtr, *errDestPtr; int h, offset; XRectangle validBox; Pixmap newPixmap; - masterPtr = instancePtr->masterPtr; - TkClipBox(masterPtr->validRegion, &validBox); + modelPtr = instancePtr->masterPtr; + TkClipBox(modelPtr->validRegion, &validBox); - if ((instancePtr->width != masterPtr->width) - || (instancePtr->height != masterPtr->height) + if ((instancePtr->width != modelPtr->width) + || (instancePtr->height != modelPtr->height) || (instancePtr->pixels == None)) { newPixmap = Tk_GetPixmap(instancePtr->display, RootWindow(instancePtr->display, instancePtr->visualInfo.screen), - (masterPtr->width > 0) ? masterPtr->width: 1, - (masterPtr->height > 0) ? masterPtr->height: 1, + (modelPtr->width > 0) ? modelPtr->width: 1, + (modelPtr->height > 0) ? modelPtr->height: 1, instancePtr->visualInfo.depth); if (!newPixmap) { Tcl_Panic("Fail to create pixmap with Tk_GetPixmap in TkImgPhotoInstanceSetSize"); @@ -814,17 +814,17 @@ TkImgPhotoInstanceSetSize( instancePtr->pixels = newPixmap; } - if ((instancePtr->width != masterPtr->width) - || (instancePtr->height != masterPtr->height) + if ((instancePtr->width != modelPtr->width) + || (instancePtr->height != modelPtr->height) || (instancePtr->error == NULL)) { - if (masterPtr->height > 0 && masterPtr->width > 0) { + if (modelPtr->height > 0 && modelPtr->width > 0) { /* * TODO: use attemptckalloc() here once there is a strategy that * will allow us to recover from failure. Right now, there's no * such possibility. */ - newError = ckalloc(masterPtr->height * masterPtr->width + newError = ckalloc(modelPtr->height * modelPtr->width * 3 * sizeof(schar)); /* @@ -833,21 +833,21 @@ TkImgPhotoInstanceSetSize( */ if ((instancePtr->error != NULL) - && ((instancePtr->width == masterPtr->width) - || (validBox.width == masterPtr->width))) { + && ((instancePtr->width == modelPtr->width) + || (validBox.width == modelPtr->width))) { if (validBox.y > 0) { memset(newError, 0, (size_t) - validBox.y * masterPtr->width * 3 * sizeof(schar)); + validBox.y * modelPtr->width * 3 * sizeof(schar)); } h = validBox.y + validBox.height; - if (h < masterPtr->height) { - memset(newError + h*masterPtr->width*3, 0, - (size_t) (masterPtr->height - h) - * masterPtr->width * 3 * sizeof(schar)); + if (h < modelPtr->height) { + memset(newError + h*modelPtr->width*3, 0, + (size_t) (modelPtr->height - h) + * modelPtr->width * 3 * sizeof(schar)); } } else { memset(newError, 0, (size_t) - masterPtr->height * masterPtr->width *3*sizeof(schar)); + modelPtr->height * modelPtr->width *3*sizeof(schar)); } } else { newError = NULL; @@ -859,22 +859,22 @@ TkImgPhotoInstanceSetSize( * array. */ - if (masterPtr->width == instancePtr->width) { - offset = validBox.y * masterPtr->width * 3; + if (modelPtr->width == instancePtr->width) { + offset = validBox.y * modelPtr->width * 3; memcpy(newError + offset, instancePtr->error + offset, (size_t) (validBox.height - * masterPtr->width * 3 * sizeof(schar))); + * modelPtr->width * 3 * sizeof(schar))); } else if (validBox.width > 0 && validBox.height > 0) { errDestPtr = newError + - (validBox.y * masterPtr->width + validBox.x) * 3; + (validBox.y * modelPtr->width + validBox.x) * 3; errSrcPtr = instancePtr->error + (validBox.y * instancePtr->width + validBox.x) * 3; for (h = validBox.height; h > 0; --h) { memcpy(errDestPtr, errSrcPtr, validBox.width * 3 * sizeof(schar)); - errDestPtr += masterPtr->width * 3; + errDestPtr += modelPtr->width * 3; errSrcPtr += instancePtr->width * 3; } } @@ -884,8 +884,8 @@ TkImgPhotoInstanceSetSize( instancePtr->error = newError; } - instancePtr->width = masterPtr->width; - instancePtr->height = masterPtr->height; + instancePtr->width = modelPtr->width; + instancePtr->height = modelPtr->height; } /* @@ -1617,7 +1617,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. @@ -1635,7 +1635,7 @@ TkImgDitherInstance( * block to be dithered. */ int width, int height) /* Dimensions of the block to be dithered. */ { - PhotoModel *masterPtr = instancePtr->masterPtr; + PhotoModel *modelPtr = instancePtr->masterPtr; ColorTable *colorPtr = instancePtr->colorTablePtr; XImage *imagePtr; int nLines, bigEndian, i, c, x, y, xEnd, doDithering = 1; @@ -1693,8 +1693,8 @@ TkImgDitherInstance( bigEndian = imagePtr->bitmap_bit_order == MSBFirst; firstBit = bigEndian? (1 << (imagePtr->bitmap_unit - 1)): 1; - lineLength = masterPtr->width * 3; - srcLinePtr = masterPtr->pix32 + (yStart * masterPtr->width + xStart) * 4; + lineLength = modelPtr->width * 3; + srcLinePtr = modelPtr->pix32 + (yStart * modelPtr->width + xStart) * 4; errLinePtr = instancePtr->error + yStart * lineLength + xStart * 3; xEnd = xStart + width; @@ -1749,7 +1749,7 @@ TkImgDitherInstance( c += errPtr[-lineLength-3]; } c += errPtr[-lineLength] * 5; - if ((x + 1) < masterPtr->width) { + if ((x + 1) < modelPtr->width) { c += errPtr[-lineLength+3] * 3; } } @@ -1820,7 +1820,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. */ @@ -1832,13 +1832,13 @@ TkImgDitherInstance( c += errPtr[-lineLength-1]; } c += errPtr[-lineLength] * 5; - if (x + 1 < masterPtr->width) { + if (x + 1 < modelPtr->width) { c += errPtr[-lineLength+1] * 3; } } c = ((c + 2056) >> 4) - 128; - if (masterPtr->flags & COLOR_IMAGE) { + if (modelPtr->flags & COLOR_IMAGE) { c += (unsigned) (srcPtr[0] * 11 + srcPtr[1] * 16 + srcPtr[2] * 5 + 16) >> 5; } else { @@ -1905,13 +1905,13 @@ TkImgDitherInstance( c += errPtr[-lineLength-1]; } c += errPtr[-lineLength] * 5; - if (x + 1 < masterPtr->width) { + if (x + 1 < modelPtr->width) { c += errPtr[-lineLength+1] * 3; } } c = ((c + 2056) >> 4) - 128; - if (masterPtr->flags & COLOR_IMAGE) { + if (modelPtr->flags & COLOR_IMAGE) { c += (unsigned)(srcPtr[0] * 11 + srcPtr[1] * 16 + srcPtr[2] * 5 + 16) >> 5; } else { @@ -1934,7 +1934,7 @@ TkImgDitherInstance( } *destLongPtr = word; } - srcLinePtr += masterPtr->width * 4; + srcLinePtr += modelPtr->width * 4; errLinePtr += lineLength; dstLinePtr += bytesPerLine; } diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 765b8a2..afbf7b0 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -339,7 +339,7 @@ ImgPhotoCreate( PhotoModel *modelPtr; /* - * Allocate and initialize the photo image master record. + * Allocate and initialize the photo image model record. */ modelPtr = ckalloc(sizeof(PhotoModel)); @@ -386,7 +386,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. */ @@ -2083,7 +2083,7 @@ ImgPhotoConfigureModel( * None. * * Side effects: - * (Re)sets COMPLEX_ALPHA flag of master. + * (Re)sets COMPLEX_ALPHA flag of model. * *---------------------------------------------------------------------- */ @@ -2121,7 +2121,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: @@ -2135,10 +2135,10 @@ ToggleComplexAlphaIfNeeded( static void ImgPhotoDelete( - ClientData masterData) /* Pointer to PhotoModel structure for image. + ClientData modelData) /* Pointer to PhotoModel structure for image. * Must not have any more instances. */ { - PhotoModel *modelPtr = masterData; + PhotoModel *modelPtr = modelData; PhotoInstance *instancePtr; while ((instancePtr = modelPtr->instancePtr) != NULL) { @@ -2212,7 +2212,7 @@ 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. * *---------------------------------------------------------------------- */ @@ -3486,7 +3486,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. @@ -3501,7 +3501,7 @@ 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. */ diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h index 9cd4195..994fa40 100644 --- a/generic/tkImgPhoto.h +++ b/generic/tkImgPhoto.h @@ -138,7 +138,7 @@ 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 PhotoMaster { @@ -165,7 +165,7 @@ struct PhotoMaster { 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. */ }; /* @@ -196,17 +196,17 @@ struct PhotoMaster { */ struct PhotoInstance { - PhotoMaster *masterPtr; /* Pointer to master for image. */ + PhotoMaster *masterPtr; /* Pointer to model for image. */ Display *display; /* Display for windows using this instance. */ 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. */ int refCount; /* Number of instances using this structure. */ 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/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index 931c037..b8b3477 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -88,9 +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 = recordPtr; + Frame *framePtr = (Frame *)recordPtr; Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr)); return 0; } @@ -111,7 +114,7 @@ static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr) static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Frame *framePtr = recordPtr; + Frame *framePtr = (Frame *)recordPtr; int width, height; /* @@ -337,9 +340,12 @@ 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 = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; WidgetCore *corePtr = &lframePtr->core; Ttk_Padding margins; LabelframeStyle style; @@ -384,7 +390,7 @@ static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr) static Ttk_Layout LabelframeGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Labelframe *lf = recordPtr; + Labelframe *lf = (Labelframe *)recordPtr; Ttk_Layout frameLayout = TtkWidgetGetLayout(interp, theme, recordPtr); Ttk_Layout labelLayout; @@ -415,7 +421,7 @@ static Ttk_Layout LabelframeGetLayout( static void LabelframeDoLayout(void *recordPtr) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; WidgetCore *corePtr = &lframePtr->core; int lw, lh; /* Label width and height */ LabelframeStyle style; @@ -461,7 +467,7 @@ static void LabelframeDoLayout(void *recordPtr) static void LabelframeDisplay(void *recordPtr, Drawable d) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; Ttk_DrawLayout(lframePtr->core.layout, lframePtr->core.state, d); if (lframePtr->label.labelLayout) { Ttk_DrawLayout(lframePtr->label.labelLayout, lframePtr->core.state, d); @@ -476,22 +482,22 @@ static void LabelframeDisplay(void *recordPtr, Drawable d) */ static void LabelframePlaceContent(void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; if (Ttk_NumberContent(lframe->label.mgr) == 1) { 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, - int index, - int width, - int height) + TCL_UNUSED(void *), + TCL_UNUSED(int), + TCL_UNUSED(int), + TCL_UNUSED(int)) { return 1; } @@ -501,13 +507,14 @@ static int LabelRequest( * * <<NOTE-LABELREMOVED>>: * This routine is also called when the widget voluntarily forgets - * the slave in LabelframeConfigure. + * the window in LabelframeConfigure. */ static void LabelRemoved( void *managerData, TCL_UNUSED(int)) { - Labelframe *lframe = managerData; + Labelframe *lframe = (Labelframe *)managerData; + lframe->label.labelWidget = 0; } @@ -522,9 +529,11 @@ static Ttk_ManagerSpec LabelframeManagerSpec = { /* LabelframeInitialize -- * Initialization hook. */ -static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) +static void LabelframeInitialize( + TCL_UNUSED(Tcl_Interp *), + void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; lframe->label.mgr = Ttk_CreateManager( &LabelframeManagerSpec, lframe, lframe->core.tkwin); @@ -538,7 +547,7 @@ static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) */ static void LabelframeCleanup(void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; Ttk_DeleteManager(lframe->label.mgr); if (lframe->label.labelLayout) { Ttk_FreeLayout(lframe->label.labelLayout); @@ -569,7 +578,7 @@ static void RaiseLabelWidget(Labelframe *lframe) */ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; Tk_Window labelWidget = lframePtr->label.labelWidget; Ttk_PositionSpec unused; diff --git a/generic/ttk/ttkGenStubs.tcl b/generic/ttk/ttkGenStubs.tcl index 8047e3f..6aabd61 100644 --- a/generic/ttk/ttkGenStubs.tcl +++ b/generic/ttk/ttkGenStubs.tcl @@ -284,18 +284,26 @@ proc genStubs::rewriteFile {file text} { # Results: # Returns the original text inside an appropriate #ifdef. -proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} { +proc genStubs::addPlatformGuard {plat iftxt {eltxt {}} {withCygwin 0}} { set text "" switch $plat { win { - append text "#ifdef _WIN32 /* WIN */\n${iftxt}" + append text "#if defined(_WIN32)" + if {$withCygwin} { + append text " || defined(__CYGWIN__)" + } + append text " /* WIN */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* WIN */\n${eltxt}" } append text "#endif /* WIN */\n" } unix { - append text "#if !defined(_WIN32) && !defined(MAC_OSX_TCL)\ + append text "#if !defined(_WIN32)" + if {$withCygwin} { + append text " && !defined(__CYGWIN__)" + } + append text " && !defined(MAC_OSX_TCL)\ /* UNIX */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* UNIX */\n${eltxt}" @@ -317,7 +325,11 @@ proc genStubs::addPlatformGuard {plat iftxt {eltxt {}}} { append text "#endif /* AQUA */\n" } x11 { - append text "#if !(defined(_WIN32) || defined(MAC_OSX_TK))\ + append text "#if !(defined(_WIN32)" + if {$withCygwin} { + append text " || defined(__CYGWIN__)" + } + append text " || defined(MAC_OSX_TK))\ /* X11 */\n${iftxt}" if {$eltxt ne ""} { append text "#else /* X11 */\n${eltxt}" @@ -450,12 +462,23 @@ proc genStubs::parseArg {arg} { proc genStubs::makeDecl {name decl index} { variable scspec + variable stubs + variable libraryName lassign $decl rtype fname args append text "/* $index */\n" - set line "$scspec $rtype" + if {[info exists stubs($name,deprecated,$index)]} { + append text "[string toupper $libraryName]_DEPRECATED(\"$stubs($name,deprecated,$index)\")\n" + set line "$rtype" + } elseif {[string range $rtype end-5 end] eq "MP_WUR"} { + set line "$scspec [string trim [string range $rtype 0 end-6]]" + } else { + set line "$scspec $rtype" + } set count [expr {2 - ([string length $line] / 8)}] - append line [string range "\t\t\t" 0 $count] + if {$count >= 0} { + append line [string range "\t\t\t" 0 $count] + } set pad [expr {24 - [string length $line]}] if {$pad <= 0} { append line " " @@ -494,6 +517,9 @@ proc genStubs::makeDecl {name decl index} { set sep ", " } append line ", ...)" + if {[lindex $args end] eq "{const char *} format"} { + append line " TCL_FORMAT_PRINTF(" [expr {[llength $args] - 1}] ", " [llength $args] ")" + } } default { set sep "(" @@ -517,6 +543,9 @@ proc genStubs::makeDecl {name decl index} { append line ")" } } + if {[string range $rtype end-5 end] eq "MP_WUR"} { + append line " MP_WUR" + } return "$text$line;\n" } @@ -561,17 +590,27 @@ proc genStubs::makeMacro {name decl index} { proc genStubs::makeSlot {name decl index} { lassign $decl rtype fname args + variable stubs set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] set text " " + if {[info exists stubs($name,deprecated,$index)]} { + append text "TCL_DEPRECATED_API(\"$stubs($name,deprecated,$index)\") " + } elseif {[info exists stubs($name,nostub,$index)]} { + append text "TCL_DEPRECATED_API(\"$stubs($name,nostub,$index)\") " + } if {$args eq ""} { append text $rtype " *" $lfname "; /* $index */\n" return $text } if {[string range $rtype end-8 end] eq "__stdcall"} { append text [string trim [string range $rtype 0 end-9]] " (__stdcall *" $lfname ") " + } elseif {[string range $rtype 0 11] eq "TCL_NORETURN"} { + append text "TCL_NORETURN1 " [string trim [string range $rtype 12 end]] " (*" $lfname ") " + } elseif {[string range $rtype end-5 end] eq "MP_WUR"} { + append text [string trim [string range $rtype 0 end-6]] " (*" $lfname ") " } else { append text $rtype " (*" $lfname ") " } @@ -591,6 +630,9 @@ proc genStubs::makeSlot {name decl index} { set sep ", " } append text ", ...)" + if {[lindex $args end] eq "{const char *} format"} { + append text " TCL_FORMAT_PRINTF(" [expr {[llength $args] - 1}] ", " [llength $args] ")" + } } default { set sep "(" @@ -606,6 +648,9 @@ proc genStubs::makeSlot {name decl index} { } } + if {[string range $rtype end-5 end] eq "MP_WUR"} { + append text " MP_WUR" + } append text "; /* $index */\n" return $text } @@ -837,7 +882,7 @@ proc genStubs::emitInit {name textVar} { } foreach intf [array names interfaces] { if {[info exists hooks($intf)]} { - if {[lsearch -exact $hooks($intf) $name] >= 0} { + if {$name in $hooks($intf)} { set root 0 break } diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index 8fa7860..42f1812 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -11,7 +11,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. @@ -19,7 +19,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). @@ -36,23 +36,23 @@ * (3) Content window is destroyed * * In case (1), Tk calls the manager's lostSlaveProc. - * Case (2) is performed by calling Tk_ManageGeometry(slave,NULL,0); - * in this case Tk does _not_ call the LostSlaveProc (documented behavior). + * Case (2) is performed by calling Tk_ManageGeometry(window,NULL,0); + * in this case Tk does _not_ call the lostSlaveProc (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 */ @@ -60,7 +60,7 @@ struct TtkManager_ { Ttk_ManagerSpec *managerSpec; void *managerData; - Tk_Window containerWindow; + Tk_Window window; unsigned flags; int nContent; Ttk_Content **content; @@ -96,14 +96,14 @@ static void RecomputeSize(Ttk_Manager *mgr) int width = 1, height = 1; if (mgr->managerSpec->RequestedSize(mgr->managerData, &width, &height)) { - Tk_GeometryRequest(mgr->containerWindow, width, height); + Tk_GeometryRequest(mgr->window, width, height); ScheduleUpdate(mgr, MGR_RELAYOUT_REQUIRED); } mgr->flags &= ~MGR_RESIZE_REQUIRED; } /* ++ RecomputeLayout -- - * Recompute geometry of all slaves. + * Recompute geometry of all content windows. */ static void RecomputeLayout(Ttk_Manager *mgr) { @@ -136,8 +136,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) @@ -152,45 +152,44 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) break; case MapNotify: for (i = 0; i < mgr->nContent; ++i) { - Ttk_Content *slave = mgr->content[i]; - if (slave->flags & CONTENT_MAPPED) { - Tk_MapWindow(slave->contentWindow); + Ttk_Content *content = mgr->content[i]; + if (content->flags & CONTENT_MAPPED) { + Tk_MapWindow(content->window); } } break; case UnmapNotify: for (i = 0; i < mgr->nContent; ++i) { - Ttk_Content *slave = mgr->content[i]; - Tk_UnmapWindow(slave->contentWindow); + Ttk_Content *content = mgr->content[i]; + Tk_UnmapWindow(content->window); } break; } } -/* ++ LostContentEventHandler -- - * Notifies manager when a slave is destroyed +/* ++ ContentLostEventHandler -- + * Notifies manager when a content window is destroyed * (see <<NOTE-LOSTCONTENT>>). */ -static const unsigned SlaveEventMask = StructureNotifyMask; -static void LostContentEventHandler(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.lostSlaveProc( - slave->manager, slave->contentWindow); + content->manager->managerSpec->tkGeomMgr.lostSlaveProc( + 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; @@ -198,7 +197,7 @@ static Ttk_Content *NewContent( return content; } -static void DeleteSlave(Ttk_Content *content) +static void DeleteContent(Ttk_Content *content) { ckfree(content); } @@ -208,19 +207,19 @@ static void DeleteSlave(Ttk_Content *content) */ Ttk_Manager *Ttk_CreateManager( - Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window containerWindow) + Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)ckalloc(sizeof(*mgr)); mgr->managerSpec = managerSpec; mgr->managerData = managerData; - mgr->containerWindow = containerWindow; + mgr->window = window; mgr->nContent = 0; mgr->content = NULL; mgr->flags = 0; Tk_CreateEventHandler( - mgr->containerWindow, ManagerEventMask, ManagerEventHandler, mgr); + mgr->window, ManagerEventMask, ManagerEventHandler, mgr); return mgr; } @@ -228,7 +227,7 @@ Ttk_Manager *Ttk_CreateManager( void Ttk_DeleteManager(Ttk_Manager *mgr) { Tk_DeleteEventHandler( - mgr->containerWindow, ManagerEventMask, ManagerEventHandler, mgr); + mgr->window, ManagerEventMask, ManagerEventHandler, mgr); while (mgr->nContent > 0) { Ttk_ForgetContent(mgr, mgr->nContent - 1); @@ -243,7 +242,7 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) } /*------------------------------------------------------------------------ - * +++ Slave management. + * +++ Content window management. */ /* ++ InsertContent -- @@ -261,26 +260,26 @@ static void InsertContent(Ttk_Manager *mgr, Ttk_Content *content, int index) mgr->content[index] = content; - Tk_ManageGeometry(content->contentWindow, + Tk_ManageGeometry(content->window, &mgr->managerSpec->tkGeomMgr, mgr); - Tk_CreateEventHandler(content->contentWindow, - SlaveEventMask, LostContentEventHandler, content); + 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, int index) +static void RemoveContent(Ttk_Manager *mgr, int index) { - Ttk_Content *slave = mgr->content[index]; + Ttk_Content *content = mgr->content[index]; int i; /* Notify manager: @@ -297,13 +296,13 @@ static void RemoveSlave(Ttk_Manager *mgr, int index) /* Clean up: */ Tk_DeleteEventHandler( - slave->contentWindow, SlaveEventMask, LostContentEventHandler, slave); + content->window, StructureNotifyMask, ContentLostEventHandler, content); /* Note [1] */ - Tk_UnmaintainGeometry(slave->contentWindow, mgr->containerWindow); - Tk_UnmapWindow(slave->contentWindow); + Tk_UnmaintainGeometry(content->window, mgr->window); + Tk_UnmapWindow(content->window); - DeleteSlave(slave); + DeleteContent(content); ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } @@ -312,12 +311,12 @@ static void RemoveSlave(Ttk_Manager *mgr, int 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; - int index = Ttk_ContentIndex(mgr, contentWindow); - int reqWidth = Tk_ReqWidth(contentWindow); - int reqHeight= Tk_ReqHeight(contentWindow); + int index = Ttk_ContentIndex(mgr, window); + int reqWidth = Tk_ReqWidth(window); + int reqHeight= Tk_ReqHeight(window); if (mgr->managerSpec->SlaveRequest( mgr->managerData, index, reqWidth, reqHeight)) @@ -326,13 +325,13 @@ void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window contentWindow) } } -void Ttk_LostContentProc(ClientData clientData, Tk_Window contentWindow) +void Ttk_LostContentProc(ClientData clientData, Tk_Window window) { Ttk_Manager *mgr = (Ttk_Manager *)clientData; - int index = Ttk_ContentIndex(mgr, contentWindow); + int index = Ttk_ContentIndex(mgr, window); /* ASSERT: index >= 0 */ - RemoveSlave(mgr, index); + RemoveContent(mgr, index); } /*------------------------------------------------------------------------ @@ -345,8 +344,8 @@ void Ttk_LostContentProc(ClientData clientData, Tk_Window contentWindow) void Ttk_InsertContent( Ttk_Manager *mgr, int 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 -- @@ -354,9 +353,9 @@ void Ttk_InsertContent( */ void Ttk_ForgetContent(Ttk_Manager *mgr, int 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 -- @@ -369,11 +368,11 @@ void Ttk_ForgetContent(Ttk_Manager *mgr, int index) void Ttk_PlaceContent( Ttk_Manager *mgr, int index, int x, int y, int width, int height) { - Ttk_Content *slave = mgr->content[index]; - Tk_MaintainGeometry(slave->contentWindow,mgr->containerWindow,x,y,width,height); - slave->flags |= CONTENT_MAPPED; - if (Tk_IsMapped(mgr->containerWindow)) { - Tk_MapWindow(slave->contentWindow); + Ttk_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(content->window); } } @@ -382,13 +381,13 @@ void Ttk_PlaceContent( */ void Ttk_UnmapContent(Ttk_Manager *mgr, int index) { - Ttk_Content *slave = mgr->content[index]; - Tk_UnmaintainGeometry(slave->contentWindow, mgr->containerWindow); - 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 -- @@ -416,7 +415,7 @@ void *Ttk_ContentData(Ttk_Manager *mgr, int index) } Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, int index) { - return mgr->content[index]->contentWindow; + return mgr->content[index]->window; } /*------------------------------------------------------------------------ @@ -426,11 +425,11 @@ Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, int index) /* ++ Ttk_ContentIndex -- * Returns the index of specified content window, -1 if not found. */ -int Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window contentWindow) +int Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window) { int index; for (index = 0; index < mgr->nContent; ++index) - if (mgr->content[index]->contentWindow == contentWindow) + if (mgr->content[index]->window == window) return index; return -1; } @@ -467,12 +466,12 @@ int Ttk_GetContentIndexFromObj( /* Try interpreting as a slave window name; */ if ((*string == '.') && - (tkwin = Tk_NameToWindow(interp, string, mgr->containerWindow))) { + (tkwin = Tk_NameToWindow(interp, string, mgr->window))) { index = Ttk_ContentIndex(mgr, tkwin); if (index < 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s is not managed by %s", string, - Tk_PathName(mgr->containerWindow))); + Tk_PathName(mgr->window))); Tcl_SetErrorCode(interp, "TTK", "SLAVE", "MANAGER", NULL); return TCL_ERROR; } diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h index c4c46ed..d487dea 100644 --- a/generic/ttk/ttkManager.h +++ b/generic/ttk/ttkManager.h @@ -16,14 +16,14 @@ typedef struct TtkManager_ Ttk_Manager; * * RequestedSize computes the requested size of the container window. * - * PlaceSlaves sets the position and size of all managed slaves + * PlaceSlaves 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 + * SlaveRemoved() 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. + * SlaveRequest() 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 */ @@ -39,8 +39,8 @@ typedef struct { /* Manager hooks */ * Default implementations for Tk_GeomMgr hooks: */ #define Ttk_LostContentProc Ttk_LostSlaveProc -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: @@ -77,7 +77,7 @@ MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *); */ #define Ttk_ContentIndex Ttk_SlaveIndex MODULE_SCOPE int Ttk_ContentIndex(Ttk_Manager *, Tk_Window); - /* Returns: index in slave array of specified window, -1 if not found */ + /* Returns: index in content array of specified window, -1 if not found */ #define Ttk_GetContentIndexFromObj Ttk_GetSlaveIndexFromObj MODULE_SCOPE int Ttk_GetContentIndexFromObj( diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index d94b4ed..bd7c7ba 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -57,7 +57,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 content window. */ static Tk_OptionSpec TabOptionSpecs[] = { @@ -102,7 +102,7 @@ typedef struct int 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 widgets */ } NotebookPart; typedef struct @@ -191,13 +191,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; - void *record = ckalloc(sizeof(Tab)); + Tab *record = (Tab *)ckalloc(sizeof(Tab)); memset(record, 0, sizeof(Tab)); - if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) { + if (Tk_InitOptions(interp, (char *)record, optionTable, window) != TCL_OK) { ckfree(record); return NULL; } @@ -213,7 +213,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; @@ -222,7 +222,7 @@ static int ConfigureTab( int mask = 0; if (Tk_SetOptions(interp, (void *)tab, nb->notebook.paneOptionTable, - objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) + objc, objv, window, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } @@ -234,7 +234,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; @@ -262,7 +262,7 @@ static int IdentifyTab(Notebook *nb, int x, int y) { int index; for (index = 0; index < Ttk_NumberContent(nb->notebook.mgr); ++index) { - Tab *tab = Ttk_ContentData(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)) { @@ -294,7 +294,7 @@ static void ActivateTab(Notebook *nb, int index) static Ttk_State TabState(Notebook *nb, int index) { Ttk_State state = nb->core.state; - Tab *tab = Ttk_ContentData(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); int i = 0; if (index == nb->notebook.currentIndex) { @@ -307,7 +307,7 @@ static Ttk_State TabState(Notebook *nb, int index) state |= TTK_STATE_ACTIVE; } for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { - Tab *tab = Ttk_ContentData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } @@ -316,8 +316,8 @@ static Ttk_State TabState(Notebook *nb, int index) } break; } - for (i = Ttk_NumberContent(nb->notebook.mgr) - 1; i >= 0; --i) { - Tab *tab = Ttk_ContentData(nb->notebook.mgr, i); + for (i = Ttk_NumberContent(nb->notebook.mgr) - 1; i != -1; --i) { + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } @@ -358,7 +358,7 @@ static void TabrowSize( int i; for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) { - Tab *tab = Ttk_ContentData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb,i); Ttk_RebindSublayout(tabLayout, tab); @@ -382,13 +382,13 @@ 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. */ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; NotebookStyle nbstyle; Ttk_Padding padding; Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client"); @@ -399,18 +399,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); - 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); + Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i); + 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: @@ -474,7 +474,7 @@ static void SqueezeTabs( int i; for (i = 0; i < nTabs; ++i) { - Tab *tab = Ttk_ContentData(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; @@ -493,7 +493,7 @@ static void PlaceTabs( int i; for (i = 0; i < nTabs; ++i) { - Tab *tab = Ttk_ContentData(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) { @@ -517,11 +517,11 @@ 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) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Tk_Window nbwin = nb->core.tkwin; Ttk_Box cavity = Ttk_WinBox(nbwin); int tabrowWidth = 0, tabrowHeight = 0; @@ -577,14 +577,14 @@ static void NotebookDoLayout(void *recordPtr) */ static void NotebookPlaceContent(Notebook *nb, int index) { - Tab *tab = Ttk_ContentData(nb->notebook.mgr, index); - Tk_Window slaveWindow = Ttk_ContentWindow(nb->notebook.mgr, index); - Ttk_Box slaveBox = + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); + 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 -- @@ -592,7 +592,7 @@ static void NotebookPlaceContent(Notebook *nb, int index) */ static void NotebookPlaceContents(void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int currentIndex = nb->notebook.currentIndex; if (currentIndex >= 0) { NotebookDoLayout(nb); @@ -606,7 +606,7 @@ static void NotebookPlaceContents(void *recordPtr) */ static void SelectTab(Notebook *nb, int index) { - Tab *tab = Ttk_ContentData(nb->notebook.mgr,index); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); int currentIndex = nb->notebook.currentIndex; if (index == currentIndex) { @@ -651,7 +651,7 @@ static int NextTab(Notebook *nb, int index) /* Scan forward for following usable tab: */ for (nextIndex = index + 1; nextIndex < nTabs; ++nextIndex) { - Tab *tab = Ttk_ContentData(nb->notebook.mgr, nextIndex); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } @@ -660,7 +660,7 @@ static int NextTab(Notebook *nb, int index) /* Not found -- scan backwards. */ for (nextIndex = index - 1; nextIndex >= 0; --nextIndex) { - Tab *tab = Ttk_ContentData(nb->notebook.mgr, nextIndex); + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } @@ -697,12 +697,12 @@ 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, int index) { - Notebook *nb = managerData; - Tab *tab = Ttk_ContentData(nb->notebook.mgr, index); + Notebook *nb = (Notebook *)managerData; + Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -717,7 +717,11 @@ static void TabRemoved(void *managerData, int index) TtkRedisplayWidget(&nb->core); } -static int TabRequest(void *managerData, int index, int width, int height) +static int TabRequest( + TCL_UNUSED(void *), + TCL_UNUSED(int), + TCL_UNUSED(int), + TCL_UNUSED(int)) { return 1; } @@ -727,17 +731,17 @@ static int TabRequest(void *managerData, int index, int width, int height) */ static int AddTab( Tcl_Interp *interp, Notebook *nb, - int destIndex, Tk_Window slaveWindow, + int 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) >= 0) { + if (Ttk_ContentIndex(nb->notebook.mgr, window) >= 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s already added", - Tk_PathName(slaveWindow))); + Tk_PathName(window))); Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "PRESENT", NULL); return TCL_ERROR; } @@ -745,16 +749,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: */ @@ -789,7 +793,7 @@ static const int NotebookEventMask ; static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; if (eventPtr->type == DestroyNotify) { /* Remove self */ Tk_DeleteEventHandler(nb->core.tkwin, @@ -813,7 +817,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. * @@ -885,8 +889,8 @@ static int GetTabIndex( static int NotebookAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; - Tk_Window slaveWindow; + Notebook *nb = (Notebook *)recordPtr; + Tk_Window window; int index; Tab *tab; @@ -895,21 +899,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 = Ttk_ContentData(nb->notebook.mgr, index); + 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; } @@ -924,7 +928,7 @@ static int NotebookAddCommand( static int NotebookInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int current = nb->notebook.currentIndex; int nContent = Ttk_NumberContent(nb->notebook.mgr); int srcIndex, destIndex; @@ -942,18 +946,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 < 0) { /* New slave */ - return AddTab(interp, nb, destIndex, slaveWindow, objc-4,objv+4); + srcIndex = Ttk_ContentIndex(nb->notebook.mgr, window); + if (srcIndex < 0) { /* 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) @@ -961,10 +965,10 @@ static int NotebookInsertCommand( return TCL_ERROR; } - /* Move existing slave: + /* Move existing content window: */ if (ConfigureTab(interp, nb, - Ttk_ContentData(nb->notebook.mgr,srcIndex), + (Tab *)Ttk_ContentData(nb->notebook.mgr,srcIndex), Ttk_ContentWindow(nb->notebook.mgr,srcIndex), objc-4,objv+4) != TCL_OK) { @@ -998,7 +1002,7 @@ static int NotebookInsertCommand( static int NotebookForgetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index; if (objc != 3) { @@ -1022,7 +1026,7 @@ static int NotebookForgetCommand( static int NotebookHideCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index; Tab *tab; @@ -1035,7 +1039,7 @@ static int NotebookHideCommand( return TCL_ERROR; } - tab = Ttk_ContentData(nb->notebook.mgr, index); + tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index); tab->state = TAB_STATE_HIDDEN; if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -1055,16 +1059,17 @@ static int NotebookIdentifyCommand( static const char *whatTable[] = { "element", "tab", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_TAB }; int what = IDENTIFY_ELEMENT; - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Element element = NULL; - int x, y, tabIndex; + int x, y; + int tabIndex; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 2,objv, "?what? x y"); return TCL_ERROR; } - if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK + if (Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK || (objc == 5 && Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable, sizeof(char *), "option", 0, &what) != TCL_OK) @@ -1074,7 +1079,7 @@ static int NotebookIdentifyCommand( tabIndex = IdentifyTab(nb, x, y); if (tabIndex >= 0) { - Tab *tab = Ttk_ContentData(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; @@ -1109,8 +1114,9 @@ static int NotebookIdentifyCommand( static int NotebookIndexCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; - int index, status; + Notebook *nb = (Notebook *)recordPtr; + int index; + int status; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "tab"); @@ -1141,7 +1147,7 @@ static int NotebookIndexCommand( static int NotebookSelectCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; if (objc == 2) { if (nb->notebook.currentIndex >= 0) { @@ -1167,7 +1173,7 @@ static int NotebookSelectCommand( static int NotebookTabsCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; Tcl_Obj *result; int i; @@ -1192,10 +1198,10 @@ static int NotebookTabsCommand( static int NotebookTabCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; int index; - Tk_Window slaveWindow; + Tk_Window window; Tab *tab; if (objc < 3) { @@ -1207,18 +1213,18 @@ static int NotebookTabCommand( return TCL_ERROR; } - tab = Ttk_ContentData(mgr, index); - slaveWindow = Ttk_ContentWindow(mgr, index); + tab = (Tab *)Ttk_ContentData(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; } @@ -1257,7 +1263,7 @@ static const Ttk_Ensemble NotebookCommands[] = { static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; nb->notebook.mgr = Ttk_CreateManager( &NotebookManagerSpec, recordPtr, nb->core.tkwin); @@ -1277,7 +1283,7 @@ static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr) static void NotebookCleanup(void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_DeleteManager(nb->notebook.mgr); if (nb->notebook.tabLayout) @@ -1286,7 +1292,7 @@ static void NotebookCleanup(void *recordPtr) static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; /* * Error-checks: @@ -1310,7 +1316,7 @@ static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask) static Ttk_Layout NotebookGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Layout notebookLayout = TtkWidgetGetLayout(interp, theme, recordPtr); Ttk_Layout tabLayout; @@ -1338,7 +1344,7 @@ static Ttk_Layout NotebookGetLayout( static void DisplayTab(Notebook *nb, int index, Drawable d) { Ttk_Layout tabLayout = nb->notebook.tabLayout; - Tab *tab = Ttk_ContentData(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) { @@ -1350,7 +1356,7 @@ static void DisplayTab(Notebook *nb, int index, Drawable d) static void NotebookDisplay(void *clientData, Drawable d) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; int nContent = Ttk_NumberContent(nb->notebook.mgr); int index; diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 85f0b26..fa0d5c8 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -29,7 +29,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. * @@ -78,13 +78,13 @@ typedef struct { static Tk_OptionSpec PanedOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", Tk_Offset(Paned,paned.orientObj), Tk_Offset(Paned,paned.orient), - 0,(void *)ttkOrientStrings,READONLY_OPTION|STYLE_CHANGED }, + 0, (void *)ttkOrientStrings, READONLY_OPTION|STYLE_CHANGED }, {TK_OPTION_INT, "-width", "width", "Width", "0", -1,Tk_Offset(Paned,paned.width), - 0,0,GEOMETRY_CHANGED }, + 0, 0, GEOMETRY_CHANGED }, {TK_OPTION_INT, "-height", "height", "Height", "0", -1,Tk_Offset(Paned,paned.height), - 0,0,GEOMETRY_CHANGED }, + 0, 0, GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) @@ -108,21 +108,21 @@ static 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 = record; + 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; } @@ -141,7 +141,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; @@ -149,7 +149,7 @@ static int ConfigurePane( int mask = 0; if (Tk_SetOptions(interp, (void*)pane, pw->paned.paneOptionTable, - objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) + objc, objv, window, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } @@ -189,14 +189,14 @@ error: static int ShoveUp(Paned *pw, int i, int pos) { - Pane *pane = Ttk_ContentData(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 = Ttk_ContentData(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; } @@ -209,13 +209,13 @@ static int ShoveUp(Paned *pw, int i, int pos) */ static int ShoveDown(Paned *pw, int i, int pos) { - Pane *pane = Ttk_ContentData(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 = Ttk_ContentData(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; } @@ -230,7 +230,7 @@ static int ShoveDown(Paned *pw, int i, int pos) */ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int nPanes = Ttk_NumberContent(pw->paned.mgr); int nSashes = nPanes - 1; int sashThickness = pw->paned.sashThickness; @@ -239,21 +239,21 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) if (pw->paned.orient == TTK_ORIENT_HORIZONTAL) { for (index = 0; index < nPanes; ++index) { - Pane *pane = Ttk_ContentData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(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 = Ttk_ContentData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(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; @@ -279,7 +279,7 @@ static void AdjustPanes(Paned *pw) int index; for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) { - Pane *pane = Ttk_ContentData(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; @@ -317,7 +317,7 @@ static void PlaceSashes(Paned *pw, int width, int height) /* Compute total required size and total available weight: */ for (i = 0; i < nPanes; ++i) { - Pane *pane = Ttk_ContentData(mgr, i); + Pane *pane = (Pane *)Ttk_ContentData(mgr, i); reqSize += pane->reqSize; totalWeight += pane->weight * (pane->reqSize != 0); } @@ -341,7 +341,7 @@ static void PlaceSashes(Paned *pw, int width, int height) */ pos = 0; for (i = 0; i < nPanes; ++i) { - Pane *pane = Ttk_ContentData(mgr, i); + Pane *pane = (Pane *)Ttk_ContentData(mgr, i); int weight = pane->weight * (pane->reqSize != 0); int size = pane->reqSize + delta * weight; @@ -365,7 +365,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) { @@ -376,7 +376,7 @@ static void PlacePanes(Paned *pw) int index; for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) { - Pane *pane = Ttk_ContentData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); int size = pane->sashPos - pos; if (size > 0) { @@ -399,61 +399,61 @@ static void PlacePanes(Paned *pw) static void PanedPlaceContent(void *managerData) { - Paned *pw = managerData; + Paned *pw = (Paned *)managerData; PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin)); PlacePanes(pw); } static void PaneRemoved(void *managerData, int index) { - Paned *pw = managerData; - Pane *pane = Ttk_ContentData(pw->paned.mgr, index); + Paned *pw = (Paned *)managerData; + Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index); DestroyPane(pw, pane); } 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) >= 0) { + if (Ttk_ContentIndex(pw->paned.mgr, window) >= 0) { 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. - * Geometry requests from mapped slaves are not directly honored + * 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]). */ static int PaneRequest(void *managerData, int index, int width, int height) { - Paned *pw = managerData; - Pane *pane = Ttk_ContentData(pw->paned.mgr, index); - Tk_Window slaveWindow = Ttk_ContentWindow(pw->paned.mgr, index); + Paned *pw = (Paned *)managerData; + Pane *pane = (Pane *)Ttk_ContentData(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; @@ -483,7 +483,7 @@ static Ttk_ManagerSpec PanedManagerSpec = { static const unsigned PanedEventMask = LeaveWindowMask; static void PanedEventProc(ClientData clientData, XEvent *eventPtr) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; if ( eventPtr->type == LeaveNotify && eventPtr->xcrossing.detail == NotifyInferior) { @@ -497,7 +497,7 @@ static void PanedEventProc(ClientData clientData, XEvent *eventPtr) static void PanedInitialize(Tcl_Interp *interp, void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Tk_CreateEventHandler(pw->core.tkwin, PanedEventMask, PanedEventProc, recordPtr); @@ -509,7 +509,7 @@ static void PanedInitialize(Tcl_Interp *interp, void *recordPtr) static void PanedCleanup(void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; if (pw->paned.sashLayout) Ttk_FreeLayout(pw->paned.sashLayout); @@ -520,9 +520,12 @@ static void PanedCleanup(void *recordPtr) /* Post-configuration hook. */ -static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask) +static int PanedPostConfigure( + TCL_UNUSED(Tcl_Interp *), + void *clientData, + int mask) { - Paned *pw = clientData; + Paned *pw = (Paned *)clientData; if (mask & GEOMETRY_CHANGED) { /* User has changed -width or -height. @@ -543,7 +546,7 @@ static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask) static Ttk_Layout PanedGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Ttk_Layout panedLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); if (panedLayout) { @@ -581,7 +584,7 @@ static Ttk_Layout PanedGetLayout( */ static Ttk_Layout SashLayout(Paned *pw, int index) { - Pane *pane = Ttk_ContentData(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), @@ -603,7 +606,7 @@ static void DrawSash(Paned *pw, int index, Drawable d) static void PanedDisplay(void *recordPtr, Drawable d) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int i, nSashes = Ttk_NumberContent(pw->paned.mgr) - 1; TtkWidgetDisplay(recordPtr, d); @@ -621,59 +624,59 @@ static void PanedDisplay(void *recordPtr, Drawable d) static int PanedAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; - Tk_Window slaveWindow; + Paned *pw = (Paned *)recordPtr; + 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 = recordPtr; + Paned *pw = (Paned *)recordPtr; int nContent = Ttk_NumberContent(pw->paned.mgr); int srcIndex, destIndex; - Tk_Window slaveWindow; + Tk_Window window; if (objc < 4) { Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-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; } if (!strcmp(Tcl_GetString(objv[2]), "end")) { destIndex = Ttk_NumberContent(pw->paned.mgr); } else if (TCL_OK != Ttk_GetContentIndexFromObj( - interp,pw->paned.mgr,objv[2],&destIndex)) + interp,pw->paned.mgr, objv[2], &destIndex)) { return TCL_ERROR; } - srcIndex = Ttk_ContentIndex(pw->paned.mgr, slaveWindow); - if (srcIndex < 0) { /* New slave: */ - return AddPane(interp, pw, destIndex, slaveWindow, objc-4, objv+4); - } /* else -- move existing slave: */ + srcIndex = Ttk_ContentIndex(pw->paned.mgr, window); + if (srcIndex < 0) { /* New content: */ + return AddPane(interp, pw, destIndex, window, objc-4, objv+4); + } /* else -- move existing content: */ if (destIndex >= nContent) destIndex = nContent - 1; @@ -681,9 +684,9 @@ static int PanedInsertCommand( return objc == 4 ? TCL_OK : ConfigurePane(interp, pw, - Ttk_ContentData(pw->paned.mgr, destIndex), + (Pane *)Ttk_ContentData(pw->paned.mgr, destIndex), Ttk_ContentWindow(pw->paned.mgr, destIndex), - objc-4,objv+4); + objc-4, objv+4); } /* $pw forget $pane @@ -691,7 +694,7 @@ static int PanedInsertCommand( static int PanedForgetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int paneIndex; if (objc != 3) { @@ -718,7 +721,7 @@ static int PanedIdentifyCommand( static const char *whatTable[] = { "element", "sash", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_SASH }; int what = IDENTIFY_SASH; - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int sashThickness = pw->paned.sashThickness; int nSashes = Ttk_NumberContent(pw->paned.mgr) - 1; int x, y, pos; @@ -739,7 +742,7 @@ static int PanedIdentifyCommand( pos = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? x : y; for (index = 0; index < nSashes; ++index) { - Pane *pane = Ttk_ContentData(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) { @@ -769,9 +772,9 @@ static int PanedIdentifyCommand( static int PanedPaneCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int paneIndex; - Tk_Window slaveWindow; + Tk_Window window; Pane *pane; if (objc < 3) { @@ -780,23 +783,23 @@ static int PanedPaneCommand( } if (TCL_OK != Ttk_GetContentIndexFromObj( - interp,pw->paned.mgr,objv[2],&paneIndex)) + interp,pw->paned.mgr, objv[2], &paneIndex)) { return TCL_ERROR; } - pane = Ttk_ContentData(pw->paned.mgr, paneIndex); - slaveWindow = Ttk_ContentWindow(pw->paned.mgr, paneIndex); + pane = (Pane *)Ttk_ContentData(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); } } @@ -806,7 +809,7 @@ static int PanedPaneCommand( static int PanedPanesCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Ttk_Manager *mgr = pw->paned.mgr; Tcl_Obj *panes; int i; @@ -833,7 +836,7 @@ static int PanedPanesCommand( static int PanedSashposCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int sashIndex, position = -1; Pane *pane; @@ -851,7 +854,7 @@ static int PanedSashposCommand( return TCL_ERROR; } - pane = Ttk_ContentData(pw->paned.mgr, sashIndex); + pane = (Pane *)Ttk_ContentData(pw->paned.mgr, sashIndex); if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewIntObj(pane->sashPos)); @@ -924,15 +927,20 @@ typedef struct { static Ttk_ElementOptionSpec SashElementOptions[] = { { "-sashthickness", TK_OPTION_INT, Tk_Offset(SashElement,thicknessObj), "5" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SashElementSize( - void *clientData, 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 = elementRecord; + SashElement *sash = (SashElement *)elementRecord; int thickness = DEFAULT_SASH_THICKNESS; + Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness); *widthPtr = *heightPtr = thickness; } diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 8723b94..00cb50b 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -37,7 +37,7 @@ typedef struct Ttk_Style_ static Style *NewStyle(void) { - Style *stylePtr = ckalloc(sizeof(Style)); + Style *stylePtr = (Style *)ckalloc(sizeof(Style)); stylePtr->styleName = NULL; stylePtr->parentStyle = NULL; @@ -56,7 +56,7 @@ static void FreeStyle(Style *stylePtr) entryPtr = Tcl_FirstHashEntry(&stylePtr->settingsTable, &search); while (entryPtr != NULL) { - Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr); + Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(stateMap); entryPtr = Tcl_NextHashEntry(&search); } @@ -64,7 +64,7 @@ static void FreeStyle(Style *stylePtr) entryPtr = Tcl_FirstHashEntry(&stylePtr->defaultsTable, &search); while (entryPtr != NULL) { - Tcl_Obj *defaultValue = Tcl_GetHashValue(entryPtr); + Tcl_Obj *defaultValue = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(defaultValue); entryPtr = Tcl_NextHashEntry(&search); } @@ -85,7 +85,7 @@ Tcl_Obj *Ttk_StyleMap(Ttk_Style style, const char *optionName, Ttk_State state) Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&style->settingsTable, optionName); if (entryPtr) { - Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr); + Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr); return Ttk_StateMapLookup(NULL, stateMap, state); } style = style->parentStyle; @@ -103,7 +103,7 @@ Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName) Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&style->defaultsTable, optionName); if (entryPtr) - return Tcl_GetHashValue(entryPtr); + return (Tcl_Obj *)Tcl_GetHashValue(entryPtr); style= style->parentStyle; } return 0; @@ -176,7 +176,7 @@ static const Tk_OptionSpec *TTKGetOptionSpec( static OptionMap BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) { - OptionMap optionMap = ckalloc( + OptionMap optionMap = (OptionMap)ckalloc( sizeof(const Tk_OptionSpec) * elementClass->nResources + 1); int i; @@ -204,7 +204,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) optionMap = BuildOptionMap(elementClass, optionTable); Tcl_SetHashValue(entryPtr, optionMap); } else { - optionMap = Tcl_GetHashValue(entryPtr); + optionMap = (OptionMap)Tcl_GetHashValue(entryPtr); } return optionMap; @@ -218,7 +218,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) static Ttk_ElementClass * NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) { - Ttk_ElementClass *elementClass = ckalloc(sizeof(Ttk_ElementClass)); + Ttk_ElementClass *elementClass = (Ttk_ElementClass *)ckalloc(sizeof(Ttk_ElementClass)); int i; elementClass->name = name; @@ -234,7 +234,7 @@ NewElementClass(const char *name, Ttk_ElementSpec *specPtr,void *clientData) /* Initialize default values: */ - elementClass->defaultValues = + elementClass->defaultValues = (Tcl_Obj **) ckalloc(elementClass->nResources * sizeof(Tcl_Obj *) + 1); for (i=0; i < elementClass->nResources; ++i) { const char *defaultValue = specPtr->options[i].defaultValue; @@ -291,8 +291,13 @@ static void FreeElementClass(Ttk_ElementClass *elementClass) * +++ Themes. */ -static int ThemeEnabled(Ttk_Theme theme, void *clientData) { return 1; } +static int ThemeEnabled( + TCL_UNUSED(Ttk_Theme), + TCL_UNUSED(void *)) +{ /* Default ThemeEnabledProc -- always return true */ + return 1; +} typedef struct Ttk_Theme_ { @@ -307,7 +312,7 @@ typedef struct Ttk_Theme_ static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) { - Theme *themePtr = ckalloc(sizeof(Theme)); + Theme *themePtr = (Theme *)ckalloc(sizeof(Theme)); Tcl_HashEntry *entryPtr; int unused; @@ -324,7 +329,7 @@ static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) entryPtr = Tcl_CreateHashEntry(&themePtr->styleTable, ".", &unused); themePtr->rootStyle = NewStyle(); themePtr->rootStyle->styleName = - Tcl_GetHashKey(&themePtr->styleTable, entryPtr); + (const char *)Tcl_GetHashKey(&themePtr->styleTable, entryPtr); themePtr->rootStyle->cache = themePtr->cache; Tcl_SetHashValue(entryPtr, themePtr->rootStyle); @@ -341,7 +346,7 @@ static void FreeTheme(Theme *themePtr) */ entryPtr = Tcl_FirstHashEntry(&themePtr->elementTable, &search); while (entryPtr != NULL) { - Ttk_ElementClass *elementClass = Tcl_GetHashValue(entryPtr); + Ttk_ElementClass *elementClass = (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); FreeElementClass(elementClass); entryPtr = Tcl_NextHashEntry(&search); } @@ -352,7 +357,7 @@ static void FreeTheme(Theme *themePtr) */ entryPtr = Tcl_FirstHashEntry(&themePtr->styleTable, &search); while (entryPtr != NULL) { - Style *stylePtr = Tcl_GetHashValue(entryPtr); + Style *stylePtr = (Style *)Tcl_GetHashValue(entryPtr); FreeStyle(stylePtr); entryPtr = Tcl_NextHashEntry(&search); } @@ -403,9 +408,11 @@ static void ThemeChangedProc(void *); /* Forward */ /* Ttk_StylePkgFree -- * Cleanup procedure for StylePackageData. */ -static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) +static void Ttk_StylePkgFree( + ClientData clientData, + TCL_UNUSED(Tcl_Interp *)) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr; Cleanup *cleanup; @@ -422,7 +429,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) */ entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search); while (entryPtr != NULL) { - Theme *themePtr = Tcl_GetHashValue(entryPtr); + Theme *themePtr = (Theme *)Tcl_GetHashValue(entryPtr); FreeTheme(themePtr); entryPtr = Tcl_NextHashEntry(&search); } @@ -464,7 +471,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) static StylePackageData *GetStylePackageData(Tcl_Interp *interp) { - return Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL); + return (StylePackageData *)Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL); } /* @@ -479,8 +486,8 @@ static StylePackageData *GetStylePackageData(Tcl_Interp *interp) void Ttk_RegisterCleanup( Tcl_Interp *interp, ClientData clientData, Ttk_CleanupProc *cleanupProc) { - StylePackageData *pkgPtr = GetStylePackageData(interp); - Cleanup *cleanup = ckalloc(sizeof(*cleanup)); + StylePackageData *pkgPtr = (StylePackageData *)GetStylePackageData(interp); + Cleanup *cleanup = (Cleanup *)ckalloc(sizeof(*cleanup)); cleanup->clientData = clientData; cleanup->cleanupProc = cleanupProc; @@ -503,7 +510,7 @@ void Ttk_RegisterCleanup( static void ThemeChangedProc(ClientData clientData) { static char ThemeChangedScript[] = "ttk::ThemeChanged"; - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; int code = Tcl_EvalEx(pkgPtr->interp, ThemeChangedScript, -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { @@ -583,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; @@ -596,7 +603,7 @@ static Ttk_Theme LookupTheme( return NULL; } - return Tcl_GetHashValue(entryPtr); + return (Ttk_Theme)Tcl_GetHashValue(entryPtr); } /* @@ -704,12 +711,12 @@ Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName) stylePtr->parentStyle = themePtr->rootStyle; } - stylePtr->styleName = Tcl_GetHashKey(&themePtr->styleTable, entryPtr); + stylePtr->styleName = (const char *)Tcl_GetHashKey(&themePtr->styleTable, entryPtr); stylePtr->cache = stylePtr->parentStyle->cache; Tcl_SetHashValue(entryPtr, stylePtr); return stylePtr; } - return Tcl_GetHashValue(entryPtr); + return (Ttk_Style)Tcl_GetHashValue(entryPtr); } /* FindLayoutTemplate -- @@ -755,7 +762,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) */ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, elementName); if (entryPtr) { - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } /* @@ -766,7 +773,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, dot); } if (entryPtr) { - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } /* @@ -782,7 +789,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) */ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, ""); /* ASSERT: entryPtr != 0 */ - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } const char *Ttk_ElementClassName(Ttk_ElementClass *elementClass) @@ -799,7 +806,7 @@ int Ttk_RegisterElementFactory( Ttk_ElementFactory factory, void *clientData) { StylePackageData *pkgPtr = GetStylePackageData(interp); - FactoryRec *recPtr = ckalloc(sizeof(*recPtr)); + FactoryRec *recPtr = (FactoryRec *)ckalloc(sizeof(*recPtr)); Tcl_HashEntry *entryPtr; int newEntry; @@ -820,7 +827,7 @@ int Ttk_RegisterElementFactory( * (style element create $name) "from" $theme ?$element? */ static int Ttk_CloneElement( - Tcl_Interp *interp, void *clientData, + Tcl_Interp *interp, TCL_UNUSED(void *), Ttk_Theme theme, const char *elementName, int objc, Tcl_Obj *const objv[]) { @@ -895,7 +902,7 @@ Ttk_ElementClass *Ttk_RegisterElement( return 0; } - name = Tcl_GetHashKey(&theme->elementTable, entryPtr); + name = (char *)Tcl_GetHashKey(&theme->elementTable, entryPtr); elementClass = NewElementClass(name, specPtr, clientData); Tcl_SetHashValue(entryPtr, elementClass); @@ -984,7 +991,7 @@ int InitializeElementRecord( int i; for (i=0; i<nResources; ++i, ++elementOption) { Tcl_Obj **dest = (Tcl_Obj **) - (elementRecord + elementOption->offset); + ((char *)elementRecord + elementOption->offset); const char *optionName = elementOption->optionName; Tcl_Obj *dynamicSetting = Ttk_StyleMap(style, optionName, state); Tcl_Obj *widgetValue = 0; @@ -992,7 +999,7 @@ int InitializeElementRecord( if (optionMap[i]) { widgetValue = *(Tcl_Obj **) - (widgetRecord + optionMap[i]->objOffset); + ((char *)widgetRecord + optionMap[i]->objOffset); } if (widgetValue) { @@ -1134,7 +1141,7 @@ int TtkEnumerateHashTable(Tcl_Interp *interp, Tcl_HashTable *ht) Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { - Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1); + Tcl_Obj *nameObj = Tcl_NewStringObj((const char *)Tcl_GetHashKey(ht, entryPtr),-1); Tcl_ListObjAppendElement(interp, result, nameObj); entryPtr = Tcl_NextHashEntry(&search); } @@ -1154,8 +1161,8 @@ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht) Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { - Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1); - Tcl_Obj *valueObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *nameObj = Tcl_NewStringObj((const char *)Tcl_GetHashKey(ht, entryPtr),-1); + Tcl_Obj *valueObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_ListObjAppendElement(NULL, result, nameObj); Tcl_ListObjAppendElement(NULL, result, valueObj); entryPtr = Tcl_NextHashEntry(&search); @@ -1176,7 +1183,7 @@ StyleMapCmd( int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; @@ -1240,7 +1247,7 @@ usage: static int StyleConfigureCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; @@ -1295,7 +1302,7 @@ usage: static int StyleLookupCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; Ttk_Style style = NULL; const char *optionName; @@ -1337,7 +1344,7 @@ static int StyleLookupCmd( static int StyleThemeCurrentCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr = NULL; const char *name = NULL; @@ -1349,9 +1356,9 @@ static int StyleThemeCurrentCmd( entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search); while (entryPtr != NULL) { - Theme *ptr = Tcl_GetHashValue(entryPtr); + Theme *ptr = (Theme *)Tcl_GetHashValue(entryPtr); if (ptr == pkgPtr->currentTheme) { - name = Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr); + name = (char *)Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr); break; } entryPtr = Tcl_NextHashEntry(&search); @@ -1373,7 +1380,7 @@ static int StyleThemeCurrentCmd( static int StyleThemeCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; static const char *optStrings[] = { "-parent", "-settings", NULL }; enum { OP_PARENT, OP_SETTINGS }; @@ -1435,9 +1442,13 @@ 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 = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; + return TtkEnumerateHashTable(interp, &pkgPtr->themeTable); } @@ -1453,7 +1464,7 @@ StyleThemeSettingsCmd( int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme oldTheme = pkgPtr->currentTheme; Ttk_Theme newTheme; int status; @@ -1479,7 +1490,7 @@ StyleThemeSettingsCmd( static int StyleElementCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName, *factoryName; Tcl_HashEntry *entryPtr; @@ -1502,7 +1513,7 @@ static int StyleElementCreateCmd( return TCL_ERROR; } - recPtr = Tcl_GetHashValue(entryPtr); + recPtr = (FactoryRec *)Tcl_GetHashValue(entryPtr); return recPtr->factory(interp, recPtr->clientData, theme, elementName, objc - 5, objv + 5); @@ -1514,7 +1525,7 @@ static int StyleElementCreateCmd( static int StyleElementNamesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; if (objc != 3) { @@ -1530,7 +1541,7 @@ static int StyleElementNamesCmd( static int StyleElementOptionsCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName; Ttk_ElementClass *elementClass; @@ -1568,7 +1579,7 @@ static int StyleElementOptionsCmd( static int StyleLayoutCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *layoutName; Ttk_LayoutTemplate layoutTemplate; @@ -1611,7 +1622,7 @@ StyleThemeUseCmd( int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme; if (objc < 3 || objc > 4) { @@ -1706,7 +1717,7 @@ void Ttk_StylePkgInit(Tcl_Interp *interp) { Tcl_Namespace *nsPtr; - StylePackageData *pkgPtr = ckalloc(sizeof(StylePackageData)); + StylePackageData *pkgPtr = (StylePackageData *)ckalloc(sizeof(StylePackageData)); pkgPtr->interp = interp; Tcl_InitHashTable(&pkgPtr->themeTable, TCL_STRING_KEYS); |