diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-03 06:18:06 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-03 06:18:06 (GMT) |
commit | 18cb58ab84107c6049642f8aea423dd75e25e4c1 (patch) | |
tree | f83a780af872b4a234297c9bbb482dbf1d078fb6 | |
parent | 066d6dcb874a4f9bae3ba8f4d8fd54e460413e88 (diff) | |
download | tk-18cb58ab84107c6049642f8aea423dd75e25e4c1.zip tk-18cb58ab84107c6049642f8aea423dd75e25e4c1.tar.gz tk-18cb58ab84107c6049642f8aea423dd75e25e4c1.tar.bz2 |
Implement part of TIP #581: Master/Slave. Not complete yet, and also the change to TkGetGeomContainer/TkGetTransientContainer is left out for now.
-rw-r--r-- | doc/CrtImgType.3 | 15 | ||||
-rw-r--r-- | doc/ImgChanged.3 | 4 | ||||
-rw-r--r-- | doc/NameOfImg.3 | 4 | ||||
-rw-r--r-- | generic/tk.decls | 4 | ||||
-rw-r--r-- | generic/tk.h | 9 | ||||
-rw-r--r-- | generic/tkDecls.h | 9 | ||||
-rw-r--r-- | generic/tkGrid.c | 9 | ||||
-rw-r--r-- | generic/tkImage.c | 40 | ||||
-rw-r--r-- | generic/tkImgBmap.c | 252 | ||||
-rw-r--r-- | generic/tkImgPhInstance.c | 8 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 664 | ||||
-rw-r--r-- | generic/tkImgPhoto.h | 11 | ||||
-rw-r--r-- | generic/tkInt.h | 2 | ||||
-rw-r--r-- | generic/tkOldTest.c | 52 | ||||
-rw-r--r-- | generic/tkPack.c | 9 | ||||
-rw-r--r-- | generic/tkPlace.c | 5 | ||||
-rw-r--r-- | generic/tkTest.c | 54 | ||||
-rw-r--r-- | tests/grid.test | 2 | ||||
-rw-r--r-- | tests/oldpack.test | 4 | ||||
-rw-r--r-- | tests/pack.test | 2 | ||||
-rw-r--r-- | tests/place.test | 2 |
21 files changed, 594 insertions, 567 deletions
diff --git a/doc/CrtImgType.3 b/doc/CrtImgType.3 index cbbc11e..8e6b826 100644 --- a/doc/CrtImgType.3 +++ b/doc/CrtImgType.3 @@ -9,7 +9,7 @@ .so man.macros .BS .SH NAME -Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind of image +Tk_CreateImageType, Tk_GetImageMasterData, Tk_GetImageModelData, Tk_InitImageArgs \- define new kind of image .SH SYNOPSIS .nf \fB#include <tk.h>\fR @@ -19,6 +19,11 @@ Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind o ClientData \fBTk_GetImageMasterData\fR(\fIinterp, name, typePtrPtr\fR) .sp +.VS "TIP 581" +ClientData +\fBTk_GetImageModelData\fR(\fIinterp, name, typePtrPtr\fR) +.VE "TIP 581" +.sp \fBTk_InitImageArgs\fR(\fIinterp, argc, argvPtr\fR) .SH ARGUMENTS .AS "const Tk_ImageType" *typePtrPtr @@ -241,6 +246,10 @@ and the return value is the ClientData value returned by the \fIcreateProc\fR when the image was created (this is typically a pointer to the image master data structure). If no such image exists then NULL is returned and NULL is stored at \fI*typePtrPtr\fR. +.PP +.VS "TIP 581" +\fBTk_GetImageModelData\fR is synonym for \fBTk_GetImageMasterData\fR +.VE "TIP 581" .SH "LEGACY INTERFACE SUPPORT" .PP In Tk 8.2 and earlier, the definition of \fBTk_ImageCreateProc\fR @@ -261,6 +270,10 @@ interface. The Tk header file will still support this legacy interface if the code is compiled with the macro \fBUSE_OLD_IMAGE\fR defined. .PP +.VS "TIP 581" +\fITk_ImageModel\fR is synonym for \fITk_ImageMaster\fR +.VE "TIP 581" +.PP When the \fBUSE_OLD_IMAGE\fR legacy support is enabled, you may see the routine \fBTk_InitImageArgs\fR in use. This was a migration tool used to create stub-enabled extensions that could be loaded diff --git a/doc/ImgChanged.3 b/doc/ImgChanged.3 index f4d2c04..aa56548 100644 --- a/doc/ImgChanged.3 +++ b/doc/ImgChanged.3 @@ -48,6 +48,10 @@ specify a rectangular region within the image that needs to be redrawn. \fIimageWidth\fR and \fIimageHeight\fR specify the image's (new) size. .PP +.VS "TIP 581" +\fITk_ImageModel\fR is synonym for \fITk_ImageMaster\fR +.VE "TIP 581" +.PP An image manager should call \fBTk_ImageChanged\fR during its \fIcreateProc\fR to specify the image's initial size and to force redisplay if there are existing instances for the image. diff --git a/doc/NameOfImg.3 b/doc/NameOfImg.3 index 8c191ce..484e479 100644 --- a/doc/NameOfImg.3 +++ b/doc/NameOfImg.3 @@ -26,5 +26,9 @@ the image was created. This procedure is invoked by image managers to find out the name of an image. Given the token for the image, it returns the string name for the image. +.PP +.VS "TIP 581" +\fITk_ImageModel\fR is synonym for \fITk_ImageMaster\fR +.VE "TIP 581" .SH KEYWORDS image manager, image name diff --git a/generic/tk.decls b/generic/tk.decls index 3e64878..59977ef 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_ImageModel master, int x, int y, int width, int height, int imageWidth, int imageHeight) } declare 118 { @@ -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_ImageModel imageMaster) } declare 138 { CONST84_RETURN char *Tk_NameOfJoinStyle(int join) diff --git a/generic/tk.h b/generic/tk.h index 01f3657..4905aae 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -122,13 +122,14 @@ extern "C" { * Dummy types that are used by clients: */ +#define Tk_ImageModel Tk_ImageMaster typedef struct Tk_BindingTable_ *Tk_BindingTable; typedef struct Tk_Canvas_ *Tk_Canvas; typedef struct Tk_Cursor_ *Tk_Cursor; typedef struct Tk_ErrorHandler_ *Tk_ErrorHandler; typedef struct Tk_Font_ *Tk_Font; typedef struct Tk_Image__ *Tk_Image; -typedef struct Tk_ImageMaster_ *Tk_ImageMaster; +typedef struct Tk_ImageMaster_ *Tk_ImageModel; typedef struct Tk_OptionTable_ *Tk_OptionTable; typedef struct Tk_PostscriptInfo_ *Tk_PostscriptInfo; typedef struct Tk_TextLayout_ *Tk_TextLayout; @@ -1228,12 +1229,12 @@ typedef struct Tk_Outline { typedef struct Tk_ImageType Tk_ImageType; #ifdef USE_OLD_IMAGE typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc, - char **argv, Tk_ImageType *typePtr, Tk_ImageMaster master, + char **argv, Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *masterDataPtr); #else typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, CONST86 char *name, int objc, - Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageMaster master, - ClientData *masterDataPtr); + Tcl_Obj *const objv[], CONST86 Tk_ImageType *typePtr, Tk_ImageModel model, + ClientData *modelDataPtr); #endif /* USE_OLD_IMAGE */ typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData masterData); typedef void (Tk_ImageDisplayProc) (ClientData instanceData, Display *display, diff --git a/generic/tkDecls.h b/generic/tkDecls.h index 64c32cd..c96039d 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_ImageModel master, int x, int y, int width, int height, int imageWidth, int imageHeight); /* 118 */ @@ -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_ImageModel imageMaster); /* 138 */ EXTERN CONST84_RETURN char * Tk_NameOfJoinStyle(int join); /* 139 */ @@ -993,7 +993,7 @@ 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_ImageModel master, 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 */ @@ -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_ImageModel imageMaster); /* 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 */ @@ -1720,6 +1720,7 @@ extern const TkStubs *tkStubsPtr; #undef Tk_Init #undef Tk_SafeInit #undef Tk_CreateConsoleWindow +#define Tk_GetImageModelData Tk_GetImageMasterData #if defined(_WIN32) && defined(UNICODE) # define Tk_MainEx Tk_MainExW diff --git a/generic/tkGrid.c b/generic/tkGrid.c index be15c14..835971d 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -338,13 +338,13 @@ Tk_GridObjCmd( Tk_Window tkwin = clientData; static const char *const optionStrings[] = { "anchor", "bbox", "columnconfigure", "configure", - "forget", "info", "location", "propagate", "remove", - "rowconfigure", "size", "slaves", NULL + "content", "forget", "info", "location", "propagate", + "remove", "rowconfigure", "size", "slaves", NULL }; enum options { GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE, - GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, GRID_REMOVE, - GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES + GRID_CONTENT, GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, + GRID_REMOVE, GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES }; int index; @@ -384,6 +384,7 @@ Tk_GridObjCmd( return GridPropagateCommand(tkwin, interp, objc, objv); case GRID_SIZE: return GridSizeCommand(tkwin, interp, objc, objv); + case GRID_CONTENT: case GRID_SLAVES: return GridSlavesCommand(tkwin, interp, objc, objv); diff --git a/generic/tkImage.c b/generic/tkImage.c index dc4e8e0..8192c23 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -26,7 +26,7 @@ typedef struct Image { Display *display; /* Display for tkwin. Needed because when the * image is eventually freed tkwin may not * exist anymore. */ - struct ImageMaster *masterPtr; + struct ImageModel *masterPtr; /* Master for this image (identifiers image * manager, for example). */ ClientData instanceData; /* One word argument to pass to image manager @@ -45,7 +45,7 @@ typedef struct Image { * from it. Entries in mainPtr->imageTable point to these structures. */ -typedef struct ImageMaster { +typedef struct ImageModel { Tk_ImageType *typePtr; /* Information about image type. NULL means * that no image manager owns this image: the * image was deleted. */ @@ -64,7 +64,7 @@ typedef struct ImageMaster { int deleted; /* Flag set when image is being deleted. */ TkWindow *winPtr; /* Main window of interpreter (used to detect * when the world is falling apart.) */ -} ImageMaster; +} ImageModel; typedef struct { Tk_ImageType *imageTypeList;/* First in a list of all known image @@ -82,8 +82,8 @@ static Tcl_ThreadDataKey dataKey; */ static void ImageTypeThreadExitProc(ClientData clientData); -static void DeleteImage(ImageMaster *masterPtr); -static void EventuallyDeleteImage(ImageMaster *masterPtr, +static void DeleteImage(ImageModel *masterPtr); +static void EventuallyDeleteImage(ImageModel *masterPtr, int forgetImageHashNow); /* @@ -218,7 +218,7 @@ Tk_ImageObjCmd( TkWindow *winPtr = clientData; int i, isNew, firstOption, index; Tk_ImageType *typePtr; - ImageMaster *masterPtr; + ImageModel *masterPtr; Image *imagePtr; Tcl_HashEntry *hPtr; Tcl_HashSearch search; @@ -318,7 +318,7 @@ Tk_ImageObjCmd( hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable, name, &isNew); if (isNew) { - masterPtr = ckalloc(sizeof(ImageMaster)); + masterPtr = ckalloc(sizeof(ImageModel)); masterPtr->typePtr = NULL; masterPtr->masterData = NULL; masterPtr->width = masterPtr->height = 1; @@ -371,7 +371,7 @@ Tk_ImageObjCmd( } Tcl_Preserve(masterPtr); if (typePtr->createProc(interp, name, objc, args, typePtr, - (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK){ + (Tk_ImageModel)masterPtr, &masterPtr->masterData) != TCL_OK){ EventuallyDeleteImage(masterPtr, 0); Tcl_Release(masterPtr); if (oldimage) { @@ -523,7 +523,7 @@ Tk_ImageObjCmd( void Tk_ImageChanged( - Tk_ImageMaster imageMaster, /* Image that needs redisplay. */ + Tk_ImageModel imageModel, /* Image that needs redisplay. */ int x, int y, /* Coordinates of upper-left pixel of region * of image that needs to be redrawn. */ int width, int height, /* Dimensions (in pixels) of region of image @@ -534,7 +534,7 @@ Tk_ImageChanged( int imageWidth, int imageHeight) /* New dimensions of image. */ { - ImageMaster *masterPtr = (ImageMaster *) imageMaster; + ImageModel *masterPtr = (ImageModel *) imageModel; Image *imagePtr; masterPtr->width = imageWidth; @@ -555,7 +555,7 @@ Tk_ImageChanged( * the image. * * Results: - * The return value is the string name for imageMaster. + * The return value is the string name for imageModel. * * Side effects: * None. @@ -565,9 +565,9 @@ Tk_ImageChanged( const char * Tk_NameOfImage( - Tk_ImageMaster imageMaster) /* Token for image. */ + Tk_ImageModel imageModel) /* Token for image. */ { - ImageMaster *masterPtr = (ImageMaster *) imageMaster; + ImageModel *masterPtr = (ImageModel *) imageModel; if (masterPtr->hPtr == NULL) { return NULL; @@ -610,7 +610,7 @@ Tk_GetImage( ClientData clientData) /* One-word argument to pass to damageProc. */ { Tcl_HashEntry *hPtr; - ImageMaster *masterPtr; + ImageModel *masterPtr; Image *imagePtr; hPtr = Tcl_FindHashEntry(&((TkWindow *) tkwin)->mainPtr->imageTable, name); @@ -669,7 +669,7 @@ Tk_FreeImage( * a widget. */ { Image *imagePtr = (Image *) image; - ImageMaster *masterPtr = imagePtr->masterPtr; + ImageModel *masterPtr = imagePtr->masterPtr; Image *prevPtr; /* @@ -956,7 +956,7 @@ Tk_DeleteImage( static void DeleteImage( - ImageMaster *masterPtr) /* Pointer to main data structure for image. */ + ImageModel *masterPtr) /* Pointer to main data structure for image. */ { Image *imagePtr; Tk_ImageType *typePtr; @@ -1004,7 +1004,7 @@ DeleteImage( static void EventuallyDeleteImage( - ImageMaster *masterPtr, /* Pointer to main data structure for image. */ + ImageModel *masterPtr, /* Pointer to main data structure for image. */ int forgetImageHashNow) /* Flag to say whether the hash table is about * to vanish. */ { @@ -1053,7 +1053,7 @@ TkDeleteAllImages( /* *---------------------------------------------------------------------- * - * Tk_GetImageMasterData -- + * Tk_GetImageModelData -- * * Given the name of an image, this function returns the type of the * image and the clientData associated with its master. @@ -1071,7 +1071,7 @@ TkDeleteAllImages( */ ClientData -Tk_GetImageMasterData( +Tk_GetImageModelData( Tcl_Interp *interp, /* Interpreter in which the image was * created. */ const char *name, /* Name of image. */ @@ -1081,7 +1081,7 @@ Tk_GetImageMasterData( { TkWindow *winPtr = (TkWindow *) Tk_MainWindow(interp); Tcl_HashEntry *hPtr; - ImageMaster *masterPtr; + ImageModel *masterPtr; hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, name); if (hPtr == NULL) { diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index f4ee407..a5c21bb 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -18,8 +18,8 @@ * image: */ -typedef struct BitmapMaster { - Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the +typedef struct BitmapModel { + Tk_ImageModel tkModel; /* Tk's token for image model. NULL means the * image is being deleted. */ Tcl_Interp *interp; /* Interpreter for application that is using * image. */ @@ -41,7 +41,7 @@ typedef struct BitmapMaster { struct BitmapInstance *instancePtr; /* First in list of all instances associated * with this master. */ -} BitmapMaster; +} BitmapModel; /* * The following data structure represents all of the instances of an image @@ -51,7 +51,7 @@ typedef struct BitmapMaster { typedef struct BitmapInstance { int refCount; /* Number of instances that share this data * structure. */ - BitmapMaster *masterPtr; /* Pointer to master for image. */ + BitmapModel *modelPtr; /* Pointer to master for image. */ Tk_Window tkwin; /* Window in which the instances will be * displayed. */ XColor *fg; /* Foreground color for displaying image. */ @@ -65,7 +65,7 @@ typedef struct BitmapInstance { * displayed. */ struct BitmapInstance *nextPtr; /* Next in list of all instance structures - * associated with masterPtr (NULL means end + * associated with modelPtr (NULL means end * of list). */ } BitmapInstance; @@ -76,7 +76,7 @@ typedef struct BitmapInstance { static int GetByte(Tcl_Channel chan); static int ImgBmapCreate(Tcl_Interp *interp, const char *name, int argc, Tcl_Obj *const objv[], - const Tk_ImageType *typePtr, Tk_ImageMaster master, + const Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData); static void ImgBmapDisplay(ClientData clientData, @@ -108,17 +108,17 @@ Tk_ImageType tkBitmapImageType = { static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_UID, "-background", NULL, NULL, - "", Tk_Offset(BitmapMaster, bgUid), 0, NULL}, + "", Tk_Offset(BitmapModel, bgUid), 0, NULL}, {TK_CONFIG_STRING, "-data", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, dataString), TK_CONFIG_NULL_OK, NULL}, + NULL, Tk_Offset(BitmapModel, dataString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-file", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, fileString), TK_CONFIG_NULL_OK, NULL}, + NULL, Tk_Offset(BitmapModel, fileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_UID, "-foreground", NULL, NULL, - "#000000", Tk_Offset(BitmapMaster, fgUid), 0, NULL}, + "#000000", Tk_Offset(BitmapModel, fgUid), 0, NULL}, {TK_CONFIG_STRING, "-maskdata", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, maskDataString), TK_CONFIG_NULL_OK, NULL}, + NULL, Tk_Offset(BitmapModel, maskDataString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-maskfile", NULL, NULL, - NULL, Tk_Offset(BitmapMaster, maskFileString), TK_CONFIG_NULL_OK, NULL}, + NULL, Tk_Offset(BitmapModel, maskFileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; @@ -149,7 +149,7 @@ static int ImgBmapCmd(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *const objv[]); static void ImgBmapCmdDeletedProc(ClientData clientData); static void ImgBmapConfigureInstance(BitmapInstance *instancePtr); -static int ImgBmapConfigureMaster(BitmapMaster *masterPtr, +static int ImgBmapConfigureMaster(BitmapModel *modelPtr, int argc, Tcl_Obj *const objv[], int flags); static int NextBitmapWord(ParseInfo *parseInfoPtr); @@ -179,32 +179,32 @@ ImgBmapCreate( Tcl_Obj *const argv[], /* Argument objects for options (doesn't * include image name or type). */ const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */ - Tk_ImageMaster master, /* Token for image, to be used by us in later + Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - BitmapMaster *masterPtr = ckalloc(sizeof(BitmapMaster)); - - masterPtr->tkMaster = master; - masterPtr->interp = interp; - masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd, - masterPtr, ImgBmapCmdDeletedProc); - masterPtr->width = masterPtr->height = 0; - masterPtr->data = NULL; - masterPtr->maskData = NULL; - masterPtr->fgUid = NULL; - masterPtr->bgUid = NULL; - masterPtr->fileString = NULL; - masterPtr->dataString = NULL; - masterPtr->maskFileString = NULL; - masterPtr->maskDataString = NULL; - masterPtr->instancePtr = NULL; - if (ImgBmapConfigureMaster(masterPtr, argc, argv, 0) != TCL_OK) { - ImgBmapDelete(masterPtr); + BitmapModel *modelPtr = ckalloc(sizeof(BitmapModel)); + + modelPtr->tkModel = model; + modelPtr->interp = interp; + modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd, + modelPtr, ImgBmapCmdDeletedProc); + modelPtr->width = modelPtr->height = 0; + modelPtr->data = NULL; + modelPtr->maskData = NULL; + modelPtr->fgUid = NULL; + modelPtr->bgUid = NULL; + modelPtr->fileString = NULL; + modelPtr->dataString = NULL; + modelPtr->maskFileString = NULL; + modelPtr->maskDataString = NULL; + modelPtr->instancePtr = NULL; + if (ImgBmapConfigureMaster(modelPtr, argc, argv, 0) != TCL_OK) { + ImgBmapDelete(modelPtr); return TCL_ERROR; } - *clientDataPtr = masterPtr; + *clientDataPtr = modelPtr; return TCL_OK; } @@ -219,7 +219,7 @@ ImgBmapCreate( * * Results: * A standard Tcl return value. If TCL_ERROR is returned then an error - * message is left in the masterPtr->interp's result. + * message is left in the modelPtr->interp's result. * * Side effects: * Existing instances of the image will be redisplayed to match the new @@ -230,7 +230,7 @@ ImgBmapCreate( static int ImgBmapConfigureMaster( - BitmapMaster *masterPtr, /* Pointer to data structure describing + BitmapModel *modelPtr, /* Pointer to data structure describing * overall bitmap image to (reconfigure). */ int objc, /* Number of entries in objv. */ Tcl_Obj *const objv[], /* Pairs of configuration options for image. */ @@ -246,8 +246,8 @@ ImgBmapConfigureMaster( } argv[objc] = NULL; - if (Tk_ConfigureWidget(masterPtr->interp, Tk_MainWindow(masterPtr->interp), - configSpecs, objc, argv, (char *) masterPtr, flags) != TCL_OK) { + if (Tk_ConfigureWidget(modelPtr->interp, Tk_MainWindow(modelPtr->interp), + configSpecs, objc, argv, (char *) modelPtr, flags) != TCL_OK) { ckfree(argv); return TCL_ERROR; } @@ -258,44 +258,44 @@ ImgBmapConfigureMaster( * bitmap and mask have the same dimensions. */ - if (masterPtr->data != NULL) { - ckfree(masterPtr->data); - masterPtr->data = NULL; + if (modelPtr->data != NULL) { + ckfree(modelPtr->data); + modelPtr->data = NULL; } - if ((masterPtr->fileString != NULL) || (masterPtr->dataString != NULL)) { - masterPtr->data = TkGetBitmapData(masterPtr->interp, - masterPtr->dataString, masterPtr->fileString, - &masterPtr->width, &masterPtr->height, &dummy1, &dummy2); - if (masterPtr->data == NULL) { + if ((modelPtr->fileString != NULL) || (modelPtr->dataString != NULL)) { + modelPtr->data = TkGetBitmapData(modelPtr->interp, + modelPtr->dataString, modelPtr->fileString, + &modelPtr->width, &modelPtr->height, &dummy1, &dummy2); + if (modelPtr->data == NULL) { return TCL_ERROR; } } - if (masterPtr->maskData != NULL) { - ckfree(masterPtr->maskData); - masterPtr->maskData = NULL; + if (modelPtr->maskData != NULL) { + ckfree(modelPtr->maskData); + modelPtr->maskData = NULL; } - if ((masterPtr->maskFileString != NULL) - || (masterPtr->maskDataString != NULL)) { - if (masterPtr->data == NULL) { - Tcl_SetObjResult(masterPtr->interp, Tcl_NewStringObj( + if ((modelPtr->maskFileString != NULL) + || (modelPtr->maskDataString != NULL)) { + if (modelPtr->data == NULL) { + Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( "can't have mask without bitmap", -1)); - Tcl_SetErrorCode(masterPtr->interp, "TK", "IMAGE", "BITMAP", + Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP", "NO_BITMAP", NULL); return TCL_ERROR; } - masterPtr->maskData = TkGetBitmapData(masterPtr->interp, - masterPtr->maskDataString, masterPtr->maskFileString, + modelPtr->maskData = TkGetBitmapData(modelPtr->interp, + modelPtr->maskDataString, modelPtr->maskFileString, &maskWidth, &maskHeight, &dummy1, &dummy2); - if (masterPtr->maskData == NULL) { + if (modelPtr->maskData == NULL) { return TCL_ERROR; } - if ((maskWidth != masterPtr->width) - || (maskHeight != masterPtr->height)) { - ckfree(masterPtr->maskData); - masterPtr->maskData = NULL; - Tcl_SetObjResult(masterPtr->interp, Tcl_NewStringObj( + if ((maskWidth != modelPtr->width) + || (maskHeight != modelPtr->height)) { + ckfree(modelPtr->maskData); + modelPtr->maskData = NULL; + Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( "bitmap and mask have different sizes", -1)); - Tcl_SetErrorCode(masterPtr->interp, "TK", "IMAGE", "BITMAP", + Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP", "MASK_SIZE", NULL); return TCL_ERROR; } @@ -307,12 +307,12 @@ ImgBmapConfigureMaster( * everywhere that it is used. */ - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { ImgBmapConfigureInstance(instancePtr); } - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width, - masterPtr->height, masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width, + modelPtr->height, modelPtr->width, modelPtr->height); return TCL_OK; } @@ -340,7 +340,7 @@ static void ImgBmapConfigureInstance( BitmapInstance *instancePtr)/* Instance to reconfigure. */ { - BitmapMaster *masterPtr = instancePtr->masterPtr; + BitmapModel *modelPtr = instancePtr->modelPtr; XColor *colorPtr; XGCValues gcValues; GC gc; @@ -348,13 +348,13 @@ ImgBmapConfigureInstance( Pixmap oldBitmap, oldMask; /* - * For each of the options in masterPtr, translate the string form into an + * For each of the options in modelPtr, translate the string form into an * internal form appropriate for instancePtr. */ - if (*masterPtr->bgUid != 0) { - colorPtr = Tk_GetColor(masterPtr->interp, instancePtr->tkwin, - masterPtr->bgUid); + if (*modelPtr->bgUid != 0) { + colorPtr = Tk_GetColor(modelPtr->interp, instancePtr->tkwin, + modelPtr->bgUid); if (colorPtr == NULL) { goto error; } @@ -366,8 +366,8 @@ ImgBmapConfigureInstance( } instancePtr->bg = colorPtr; - colorPtr = Tk_GetColor(masterPtr->interp, instancePtr->tkwin, - masterPtr->fgUid); + colorPtr = Tk_GetColor(modelPtr->interp, instancePtr->tkwin, + modelPtr->fgUid); if (colorPtr == NULL) { goto error; } @@ -388,19 +388,19 @@ ImgBmapConfigureInstance( oldMask = instancePtr->mask; instancePtr->mask = None; - if (masterPtr->data != NULL) { + if (modelPtr->data != NULL) { instancePtr->bitmap = XCreateBitmapFromData( Tk_Display(instancePtr->tkwin), RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)), - masterPtr->data, (unsigned) masterPtr->width, - (unsigned) masterPtr->height); + modelPtr->data, (unsigned) modelPtr->width, + (unsigned) modelPtr->height); } - if (masterPtr->maskData != NULL) { + if (modelPtr->maskData != NULL) { instancePtr->mask = XCreateBitmapFromData( Tk_Display(instancePtr->tkwin), RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)), - masterPtr->maskData, (unsigned) masterPtr->width, - (unsigned) masterPtr->height); + modelPtr->maskData, (unsigned) modelPtr->width, + (unsigned) modelPtr->height); } if (oldMask != None) { @@ -410,7 +410,7 @@ ImgBmapConfigureInstance( Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldBitmap); } - if (masterPtr->data != NULL) { + if (modelPtr->data != NULL) { gcValues.foreground = instancePtr->fg->pixel; gcValues.graphics_exposures = False; mask = GCForeground|GCGraphicsExposures; @@ -445,10 +445,10 @@ ImgBmapConfigureInstance( Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc); } instancePtr->gc = NULL; - Tcl_AppendObjToErrorInfo(masterPtr->interp, Tcl_ObjPrintf( + Tcl_AppendObjToErrorInfo(modelPtr->interp, Tcl_ObjPrintf( "\n (while configuring image \"%s\")", Tk_NameOfImage( - masterPtr->tkMaster))); - Tcl_BackgroundException(masterPtr->interp, TCL_ERROR); + modelPtr->tkModel))); + Tcl_BackgroundException(modelPtr->interp, TCL_ERROR); } /* @@ -757,7 +757,7 @@ ImgBmapCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const bmapOptions[] = {"cget", "configure", NULL}; - BitmapMaster *masterPtr = clientData; + BitmapModel *modelPtr = clientData; int index; if (objc < 2) { @@ -775,17 +775,17 @@ ImgBmapCmd( return TCL_ERROR; } return Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs, - (char *) masterPtr, Tcl_GetString(objv[2]), 0); + (char *) modelPtr, Tcl_GetString(objv[2]), 0); case 1: /* configure */ if (objc == 2) { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) masterPtr, NULL, 0); + configSpecs, (char *) modelPtr, NULL, 0); } else if (objc == 3) { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) masterPtr, + configSpecs, (char *) modelPtr, Tcl_GetString(objv[2]), 0); } else { - return ImgBmapConfigureMaster(masterPtr, objc-2, objv+2, + return ImgBmapConfigureMaster(modelPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); } default: @@ -819,7 +819,7 @@ ImgBmapGet( ClientData masterData) /* Pointer to our master structure for the * image. */ { - BitmapMaster *masterPtr = masterData; + BitmapModel *modelPtr = masterData; BitmapInstance *instancePtr; /* @@ -827,7 +827,7 @@ ImgBmapGet( * re-use it. */ - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { if (instancePtr->tkwin == tkwin) { instancePtr->refCount++; @@ -842,15 +842,15 @@ ImgBmapGet( instancePtr = ckalloc(sizeof(BitmapInstance)); instancePtr->refCount = 1; - instancePtr->masterPtr = masterPtr; + instancePtr->modelPtr = modelPtr; instancePtr->tkwin = tkwin; instancePtr->fg = NULL; instancePtr->bg = NULL; instancePtr->bitmap = None; instancePtr->mask = None; instancePtr->gc = NULL; - instancePtr->nextPtr = masterPtr->instancePtr; - masterPtr->instancePtr = instancePtr; + instancePtr->nextPtr = modelPtr->instancePtr; + modelPtr->instancePtr = instancePtr; ImgBmapConfigureInstance(instancePtr); /* @@ -858,8 +858,8 @@ ImgBmapGet( */ if (instancePtr->nextPtr == NULL) { - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width, - masterPtr->height); + Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width, + modelPtr->height); } return instancePtr; @@ -976,10 +976,10 @@ ImgBmapFree( if (instancePtr->gc != NULL) { Tk_FreeGC(display, instancePtr->gc); } - if (instancePtr->masterPtr->instancePtr == instancePtr) { - instancePtr->masterPtr->instancePtr = instancePtr->nextPtr; + if (instancePtr->modelPtr->instancePtr == instancePtr) { + instancePtr->modelPtr->instancePtr = instancePtr->nextPtr; } else { - for (prevPtr = instancePtr->masterPtr->instancePtr; + for (prevPtr = instancePtr->modelPtr->instancePtr; prevPtr->nextPtr != instancePtr; prevPtr = prevPtr->nextPtr) { /* Empty loop body */ } @@ -1007,26 +1007,26 @@ ImgBmapFree( static void ImgBmapDelete( - ClientData masterData) /* Pointer to BitmapMaster structure for + ClientData masterData) /* Pointer to BitmapModel structure for * image. Must not have any more instances. */ { - BitmapMaster *masterPtr = masterData; + BitmapModel *modelPtr = masterData; - if (masterPtr->instancePtr != NULL) { + if (modelPtr->instancePtr != NULL) { Tcl_Panic("tried to delete bitmap image when instances still exist"); } - masterPtr->tkMaster = NULL; - if (masterPtr->imageCmd != NULL) { - Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd); + modelPtr->tkModel = NULL; + if (modelPtr->imageCmd != NULL) { + Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd); } - if (masterPtr->data != NULL) { - ckfree(masterPtr->data); + if (modelPtr->data != NULL) { + ckfree(modelPtr->data); } - if (masterPtr->maskData != NULL) { - ckfree(masterPtr->maskData); + if (modelPtr->maskData != NULL) { + ckfree(modelPtr->maskData); } - Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0); - ckfree(masterPtr); + Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0); + ckfree(modelPtr); } /* @@ -1048,14 +1048,14 @@ ImgBmapDelete( static void ImgBmapCmdDeletedProc( - ClientData clientData) /* Pointer to BitmapMaster structure for + ClientData clientData) /* Pointer to BitmapModel structure for * image. */ { - BitmapMaster *masterPtr = clientData; + BitmapModel *modelPtr = clientData; - masterPtr->imageCmd = NULL; - if (masterPtr->tkMaster != NULL) { - Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster)); + modelPtr->imageCmd = NULL; + if (modelPtr->tkModel != NULL) { + Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel)); } } @@ -1198,7 +1198,7 @@ ImgBmapPostscript( int x, int y, int width, int height, int prepass) { - BitmapMaster *masterPtr = clientData; + BitmapModel *modelPtr = clientData; Tcl_InterpState interpState; Tcl_Obj *psObj; @@ -1210,7 +1210,7 @@ ImgBmapPostscript( * There is nothing to do for bitmaps with zero width or height. */ - if (width<=0 || height<=0 || masterPtr->width<=0 || masterPtr->height<=0){ + if (width<=0 || height<=0 || modelPtr->width<=0 || modelPtr->height<=0){ return TCL_OK; } @@ -1220,7 +1220,7 @@ ImgBmapPostscript( * we bail out. */ - if (masterPtr->width*masterPtr->height > 60000) { + if (modelPtr->width*modelPtr->height > 60000) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "unable to generate postscript for bitmaps larger than 60000" " pixels", -1)); @@ -1259,10 +1259,10 @@ ImgBmapPostscript( * color to the bits specified by the mask. */ - if ((masterPtr->bgUid != NULL) && (masterPtr->bgUid[0] != '\000')) { + if ((modelPtr->bgUid != NULL) && (modelPtr->bgUid[0] != '\000')) { XColor color; - TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->bgUid, + TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), modelPtr->bgUid, &color); Tcl_ResetResult(interp); if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) { @@ -1270,13 +1270,13 @@ ImgBmapPostscript( } Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); - if (masterPtr->maskData == NULL) { + if (modelPtr->maskData == NULL) { Tcl_AppendToObj(psObj, "0 0 moveto 1 0 rlineto 0 1 rlineto -1 0 rlineto " "closepath fill\n", -1); } else { - ImgBmapPsImagemask(psObj, masterPtr->width, masterPtr->height, - masterPtr->maskData); + ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height, + modelPtr->maskData); } } @@ -1284,10 +1284,10 @@ ImgBmapPostscript( * Draw the bitmap foreground, assuming there is one. */ - if ((masterPtr->fgUid != NULL) && (masterPtr->data != NULL)) { + if ((modelPtr->fgUid != NULL) && (modelPtr->data != NULL)) { XColor color; - TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->fgUid, + TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), modelPtr->fgUid, &color); Tcl_ResetResult(interp); if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) { @@ -1295,8 +1295,8 @@ ImgBmapPostscript( } Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); - ImgBmapPsImagemask(psObj, masterPtr->width, masterPtr->height, - masterPtr->data); + ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height, + modelPtr->data); } /* diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index 32b09be..a8e5b5e 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -77,7 +77,7 @@ void TkImgPhotoConfigureInstance( PhotoInstance *instancePtr) /* Instance to reconfigure. */ { - PhotoMaster *masterPtr = instancePtr->masterPtr; + PhotoModel *masterPtr = instancePtr->masterPtr; XImage *imagePtr; int bitsPerPixel; ColorTable *colorTablePtr; @@ -210,7 +210,7 @@ TkImgPhotoGet( ClientData masterData) /* Pointer to our master structure for the * image. */ { - PhotoMaster *masterPtr = masterData; + PhotoModel *masterPtr = masterData; PhotoInstance *instancePtr; Colormap colormap; int mono, nRed, nGreen, nBlue, numVisuals; @@ -768,7 +768,7 @@ void TkImgPhotoInstanceSetSize( PhotoInstance *instancePtr) /* Instance whose size is to be changed. */ { - PhotoMaster *masterPtr; + PhotoModel *masterPtr; schar *newError, *errSrcPtr, *errDestPtr; int h, offset; XRectangle validBox; @@ -1635,7 +1635,7 @@ TkImgDitherInstance( * block to be dithered. */ int width, int height) /* Dimensions of the block to be dithered. */ { - PhotoMaster *masterPtr = instancePtr->masterPtr; + PhotoModel *masterPtr = instancePtr->masterPtr; ColorTable *colorPtr = instancePtr->colorTablePtr; XImage *imagePtr; int nLines, bigEndian, i, c, x, y, xEnd, doDithering = 1; diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 26b0446..395fc9d 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -101,7 +101,7 @@ static const char *const optionNames[] = { static int ImgPhotoCreate(Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], - const Tk_ImageType *typePtr, Tk_ImageMaster master, + const Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static void ImgPhotoDelete(ClientData clientData); static int ImgPhotoPostscript(ClientData clientData, @@ -152,15 +152,15 @@ static Tcl_ThreadDataKey dataKey; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-file", NULL, NULL, - NULL, Tk_Offset(PhotoMaster, fileString), TK_CONFIG_NULL_OK, NULL}, + NULL, Tk_Offset(PhotoModel, fileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_DOUBLE, "-gamma", NULL, NULL, - DEF_PHOTO_GAMMA, Tk_Offset(PhotoMaster, gamma), 0, NULL}, + DEF_PHOTO_GAMMA, Tk_Offset(PhotoModel, gamma), 0, NULL}, {TK_CONFIG_INT, "-height", NULL, NULL, - DEF_PHOTO_HEIGHT, Tk_Offset(PhotoMaster, userHeight), 0, NULL}, + DEF_PHOTO_HEIGHT, Tk_Offset(PhotoModel, userHeight), 0, NULL}, {TK_CONFIG_UID, "-palette", NULL, NULL, - DEF_PHOTO_PALETTE, Tk_Offset(PhotoMaster, palette), 0, NULL}, + DEF_PHOTO_PALETTE, Tk_Offset(PhotoModel, palette), 0, NULL}, {TK_CONFIG_INT, "-width", NULL, NULL, - DEF_PHOTO_WIDTH, Tk_Offset(PhotoMaster, userWidth), 0, NULL}, + DEF_PHOTO_WIDTH, Tk_Offset(PhotoModel, userWidth), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; @@ -177,15 +177,15 @@ static int ParseSubcommandOptions( int *indexPtr, int objc, Tcl_Obj *const objv[]); static void ImgPhotoCmdDeletedProc(ClientData clientData); static int ImgPhotoConfigureMaster(Tcl_Interp *interp, - PhotoMaster *masterPtr, int objc, + PhotoModel *modelPtr, int objc, Tcl_Obj *const objv[], int flags); -static int ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr); -static int ImgPhotoSetSize(PhotoMaster *masterPtr, int width, +static int ToggleComplexAlphaIfNeeded(PhotoModel *mPtr); +static int ImgPhotoSetSize(PhotoModel *modelPtr, int width, int height); static int ImgStringWrite(Tcl_Interp *interp, Tcl_Obj *formatString, Tk_PhotoImageBlock *blockPtr); -static char * ImgGetPhoto(PhotoMaster *masterPtr, +static char * ImgGetPhoto(PhotoModel *modelPtr, Tk_PhotoImageBlock *blockPtr, struct SubcommandOptions *optPtr); static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan, @@ -331,38 +331,38 @@ ImgPhotoCreate( Tcl_Obj *const objv[], /* Argument objects for options (doesn't * include image name or type). */ const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */ - Tk_ImageMaster master, /* Token for image, to be used by us in later + Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - PhotoMaster *masterPtr; + PhotoModel *modelPtr; /* * Allocate and initialize the photo image master record. */ - masterPtr = ckalloc(sizeof(PhotoMaster)); - memset(masterPtr, 0, sizeof(PhotoMaster)); - masterPtr->tkMaster = master; - masterPtr->interp = interp; - masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd, - masterPtr, ImgPhotoCmdDeletedProc); - masterPtr->palette = NULL; - masterPtr->pix32 = NULL; - masterPtr->instancePtr = NULL; - masterPtr->validRegion = TkCreateRegion(); + modelPtr = ckalloc(sizeof(PhotoModel)); + memset(modelPtr, 0, sizeof(PhotoModel)); + modelPtr->tkMaster = model; + modelPtr->interp = interp; + modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd, + modelPtr, ImgPhotoCmdDeletedProc); + modelPtr->palette = NULL; + modelPtr->pix32 = NULL; + modelPtr->instancePtr = NULL; + modelPtr->validRegion = TkCreateRegion(); /* * Process configuration options given in the image create command. */ - if (ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, 0) != TCL_OK) { - ImgPhotoDelete(masterPtr); + if (ImgPhotoConfigureMaster(interp, modelPtr, objc, objv, 0) != TCL_OK) { + ImgPhotoDelete(modelPtr); return TCL_ERROR; } - *clientDataPtr = masterPtr; + *clientDataPtr = modelPtr; return TCL_OK; } @@ -401,7 +401,7 @@ ImgPhotoCmd( PHOTO_WRITE }; - PhotoMaster *masterPtr = clientData; + PhotoModel *modelPtr = clientData; int result, index, x, y, width, height, dataWidth, dataHeight, listObjc; struct SubcommandOptions options; Tcl_Obj **listObjv, **srcObjv; @@ -433,7 +433,7 @@ ImgPhotoCmd( */ if (objc == 2) { - Tk_PhotoBlank(masterPtr); + Tk_PhotoBlank(modelPtr); return TCL_OK; } else { Tcl_WrongNumArgs(interp, 2, objv, NULL); @@ -450,16 +450,16 @@ ImgPhotoCmd( arg = Tcl_GetString(objv[2]); length = objv[2]->length; if (strncmp(arg,"-data", length) == 0) { - if (masterPtr->dataString) { - Tcl_SetObjResult(interp, masterPtr->dataString); + if (modelPtr->dataString) { + Tcl_SetObjResult(interp, modelPtr->dataString); } } else if (strncmp(arg,"-format", length) == 0) { - if (masterPtr->format) { - Tcl_SetObjResult(interp, masterPtr->format); + if (modelPtr->format) { + Tcl_SetObjResult(interp, modelPtr->format); } } else { Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs, - (char *) masterPtr, Tcl_GetString(objv[2]), 0); + (char *) modelPtr, Tcl_GetString(objv[2]), 0); } return TCL_OK; } @@ -473,21 +473,21 @@ ImgPhotoCmd( Tcl_Obj *obj, *subobj; result = Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) masterPtr, NULL, 0); + configSpecs, (char *) modelPtr, NULL, 0); if (result != TCL_OK) { return result; } obj = Tcl_NewObj(); subobj = Tcl_NewStringObj("-data {} {} {}", 14); - if (masterPtr->dataString) { - Tcl_ListObjAppendElement(NULL, subobj, masterPtr->dataString); + if (modelPtr->dataString) { + Tcl_ListObjAppendElement(NULL, subobj, modelPtr->dataString); } else { Tcl_AppendStringsToObj(subobj, " {}", NULL); } Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewStringObj("-format {} {} {}", 16); - if (masterPtr->format) { - Tcl_ListObjAppendElement(NULL, subobj, masterPtr->format); + if (modelPtr->format) { + Tcl_ListObjAppendElement(NULL, subobj, modelPtr->format); } else { Tcl_AppendStringsToObj(subobj, " {}", NULL); } @@ -502,13 +502,13 @@ ImgPhotoCmd( length = objv[2]->length; if (length > 1 && !strncmp(arg, "-data", length)) { Tcl_AppendResult(interp, "-data {} {} {}", NULL); - if (masterPtr->dataString) { + if (modelPtr->dataString) { /* * TODO: Modifying result is bad! */ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), - masterPtr->dataString); + modelPtr->dataString); } else { Tcl_AppendResult(interp, " {}", NULL); } @@ -516,23 +516,23 @@ ImgPhotoCmd( } else if (length > 1 && !strncmp(arg, "-format", length)) { Tcl_AppendResult(interp, "-format {} {} {}", NULL); - if (masterPtr->format) { + if (modelPtr->format) { /* * TODO: Modifying result is bad! */ Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), - masterPtr->format); + modelPtr->format); } else { Tcl_AppendResult(interp, " {}", NULL); } return TCL_OK; } else { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) masterPtr, arg, 0); + configSpecs, (char *) modelPtr, arg, 0); } } else { - return ImgPhotoConfigureMaster(interp, masterPtr, objc-2, objv+2, + return ImgPhotoConfigureMaster(interp, modelPtr, objc-2, objv+2, TK_CONFIG_ARGV_ONLY); } @@ -591,7 +591,7 @@ ImgPhotoCmd( * has a simple alpha channel. */ - if (!(((PhotoMaster *) srcHandle)->flags & COMPLEX_ALPHA)) { + if (!(((PhotoModel *) srcHandle)->flags & COMPLEX_ALPHA)) { options.compositingRule |= SOURCE_IS_SIMPLE_ALPHA_PHOTO; } @@ -635,7 +635,7 @@ ImgPhotoCmd( + options.fromY * block.pitch; block.width = options.fromX2 - options.fromX; block.height = options.fromY2 - options.fromY; - result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr, + result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) modelPtr, &block, options.toX, options.toY, options.toX2 - options.toX, options.toY2 - options.toY, options.zoomX, options.zoomY, options.subsampleX, options.subsampleY, @@ -649,7 +649,7 @@ ImgPhotoCmd( */ if (options.options & OPT_SHRINK) { - if (ImgPhotoSetSize(masterPtr, options.toX2, + if (ImgPhotoSetSize(modelPtr, options.toX2, options.toY2) != TCL_OK) { if (options.background) { Tk_FreeColor(options.background); @@ -660,8 +660,8 @@ ImgPhotoCmd( return TCL_ERROR; } } - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, - masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, + modelPtr->width, modelPtr->height); if (options.background) { Tk_FreeColor(options.background); } @@ -691,10 +691,10 @@ ImgPhotoCmd( Tcl_WrongNumArgs(interp, 2, objv, "?-option value ...?"); return TCL_ERROR; } - if ((options.fromX > masterPtr->width) - || (options.fromY > masterPtr->height) - || (options.fromX2 > masterPtr->width) - || (options.fromY2 > masterPtr->height)) { + if ((options.fromX > modelPtr->width) + || (options.fromY > modelPtr->height) + || (options.fromX2 > modelPtr->width) + || (options.fromY2 > modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); @@ -706,8 +706,8 @@ ImgPhotoCmd( */ if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) { - options.fromX2 = masterPtr->width; - options.fromY2 = masterPtr->height; + options.fromX2 = modelPtr->width; + options.fromY2 = modelPtr->height; } /* @@ -759,7 +759,7 @@ ImgPhotoCmd( * Call the handler's string write function to write out the image. */ - data = ImgGetPhoto(masterPtr, &block, &options); + data = ImgGetPhoto(modelPtr, &block, &options); if (oldformat) { Tcl_DString buffer; @@ -807,8 +807,8 @@ ImgPhotoCmd( || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) { return TCL_ERROR; } - if ((x < 0) || (x >= masterPtr->width) - || (y < 0) || (y >= masterPtr->height)) { + if ((x < 0) || (x >= modelPtr->width) + || (y < 0) || (y >= modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s get: coordinates out of range", Tcl_GetString(objv[0]))); @@ -821,7 +821,7 @@ ImgPhotoCmd( * Extract the value of the desired pixel and format it as a string. */ - pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; + pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; channels[0] = Tcl_NewIntObj(pixelPtr[0]); channels[1] = Tcl_NewIntObj(pixelPtr[1]); channels[2] = Tcl_NewIntObj(pixelPtr[2]); @@ -870,11 +870,11 @@ ImgPhotoCmd( data = (Tcl_Obj *) Tcl_GetString(data); } if (imageFormat->stringReadProc(interp, data, format, - (Tk_PhotoHandle) masterPtr, options.toX, options.toY, + (Tk_PhotoHandle) modelPtr, options.toX, options.toY, imageWidth, imageHeight, 0, 0) != TCL_OK) { return TCL_ERROR; } - masterPtr->flags |= IMAGE_CHANGED; + modelPtr->flags |= IMAGE_CHANGED; return TCL_OK; } if (options.options & OPT_FORMAT) { @@ -1007,7 +1007,7 @@ ImgPhotoCmd( block.offset[1] = 1; block.offset[2] = 2; block.offset[3] = 0; - result = Tk_PhotoPutBlock(interp, masterPtr, &block, + result = Tk_PhotoPutBlock(interp, modelPtr, &block, options.toX, options.toY, options.toX2 - options.toX, options.toY2 - options.toY, TK_PHOTO_COMPOSITE_SET); @@ -1100,7 +1100,7 @@ ImgPhotoCmd( */ if (options.options & OPT_SHRINK) { - if (ImgPhotoSetSize(masterPtr, options.toX + width, + if (ImgPhotoSetSize(modelPtr, options.toX + width, options.toY + height) != TCL_OK) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -1122,7 +1122,7 @@ ImgPhotoCmd( } result = imageFormat->fileReadProc(interp, chan, Tcl_GetString(options.name), - format, (Tk_PhotoHandle) masterPtr, options.toX, + format, (Tk_PhotoHandle) modelPtr, options.toX, options.toY, width, height, options.fromX, options.fromY); if (chan != NULL) { Tcl_Close(NULL, chan); @@ -1141,27 +1141,27 @@ ImgPhotoCmd( * present. */ - x = masterPtr->ditherX; - y = masterPtr->ditherY; - if (masterPtr->ditherX != 0) { - Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y, - masterPtr->width - x, 1); + x = modelPtr->ditherX; + y = modelPtr->ditherY; + if (modelPtr->ditherX != 0) { + Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y, + modelPtr->width - x, 1); } - if (masterPtr->ditherY < masterPtr->height) { + if (modelPtr->ditherY < modelPtr->height) { x = 0; - Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, 0, - masterPtr->ditherY, masterPtr->width, - masterPtr->height - masterPtr->ditherY); + Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, 0, + modelPtr->ditherY, modelPtr->width, + modelPtr->height - modelPtr->ditherY); } - if (y < masterPtr->height) { + if (y < modelPtr->height) { /* * Tell the core image code that part of the image has changed. */ - Tk_ImageChanged(masterPtr->tkMaster, x, y, - (masterPtr->width - x), (masterPtr->height - y), - masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, x, y, + (modelPtr->width - x), (modelPtr->height - y), + modelPtr->width, modelPtr->height); } return TCL_OK; @@ -1195,8 +1195,8 @@ ImgPhotoCmd( || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)) { return TCL_ERROR; } - if ((x < 0) || (x >= masterPtr->width) - || (y < 0) || (y >= masterPtr->height)) { + if ((x < 0) || (x >= modelPtr->width) + || (y < 0) || (y >= modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s transparency get: coordinates out of range", Tcl_GetString(objv[0]))); @@ -1212,7 +1212,7 @@ ImgPhotoCmd( /* What a way to do a test! */ testRegion = TkCreateRegion(); TkUnionRectWithRegion(&testBox, testRegion, testRegion); - TkIntersectRegion(testRegion, masterPtr->validRegion, testRegion); + TkIntersectRegion(testRegion, modelPtr->validRegion, testRegion); TkClipBox(testRegion, &testBox); TkDestroyRegion(testRegion); @@ -1235,8 +1235,8 @@ ImgPhotoCmd( &transFlag) != TCL_OK)) { return TCL_ERROR; } - if ((x < 0) || (x >= masterPtr->width) - || (y < 0) || (y >= masterPtr->height)) { + if ((x < 0) || (x >= modelPtr->width) + || (y < 0) || (y >= modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s transparency set: coordinates out of range", Tcl_GetString(objv[0]))); @@ -1249,7 +1249,7 @@ ImgPhotoCmd( setBox.y = y; setBox.width = 1; setBox.height = 1; - pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; + pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; if (transFlag) { /* @@ -1259,8 +1259,8 @@ ImgPhotoCmd( TkRegion clearRegion = TkCreateRegion(); TkUnionRectWithRegion(&setBox, clearRegion, clearRegion); - TkSubtractRegion(masterPtr->validRegion, clearRegion, - masterPtr->validRegion); + TkSubtractRegion(modelPtr->validRegion, clearRegion, + modelPtr->validRegion); TkDestroyRegion(clearRegion); /* @@ -1273,8 +1273,8 @@ ImgPhotoCmd( * Make pixel opaque. */ - TkUnionRectWithRegion(&setBox, masterPtr->validRegion, - masterPtr->validRegion); + TkUnionRectWithRegion(&setBox, modelPtr->validRegion, + modelPtr->validRegion); pixelPtr[3] = 255; } @@ -1283,9 +1283,9 @@ ImgPhotoCmd( * has (potentially) changed. */ - Tk_ImageChanged(masterPtr->tkMaster, x, y, 1, 1, - masterPtr->width, masterPtr->height); - masterPtr->flags &= ~IMAGE_CHANGED; + Tk_ImageChanged(modelPtr->tkMaster, x, y, 1, 1, + modelPtr->width, modelPtr->height); + modelPtr->flags &= ~IMAGE_CHANGED; return TCL_OK; } @@ -1327,10 +1327,10 @@ ImgPhotoCmd( Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?"); return TCL_ERROR; } - if ((options.fromX > masterPtr->width) - || (options.fromY > masterPtr->height) - || (options.fromX2 > masterPtr->width) - || (options.fromY2 > masterPtr->height)) { + if ((options.fromX > modelPtr->width) + || (options.fromY > modelPtr->height) + || (options.fromX2 > modelPtr->width) + || (options.fromY2 > modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); @@ -1344,8 +1344,8 @@ ImgPhotoCmd( */ if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) { - options.fromX2 = masterPtr->width; - options.fromY2 = masterPtr->height; + options.fromX2 = modelPtr->width; + options.fromY2 = modelPtr->height; } if (options.format == NULL) { fmtString = GetExtension(Tcl_GetString(options.name)); @@ -1420,7 +1420,7 @@ ImgPhotoCmd( * Call the handler's file write function to write out the image. */ - data = ImgGetPhoto(masterPtr, &block, &options); + data = ImgGetPhoto(modelPtr, &block, &options); format = options.format; if (oldformat && format) { format = (Tcl_Obj *) Tcl_GetString(options.format); @@ -1767,7 +1767,7 @@ ParseSubcommandOptions( * * Results: * A standard Tcl return value. If TCL_ERROR is returned then an error - * message is left in the masterPtr->interp's result. + * message is left in the modelPtr->interp's result. * * Side effects: * Existing instances of the image will be redisplayed to match the new @@ -1779,7 +1779,7 @@ ParseSubcommandOptions( static int ImgPhotoConfigureMaster( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ - PhotoMaster *masterPtr, /* Pointer to data structure describing + PhotoModel *modelPtr, /* Pointer to data structure describing * overall photo image to (re)configure. */ int objc, /* Number of entries in objv. */ Tcl_Obj *const objv[], /* Pairs of configuration options for image. */ @@ -1839,28 +1839,28 @@ ImgPhotoConfigureMaster( * the format string influences how "-data" or "-file" is interpreted. */ - oldFileString = masterPtr->fileString; + oldFileString = modelPtr->fileString; if (oldFileString == NULL) { - oldData = masterPtr->dataString; + oldData = modelPtr->dataString; if (oldData != NULL) { Tcl_IncrRefCount(oldData); } } else { oldData = NULL; } - oldFormat = masterPtr->format; + oldFormat = modelPtr->format; if (oldFormat != NULL) { Tcl_IncrRefCount(oldFormat); } - oldPaletteString = masterPtr->palette; - oldGamma = masterPtr->gamma; + oldPaletteString = modelPtr->palette; + oldGamma = modelPtr->gamma; /* * Process the configuration options specified. */ if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs, - j, args, (char *) masterPtr, flags) != TCL_OK) { + j, args, (char *) modelPtr, flags) != TCL_OK) { ckfree(args); goto errorExit; } @@ -1870,9 +1870,9 @@ ImgPhotoConfigureMaster( * Regard the empty string for -file, -data or -format as the null value. */ - if ((masterPtr->fileString != NULL) && (masterPtr->fileString[0] == 0)) { - ckfree(masterPtr->fileString); - masterPtr->fileString = NULL; + if ((modelPtr->fileString != NULL) && (modelPtr->fileString[0] == 0)) { + ckfree(modelPtr->fileString); + modelPtr->fileString = NULL; } if (data) { /* @@ -1887,10 +1887,10 @@ ImgPhotoConfigureMaster( } else { data = NULL; } - if (masterPtr->dataString) { - Tcl_DecrRefCount(masterPtr->dataString); + if (modelPtr->dataString) { + Tcl_DecrRefCount(modelPtr->dataString); } - masterPtr->dataString = data; + modelPtr->dataString = data; } if (format) { /* @@ -1904,18 +1904,18 @@ ImgPhotoConfigureMaster( } else { format = NULL; } - if (masterPtr->format) { - Tcl_DecrRefCount(masterPtr->format); + if (modelPtr->format) { + Tcl_DecrRefCount(modelPtr->format); } - masterPtr->format = format; + modelPtr->format = format; } /* * Set the image to the user-requested size, if any, and make sure storage * is correctly allocated for this image. */ - if (ImgPhotoSetSize(masterPtr, masterPtr->width, - masterPtr->height) != TCL_OK) { + if (ImgPhotoSetSize(modelPtr, modelPtr->width, + modelPtr->height) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); @@ -1927,9 +1927,9 @@ ImgPhotoConfigureMaster( * -file or -data option. */ - if ((masterPtr->fileString != NULL) - && ((masterPtr->fileString != oldFileString) - || (masterPtr->format != oldFormat))) { + if ((modelPtr->fileString != NULL) + && ((modelPtr->fileString != oldFileString) + || (modelPtr->format != oldFormat))) { /* * Prevent file system access in a safe interpreter. */ @@ -1943,7 +1943,7 @@ ImgPhotoConfigureMaster( goto errorExit; } - chan = Tcl_OpenFileChannel(interp, masterPtr->fileString, "r", 0); + chan = Tcl_OpenFileChannel(interp, modelPtr->fileString, "r", 0); if (chan == NULL) { goto errorExit; } @@ -1954,13 +1954,13 @@ ImgPhotoConfigureMaster( if ((Tcl_SetChannelOption(interp, chan, "-translation", "binary") != TCL_OK) || - (MatchFileFormat(interp, chan, masterPtr->fileString, - masterPtr->format, &imageFormat, &imageWidth, + (MatchFileFormat(interp, chan, modelPtr->fileString, + modelPtr->format, &imageFormat, &imageWidth, &imageHeight, &oldformat) != TCL_OK)) { Tcl_Close(NULL, chan); goto errorExit; } - result = ImgPhotoSetSize(masterPtr, imageWidth, imageHeight); + result = ImgPhotoSetSize(modelPtr, imageWidth, imageHeight); if (result != TCL_OK) { Tcl_Close(NULL, chan); Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -1968,12 +1968,12 @@ ImgPhotoConfigureMaster( Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); goto errorExit; } - tempformat = masterPtr->format; + tempformat = modelPtr->format; if (oldformat && tempformat) { tempformat = (Tcl_Obj *) Tcl_GetString(tempformat); } result = imageFormat->fileReadProc(interp, chan, - masterPtr->fileString, tempformat, (Tk_PhotoHandle) masterPtr, + modelPtr->fileString, tempformat, (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight, 0, 0); Tcl_Close(NULL, chan); if (result != TCL_OK) { @@ -1981,26 +1981,26 @@ ImgPhotoConfigureMaster( } Tcl_ResetResult(interp); - masterPtr->flags |= IMAGE_CHANGED; + modelPtr->flags |= IMAGE_CHANGED; } - if ((masterPtr->fileString == NULL) && (masterPtr->dataString != NULL) - && ((masterPtr->dataString != oldData) - || (masterPtr->format != oldFormat))) { + if ((modelPtr->fileString == NULL) && (modelPtr->dataString != NULL) + && ((modelPtr->dataString != oldData) + || (modelPtr->format != oldFormat))) { - if (MatchStringFormat(interp, masterPtr->dataString, - masterPtr->format, &imageFormat, &imageWidth, + if (MatchStringFormat(interp, modelPtr->dataString, + modelPtr->format, &imageFormat, &imageWidth, &imageHeight, &oldformat) != TCL_OK) { goto errorExit; } - if (ImgPhotoSetSize(masterPtr, imageWidth, imageHeight) != TCL_OK) { + if (ImgPhotoSetSize(modelPtr, imageWidth, imageHeight) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); goto errorExit; } - tempformat = masterPtr->format; - tempdata = masterPtr->dataString; + tempformat = modelPtr->format; + tempdata = modelPtr->dataString; if (oldformat) { if (tempformat) { tempformat = (Tcl_Obj *) Tcl_GetString(tempformat); @@ -2008,26 +2008,26 @@ ImgPhotoConfigureMaster( tempdata = (Tcl_Obj *) Tcl_GetString(tempdata); } if (imageFormat->stringReadProc(interp, tempdata, tempformat, - (Tk_PhotoHandle) masterPtr, 0, 0, imageWidth, imageHeight, + (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight, 0, 0) != TCL_OK) { goto errorExit; } Tcl_ResetResult(interp); - masterPtr->flags |= IMAGE_CHANGED; + modelPtr->flags |= IMAGE_CHANGED; } /* * Enforce a reasonable value for gamma. */ - if (masterPtr->gamma <= 0) { - masterPtr->gamma = 1.0; + if (modelPtr->gamma <= 0) { + modelPtr->gamma = 1.0; } - if ((masterPtr->gamma != oldGamma) - || (masterPtr->palette != oldPaletteString)) { - masterPtr->flags |= IMAGE_CHANGED; + if ((modelPtr->gamma != oldGamma) + || (modelPtr->palette != oldPaletteString)) { + modelPtr->flags |= IMAGE_CHANGED; } /* @@ -2036,7 +2036,7 @@ ImgPhotoConfigureMaster( * everywhere that it is used. */ - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { TkImgPhotoConfigureInstance(instancePtr); } @@ -2045,9 +2045,9 @@ ImgPhotoConfigureMaster( * Inform the generic image code that the image has (potentially) changed. */ - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width, - masterPtr->height, masterPtr->width, masterPtr->height); - masterPtr->flags &= ~IMAGE_CHANGED; + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width, + modelPtr->height, modelPtr->width, modelPtr->height); + modelPtr->flags &= ~IMAGE_CHANGED; if (oldData != NULL) { Tcl_DecrRefCount(oldData); @@ -2056,7 +2056,7 @@ ImgPhotoConfigureMaster( Tcl_DecrRefCount(oldFormat); } - ToggleComplexAlphaIfNeeded(masterPtr); + ToggleComplexAlphaIfNeeded(modelPtr); return TCL_OK; @@ -2090,7 +2090,7 @@ ImgPhotoConfigureMaster( static int ToggleComplexAlphaIfNeeded( - PhotoMaster *mPtr) + PhotoModel *mPtr) { size_t len = (size_t)MAX(mPtr->userWidth, mPtr->width) * (size_t)MAX(mPtr->userHeight, mPtr->height) * 4; @@ -2135,37 +2135,37 @@ ToggleComplexAlphaIfNeeded( static void ImgPhotoDelete( - ClientData masterData) /* Pointer to PhotoMaster structure for image. + ClientData masterData) /* Pointer to PhotoModel structure for image. * Must not have any more instances. */ { - PhotoMaster *masterPtr = masterData; + PhotoModel *modelPtr = masterData; PhotoInstance *instancePtr; - while ((instancePtr = masterPtr->instancePtr) != NULL) { + while ((instancePtr = modelPtr->instancePtr) != NULL) { if (instancePtr->refCount > 0) { Tcl_Panic("tried to delete photo image when instances still exist"); } Tcl_CancelIdleCall(TkImgDisposeInstance, instancePtr); TkImgDisposeInstance(instancePtr); } - masterPtr->tkMaster = NULL; - if (masterPtr->imageCmd != NULL) { - Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd); + modelPtr->tkMaster = NULL; + if (modelPtr->imageCmd != NULL) { + Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd); } - if (masterPtr->pix32 != NULL) { - ckfree(masterPtr->pix32); + if (modelPtr->pix32 != NULL) { + ckfree(modelPtr->pix32); } - if (masterPtr->validRegion != NULL) { - TkDestroyRegion(masterPtr->validRegion); + if (modelPtr->validRegion != NULL) { + TkDestroyRegion(modelPtr->validRegion); } - if (masterPtr->dataString != NULL) { - Tcl_DecrRefCount(masterPtr->dataString); + if (modelPtr->dataString != NULL) { + Tcl_DecrRefCount(modelPtr->dataString); } - if (masterPtr->format != NULL) { - Tcl_DecrRefCount(masterPtr->format); + if (modelPtr->format != NULL) { + Tcl_DecrRefCount(modelPtr->format); } - Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0); - ckfree(masterPtr); + Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0); + ckfree(modelPtr); } /* @@ -2187,14 +2187,14 @@ ImgPhotoDelete( static void ImgPhotoCmdDeletedProc( - ClientData clientData) /* Pointer to PhotoMaster structure for + ClientData clientData) /* Pointer to PhotoModel structure for * image. */ { - PhotoMaster *masterPtr = clientData; + PhotoModel *modelPtr = clientData; - masterPtr->imageCmd = NULL; - if (masterPtr->tkMaster != NULL) { - Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster)); + modelPtr->imageCmd = NULL; + if (modelPtr->tkMaster != NULL) { + Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkMaster)); } } @@ -2219,7 +2219,7 @@ ImgPhotoCmdDeletedProc( static int ImgPhotoSetSize( - PhotoMaster *masterPtr, + PhotoModel *modelPtr, int width, int height) { unsigned char *newPix32 = NULL; @@ -2229,11 +2229,11 @@ ImgPhotoSetSize( TkRegion clipRegion; PhotoInstance *instancePtr; - if (masterPtr->userWidth > 0) { - width = masterPtr->userWidth; + if (modelPtr->userWidth > 0) { + width = modelPtr->userWidth; } - if (masterPtr->userHeight > 0) { - height = masterPtr->userHeight; + if (modelPtr->userHeight > 0) { + height = modelPtr->userHeight; } if (width > INT_MAX / 4) { @@ -2247,8 +2247,8 @@ ImgPhotoSetSize( * failures will leave the photo unchanged. */ - if ((width != masterPtr->width) || (height != masterPtr->height) - || (masterPtr->pix32 == NULL)) { + if ((width != modelPtr->width) || (height != modelPtr->height) + || (modelPtr->pix32 == NULL)) { unsigned newPixSize; if (pitch && height > (int)(UINT_MAX / pitch)) { @@ -2275,7 +2275,7 @@ ImgPhotoSetSize( * image size. */ - TkClipBox(masterPtr->validRegion, &validBox); + TkClipBox(modelPtr->validRegion, &validBox); if ((validBox.x + validBox.width > width) || (validBox.y + validBox.height > height)) { clipBox.x = 0; @@ -2284,10 +2284,10 @@ ImgPhotoSetSize( clipBox.height = height; clipRegion = TkCreateRegion(); TkUnionRectWithRegion(&clipBox, clipRegion, clipRegion); - TkIntersectRegion(masterPtr->validRegion, clipRegion, - masterPtr->validRegion); + TkIntersectRegion(modelPtr->validRegion, clipRegion, + modelPtr->validRegion); TkDestroyRegion(clipRegion); - TkClipBox(masterPtr->validRegion, &validBox); + TkClipBox(modelPtr->validRegion, &validBox); } /* @@ -2303,8 +2303,8 @@ ImgPhotoSetSize( * or written to a file. */ - if ((masterPtr->pix32 != NULL) - && ((width == masterPtr->width) || (width == validBox.width))) { + if ((modelPtr->pix32 != NULL) + && ((width == modelPtr->width) || (width == validBox.width))) { if (validBox.y > 0) { memset(newPix32, 0, ((size_t) validBox.y * pitch)); } @@ -2316,20 +2316,20 @@ ImgPhotoSetSize( memset(newPix32, 0, ((size_t)height * pitch)); } - if (masterPtr->pix32 != NULL) { + if (modelPtr->pix32 != NULL) { /* * Copy the common area over to the new array array and free the * old array. */ - if (width == masterPtr->width) { + if (width == modelPtr->width) { /* * The region to be copied is contiguous. */ offset = validBox.y * pitch; - memcpy(newPix32 + offset, masterPtr->pix32 + offset, + memcpy(newPix32 + offset, modelPtr->pix32 + offset, ((size_t)validBox.height * pitch)); } else if ((validBox.width > 0) && (validBox.height > 0)) { @@ -2338,21 +2338,21 @@ ImgPhotoSetSize( */ destPtr = newPix32 + (validBox.y * width + validBox.x) * 4; - srcPtr = masterPtr->pix32 + (validBox.y * masterPtr->width + srcPtr = modelPtr->pix32 + (validBox.y * modelPtr->width + validBox.x) * 4; for (h = validBox.height; h > 0; h--) { memcpy(destPtr, srcPtr, ((size_t)validBox.width * 4)); destPtr += width * 4; - srcPtr += masterPtr->width * 4; + srcPtr += modelPtr->width * 4; } } - ckfree(masterPtr->pix32); + ckfree(modelPtr->pix32); } - masterPtr->pix32 = newPix32; - masterPtr->width = width; - masterPtr->height = height; + modelPtr->pix32 = newPix32; + modelPtr->width = width; + modelPtr->height = height; /* * Dithering will be correct up to the end of the last pre-existing @@ -2360,27 +2360,27 @@ ImgPhotoSetSize( */ if ((validBox.x > 0) || (validBox.y > 0)) { - masterPtr->ditherX = 0; - masterPtr->ditherY = 0; + modelPtr->ditherX = 0; + modelPtr->ditherY = 0; } else if (validBox.width == width) { - if ((int) validBox.height < masterPtr->ditherY) { - masterPtr->ditherX = 0; - masterPtr->ditherY = validBox.height; + if ((int) validBox.height < modelPtr->ditherY) { + modelPtr->ditherX = 0; + modelPtr->ditherY = validBox.height; } - } else if ((masterPtr->ditherY > 0) - || ((int) validBox.width < masterPtr->ditherX)) { - masterPtr->ditherX = validBox.width; - masterPtr->ditherY = 0; + } else if ((modelPtr->ditherY > 0) + || ((int) validBox.width < modelPtr->ditherX)) { + modelPtr->ditherX = validBox.width; + modelPtr->ditherY = 0; } } - ToggleComplexAlphaIfNeeded(masterPtr); + ToggleComplexAlphaIfNeeded(modelPtr); /* * Now adjust the sizes of the pixmaps for all of the instances. */ - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { TkImgPhotoInstanceSetSize(instancePtr); } @@ -2659,7 +2659,7 @@ MatchStringFormat( * Tk_FindPhoto -- * * This function is called to get an opaque handle (actually a - * PhotoMaster *) for a given image, which can be used in subsequent + * PhotoModel *) for a given image, which can be used in subsequent * calls to Tk_PhotoPutBlock, etc. The `name' parameter is the name of * the image. * @@ -2724,7 +2724,7 @@ Tk_PhotoPutBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoMaster *masterPtr = (PhotoMaster *) handle; + register PhotoModel *modelPtr = (PhotoModel *) handle; Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -2743,12 +2743,12 @@ Tk_PhotoPutBlock( compRule &= ~SOURCE_IS_SIMPLE_ALPHA_PHOTO; - if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) { - width = masterPtr->userWidth - x; + if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) { + width = modelPtr->userWidth - x; } - if ((masterPtr->userHeight != 0) - && ((y + height) > masterPtr->userHeight)) { - height = masterPtr->userHeight - y; + if ((modelPtr->userHeight != 0) + && ((y + height) > modelPtr->userHeight)) { + height = modelPtr->userHeight - y; } if ((width <= 0) || (height <= 0)) { return TCL_OK; @@ -2769,18 +2769,18 @@ Tk_PhotoPutBlock( */ sourceBlock = *blockPtr; memToFree = NULL; - if (sourceBlock.pixelPtr >= masterPtr->pix32 - && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width - * masterPtr->height * 4) { + if (sourceBlock.pixelPtr >= modelPtr->pix32 + && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width + * modelPtr->height * 4) { /* * Fix 5c51be6411: avoid reading * * (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize) * - * bytes past the end of masterPtr->pix32[] when + * bytes past the end of modelPtr->pix32[] when * - * blockPtr->pixelPtr > (masterPtr->pix32 + - * 4 * masterPtr->width * masterPtr->height - + * blockPtr->pixelPtr > (modelPtr->pix32 + + * 4 * modelPtr->width * modelPtr->height - * sourceBlock.height * sourceBlock.pitch) */ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + @@ -2802,9 +2802,9 @@ Tk_PhotoPutBlock( xEnd = x + width; yEnd = y + height; - if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) { - if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width), - MAX(yEnd, masterPtr->height)) == TCL_ERROR) { + if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) { + if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width), + MAX(yEnd, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); @@ -2814,14 +2814,14 @@ Tk_PhotoPutBlock( } } - if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY) - && (x < masterPtr->ditherX))) { + if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY) + && (x < modelPtr->ditherX))) { /* * The dithering isn't correct past the start of this block. */ - masterPtr->ditherX = x; - masterPtr->ditherY = y; + modelPtr->ditherX = x; + modelPtr->ditherY = y; } /* @@ -2839,7 +2839,7 @@ Tk_PhotoPutBlock( alphaOffset -= sourceBlock.offset[0]; } if ((greenOffset != 0) || (blueOffset != 0)) { - masterPtr->flags |= COLOR_IMAGE; + modelPtr->flags |= COLOR_IMAGE; } /* @@ -2847,8 +2847,8 @@ Tk_PhotoPutBlock( * single memmove, we do. */ - destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; - pitch = masterPtr->width * 4; + destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; + pitch = modelPtr->width * 4; /* * Test to see if we can do the whole write in a single copy. This test is @@ -2859,7 +2859,7 @@ Tk_PhotoPutBlock( if ((sourceBlock.pixelSize == 4) && (greenOffset == 1) && (blueOffset == 2) && (alphaOffset == 3) && (width <= sourceBlock.width) && (height <= sourceBlock.height) - && ((height == 1) || ((x == 0) && (width == masterPtr->width) + && ((height == 1) || ((x == 0) && (width == modelPtr->width) && (sourceBlock.pitch == pitch))) && (compRule == TK_PHOTO_COMPOSITE_SET)) { memmove(destLinePtr, sourceBlock.pixelPtr + sourceBlock.offset[0], @@ -3041,8 +3041,8 @@ Tk_PhotoPutBlock( rect.width = width; rect.height = height; TkUnionRectWithRegion(&rect, workRgn, workRgn); - TkSubtractRegion(masterPtr->validRegion, workRgn, - masterPtr->validRegion); + TkSubtractRegion(modelPtr->validRegion, workRgn, + modelPtr->validRegion); TkDestroyRegion(workRgn); } @@ -3051,17 +3051,17 @@ Tk_PhotoPutBlock( * allow for more efficient per-platform implementations. [Bug 919066] */ - TkpBuildRegionFromAlphaData(masterPtr->validRegion, (unsigned) x, + TkpBuildRegionFromAlphaData(modelPtr->validRegion, (unsigned) x, (unsigned) y, (unsigned) width, (unsigned) height, - masterPtr->pix32 + (y * masterPtr->width + x) * 4 + 3, - 4, (unsigned) masterPtr->width * 4); + modelPtr->pix32 + (y * modelPtr->width + x) * 4 + 3, + 4, (unsigned) modelPtr->width * 4); } else { rect.x = x; rect.y = y; rect.width = width; rect.height = height; - TkUnionRectWithRegion(&rect, masterPtr->validRegion, - masterPtr->validRegion); + TkUnionRectWithRegion(&rect, modelPtr->validRegion, + modelPtr->validRegion); } /* @@ -3076,21 +3076,21 @@ Tk_PhotoPutBlock( * [Patch 1539990] */ - if (!(masterPtr->flags & COMPLEX_ALPHA)) { + if (!(modelPtr->flags & COMPLEX_ALPHA)) { register int x1; for (x1=x ; x1<x+width ; x1++) { register unsigned char newAlpha; - destLinePtr = masterPtr->pix32 + (y*masterPtr->width + x1)*4; + destLinePtr = modelPtr->pix32 + (y*modelPtr->width + x1)*4; newAlpha = destLinePtr[3]; if (newAlpha && newAlpha != 255) { - masterPtr->flags |= COMPLEX_ALPHA; + modelPtr->flags |= COMPLEX_ALPHA; break; } } } - } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) { + } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) { /* * Check for partial transparency if alpha pixels are specified, or * rescan if we already knew such pixels existed. To restrict this @@ -3098,21 +3098,21 @@ Tk_PhotoPutBlock( * the alpha pixels are. */ - ToggleComplexAlphaIfNeeded(masterPtr); + ToggleComplexAlphaIfNeeded(modelPtr); } /* * Update each instance. */ - Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, x, y, width, height); + Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, x, y, width, height); /* * Tell the core image code that this image has changed. */ - Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, - masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height, + modelPtr->width, modelPtr->height); if (memToFree) ckfree(memToFree); @@ -3162,7 +3162,7 @@ Tk_PhotoPutZoomedBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoMaster *masterPtr = (PhotoMaster *) handle; + register PhotoModel *modelPtr = (PhotoModel *) handle; register Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -3190,12 +3190,12 @@ Tk_PhotoPutZoomedBlock( if (zoomX <= 0 || zoomY <= 0) { return TCL_OK; } - if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) { - width = masterPtr->userWidth - x; + if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) { + width = modelPtr->userWidth - x; } - if ((masterPtr->userHeight != 0) - && ((y + height) > masterPtr->userHeight)) { - height = masterPtr->userHeight - y; + if ((modelPtr->userHeight != 0) + && ((y + height) > modelPtr->userHeight)) { + height = modelPtr->userHeight - y; } if (width <= 0 || height <= 0) { return TCL_OK; @@ -3215,18 +3215,18 @@ Tk_PhotoPutZoomedBlock( */ sourceBlock = *blockPtr; memToFree = NULL; - if (sourceBlock.pixelPtr >= masterPtr->pix32 - && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width - * masterPtr->height * 4) { + if (sourceBlock.pixelPtr >= modelPtr->pix32 + && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width + * modelPtr->height * 4) { /* * Fix 5c51be6411: avoid reading * * (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize) * - * bytes past the end of masterPtr->pix32[] when + * bytes past the end of modelPtr->pix32[] when * - * blockPtr->pixelPtr > (masterPtr->pix32 + - * 4 * masterPtr->width * masterPtr->height - + * blockPtr->pixelPtr > (modelPtr->pix32 + + * 4 * modelPtr->width * modelPtr->height - * sourceBlock.height * sourceBlock.pitch) */ unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch + @@ -3247,9 +3247,9 @@ Tk_PhotoPutZoomedBlock( xEnd = x + width; yEnd = y + height; - if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) { - if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width), - MAX(yEnd, masterPtr->height)) == TCL_ERROR) { + if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) { + if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width), + MAX(yEnd, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); @@ -3259,14 +3259,14 @@ Tk_PhotoPutZoomedBlock( } } - if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY) - && (x < masterPtr->ditherX))) { + if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY) + && (x < modelPtr->ditherX))) { /* * The dithering isn't correct past the start of this block. */ - masterPtr->ditherX = x; - masterPtr->ditherY = y; + modelPtr->ditherX = x; + modelPtr->ditherY = y; } /* @@ -3284,7 +3284,7 @@ Tk_PhotoPutZoomedBlock( alphaOffset -= sourceBlock.offset[0]; } if ((greenOffset != 0) || (blueOffset != 0)) { - masterPtr->flags |= COLOR_IMAGE; + modelPtr->flags |= COLOR_IMAGE; } /* @@ -3313,7 +3313,7 @@ Tk_PhotoPutZoomedBlock( * Copy the data into our local 32-bit/pixel array. */ - destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; + destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; srcOrigPtr = sourceBlock.pixelPtr + sourceBlock.offset[0]; if (subsampleX < 0) { srcOrigPtr += (sourceBlock.width - 1) * sourceBlock.pixelSize; @@ -3322,7 +3322,7 @@ Tk_PhotoPutZoomedBlock( srcOrigPtr += (sourceBlock.height - 1) * sourceBlock.pitch; } - pitch = masterPtr->width * 4; + pitch = modelPtr->width * 4; for (hLeft = height; hLeft > 0; ) { hCopy = MIN(hLeft, blockHt); hLeft -= hCopy; @@ -3409,22 +3409,22 @@ Tk_PhotoPutZoomedBlock( rect.width = width; rect.height = 1; TkUnionRectWithRegion(&rect, workRgn, workRgn); - TkSubtractRegion(masterPtr->validRegion, workRgn, - masterPtr->validRegion); + TkSubtractRegion(modelPtr->validRegion, workRgn, + modelPtr->validRegion); TkDestroyRegion(workRgn); } - TkpBuildRegionFromAlphaData(masterPtr->validRegion, + TkpBuildRegionFromAlphaData(modelPtr->validRegion, (unsigned)x, (unsigned)y, (unsigned)width, (unsigned)height, - &masterPtr->pix32[(y * masterPtr->width + x) * 4 + 3], 4, - (unsigned) masterPtr->width * 4); + &modelPtr->pix32[(y * modelPtr->width + x) * 4 + 3], 4, + (unsigned) modelPtr->width * 4); } else { rect.x = x; rect.y = y; rect.width = width; rect.height = height; - TkUnionRectWithRegion(&rect, masterPtr->validRegion, - masterPtr->validRegion); + TkUnionRectWithRegion(&rect, modelPtr->validRegion, + modelPtr->validRegion); } /* @@ -3437,38 +3437,38 @@ Tk_PhotoPutZoomedBlock( * builds up large simple-alpha images by single pixels. We don't * negate COMPLEX_ALPHA in this case. [Bug 1409140] */ - if (!(masterPtr->flags & COMPLEX_ALPHA)) { + if (!(modelPtr->flags & COMPLEX_ALPHA)) { unsigned char newAlpha; - destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; + destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4; newAlpha = destLinePtr[3]; if (newAlpha && newAlpha != 255) { - masterPtr->flags |= COMPLEX_ALPHA; + modelPtr->flags |= COMPLEX_ALPHA; } } - } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) { + } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) { /* * Check for partial transparency if alpha pixels are specified, or * rescan if we already knew such pixels existed. To restrict this * Toggle to only checking the changed pixels requires knowing where * the alpha pixels are. */ - ToggleComplexAlphaIfNeeded(masterPtr); + ToggleComplexAlphaIfNeeded(modelPtr); } /* * Update each instance. */ - Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y, width, height); + Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y, width, height); /* * Tell the core image code that this image has changed. */ - Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, masterPtr->width, - masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, x, y, width, height, modelPtr->width, + modelPtr->height); if (memToFree) ckfree(memToFree); @@ -3493,7 +3493,7 @@ Tk_PhotoPutZoomedBlock( * * Side effects: * The pixmap of each instance of this image gets updated. The fields in - * *masterPtr indicating which area of the image is correctly dithered + * *modelPtr indicating which area of the image is correctly dithered * get updated. * *---------------------------------------------------------------------- @@ -3507,14 +3507,14 @@ Tk_DitherPhoto( * area to be dithered. */ int width, int height) /* Dimensions of the area to be dithered. */ { - PhotoMaster *masterPtr = (PhotoMaster *) photo; + PhotoModel *modelPtr = (PhotoModel *) photo; PhotoInstance *instancePtr; if ((width <= 0) || (height <= 0)) { return; } - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { TkImgDitherInstance(instancePtr, x, y, width, height); } @@ -3524,23 +3524,23 @@ Tk_DitherPhoto( * will extend the correctly dithered region. */ - if (((y < masterPtr->ditherY) - || ((y == masterPtr->ditherY) && (x <= masterPtr->ditherX))) - && ((y + height) > (masterPtr->ditherY))) { + if (((y < modelPtr->ditherY) + || ((y == modelPtr->ditherY) && (x <= modelPtr->ditherX))) + && ((y + height) > (modelPtr->ditherY))) { /* * This block starts inside (or immediately after) the correctly * dithered region, so the first scan line at least will be right. - * Furthermore this block extends into scanline masterPtr->ditherY. + * Furthermore this block extends into scanline modelPtr->ditherY. */ - if ((x == 0) && (width == masterPtr->width)) { + if ((x == 0) && (width == modelPtr->width)) { /* * We are doing the full width, therefore the dithering will be * correct to the end. */ - masterPtr->ditherX = 0; - masterPtr->ditherY = y + height; + modelPtr->ditherX = 0; + modelPtr->ditherY = y + height; } else { /* * We are doing partial scanlines, therefore the @@ -3548,11 +3548,11 @@ Tk_DitherPhoto( * line. */ - if (x <= masterPtr->ditherX) { - masterPtr->ditherX = x + width; - if (masterPtr->ditherX >= masterPtr->width) { - masterPtr->ditherX = 0; - masterPtr->ditherY++; + if (x <= modelPtr->ditherX) { + modelPtr->ditherX = x + width; + if (modelPtr->ditherX >= modelPtr->width) { + modelPtr->ditherX = 0; + modelPtr->ditherY++; } } } @@ -3580,29 +3580,29 @@ void Tk_PhotoBlank( Tk_PhotoHandle handle) /* Handle for the image to be blanked. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; PhotoInstance *instancePtr; - masterPtr->ditherX = masterPtr->ditherY = 0; - masterPtr->flags = 0; + modelPtr->ditherX = modelPtr->ditherY = 0; + modelPtr->flags = 0; /* * The image has valid data nowhere. */ - if (masterPtr->validRegion != NULL) { - TkDestroyRegion(masterPtr->validRegion); + if (modelPtr->validRegion != NULL) { + TkDestroyRegion(modelPtr->validRegion); } - masterPtr->validRegion = TkCreateRegion(); + modelPtr->validRegion = TkCreateRegion(); /* * Clear out the 32-bit pixel storage array. Clear out the dithering error * arrays for each instance. */ - memset(masterPtr->pix32, 0, - ((size_t)masterPtr->width * masterPtr->height * 4)); - for (instancePtr = masterPtr->instancePtr; instancePtr != NULL; + memset(modelPtr->pix32, 0, + ((size_t)modelPtr->width * modelPtr->height * 4)); + for (instancePtr = modelPtr->instancePtr; instancePtr != NULL; instancePtr = instancePtr->nextPtr) { TkImgResetDither(instancePtr); } @@ -3611,8 +3611,8 @@ Tk_PhotoBlank( * Tell the core image code that this image has changed. */ - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width, - masterPtr->height, masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, modelPtr->width, + modelPtr->height, modelPtr->width, modelPtr->height); } /* @@ -3642,17 +3642,17 @@ Tk_PhotoExpand( Tk_PhotoHandle handle, /* Handle for the image to be expanded. */ int width, int height) /* Desired minimum dimensions of the image. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; - if (width <= masterPtr->width) { - width = masterPtr->width; + if (width <= modelPtr->width) { + width = modelPtr->width; } - if (height <= masterPtr->height) { - height = masterPtr->height; + if (height <= modelPtr->height) { + height = modelPtr->height; } - if ((width != masterPtr->width) || (height != masterPtr->height)) { - if (ImgPhotoSetSize(masterPtr, MAX(width, masterPtr->width), - MAX(height, masterPtr->height)) == TCL_ERROR) { + if ((width != modelPtr->width) || (height != modelPtr->height)) { + if (ImgPhotoSetSize(modelPtr, MAX(width, modelPtr->width), + MAX(height, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); @@ -3660,8 +3660,8 @@ Tk_PhotoExpand( } return TCL_ERROR; } - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width, - masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, modelPtr->width, + modelPtr->height); } return TCL_OK; } @@ -3690,10 +3690,10 @@ Tk_PhotoGetSize( /* The dimensions of the image are returned * here. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; - *widthPtr = masterPtr->width; - *heightPtr = masterPtr->height; + *widthPtr = modelPtr->width; + *heightPtr = modelPtr->height; } /* @@ -3722,12 +3722,12 @@ Tk_PhotoSetSize( * set. */ int width, int height) /* New dimensions for the image. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; - masterPtr->userWidth = width; - masterPtr->userHeight = height; - if (ImgPhotoSetSize(masterPtr, ((width > 0) ? width: masterPtr->width), - ((height > 0) ? height: masterPtr->height)) == TCL_ERROR) { + modelPtr->userWidth = width; + modelPtr->userHeight = height; + if (ImgPhotoSetSize(modelPtr, ((width > 0) ? width: modelPtr->width), + ((height > 0) ? height: modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); @@ -3735,8 +3735,8 @@ Tk_PhotoSetSize( } return TCL_ERROR; } - Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, - masterPtr->width, masterPtr->height); + Tk_ImageChanged(modelPtr->tkMaster, 0, 0, 0, 0, + modelPtr->width, modelPtr->height); return TCL_OK; } @@ -3765,9 +3765,9 @@ TkPhotoGetValidRegion( Tk_PhotoHandle handle) /* Handle for the image whose valid region is * to obtained. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; - return masterPtr->validRegion; + return modelPtr->validRegion; } /* @@ -3793,7 +3793,7 @@ TkPhotoGetValidRegion( static char * ImgGetPhoto( - PhotoMaster *masterPtr, /* Handle for the photo image from which image + PhotoModel *modelPtr, /* Handle for the photo image from which image * data is desired. */ Tk_PhotoImageBlock *blockPtr, /* Information about the address and layout of @@ -3803,13 +3803,13 @@ ImgGetPhoto( unsigned char *pixelPtr; int x, y, greenOffset, blueOffset, alphaOffset; - Tk_PhotoGetImage((Tk_PhotoHandle) masterPtr, blockPtr); + Tk_PhotoGetImage((Tk_PhotoHandle) modelPtr, blockPtr); blockPtr->pixelPtr += optPtr->fromY * blockPtr->pitch + optPtr->fromX * blockPtr->pixelSize; blockPtr->width = optPtr->fromX2 - optPtr->fromX; blockPtr->height = optPtr->fromY2 - optPtr->fromY; - if (!(masterPtr->flags & COLOR_IMAGE) && + if (!(modelPtr->flags & COLOR_IMAGE) && (!(optPtr->options & OPT_BACKGROUND) || ((optPtr->background->red == optPtr->background->green) && (optPtr->background->red == optPtr->background->blue)))) { @@ -4041,12 +4041,12 @@ Tk_PhotoGetImage( /* Information about the address and layout of * the image data is returned here. */ { - PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoModel *modelPtr = (PhotoModel *) handle; - blockPtr->pixelPtr = masterPtr->pix32; - blockPtr->width = masterPtr->width; - blockPtr->height = masterPtr->height; - blockPtr->pitch = masterPtr->width * 4; + blockPtr->pixelPtr = modelPtr->pix32; + blockPtr->width = modelPtr->width; + blockPtr->height = modelPtr->height; + blockPtr->pitch = modelPtr->width * 4; blockPtr->pixelSize = 4; blockPtr->offset[0] = 0; blockPtr->offset[1] = 1; diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h index 36bc6cb..90705e9 100644 --- a/generic/tkImgPhoto.h +++ b/generic/tkImgPhoto.h @@ -27,10 +27,11 @@ * Forward declarations of the structures we define. */ +#define PhotoMaster PhotoModel typedef struct ColorTableId ColorTableId; typedef struct ColorTable ColorTable; typedef struct PhotoInstance PhotoInstance; -typedef struct PhotoMaster PhotoMaster; +typedef struct PhotoModel PhotoModel; /* * A signed 8-bit integral type. If chars are unsigned and the compiler isn't @@ -140,8 +141,8 @@ struct ColorTable { * Definition of the data associated with each photo image master. */ -struct PhotoMaster { - Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the +struct PhotoModel { + Tk_ImageModel tkMaster; /* Tk's token for image model. NULL means the * image is being deleted. */ Tcl_Interp *interp; /* Interpreter associated with the application * using this image. */ @@ -168,7 +169,7 @@ struct PhotoMaster { }; /* - * Bit definitions for the flags field of a PhotoMaster. + * Bit definitions for the flags field of a PhotoModel. * COLOR_IMAGE: 1 means that the image has different color * components. * IMAGE_CHANGED: 1 means that the instances of this image need @@ -195,7 +196,7 @@ struct PhotoMaster { */ struct PhotoInstance { - PhotoMaster *masterPtr; /* Pointer to master for image. */ + PhotoModel *masterPtr; /* Pointer to master for image. */ Display *display; /* Display for windows using this instance. */ Colormap colormap; /* The image may only be used in windows with * this particular colormap. */ diff --git a/generic/tkInt.h b/generic/tkInt.h index 23605cf..9c61c20 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -665,7 +665,7 @@ typedef struct TkMainInfo { /* Top level of option hierarchy for this main * window. NULL means uninitialized. Managed * by tkOption.c. */ - Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageMaster + Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageModel * structures. Managed by tkImage.c. */ int strictMotif; /* This is linked to the tk_strictMotif global * variable. */ diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c index 948883d..8996f31 100644 --- a/generic/tkOldTest.c +++ b/generic/tkOldTest.c @@ -25,17 +25,17 @@ #include "tkInt.h" /* - * The following data structure represents the master for a test image: + * The following data structure represents the model for a test image: */ -typedef struct TImageMaster { - Tk_ImageMaster master; /* Tk's token for image master. */ +typedef struct TImageModel { + Tk_ImageModel model; /* Tk's token for image model. */ Tcl_Interp *interp; /* Interpreter for application. */ int width, height; /* Dimensions of image. */ char *imageName; /* Name of image (malloc-ed). */ char *varName; /* Name of variable in which to log events for * image (malloc-ed). */ -} TImageMaster; +} TImageModel; /* * The following data structure represents a particular use of a particular @@ -43,7 +43,7 @@ typedef struct TImageMaster { */ typedef struct TImageInstance { - TImageMaster *masterPtr; /* Pointer to master for image. */ + TImageModel *modelPtr; /* Pointer to model for image. */ XColor *fg; /* Foreground color for drawing in image. */ GC gc; /* Graphics context for drawing in image. */ } TImageInstance; @@ -54,7 +54,7 @@ typedef struct TImageInstance { static int ImageCreate(Tcl_Interp *interp, char *name, int argc, char **argv, - Tk_ImageType *typePtr, Tk_ImageMaster master, + Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static ClientData ImageGet(Tk_Window tkwin, ClientData clientData); static void ImageDisplay(ClientData clientData, @@ -143,12 +143,12 @@ ImageCreate( char **argv, /* Argument strings for options (doesn't * include image name or type). */ Tk_ImageType *typePtr, /* Pointer to our type record (not used). */ - Tk_ImageMaster master, /* Token for image, to be used by us in later + Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - TImageMaster *timPtr; + TImageModel *timPtr; const char *varName; int i; @@ -167,8 +167,8 @@ ImageCreate( varName = argv[i+1]; } - timPtr = ckalloc(sizeof(TImageMaster)); - timPtr->master = master; + timPtr = ckalloc(sizeof(TImageModel)); + timPtr->model = model; timPtr->interp = interp; timPtr->width = 30; timPtr->height = 15; @@ -178,7 +178,7 @@ ImageCreate( strcpy(timPtr->varName, varName); Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL); *clientDataPtr = timPtr; - Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15); + Tk_ImageChanged(model, 0, 0, 30, 15, 30, 15); return TCL_OK; } @@ -207,7 +207,7 @@ ImageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TImageMaster *timPtr = clientData; + TImageModel *timPtr = clientData; int x, y, width, height; if (objc < 2) { @@ -228,7 +228,7 @@ ImageObjCmd( || (Tcl_GetIntFromObj(interp, objv[7], &timPtr->height) != TCL_OK)) { return TCL_ERROR; } - Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width, + Tk_ImageChanged(timPtr->model, x, y, width, height, timPtr->width, timPtr->height); } else { Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]), @@ -260,9 +260,9 @@ static ClientData ImageGet( Tk_Window tkwin, /* Token for window in which image will be * used. */ - ClientData clientData) /* Pointer to TImageMaster for image. */ + ClientData clientData) /* Pointer to TImageModel for image. */ { - TImageMaster *timPtr = clientData; + TImageModel *timPtr = clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -272,7 +272,7 @@ ImageGet( TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); instPtr = ckalloc(sizeof(TImageInstance)); - instPtr->masterPtr = timPtr; + instPtr->modelPtr = timPtr; instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues); @@ -313,15 +313,15 @@ ImageDisplay( char buffer[200 + TCL_INTEGER_SPACE * 6]; sprintf(buffer, "%s display %d %d %d %d %d %d", - instPtr->masterPtr->imageName, imageX, imageY, width, height, + instPtr->modelPtr->imageName, imageX, imageY, width, height, drawableX, drawableY); - Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL, + Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - if (width > (instPtr->masterPtr->width - imageX)) { - width = instPtr->masterPtr->width - imageX; + if (width > (instPtr->modelPtr->width - imageX)) { + width = instPtr->modelPtr->width - imageX; } - if (height > (instPtr->masterPtr->height - imageY)) { - height = instPtr->masterPtr->height - imageY; + if (height > (instPtr->modelPtr->height - imageY)) { + height = instPtr->modelPtr->height - imageY; } XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY, (unsigned) (width-1), (unsigned) (height-1)); @@ -357,8 +357,8 @@ ImageFree( TImageInstance *instPtr = clientData; char buffer[200]; - sprintf(buffer, "%s free", instPtr->masterPtr->imageName); - Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL, + sprintf(buffer, "%s free", instPtr->modelPtr->imageName); + Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); Tk_FreeColor(instPtr->fg); Tk_FreeGC(display, instPtr->gc); @@ -384,11 +384,11 @@ ImageFree( static void ImageDelete( - ClientData clientData) /* Pointer to TImageMaster for image. When + ClientData clientData) /* Pointer to TImageModel for image. When * this function is called, no more instances * exist. */ { - TImageMaster *timPtr = clientData; + TImageModel *timPtr = clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); diff --git a/generic/tkPack.c b/generic/tkPack.c index 9005d7f..245c6a4 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -198,11 +198,11 @@ Tk_PackObjCmd( const char *argv2; static const char *const optionStrings[] = { /* after, append, before and unpack are deprecated */ - "after", "append", "before", "unpack", - "configure", "forget", "info", "propagate", "slaves", NULL }; + "after", "append", "before", "unpack", "configure", + "content", "forget", "info", "propagate", "slaves", NULL }; enum options { - PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK, - PACK_CONFIGURE, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES }; + PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK, PACK_CONFIGURE, + PACK_CONTENT, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES }; int index; if (objc >= 2) { @@ -436,6 +436,7 @@ Tk_PackObjCmd( } break; } + case PACK_CONTENT: case PACK_SLAVES: { Tk_Window master; Packer *masterPtr, *slavePtr; diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 59b8a2b..f5afa38 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -214,9 +214,9 @@ Tk_PlaceObjCmd( TkDisplay *dispPtr; Tk_OptionTable optionTable; static const char *const optionStrings[] = { - "configure", "forget", "info", "slaves", NULL + "configure", "content", "forget", "info", "slaves", NULL }; - enum options { PLACE_CONFIGURE, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES }; + enum options { PLACE_CONFIGURE, PLACE_CONTENT, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES }; int index; if (objc < 3) { @@ -330,6 +330,7 @@ Tk_PlaceObjCmd( } return PlaceInfoCommand(interp, tkwin); + case PLACE_CONTENT: case PLACE_SLAVES: { Master *masterPtr; diff --git a/generic/tkTest.c b/generic/tkTest.c index 26b3fa5..bb7bde5 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -50,17 +50,17 @@ #define TCL_STORAGE_CLASS DLLEXPORT EXTERN int Tktest_Init(Tcl_Interp *interp); /* - * The following data structure represents the master for a test image: + * The following data structure represents the model for a test image: */ -typedef struct TImageMaster { - Tk_ImageMaster master; /* Tk's token for image master. */ +typedef struct TImageModel { + Tk_ImageModel model; /* Tk's token for image model. */ Tcl_Interp *interp; /* Interpreter for application. */ int width, height; /* Dimensions of image. */ char *imageName; /* Name of image (malloc-ed). */ char *varName; /* Name of variable in which to log events for * image (malloc-ed). */ -} TImageMaster; +} TImageModel; /* * The following data structure represents a particular use of a particular @@ -68,7 +68,7 @@ typedef struct TImageMaster { */ typedef struct TImageInstance { - TImageMaster *masterPtr; /* Pointer to master for image. */ + TImageModel *modelPtr; /* Pointer to model for image. */ XColor *fg; /* Foreground color for drawing in image. */ GC gc; /* Graphics context for drawing in image. */ Bool displayFailed; /* macOS display attempted out of drawRect. */ @@ -81,7 +81,7 @@ typedef struct TImageInstance { static int ImageCreate(Tcl_Interp *interp, const char *name, int argc, Tcl_Obj *const objv[], - const Tk_ImageType *typePtr, Tk_ImageMaster master, + const Tk_ImageType *typePtr, Tk_ImageModel model, ClientData *clientDataPtr); static ClientData ImageGet(Tk_Window tkwin, ClientData clientData); static void ImageDisplay(ClientData clientData, @@ -1386,12 +1386,12 @@ ImageCreate( Tcl_Obj *const objv[], /* Argument strings for options (doesn't * include image name or type). */ const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */ - Tk_ImageMaster master, /* Token for image, to be used by us in later + Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - TImageMaster *timPtr; + TImageModel *timPtr; const char *varName; int i; @@ -1410,8 +1410,8 @@ ImageCreate( varName = Tcl_GetString(objv[i+1]); } - timPtr = ckalloc(sizeof(TImageMaster)); - timPtr->master = master; + timPtr = ckalloc(sizeof(TImageModel)); + timPtr->model = model; timPtr->interp = interp; timPtr->width = 30; timPtr->height = 15; @@ -1421,7 +1421,7 @@ ImageCreate( strcpy(timPtr->varName, varName); Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL); *clientDataPtr = timPtr; - Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15); + Tk_ImageChanged(model, 0, 0, 30, 15, 30, 15); return TCL_OK; } @@ -1450,7 +1450,7 @@ ImageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageModel *timPtr = (TImageModel *) clientData; int x, y, width, height; if (objc < 2) { @@ -1471,7 +1471,7 @@ ImageObjCmd( || (Tcl_GetIntFromObj(interp, objv[7], &timPtr->height) != TCL_OK)) { return TCL_ERROR; } - Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width, + Tk_ImageChanged(timPtr->model, x, y, width, height, timPtr->width, timPtr->height); } else { Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]), @@ -1503,9 +1503,9 @@ static ClientData ImageGet( Tk_Window tkwin, /* Token for window in which image will be * used. */ - ClientData clientData) /* Pointer to TImageMaster for image. */ + ClientData clientData) /* Pointer to TImageModel for image. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageModel *timPtr = (TImageModel *) clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -1515,7 +1515,7 @@ ImageGet( TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); instPtr = ckalloc(sizeof(TImageInstance)); - instPtr->masterPtr = timPtr; + instPtr->modelPtr = timPtr; instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues); @@ -1580,9 +1580,9 @@ ImageDisplay( */ sprintf(instPtr->buffer, "%s display %d %d %d %d", - instPtr->masterPtr->imageName, imageX, imageY, width, height); + instPtr->modelPtr->imageName, imageX, imageY, width, height); } - Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, + Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, instPtr->buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); instPtr->displayFailed = False; @@ -1595,15 +1595,15 @@ ImageDisplay( if (instPtr->displayFailed == False) { sprintf(instPtr->buffer, "%s display %d %d %d %d", - instPtr->masterPtr->imageName, imageX, imageY, width, height); + instPtr->modelPtr->imageName, imageX, imageY, width, height); } instPtr->displayFailed = True; } - if (width > (instPtr->masterPtr->width - imageX)) { - width = instPtr->masterPtr->width - imageX; + if (width > (instPtr->modelPtr->width - imageX)) { + width = instPtr->modelPtr->width - imageX; } - if (height > (instPtr->masterPtr->height - imageY)) { - height = instPtr->masterPtr->height - imageY; + if (height > (instPtr->modelPtr->height - imageY)) { + height = instPtr->modelPtr->height - imageY; } XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY, @@ -1640,8 +1640,8 @@ ImageFree( TImageInstance *instPtr = (TImageInstance *) clientData; char buffer[200]; - sprintf(buffer, "%s free", instPtr->masterPtr->imageName); - Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL, + sprintf(buffer, "%s free", instPtr->modelPtr->imageName); + Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); Tk_FreeColor(instPtr->fg); Tk_FreeGC(display, instPtr->gc); @@ -1667,11 +1667,11 @@ ImageFree( static void ImageDelete( - ClientData clientData) /* Pointer to TImageMaster for image. When + ClientData clientData) /* Pointer to TImageModel for image. When * this function is called, no more instances * exist. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageModel *timPtr = (TImageModel *) clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); diff --git a/tests/grid.test b/tests/grid.test index 62474ff..eef42e1 100644 --- a/tests/grid.test +++ b/tests/grid.test @@ -45,7 +45,7 @@ test grid-1.1 {basic argument checking} -body { } -returnCodes error -result {wrong # args: should be "grid option arg ?arg ...?"} test grid-1.2 {basic argument checking} -body { grid foo bar -} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves} +} -returnCodes error -result {bad option "foo": must be anchor, bbox, columnconfigure, configure, content, forget, info, location, propagate, remove, rowconfigure, size, or slaves} test grid-1.3 {basic argument checking} -body { button .b grid .b -row 0 -column diff --git a/tests/oldpack.test b/tests/oldpack.test index 72ec065..92c411d 100644 --- a/tests/oldpack.test +++ b/tests/oldpack.test @@ -452,10 +452,10 @@ test oldpack-8.2 {syntax errors} -body { } -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"} test oldpack-8.3 {syntax errors} -body { pack gorp foo -} -returnCodes error -result {bad option "gorp": must be configure, forget, info, propagate, or slaves} +} -returnCodes error -result {bad option "gorp": must be configure, content, forget, info, propagate, or slaves} test oldpack-8.4 {syntax errors} -body { pack a .pack -} -returnCodes error -result {bad option "a": must be configure, forget, info, propagate, or slaves} +} -returnCodes error -result {bad option "a": must be configure, content, forget, info, propagate, or slaves} test oldpack-8.5 {syntax errors} -body { pack after foobar } -returnCodes error -result {bad window path name "foobar"} diff --git a/tests/pack.test b/tests/pack.test index 86fcad2..7b75363 100644 --- a/tests/pack.test +++ b/tests/pack.test @@ -1373,7 +1373,7 @@ test pack-12.46 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack lousy .pack -} -returnCodes error -result {bad option "lousy": must be configure, forget, info, propagate, or slaves} +} -returnCodes error -result {bad option "lousy": must be configure, content, forget, info, propagate, or slaves} test pack-13.1 {window deletion} -setup { diff --git a/tests/place.test b/tests/place.test index 0a5e22f..e7cf5ff 100644 --- a/tests/place.test +++ b/tests/place.test @@ -329,7 +329,7 @@ test place-9.5 {PlaceObjCmd} -setup { place badopt .foo } -cleanup { destroy .foo -} -returnCodes error -result {bad option "badopt": must be configure, forget, info, or slaves} +} -returnCodes error -result {bad option "badopt": must be configure, content, forget, info, or slaves} test place-9.6 {PlaceObjCmd, configure errors} -setup { destroy .foo } -body { |