diff options
author | hobbs <hobbs> | 2000-08-05 23:53:09 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2000-08-05 23:53:09 (GMT) |
commit | 5b5b6e4d1496daf49370c468d89671fd5fd0e076 (patch) | |
tree | 7d003d614af5987da37517b22016022aec422d9d /generic | |
parent | 911c2f792cf63b4bfcd8dd396925f69a47f48cd5 (diff) | |
download | tk-5b5b6e4d1496daf49370c468d89671fd5fd0e076.zip tk-5b5b6e4d1496daf49370c468d89671fd5fd0e076.tar.gz tk-5b5b6e4d1496daf49370c468d89671fd5fd0e076.tar.bz2 |
* BACKPORTED FROM 8.4 (HEAD) BRANCH:
* tests/button.test:
* generic/tkButton.c: Added -activeforeground, -activebackground
for labels, for the -state option.
* doc/label.n: Added -disabledforeground to list of options [Bug:
6053].
* tests/focus.test (focusSetupAlt): removed wm withdraw from proc
as it would cause a hang for tkwait visibility
* tests/menu.test:
* generic/tk3d.c:
* generic/tkColor.c:
* generic/tkCursor.c: corrected handling of 3DBorder, Cursor and
Color objects on multiple screens. [Bug: 5454]
* generic/tkCursor.c: Added initialization for nextPtr field of
TkCursor, patch from Nijtmans/Howlett.
* canvas.test: added test for 5783.
* generic/tkCanvPoly.c (DisplayPolygon): added checks for the
polygon fillGC not being empty to prevent segfault. [Bug: 5783]
* generic/tkImgGIF.c: Applied patch from Jan Nijtmans to fix a
problem with the GIF writing code [Bug: 5823].
* generic/tkImgGIF.c: Changed defines for GIF87a/GIF89a to be
static char arrays with integer initialization, to address EBCIDIC
vs. ASCII encoding issues and to handle compilers that don't deal
with "\xAB" syntax for specifying hex values in strings.
* generic/tkMenu.c (DeleteMenuCloneEntries): Applied fix from
[Bug: 5275], which corrected a segfault-causing indexing problem
when deleting entries from torn-off menus.
* generic/tkPlace.c (Tk_PlaceCmd): reworked place master/slave
table init'n to prevent seg fault when using place on multiple
displays.
* tests/text.test: Added tests for -regexp -nocase searches with
backslash character classes.
* tests/text.test: Added tests for searching when text is elided.
* generic/tkText.c (TextSearchCmd): Text search did not work
properly when -regexp and -nocase were used, in combination with
backslash character classes represented by capital letters (ie,
\W, \M); altered implementation of -regexp -nocase searches to use
new regexp interfaces to fix this problem. [Bug: 5988].
* generic/tkText.c (TextSearchCmd): Text search was not returning
the correct index when the search covered (but did not search)
elided characters; corrected this by adjusting the match index by
the number of elided characters preceeding the start of the match,
just as is done with embedded windows, etc. [Bug: 5470].
* generic/tkText.c (TextSearchCmd): Added a test for a NULL
segment pointer when doing backwards searches for "" on an empty
text widget. [Bug: 6007].
* library/focus.tcl: fixed calling of takeFocus proc [Bug: 5372]
* win/tkWinMenu.c (ReconfigureWindowsMenu): Added MF_GRAYED bit
for disabled menu entries, to ensure that those which are drawn by
the system are shown grayed (such as entries on menubars) [Bug: 4372].
* win/tkWinMenu.c (ReconfigureWindowsMenu): Added code to add the
MF_SEPARATOR bit for SEPARATOR_ENTRY menu items. This causes
separator entries on the system menu to be drawn correctly [Bug: 5451].
* win/tkWinMenu.c (GetMenuSeparatorGeometry): Tweaked height
requested for separator bars to be (linespace - (2*descent))
instead of just (linespace); this makes the separator occupy a
more correct amount of vertical space. [Bug: 5303].
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tk3d.c | 54 | ||||
-rw-r--r-- | generic/tkButton.c | 8 | ||||
-rw-r--r-- | generic/tkCanvPoly.c | 7 | ||||
-rw-r--r-- | generic/tkColor.c | 52 | ||||
-rw-r--r-- | generic/tkCursor.c | 33 | ||||
-rw-r--r-- | generic/tkImgGIF.c | 87 | ||||
-rw-r--r-- | generic/tkMenu.c | 4 | ||||
-rw-r--r-- | generic/tkPlace.c | 38 | ||||
-rw-r--r-- | generic/tkText.c | 33 |
9 files changed, 177 insertions, 139 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c index 8cbe0ee..195433a 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tk3d.c,v 1.6 1999/12/21 23:55:10 hobbs Exp $ + * RCS: @(#) $Id: tk3d.c,v 1.6.2.1 2000/08/05 23:53:10 hobbs Exp $ */ #include "tk3d.h" @@ -501,6 +501,7 @@ Tk_Free3DBorderFromObj(tkwin, objPtr) Tcl_Obj *objPtr; /* The Tcl_Obj * to be freed. */ { Tk_Free3DBorder(Tk_Get3DBorderFromObj(tkwin, objPtr)); + FreeBorderObjProc(objPtr); } /* @@ -1263,37 +1264,46 @@ Tk_Get3DBorderFromObj(tkwin, objPtr) InitBorderObj(objPtr); } - borderPtr = (TkBorder *) objPtr->internalRep.twoPtrValue.ptr1; - if (borderPtr != NULL) { - if ((borderPtr->resourceRefCount > 0) - && (Tk_Screen(tkwin) == borderPtr->screen) - && (Tk_Colormap(tkwin) == borderPtr->colormap)) { - /* - * The object already points to the right border structure. - * Just return it. - */ + /* + * If we are lucky (and the user doesn't use too many different + * displays, screens, or colormaps...) then the TkBorder + * structure we need will be cached in the internal + * representation of the Tcl_Obj. Check it out... + */ - return (Tk_3DBorder) borderPtr; - } - hashPtr = borderPtr->hashPtr; - FreeBorderObjProc(objPtr); - } else { - hashPtr = Tcl_FindHashEntry(&dispPtr->borderTable, - Tcl_GetString(objPtr)); - if (hashPtr == NULL) { - goto error; - } + borderPtr = (TkBorder *) objPtr->internalRep.twoPtrValue.ptr1; + if ((borderPtr != NULL) + && (borderPtr->resourceRefCount > 0) + && (Tk_Screen(tkwin) == borderPtr->screen) + && (Tk_Colormap(tkwin) == borderPtr->colormap)) { + /* + * The object already points to the right border structure. + * Just return it. + */ + return (Tk_3DBorder) borderPtr; } /* - * At this point we've got a hash table entry, off of which hang - * one or more TkBorder structures. See if any of them will work. + * If we make it here, it means we aren't so lucky. Either there + * was no cached TkBorder in the Tcl_Obj, or the TkBorder that was + * there is for the wrong screen/colormap. Either way, we have + * to search for the right TkBorder. For each color name, there is + * linked list of TkBorder structures, one structure for each + * screen/colormap combination. The head of the linked list is + * recorded in a hash table (where the key is the color name) + * attached to the TkDisplay structure. Walk this list to find + * the right TkBorder structure. */ + hashPtr = Tcl_FindHashEntry(&dispPtr->borderTable, Tcl_GetString(objPtr)); + if (hashPtr == NULL) { + goto error; + } for (borderPtr = (TkBorder *) Tcl_GetHashValue(hashPtr); (borderPtr != NULL); borderPtr = borderPtr->nextPtr) { if ((Tk_Screen(tkwin) == borderPtr->screen) && (Tk_Colormap(tkwin) == borderPtr->colormap)) { + FreeBorderObjProc(objPtr); objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) borderPtr; borderPtr->objRefCount++; return (Tk_3DBorder) borderPtr; diff --git a/generic/tkButton.c b/generic/tkButton.c index 1d832c8..fdb581c 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.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: tkButton.c,v 1.4 2000/03/08 03:19:31 ericm Exp $ + * RCS: @(#) $Id: tkButton.c,v 1.4.2.1 2000/08/05 23:53:10 hobbs Exp $ */ #include "tkButton.h" @@ -48,6 +48,12 @@ static char *stateStrings[] = { */ static Tk_OptionSpec labelOptionSpecs[] = { + {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", + DEF_BUTTON_ACTIVE_BG_COLOR, -1, Tk_Offset(TkButton, activeBorder), + 0, (ClientData) DEF_BUTTON_ACTIVE_BG_MONO, 0}, + {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", + DEF_BUTTON_ACTIVE_FG_COLOR, -1, Tk_Offset(TkButton, activeFg), + TK_OPTION_NULL_OK, (ClientData) DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_BUTTON_ANCHOR, -1, Tk_Offset(TkButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 79ba527..9f2926b 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -5,11 +5,12 @@ * * Copyright (c) 1991-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. + * Copyright (c) 1998-2000 Ajuba Solutions. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkCanvPoly.c,v 1.5 2000/02/01 11:41:09 hobbs Exp $ + * RCS: @(#) $Id: tkCanvPoly.c,v 1.5.2.1 2000/08/05 23:53:11 hobbs Exp $ */ #include <stdio.h> @@ -916,7 +917,7 @@ DisplayPolygon(canvas, itemPtr, display, drawable, x, y, width, height) * read-only. */ - if (stipple != None) { + if ((stipple != None) && (polyPtr->fillGC != None)) { Tk_TSOffset *tsoffset = &polyPtr->tsoffset; int w=0; int h=0; int flags = tsoffset->flags; @@ -991,7 +992,7 @@ DisplayPolygon(canvas, itemPtr, display, drawable, x, y, width, height) } } Tk_ResetOutlineGC(canvas, itemPtr, &(polyPtr->outline)); - if (stipple != None) { + if ((stipple != None) && (polyPtr->fillGC != None)) { XSetTSOrigin(display, polyPtr->fillGC, 0, 0); } } diff --git a/generic/tkColor.c b/generic/tkColor.c index 006e93b..ffa877f 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.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: tkColor.c,v 1.6 1999/11/19 22:00:02 hobbs Exp $ + * RCS: @(#) $Id: tkColor.c,v 1.6.2.1 2000/08/05 23:53:11 hobbs Exp $ */ #include "tkColor.h" @@ -540,6 +540,7 @@ Tk_FreeColorFromObj(tkwin, objPtr) Tcl_Obj *objPtr; /* The Tcl_Obj * to be freed. */ { Tk_FreeColor(Tk_GetColorFromObj(tkwin, objPtr)); + FreeColorObjProc(objPtr); } /* @@ -645,38 +646,43 @@ Tk_GetColorFromObj(tkwin, objPtr) if (objPtr->typePtr != &colorObjType) { InitColorObj(objPtr); } - + + /* + * First check to see if the internal representation of the object + * is defined and is a color that is valid for the current screen + * and color map. If it is, we are done. + */ tkColPtr = (TkColor *) objPtr->internalRep.twoPtrValue.ptr1; - if (tkColPtr != NULL) { - if ((tkColPtr->resourceRefCount > 0) - && (Tk_Screen(tkwin) == tkColPtr->screen) - && (Tk_Colormap(tkwin) == tkColPtr->colormap)) { - /* - * The object already points to the right TkColor structure. - * Just return it. - */ - - return (XColor *) tkColPtr; - } - hashPtr = tkColPtr->hashPtr; - FreeColorObjProc(objPtr); - } else { - hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable, - Tcl_GetString(objPtr)); - if (hashPtr == NULL) { - goto error; - } + if ((tkColPtr != NULL) + && (tkColPtr->resourceRefCount > 0) + && (Tk_Screen(tkwin) == tkColPtr->screen) + && (Tk_Colormap(tkwin) == tkColPtr->colormap)) { + /* + * The object already points to the right TkColor structure. + * Just return it. + */ + + return (XColor *) tkColPtr; } /* - * At this point we've got a hash table entry, off of which hang - * one or more TkColor structures. See if any of them will work. + * If we reach this point, it means that the TkColor structure + * that we have cached in the internal representation is not valid + * for the current screen and colormap. But there is a list of + * other TkColor structures attached to the TkDisplay. Walk this + * list looking for the right TkColor structure. */ + hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable, + Tcl_GetString(objPtr)); + if (hashPtr == NULL) { + goto error; + } for (tkColPtr = (TkColor *) Tcl_GetHashValue(hashPtr); (tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) { if ((Tk_Screen(tkwin) == tkColPtr->screen) && (Tk_Colormap(tkwin) == tkColPtr->colormap)) { + FreeColorObjProc(objPtr); objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) tkColPtr; tkColPtr->objRefCount++; return (XColor *) tkColPtr; diff --git a/generic/tkCursor.c b/generic/tkCursor.c index c8e5588..a1c2717 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.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: tkCursor.c,v 1.4 1999/09/02 17:02:28 hobbs Exp $ + * RCS: @(#) $Id: tkCursor.c,v 1.4.2.1 2000/08/05 23:53:11 hobbs Exp $ */ #include "tkPort.h" @@ -276,6 +276,7 @@ GetCursor(interp, tkwin, string) cursorPtr->objRefCount = 0; cursorPtr->otherTable = &dispPtr->cursorNameTable; cursorPtr->hashPtr = nameHashPtr; + cursorPtr->nextPtr = NULL; cursorPtr->idHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorIdTable, (char *) cursorPtr->cursor, &new); if (!new) { @@ -561,6 +562,7 @@ Tk_FreeCursorFromObj(tkwin, objPtr) Tcl_Obj *objPtr; /* The Tcl_Obj * to be freed. */ { FreeCursor(GetCursorFromObj(tkwin, objPtr)); + FreeCursorObjProc(objPtr); } /* @@ -696,28 +698,31 @@ GetCursorFromObj(tkwin, objPtr) InitCursorObj(objPtr); } + /* + * The internal representation is a cache of the last cursor used + * with the given name. But there can be lots different cursors + * for each cursor name; one cursor for each display. Check to + * see if the cursor we have cached is the one that is needed. + */ cursorPtr = (TkCursor *) objPtr->internalRep.twoPtrValue.ptr1; - if (cursorPtr != NULL) { - if (Tk_Display(tkwin) == cursorPtr->display) { - return cursorPtr; - } - hashPtr = cursorPtr->hashPtr; - } else { - hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable, - Tcl_GetString(objPtr)); - if (hashPtr == NULL) { - goto error; - } + if ((cursorPtr != NULL) && (Tk_Display(tkwin) == cursorPtr->display)) { + return cursorPtr; } /* - * At this point we've got a hash table entry, off of which hang - * one or more TkCursor structures. See if any of them will work. + * If we get to here, it means the cursor we need is not in the cache. + * Try to look up the cursor in the TkDisplay structure of the window. */ + hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable, + Tcl_GetString(objPtr)); + if (hashPtr == NULL) { + goto error; + } for (cursorPtr = (TkCursor *) Tcl_GetHashValue(hashPtr); cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { + FreeCursorObjProc(objPtr); objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) cursorPtr; cursorPtr->objRefCount++; return cursorPtr; diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 4dc466a..0b528aa 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -2,8 +2,8 @@ * tkImgGIF.c -- * * A photo image file handler for GIF files. Reads 87a and 89a GIF - * files. At present, there only is a file write function. GIF images may be - * read using the -data option of the photo image. The data may be + * files. At present, there only is a file write function. GIF images + * may be read using the -data option of the photo image. The data may be * given as a binary string in a Tcl_Obj or by representing * the data as BASE64 encoded ascii. Derived from the giftoppm code * found in the pbmplus package and tkImgFmtPPM.c in the tk4.0b2 @@ -29,7 +29,7 @@ * | provided "as is" without express or implied warranty. | * +-------------------------------------------------------------------+ * - * RCS: @(#) $Id: tkImgGIF.c,v 1.14 2000/03/30 19:44:41 ericm Exp $ + * RCS: @(#) $Id: tkImgGIF.c,v 1.14.2.1 2000/08/05 23:53:11 hobbs Exp $ */ /* @@ -72,11 +72,13 @@ typedef struct mFile { * encoding independant. */ -# define GIF87a "\x47\x49\x46\x38\x37\x61" /* ASCII GIF87a */ -# define GIF89a "\x47\x49\x46\x38\x39\x61" /* ASCII GIF89a */ -# define GIF_TERMINATOR 0x3b /* ASCII ; */ -# define GIF_EXTENSION 0x21 /* ASCII ! */ -# define GIF_START 0x2c /* ASCII , */ +static CONST char GIF87a[] = + { 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x00 }; /* ASCII GIF87a */ +static CONST char GIF89a[] = + { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x00 }; /* ASCII GIF89a */ +# define GIF_TERMINATOR 0x3b /* ASCII ; */ +# define GIF_EXTENSION 0x21 /* ASCII ! */ +# define GIF_START 0x2c /* ASCII , */ /* * HACK ALERT!! HACK ALERT!! HACK ALERT!! @@ -1326,15 +1328,15 @@ static unsigned char mapa[MAXCOLORMAPSIZE][3]; * Definition of new functions to write GIFs */ -static int color _ANSI_ARGS_((int red,int green, int blue)); +static int color _ANSI_ARGS_((int red,int green, int blue, + unsigned char mapa[MAXCOLORMAPSIZE][3])); static void compress _ANSI_ARGS_((int init_bits, Tcl_Channel handle, ifunptr readValue)); static int nuevo _ANSI_ARGS_((int red, int green ,int blue, unsigned char mapa[MAXCOLORMAPSIZE][3])); -static int savemap _ANSI_ARGS_((Tk_PhotoImageBlock *blockPtr, +static void savemap _ANSI_ARGS_((Tk_PhotoImageBlock *blockPtr, unsigned char mapa[MAXCOLORMAPSIZE][3])); static int ReadValue _ANSI_ARGS_((void)); -static int no_bits _ANSI_ARGS_((int colors)); static int FileWriteGIF (interp, filename, format, blockPtr) @@ -1353,9 +1355,6 @@ FileWriteGIF (interp, filename, format, blockPtr) if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") != TCL_OK) { return TCL_ERROR; } - if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary") != TCL_OK) { - return TCL_ERROR; - } result = CommonWriteGIF(interp, chan, format, blockPtr); if (Tcl_Close(interp, chan) == TCL_ERROR) { @@ -1374,12 +1373,10 @@ CommonWriteGIF(interp, handle, format, blockPtr) Tk_PhotoImageBlock *blockPtr; { int resolution; - long numcolormap; long width,height,x; unsigned char c; unsigned int top,left; - int num; top = 0; left = 0; @@ -1410,11 +1407,12 @@ CommonWriteGIF(interp, handle, format, blockPtr) height=blockPtr->height; pixelo=blockPtr->pixelPtr + blockPtr->offset[0]; pixelPitch=blockPtr->pitch; - if ((num=savemap(blockPtr,mapa))<0) { + savemap(blockPtr,mapa); + if (num>=MAXCOLORMAPSIZE) { Tcl_AppendResult(interp, "too many colors", (char *) NULL); return TCL_ERROR; } - if (num<3) num=3; + if (num<2) num=2; c=LSB(width); Mputc(c,handle); c=MSB(width); @@ -1424,11 +1422,14 @@ CommonWriteGIF(interp, handle, format, blockPtr) c=MSB(height); Mputc(c,handle); - c= (1 << 7) | (no_bits(num) << 4) | (no_bits(num)); + resolution = 0; + while (num >> resolution) { + resolution++; + } + c = 111 + resolution * 17; Mputc(c,handle); - resolution = no_bits(num)+1; - numcolormap=1 << resolution; + num = 1 << resolution; /* background color */ @@ -1439,7 +1440,7 @@ CommonWriteGIF(interp, handle, format, blockPtr) Mputc(c,handle); - for (x=0; x<numcolormap ;x++) { + for (x=0; x<num ;x++) { c = mapa[x][CM_RED]; Mputc(c,handle); c = mapa[x][CM_GREEN]; @@ -1497,10 +1498,11 @@ CommonWriteGIF(interp, handle, format, blockPtr) } static int -color(red, green, blue) +color(red, green, blue, mapa) int red; int green; int blue; + unsigned char mapa[MAXCOLORMAPSIZE][3]; { int x; for (x=(alphaOffset != 0);x<=MAXCOLORMAPSIZE;x++) { @@ -1519,7 +1521,7 @@ nuevo(red, green, blue, mapa) unsigned char mapa[MAXCOLORMAPSIZE][3]; { int x; - for (x=(alphaOffset != 0);x<num;x++) { + for (x=(alphaOffset != 0);x<=num;x++) { if ((mapa[x][CM_RED]==red) && (mapa[x][CM_GREEN]==green) && (mapa[x][CM_BLUE]==blue)) { return 0; @@ -1528,7 +1530,7 @@ nuevo(red, green, blue, mapa) return 1; } -static int +static void savemap(blockPtr,mapa) Tk_PhotoImageBlock *blockPtr; unsigned char mapa[MAXCOLORMAPSIZE][3]; @@ -1538,12 +1540,12 @@ savemap(blockPtr,mapa) unsigned char red,green,blue; if (alphaOffset) { - num = 1; + num = 0; mapa[0][CM_RED] = 0xd9; mapa[0][CM_GREEN] = 0xd9; mapa[0][CM_BLUE] = 0xd9; } else { - num = 0; + num = -1; } for(y=0;y<blockPtr->height;y++) { @@ -1555,19 +1557,19 @@ savemap(blockPtr,mapa) green = colores[greenOffset]; blue = colores[blueOffset]; if (nuevo(red,green,blue,mapa)) { - if (num>255) - return -1; - + num++; + if (num>=MAXCOLORMAPSIZE) { + return; + } mapa[num][CM_RED]=red; mapa[num][CM_GREEN]=green; mapa[num][CM_BLUE]=blue; - num++; } } colores += pixelSize; } } - return num-1; + return; } static int @@ -1581,7 +1583,7 @@ ReadValue() if (alphaOffset && (pixelo[alphaOffset]==0)) { col = 0; } else { - col = color(pixelo[0],pixelo[greenOffset],pixelo[blueOffset]); + col = color(pixelo[0],pixelo[greenOffset],pixelo[blueOffset], mapa); } pixelo += pixelSize; if (--ssize <= 0) { @@ -1593,25 +1595,6 @@ ReadValue() return col; } -/* - * Return the number of bits ( -1 ) to represent a given - * number of colors ( ex: 256 colors => 7 ). - */ - -static int -no_bits( colors ) -int colors; -{ - register int bits = 0; - - colors--; - while ( colors >> bits ) { - bits++; - } - - return (bits-1); -} - /*----------------------------------------------------------------------- diff --git a/generic/tkMenu.c b/generic/tkMenu.c index b3f906d..6ceddf0 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMenu.c,v 1.6 2000/02/10 08:52:35 hobbs Exp $ + * RCS: @(#) $Id: tkMenu.c,v 1.6.2.1 2000/08/05 23:53:12 hobbs Exp $ */ /* @@ -3403,7 +3403,7 @@ DeleteMenuCloneEntries(menuPtr, first, last) } for (i = last + 1; i < menuListPtr->numEntries; i++) { menuListPtr->entries[i - numDeleted] = menuListPtr->entries[i]; - menuListPtr->entries[i - numDeleted]->index = i; + menuListPtr->entries[i - numDeleted]->index = i - numDeleted; } menuListPtr->numEntries -= numDeleted; if (menuListPtr->numEntries == 0) { diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 174a022..0cac18e 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkPlace.c,v 1.5 1999/04/21 21:53:27 rjohnson Exp $ + * RCS: @(#) $Id: tkPlace.c,v 1.5.12.1 2000/08/05 23:53:12 hobbs Exp $ */ #include "tkPort.h" @@ -161,18 +161,6 @@ Tk_PlaceCmd(clientData, interp, argc, argv) int c; TkDisplay *dispPtr; - dispPtr = ((TkWindow *) clientData)->dispPtr; - - /* - * Initialize, if that hasn't been done yet. - */ - - if (!dispPtr->placeInit) { - Tcl_InitHashTable(&dispPtr->masterTable, TCL_ONE_WORD_KEYS); - Tcl_InitHashTable(&dispPtr->slaveTable, TCL_ONE_WORD_KEYS); - dispPtr->placeInit = 1; - } - if (argc < 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " option|pathName args", (char *) NULL); @@ -190,6 +178,18 @@ Tk_PlaceCmd(clientData, interp, argc, argv) if (tkwin == NULL) { return TCL_ERROR; } + + /* + * Initialize, if that hasn't been done yet. + */ + + dispPtr = ((TkWindow *) tkwin)->dispPtr; + if (!dispPtr->placeInit) { + Tcl_InitHashTable(&dispPtr->masterTable, TCL_ONE_WORD_KEYS); + Tcl_InitHashTable(&dispPtr->slaveTable, TCL_ONE_WORD_KEYS); + dispPtr->placeInit = 1; + } + slavePtr = FindSlave(tkwin); return ConfigureSlave(interp, slavePtr, argc-2, argv+2); } @@ -203,6 +203,18 @@ Tk_PlaceCmd(clientData, interp, argc, argv) if (tkwin == NULL) { return TCL_ERROR; } + + /* + * Initialize, if that hasn't been done yet. + */ + + dispPtr = ((TkWindow *) tkwin)->dispPtr; + if (!dispPtr->placeInit) { + Tcl_InitHashTable(&dispPtr->masterTable, TCL_ONE_WORD_KEYS); + Tcl_InitHashTable(&dispPtr->slaveTable, TCL_ONE_WORD_KEYS); + dispPtr->placeInit = 1; + } + if ((c == 'c') && (strncmp(argv[1], "configure", length) == 0)) { if (argc < 5) { Tcl_AppendResult(interp, "wrong # args: should be \"", diff --git a/generic/tkText.c b/generic/tkText.c index d92363b..4d17bb9 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.c,v 1.14 2000/02/03 17:29:57 ericm Exp $ + * RCS: @(#) $Id: tkText.c,v 1.14.2.1 2000/08/05 23:53:12 hobbs Exp $ */ #include "default.h" @@ -1673,6 +1673,7 @@ TextSearchCmd(textPtr, interp, argc, argv) TkTextSegment *segPtr; TkTextLine *linePtr; TkTextIndex curIndex; + Tcl_Obj *patObj = NULL; Tcl_RegExp regexp = NULL; /* Initialization needed only to * prevent compiler warning. */ @@ -1748,7 +1749,7 @@ TextSearchCmd(textPtr, interp, argc, argv) * Convert the pattern to lower-case if we're supposed to ignore case. */ - if (noCase) { + if (noCase && exact) { Tcl_DStringInit(&patDString); Tcl_DStringAppend(&patDString, pattern, -1); pattern = Tcl_DStringValue(&patDString); @@ -1798,7 +1799,10 @@ TextSearchCmd(textPtr, interp, argc, argv) if (exact) { patLength = strlen(pattern); } else { - regexp = Tcl_RegExpCompile(interp, pattern); + patObj = Tcl_NewStringObj(pattern, -1); + Tcl_IncrRefCount(patObj); + regexp = Tcl_GetRegExpFromObj(interp, patObj, + (noCase ? TCL_REG_NOCASE : 0) | TCL_REG_ADVANCED); if (regexp == NULL) { code = TCL_ERROR; goto done; @@ -1952,18 +1956,26 @@ TextSearchCmd(textPtr, interp, argc, argv) /* * The index information returned by the regular expression * parser only considers textual information: it doesn't - * account for embedded windows or any other non-textual info. + * account for embedded windows, elided text (when we are not + * searching elided text) or any other non-textual info. * Scan through the line's segments again to adjust both * matchChar and matchCount. + * + * We will walk through the segments of this line until we have + * either reached the end of the match or we have reached the end + * of the line. */ + curIndex.linePtr = linePtr; curIndex.byteIndex = 0; for (segPtr = linePtr->segPtr, leftToScan = matchByte; - leftToScan >= 0; segPtr = segPtr->nextPtr) { - if (segPtr->typePtr != &tkTextCharType) { + leftToScan >= 0 && segPtr; segPtr = segPtr->nextPtr) { + if (segPtr->typePtr != &tkTextCharType || \ + (!searchElide && TkTextIsElided(textPtr, &curIndex))) { matchByte += segPtr->size; - continue; + } else { + leftToScan -= segPtr->size; } - leftToScan -= segPtr->size; + curIndex.byteIndex += segPtr->size; } for (leftToScan += matchLength; leftToScan > 0; segPtr = segPtr->nextPtr) { @@ -2023,9 +2035,12 @@ TextSearchCmd(textPtr, interp, argc, argv) } done: Tcl_DStringFree(&line); - if (noCase) { + if (noCase && exact) { Tcl_DStringFree(&patDString); } + if (patObj != NULL) { + Tcl_DecrRefCount(patObj); + } return code; } |