diff options
author | stanton <stanton> | 1999-03-30 04:11:56 (GMT) |
---|---|---|
committer | stanton <stanton> | 1999-03-30 04:11:56 (GMT) |
commit | 7c06d03ab6d53059992c07a0bb27f97eae021be3 (patch) | |
tree | 232299c44e653e28fe87a326c3dc785ece22cbdc | |
parent | 44224a9e992fe0879d3c0ff54522664b54343e0c (diff) | |
download | tk-7c06d03ab6d53059992c07a0bb27f97eae021be3.zip tk-7c06d03ab6d53059992c07a0bb27f97eae021be3.tar.gz tk-7c06d03ab6d53059992c07a0bb27f97eae021be3.tar.bz2 |
* doc/GetBitmap.3:
* generic/tkBitmap.c (BitmapInit): Eliminated use of Tk_Uid's in
bitmaps. Added a few CONST declarations.
-rw-r--r-- | doc/GetBitmap.3 | 20 | ||||
-rw-r--r-- | generic/tkBitmap.c | 37 |
2 files changed, 30 insertions, 27 deletions
diff --git a/doc/GetBitmap.3 b/doc/GetBitmap.3 index b9a5ae8..6a84e45 100644 --- a/doc/GetBitmap.3 +++ b/doc/GetBitmap.3 @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: GetBitmap.3,v 1.1.4.2 1998/09/30 02:15:53 stanton Exp $ +'\" RCS: @(#) $Id: GetBitmap.3,v 1.1.4.3 1999/03/30 04:11:56 stanton Exp $ '\" .so man.macros .TH Tk_AllocBitmapFromObj 3 8.1 Tk "Tk Library Procedures" @@ -28,9 +28,9 @@ Pixmap .VE .sp int -\fBTk_DefineBitmap(\fIinterp, nameId, source, width, height\fB)\fR +\fBTk_DefineBitmap(\fIinterp, name, source, width, height\fB)\fR .sp -Tk_Uid +char * \fBTk_NameOfBitmap(\fIdisplay, bitmap\fB)\fR .sp \fBTk_SizeOfBitmap(\fIdisplay, bitmap, widthPtr, heightPtr\fB)\fR @@ -51,11 +51,11 @@ Token for window in which the bitmap will be used. .AP Tcl_Obj *objPtr in/out String value describes desired bitmap; internal rep will be modified to cache pointer to corresponding Pixmap. -.AP char *info in +.AP CONST char *info in Same as \fIobjPtr\fR except description of bitmap is passed as a string and resulting Pixmap isn't cached. .VE -.AP char *name in +.AP CONST char *name in Name for new bitmap to be defined. .AP char *source in Data for bitmap, in standard bitmap format. @@ -239,22 +239,26 @@ which was created by the \fBbitmap\fR program and contains a stipple pattern. The following code uses \fBTk_DefineBitmap\fR to define a new bitmap named \fBfoo\fR: +.VS .CS Pixmap bitmap; #include "stip.bitmap" -Tk_DefineBitmap(interp, Tk_GetUid("foo"), stip_bits, +Tk_DefineBitmap(interp, "foo", stip_bits, stip_width, stip_height); \&... -bitmap = Tk_GetBitmap(interp, tkwin, Tk_GetUid("foo")); +bitmap = Tk_GetBitmap(interp, tkwin, "foo"); .CE +.VE This code causes the bitmap file to be read at compile-time and incorporates the bitmap information into the program's executable image. The same bitmap file could be read at run-time using \fBTk_GetBitmap\fR: +.VS .CS Pixmap bitmap; -bitmap = Tk_GetBitmap(interp, tkwin, Tk_GetUid("@stip.bitmap")); +bitmap = Tk_GetBitmap(interp, tkwin, "@stip.bitmap"); .CE +.VE The second form is a bit more flexible (the file could be modified after the program has been compiled, or a different string could be provided to read a different file), but it is a little slower and diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index e54d8ee..e5768e9 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkBitmap.c,v 1.1.4.4 1999/03/20 01:27:51 redman Exp $ + * RCS: @(#) $Id: tkBitmap.c,v 1.1.4.5 1999/03/30 04:11:56 stanton Exp $ */ #include "tkPort.h" @@ -113,7 +113,7 @@ static void DupBitmapObjProc _ANSI_ARGS_((Tcl_Obj *srcObjPtr, static void FreeBitmap _ANSI_ARGS_((TkBitmap *bitmapPtr)); static void FreeBitmapObjProc _ANSI_ARGS_((Tcl_Obj *objPtr)); static TkBitmap * GetBitmap _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, char *name)); + Tk_Window tkwin, CONST char *name)); static TkBitmap * GetBitmapFromObj _ANSI_ARGS_((Tk_Window tkwin, Tcl_Obj *objPtr)); static void InitBitmapObj _ANSI_ARGS_((Tcl_Obj *objPtr)); @@ -256,7 +256,7 @@ Tk_GetBitmap(interp, tkwin, string) Tcl_Interp *interp; /* Interpreter to use for error reporting, * this may be NULL. */ Tk_Window tkwin; /* Window in which bitmap will be used. */ - char *string; /* Description of bitmap. See manual entry + CONST char *string; /* Description of bitmap. See manual entry * for details on legal syntax. */ { TkBitmap *bitmapPtr = GetBitmap(interp, tkwin, string); @@ -298,7 +298,7 @@ GetBitmap(interp, tkwin, string) Tcl_Interp *interp; /* Interpreter to use for error reporting, * this may be NULL. */ Tk_Window tkwin; /* Window in which bitmap will be used. */ - char *string; /* Description of bitmap. See manual entry + CONST char *string; /* Description of bitmap. See manual entry * for details on legal syntax. */ { Tcl_HashEntry *nameHashPtr, *predefHashPtr; @@ -338,7 +338,7 @@ GetBitmap(interp, tkwin, string) * defined by a call to Tk_DefineBitmap. */ - if (*string == '@') { + if (*string == '@') { /* INTL: ISO char */ Tcl_DString buffer; int result; @@ -455,7 +455,7 @@ GetBitmap(interp, tkwin, string) int Tk_DefineBitmap(interp, name, source, width, height) Tcl_Interp *interp; /* Interpreter to use for error reporting. */ - char *name; /* Name to use for bitmap. Must not already + CONST char *name; /* Name to use for bitmap. Must not already * be defined as a bitmap. */ char *source; /* Address of bits for bitmap. */ int width; /* Width of bitmap. */ @@ -1004,28 +1004,27 @@ BitmapInit(dispPtr) if (!tsdPtr->initialized) { tsdPtr->initialized = 1; dummy = Tcl_CreateInterp(); - Tcl_InitHashTable(&tsdPtr->predefBitmapTable, - TCL_STRING_KEYS); + Tcl_InitHashTable(&tsdPtr->predefBitmapTable, TCL_STRING_KEYS); - Tk_DefineBitmap(dummy, Tk_GetUid("error"), (char *) error_bits, - error_width, error_height); - Tk_DefineBitmap(dummy, Tk_GetUid("gray75"), (char *) gray75_bits, + Tk_DefineBitmap(dummy, "error", (char *) error_bits, + error_width, error_height); + Tk_DefineBitmap(dummy, "gray75", (char *) gray75_bits, gray75_width, gray75_height); - Tk_DefineBitmap(dummy, Tk_GetUid("gray50"), (char *) gray50_bits, + Tk_DefineBitmap(dummy, "gray50", (char *) gray50_bits, gray50_width, gray50_height); - Tk_DefineBitmap(dummy, Tk_GetUid("gray25"), (char *) gray25_bits, + Tk_DefineBitmap(dummy, "gray25", (char *) gray25_bits, gray25_width, gray25_height); - Tk_DefineBitmap(dummy, Tk_GetUid("gray12"), (char *) gray12_bits, + Tk_DefineBitmap(dummy, "gray12", (char *) gray12_bits, gray12_width, gray12_height); - Tk_DefineBitmap(dummy, Tk_GetUid("hourglass"), (char *) hourglass_bits, + Tk_DefineBitmap(dummy, "hourglass", (char *) hourglass_bits, hourglass_width, hourglass_height); - Tk_DefineBitmap(dummy, Tk_GetUid("info"), (char *) info_bits, + Tk_DefineBitmap(dummy, "info", (char *) info_bits, info_width, info_height); - Tk_DefineBitmap(dummy, Tk_GetUid("questhead"), (char *) questhead_bits, + Tk_DefineBitmap(dummy, "questhead", (char *) questhead_bits, questhead_width, questhead_height); - Tk_DefineBitmap(dummy, Tk_GetUid("question"), (char *) question_bits, + Tk_DefineBitmap(dummy, "question", (char *) question_bits, question_width, question_height); - Tk_DefineBitmap(dummy, Tk_GetUid("warning"), (char *) warning_bits, + Tk_DefineBitmap(dummy, "warning", (char *) warning_bits, warning_width, warning_height); TkpDefineNativeBitmaps(); |