summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-11-17 10:57:35 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-11-17 10:57:35 (GMT)
commitade22ba319d8ff4395c82135981cc073804ce97a (patch)
tree551a8431a7603d8f0d73f739344653f03f7c3a35
parent3857560b944b318c14b18b5105c6e25d169bb9a6 (diff)
downloadtk-ade22ba319d8ff4395c82135981cc073804ce97a.zip
tk-ade22ba319d8ff4395c82135981cc073804ce97a.tar.gz
tk-ade22ba319d8ff4395c82135981cc073804ce97a.tar.bz2
Lots of ANSIfying of function decls.
Also a few spots where code has been cleaned up more completely.
-rw-r--r--generic/tk3d.c10
-rw-r--r--generic/tkAtom.c22
-rw-r--r--generic/tkBind.c52
-rw-r--r--generic/tkBitmap.c27
-rw-r--r--generic/tkCanvLine.c40
-rw-r--r--generic/tkCanvPoly.c28
-rw-r--r--generic/tkCanvText.c24
-rw-r--r--generic/tkCanvas.c22
-rw-r--r--generic/tkColor.c16
-rw-r--r--generic/tkCursor.c24
-rw-r--r--generic/tkEntry.c504
-rw-r--r--generic/tkFont.c16
-rw-r--r--generic/tkFrame.c52
-rw-r--r--generic/tkGC.c12
-rw-r--r--generic/tkGeometry.c8
-rw-r--r--generic/tkGrid.c8
-rw-r--r--generic/tkImage.c8
-rw-r--r--generic/tkListbox.c22
-rw-r--r--generic/tkMenu.c19
-rw-r--r--generic/tkObj.c99
-rw-r--r--generic/tkOldConfig.c78
-rw-r--r--generic/tkOption.c148
-rw-r--r--generic/tkPack.c171
-rw-r--r--generic/tkPanedWindow.c20
-rw-r--r--generic/tkPlace.c14
-rw-r--r--generic/tkRectOval.c254
-rw-r--r--generic/tkScale.c14
-rw-r--r--generic/tkScrollbar.c18
-rw-r--r--generic/tkTest.c12
-rw-r--r--generic/tkText.c16
-rw-r--r--generic/tkTextDisp.c1266
-rw-r--r--generic/tkTextImage.c196
-rw-r--r--generic/tkTextMark.c658
-rw-r--r--generic/tkTextTag.c177
-rw-r--r--generic/tkTextWind.c1170
-rw-r--r--generic/tkWindow.c15
36 files changed, 2623 insertions, 2617 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c
index f85d54c..cee599f 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.15 2005/11/04 11:52:50 dkf Exp $
+ * RCS: @(#) $Id: tk3d.c,v 1.16 2005/11/17 10:57:35 dkf Exp $
*/
#include "tk3d.h"
@@ -189,7 +189,7 @@ Tk_Get3DBorder(
{
Tcl_HashEntry *hashPtr;
TkBorder *borderPtr, *existingBorderPtr;
- int new;
+ int isNew;
XGCValues gcValues;
XColor *bgColorPtr;
TkDisplay *dispPtr;
@@ -200,8 +200,8 @@ Tk_Get3DBorder(
BorderInit(dispPtr);
}
- hashPtr = Tcl_CreateHashEntry(&dispPtr->borderTable, colorName, &new);
- if (!new) {
+ hashPtr = Tcl_CreateHashEntry(&dispPtr->borderTable, colorName, &isNew);
+ if (!isNew) {
existingBorderPtr = (TkBorder *) Tcl_GetHashValue(hashPtr);
for (borderPtr = existingBorderPtr; borderPtr != NULL;
borderPtr = borderPtr->nextPtr) {
@@ -221,7 +221,7 @@ Tk_Get3DBorder(
bgColorPtr = Tk_GetColor(interp, tkwin, colorName);
if (bgColorPtr == NULL) {
- if (new) {
+ if (isNew) {
Tcl_DeleteHashEntry(hashPtr);
}
return NULL;
diff --git a/generic/tkAtom.c b/generic/tkAtom.c
index eab269b..7e370d7 100644
--- a/generic/tkAtom.c
+++ b/generic/tkAtom.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: tkAtom.c,v 1.4 2005/11/04 11:52:50 dkf Exp $
+ * RCS: @(#) $Id: tkAtom.c,v 1.5 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -83,21 +83,21 @@ Tk_InternAtom(
{
register TkDisplay *dispPtr;
register Tcl_HashEntry *hPtr;
- int new;
+ int isNew;
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->atomInit) {
AtomInit(dispPtr);
}
- hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &new);
- if (new) {
+ hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew);
+ if (isNew) {
Tcl_HashEntry *hPtr2;
Atom atom;
atom = XInternAtom(dispPtr->display, name, False);
Tcl_SetHashValue(hPtr, atom);
- hPtr2 = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom, &new);
+ hPtr2 = Tcl_CreateHashEntry(&dispPtr->atomTable, (char*) atom, &isNew);
Tcl_SetHashValue(hPtr2, Tcl_GetHashKey(&dispPtr->nameTable, hPtr));
}
return (Atom) Tcl_GetHashValue(hPtr);
@@ -142,7 +142,7 @@ Tk_GetAtomName(
if (hPtr == NULL) {
char *name;
Tk_ErrorHandler handler;
- int new, mustFree;
+ int isNew, mustFree;
handler = Tk_CreateErrorHandler(dispPtr->display, BadAtom, -1, -1,
NULL, (ClientData) NULL);
@@ -153,13 +153,13 @@ Tk_GetAtomName(
mustFree = 0;
}
Tk_DeleteErrorHandler(handler);
- hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &new);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew);
Tcl_SetHashValue(hPtr, atom);
if (mustFree) {
XFree(name);
}
name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
- hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom, &new);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom, &isNew);
Tcl_SetHashValue(hPtr, name);
}
return Tcl_GetHashValue(hPtr);
@@ -194,7 +194,7 @@ AtomInit(
for (atom = 1; atom <= XA_LAST_PREDEFINED; atom++) {
char *name;
- int new;
+ int isNew;
hPtr = Tcl_FindHashEntry(&dispPtr->atomTable, (char *) atom);
if (hPtr != NULL) {
@@ -202,10 +202,10 @@ AtomInit(
}
name = atomNameArray[atom - 1];
- hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &new);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew);
Tcl_SetHashValue(hPtr, atom);
name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr);
- hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom, &new);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, (char *) atom, &isNew);
Tcl_SetHashValue(hPtr, name);
}
}
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 44f5949..2b1be76 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.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: tkBind.c,v 1.38 2005/11/10 11:38:29 dkf Exp $
+ * RCS: @(#) $Id: tkBind.c,v 1.39 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -962,7 +962,7 @@ Tk_CreateBinding(
BindingTable *bindPtr = (BindingTable *) bindingTable;
PatSeq *psPtr;
unsigned long eventMask;
- char *new, *old;
+ char *newStr, *oldStr;
psPtr = FindSequence(interp, &bindPtr->patternTable, object, eventString,
1, 1, &eventMask);
@@ -970,7 +970,7 @@ Tk_CreateBinding(
return 0;
}
if (psPtr->eventProc == NULL) {
- int new;
+ int isNew;
Tcl_HashEntry *hPtr;
/*
@@ -980,8 +980,8 @@ Tk_CreateBinding(
*/
hPtr = Tcl_CreateHashEntry(&bindPtr->objectTable, (char *) object,
- &new);
- if (new) {
+ &isNew);
+ if (isNew) {
psPtr->nextObjPtr = NULL;
} else {
psPtr->nextObjPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
@@ -999,23 +999,23 @@ Tk_CreateBinding(
append = 0;
}
- old = (char *) psPtr->clientData;
- if ((append != 0) && (old != NULL)) {
+ oldStr = (char *) psPtr->clientData;
+ if ((append != 0) && (oldStr != NULL)) {
int length;
- length = strlen(old) + strlen(command) + 2;
- new = (char *) ckalloc((unsigned) length);
- sprintf(new, "%s\n%s", old, command);
+ length = strlen(oldStr) + strlen(command) + 2;
+ newStr = (char *) ckalloc((unsigned) length);
+ sprintf(newStr, "%s\n%s", oldStr, command);
} else {
- new = (char *) ckalloc((unsigned) strlen(command) + 1);
- strcpy(new, command);
+ newStr = (char *) ckalloc((unsigned) strlen(command) + 1);
+ strcpy(newStr, command);
}
- if (old != NULL) {
- ckfree(old);
+ if (oldStr != NULL) {
+ ckfree(oldStr);
}
psPtr->eventProc = EvalTclBinding;
psPtr->freeProc = FreeTclBinding;
- psPtr->clientData = (ClientData) new;
+ psPtr->clientData = (ClientData) newStr;
return eventMask;
}
@@ -1068,7 +1068,7 @@ TkCreateBindingProcedure(
return 0;
}
if (psPtr->eventProc == NULL) {
- int new;
+ int isNew;
Tcl_HashEntry *hPtr;
/*
@@ -1078,8 +1078,8 @@ TkCreateBindingProcedure(
*/
hPtr = Tcl_CreateHashEntry(&bindPtr->objectTable, (char *) object,
- &new);
- if (new) {
+ &isNew);
+ if (isNew) {
psPtr->nextObjPtr = NULL;
} else {
psPtr->nextObjPtr = (PatSeq *) Tcl_GetHashValue(hPtr);
@@ -1638,7 +1638,7 @@ Tk_BindEvent(
eventPtr, detail.keySym, &scripts);
} else {
if (matchCount >= matchSpace) {
- PendingBinding *new;
+ PendingBinding *newPtr;
unsigned int oldSize, newSize;
oldSize = sizeof(staticPending)
@@ -1648,12 +1648,12 @@ Tk_BindEvent(
newSize = sizeof(staticPending)
- sizeof(staticPending.matchArray)
+ matchSpace * sizeof(PatSeq*);
- new = (PendingBinding *) ckalloc(newSize);
- memcpy((void *) new, (void *) pendingPtr, oldSize);
+ newPtr = (PendingBinding *) ckalloc(newSize);
+ memcpy((void *) newPtr, (void *) pendingPtr, oldSize);
if (pendingPtr != &staticPending) {
ckfree((char *) pendingPtr);
}
- pendingPtr = new;
+ pendingPtr = newPtr;
}
sourcePtr->refCount++;
pendingPtr->matchArray[matchCount] = sourcePtr;
@@ -3998,7 +3998,7 @@ FindSequence(
Pattern *patPtr;
PatSeq *psPtr;
Tcl_HashEntry *hPtr;
- int flags, count, new;
+ int flags, count, isNew;
size_t sequenceSize;
unsigned long eventMask;
PatternTableKey key;
@@ -4074,9 +4074,9 @@ FindSequence(
key.object = object;
key.type = patPtr->eventType;
key.detail = patPtr->detail;
- hPtr = Tcl_CreateHashEntry(patternTablePtr, (char *) &key, &new);
+ hPtr = Tcl_CreateHashEntry(patternTablePtr, (char *) &key, &isNew);
sequenceSize = numPats*sizeof(Pattern);
- if (!new) {
+ if (!isNew) {
for (psPtr = (PatSeq *) Tcl_GetHashValue(hPtr); psPtr != NULL;
psPtr = psPtr->nextSeqPtr) {
if ((numPats == psPtr->numPats)
@@ -4088,7 +4088,7 @@ FindSequence(
}
}
if (!create) {
- if (new) {
+ if (isNew) {
Tcl_DeleteHashEntry(hPtr);
}
diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c
index 38b7a34..612e92a 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.13 2005/11/04 11:52:50 dkf Exp $
+ * RCS: @(#) $Id: tkBitmap.c,v 1.14 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -305,7 +305,7 @@ GetBitmap(
Tcl_HashEntry *nameHashPtr, *predefHashPtr;
TkBitmap *bitmapPtr, *existingBitmapPtr;
TkPredefBitmap *predefPtr;
- int new;
+ int isNew;
Pixmap bitmap;
int width, height;
int dummy2;
@@ -317,8 +317,9 @@ GetBitmap(
BitmapInit(dispPtr);
}
- nameHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapNameTable, string, &new);
- if (!new) {
+ nameHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapNameTable, string,
+ &isNew);
+ if (!isNew) {
existingBitmapPtr = (TkBitmap *) Tcl_GetHashValue(nameHashPtr);
for (bitmapPtr = existingBitmapPtr; bitmapPtr != NULL;
bitmapPtr = bitmapPtr->nextPtr) {
@@ -423,8 +424,8 @@ GetBitmap(
bitmapPtr->objRefCount = 0;
bitmapPtr->nameHashPtr = nameHashPtr;
bitmapPtr->idHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapIdTable,
- (char *) bitmap, &new);
- if (!new) {
+ (char *) bitmap, &isNew);
+ if (!isNew) {
Tcl_Panic("bitmap already registered in Tk_GetBitmap");
}
bitmapPtr->nextPtr = existingBitmapPtr;
@@ -433,7 +434,7 @@ GetBitmap(
return bitmapPtr;
error:
- if (new) {
+ if (isNew) {
Tcl_DeleteHashEntry(nameHashPtr);
}
return NULL;
@@ -468,7 +469,7 @@ Tk_DefineBitmap(
int width, /* Width of bitmap. */
int height) /* Height of bitmap. */
{
- int new;
+ int isNew;
Tcl_HashEntry *predefHashPtr;
TkPredefBitmap *predefPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
@@ -487,8 +488,8 @@ Tk_DefineBitmap(
}
predefHashPtr = Tcl_CreateHashEntry(&tsdPtr->predefBitmapTable,
- name, &new);
- if (!new) {
+ name, &isNew);
+ if (!isNew) {
Tcl_AppendResult(interp, "bitmap \"", name,
"\" is already defined", NULL);
return TCL_ERROR;
@@ -804,7 +805,7 @@ Tk_GetBitmapFromData(
{
DataKey nameKey;
Tcl_HashEntry *dataHashPtr;
- int new;
+ int isNew;
char string[16 + TCL_INTEGER_SPACE];
char *name;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -815,8 +816,8 @@ Tk_GetBitmapFromData(
nameKey.width = width;
nameKey.height = height;
dataHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapDataTable,
- (char *) &nameKey, &new);
- if (!new) {
+ (char *) &nameKey, &isNew);
+ if (!isNew) {
name = (char *) Tcl_GetHashValue(dataHashPtr);
} else {
dispPtr->bitmapAutoNumber++;
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index cd02c18..f645243 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.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: tkCanvLine.c,v 1.17 2005/11/04 15:23:05 dkf Exp $
+ * RCS: @(#) $Id: tkCanvLine.c,v 1.18 2005/11/17 10:57:35 dkf Exp $
*/
#include <stdio.h>
@@ -955,11 +955,11 @@ LineInsert(
{
LineItem *linePtr = (LineItem *) itemPtr;
int length, objc, i;
- double *new, *coordPtr;
+ double *newCoordPtr, *coordPtr;
Tk_State state = itemPtr->state;
Tcl_Obj **objv;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -982,24 +982,27 @@ LineInsert(
linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1];
}
- new = (double *) ckalloc((unsigned)(sizeof(double) * (length + objc)));
- for(i=0; i<beforeThis; i++) {
- new[i] = linePtr->coordPtr[i];
+ newCoordPtr = (double *)
+ ckalloc(sizeof(double) * (unsigned)(length + objc));
+ for (i=0; i<beforeThis; i++) {
+ newCoordPtr[i] = linePtr->coordPtr[i];
}
- for(i=0; i<objc; i++) {
- if (Tcl_GetDoubleFromObj(NULL,objv[i],
- new+(i+beforeThis))!=TCL_OK) {
+ for (i=0; i<objc; i++) {
+ if (Tcl_GetDoubleFromObj(NULL, objv[i],
+ &newCoordPtr[i + beforeThis]) != TCL_OK) {
Tcl_ResetResult(((TkCanvas *)canvas)->interp);
- ckfree((char *) new);
+ ckfree((char *) newCoordPtr);
return;
}
}
- for(i=beforeThis; i<length; i++) {
- new[i+objc] = linePtr->coordPtr[i];
+ for (i=beforeThis; i<length; i++) {
+ newCoordPtr[i+objc] = linePtr->coordPtr[i];
}
- if(linePtr->coordPtr) ckfree((char *)linePtr->coordPtr);
- linePtr->coordPtr = new;
+ if (linePtr->coordPtr) {
+ ckfree((char *)linePtr->coordPtr);
+ }
+ linePtr->coordPtr = newCoordPtr;
linePtr->numPoints = (length + objc)/2;
if ((length>3) && (state != TK_STATE_HIDDEN)) {
@@ -1047,9 +1050,9 @@ LineInsert(
}
}
coordPtr = linePtr->coordPtr+beforeThis+2;
- for(i=2; i<objc; i+=2) {
+ for (i=2; i<objc; i+=2) {
TkIncludePoint(itemPtr, coordPtr);
- coordPtr+=2;
+ coordPtr+=2;
}
}
if (linePtr->firstArrowPtr != NULL) {
@@ -1061,12 +1064,13 @@ LineInsert(
linePtr->lastArrowPtr = NULL;
}
if (linePtr->arrow != ARROWS_NONE) {
- ConfigureArrows(canvas, linePtr);
+ ConfigureArrows(canvas, linePtr);
}
- if(itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) {
+ if (itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) {
double width;
int intWidth;
+
if ((linePtr->firstArrowPtr != NULL) && (beforeThis>2)) {
/*
* Include new first arrow.
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index 031b0a3..05d4dfb 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.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: tkCanvPoly.c,v 1.14 2005/11/04 15:23:05 dkf Exp $
+ * RCS: @(#) $Id: tkCanvPoly.c,v 1.15 2005/11/17 10:57:35 dkf Exp $
*/
#include <stdio.h>
@@ -1016,7 +1016,7 @@ PolygonInsert(
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
int length, objc, i;
Tcl_Obj **objv;
- double *new;
+ double *newCoordPtr;
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
@@ -1034,25 +1034,27 @@ PolygonInsert(
while (beforeThis<0) {
beforeThis += length;
}
- new = (double *) ckalloc((unsigned)(sizeof(double) * (length + 2 + objc)));
+ newCoordPtr = (double *)
+ ckalloc(sizeof(double) * (unsigned)(length + 2 + objc));
for (i=0; i<beforeThis; i++) {
- new[i] = polyPtr->coordPtr[i];
+ newCoordPtr[i] = polyPtr->coordPtr[i];
}
for (i=0; i<objc; i++) {
- if (Tcl_GetDoubleFromObj(NULL, objv[i], new+(i+beforeThis)) != TCL_OK){
- ckfree((char *) new);
+ if (Tcl_GetDoubleFromObj(NULL, objv[i],
+ &newCoordPtr[i+beforeThis]) != TCL_OK){
+ ckfree((char *) newCoordPtr);
return;
}
}
for (i=beforeThis; i<length; i++) {
- new[i+objc] = polyPtr->coordPtr[i];
+ newCoordPtr[i+objc] = polyPtr->coordPtr[i];
}
if (polyPtr->coordPtr) {
ckfree((char *) polyPtr->coordPtr);
}
length += objc;
- polyPtr->coordPtr = new;
+ polyPtr->coordPtr = newCoordPtr;
polyPtr->numPoints = (length/2) + polyPtr->autoClosed;
/*
@@ -1061,19 +1063,21 @@ PolygonInsert(
*/
if (polyPtr->autoClosed) {
- if ((new[length-2] == new[0]) && (new[length-1] == new[1])) {
+ if ((newCoordPtr[length-2] == newCoordPtr[0])
+ && (newCoordPtr[length-1] == newCoordPtr[1])) {
polyPtr->autoClosed = 0;
polyPtr->numPoints--;
}
} else {
- if ((new[length-2] != new[0]) || (new[length-1] != new[1])) {
+ if ((newCoordPtr[length-2] != newCoordPtr[0])
+ || (newCoordPtr[length-1] != newCoordPtr[1])) {
polyPtr->autoClosed = 1;
polyPtr->numPoints++;
}
}
- new[length] = new[0];
- new[length+1] = new[1];
+ newCoordPtr[length] = newCoordPtr[0];
+ newCoordPtr[length+1] = newCoordPtr[1];
if (((length-objc)>3) && (state != TK_STATE_HIDDEN)) {
/*
* This is some optimizing code that will result that only the part of
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index 05ff604..2cfa782 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvText.c,v 1.19 2005/11/04 15:23:05 dkf Exp $
+ * RCS: @(#) $Id: tkCanvText.c,v 1.20 2005/11/17 10:57:35 dkf Exp $
*/
#include <stdio.h>
@@ -899,7 +899,7 @@ TextInsert(
{
TextItem *textPtr = (TextItem *) itemPtr;
int byteIndex, byteCount, charsAdded;
- char *new, *text;
+ char *newStr, *text;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
string = Tcl_GetStringFromObj((Tcl_Obj *) string, &byteCount);
@@ -918,13 +918,13 @@ TextInsert(
return;
}
- new = (char *) ckalloc((unsigned) textPtr->numBytes + byteCount + 1);
- memcpy(new, text, (size_t) byteIndex);
- strcpy(new + byteIndex, string);
- strcpy(new + byteIndex + byteCount, text + byteIndex);
+ newStr = (char *) ckalloc((unsigned) textPtr->numBytes + byteCount + 1);
+ memcpy(newStr, text, (size_t) byteIndex);
+ strcpy(newStr + byteIndex, string);
+ strcpy(newStr + byteIndex + byteCount, text + byteIndex);
ckfree(text);
- textPtr->text = new;
+ textPtr->text = newStr;
charsAdded = Tcl_NumUtfChars(string, byteCount);
textPtr->numChars += charsAdded;
textPtr->numBytes += byteCount;
@@ -980,7 +980,7 @@ TextDeleteChars(
{
TextItem *textPtr = (TextItem *) itemPtr;
int byteIndex, byteCount, charsRemoved;
- char *new, *text;
+ char *newStr, *text;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
text = textPtr->text;
@@ -999,12 +999,12 @@ TextDeleteChars(
byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved)
- (text + byteIndex);
- new = (char *) ckalloc((unsigned) (textPtr->numBytes + 1 - byteCount));
- memcpy(new, text, (size_t) byteIndex);
- strcpy(new + byteIndex, text + byteIndex + byteCount);
+ newStr = (char *) ckalloc((unsigned) (textPtr->numBytes + 1 - byteCount));
+ memcpy(newStr, text, (size_t) byteIndex);
+ strcpy(newStr + byteIndex, text + byteIndex + byteCount);
ckfree(text);
- textPtr->text = new;
+ textPtr->text = newStr;
textPtr->numChars -= charsRemoved;
textPtr->numBytes -= byteCount;
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index cb22dca..c183830 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.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: tkCanvas.c,v 1.38 2005/11/04 11:52:50 dkf Exp $
+ * RCS: @(#) $Id: tkCanvas.c,v 1.39 2005/11/17 10:57:35 dkf Exp $
*/
/* #define USE_OLD_TAG_SEARCH 1 */
@@ -385,7 +385,7 @@ Tk_CanvasObjCmd(
{
Tk_Window tkwin = (Tk_Window) clientData;
TkCanvas *canvasPtr;
- Tk_Window new;
+ Tk_Window newWin;
if (typeList == NULL) {
InitCanvas();
@@ -396,8 +396,8 @@ Tk_CanvasObjCmd(
return TCL_ERROR;
}
- new = Tk_CreateWindowFromPath(interp, tkwin, Tcl_GetString(argv[1]), NULL);
- if (new == NULL) {
+ newWin = Tk_CreateWindowFromPath(interp,tkwin,Tcl_GetString(argv[1]),NULL);
+ if (newWin == NULL) {
return TCL_ERROR;
}
@@ -408,8 +408,8 @@ Tk_CanvasObjCmd(
*/
canvasPtr = (TkCanvas *) ckalloc(sizeof(TkCanvas));
- canvasPtr->tkwin = new;
- canvasPtr->display = Tk_Display(new);
+ canvasPtr->tkwin = newWin;
+ canvasPtr->display = Tk_Display(newWin);
canvasPtr->interp = interp;
canvasPtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(canvasPtr->tkwin), CanvasWidgetCmd,
@@ -471,8 +471,8 @@ Tk_CanvasObjCmd(
canvasPtr->hotPrevPtr = NULL;
canvasPtr->cursor = None;
canvasPtr->takeFocus = NULL;
- canvasPtr->pixelsPerMM = WidthOfScreen(Tk_Screen(new));
- canvasPtr->pixelsPerMM /= WidthMMOfScreen(Tk_Screen(new));
+ canvasPtr->pixelsPerMM = WidthOfScreen(Tk_Screen(newWin));
+ canvasPtr->pixelsPerMM /= WidthMMOfScreen(Tk_Screen(newWin));
canvasPtr->flags = 0;
canvasPtr->nextId = 1;
canvasPtr->psInfo = NULL;
@@ -1888,7 +1888,7 @@ ConfigureCanvas(
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
XGCValues gcValues;
- GC new;
+ GC newGC;
if (Tk_ConfigureWidget(interp, canvasPtr->tkwin, configSpecs,
objc, (CONST char **) objv, (char *) canvasPtr,
@@ -1911,12 +1911,12 @@ ConfigureCanvas(
gcValues.function = GXcopy;
gcValues.graphics_exposures = False;
gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel;
- new = Tk_GetGC(canvasPtr->tkwin,
+ newGC = Tk_GetGC(canvasPtr->tkwin,
GCFunction|GCGraphicsExposures|GCForeground, &gcValues);
if (canvasPtr->pixmapGC != None) {
Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC);
}
- canvasPtr->pixmapGC = new;
+ canvasPtr->pixmapGC = newGC;
/*
* Reset the desired dimensions for the window.
diff --git a/generic/tkColor.c b/generic/tkColor.c
index 2390cb7..0eb80f7 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.11 2005/11/04 11:52:50 dkf Exp $
+ * RCS: @(#) $Id: tkColor.c,v 1.12 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkColor.h"
@@ -189,7 +189,7 @@ Tk_GetColor(
* suitable for passing to XParseColor). */
{
Tcl_HashEntry *nameHashPtr;
- int new;
+ int isNew;
TkColor *tkColPtr;
TkColor *existingColPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -202,8 +202,8 @@ Tk_GetColor(
* First, check to see if there's already a mapping for this color name.
*/
- nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &new);
- if (!new) {
+ nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &isNew);
+ if (!isNew) {
existingColPtr = (TkColor *) Tcl_GetHashValue(nameHashPtr);
for (tkColPtr = existingColPtr; tkColPtr != NULL;
tkColPtr = tkColPtr->nextPtr) {
@@ -232,7 +232,7 @@ Tk_GetColor(
"\"", NULL);
}
}
- if (new) {
+ if (isNew) {
Tcl_DeleteHashEntry(nameHashPtr);
}
return NULL;
@@ -289,7 +289,7 @@ Tk_GetColorByValue(
{
ValueKey valueKey;
Tcl_HashEntry *valueHashPtr;
- int new;
+ int isNew;
TkColor *tkColPtr;
Display *display = Tk_Display(tkwin);
TkDisplay *dispPtr = TkGetDisplay(display);
@@ -308,8 +308,8 @@ Tk_GetColorByValue(
valueKey.colormap = Tk_Colormap(tkwin);
valueKey.display = display;
valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable,
- (char *) &valueKey, &new);
- if (!new) {
+ (char *) &valueKey, &isNew);
+ if (!isNew) {
tkColPtr = (TkColor *) Tcl_GetHashValue(valueHashPtr);
tkColPtr->resourceRefCount++;
return &tkColPtr->color;
diff --git a/generic/tkCursor.c b/generic/tkCursor.c
index 11c0ace..9be2a2e 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.13 2005/11/11 23:51:27 dkf Exp $
+ * RCS: @(#) $Id: tkCursor.c,v 1.14 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -232,7 +232,7 @@ TkcGetCursor(
Tcl_HashEntry *nameHashPtr;
register TkCursor *cursorPtr;
TkCursor *existingCursorPtr = NULL;
- int new;
+ int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->cursorInit) {
@@ -240,8 +240,8 @@ TkcGetCursor(
}
nameHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorNameTable,
- string, &new);
- if (!new) {
+ string, &isNew);
+ if (!isNew) {
existingCursorPtr = (TkCursor *) Tcl_GetHashValue(nameHashPtr);
for (cursorPtr = existingCursorPtr; cursorPtr != NULL;
cursorPtr = cursorPtr->nextPtr) {
@@ -257,7 +257,7 @@ TkcGetCursor(
cursorPtr = TkGetCursorByName(interp, tkwin, string);
if (cursorPtr == NULL) {
- if (new) {
+ if (isNew) {
Tcl_DeleteHashEntry(nameHashPtr);
}
return NULL;
@@ -274,8 +274,8 @@ TkcGetCursor(
cursorPtr->hashPtr = nameHashPtr;
cursorPtr->nextPtr = existingCursorPtr;
cursorPtr->idHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorIdTable,
- (char *) cursorPtr->cursor, &new);
- if (!new) {
+ (char *) cursorPtr->cursor, &isNew);
+ if (!isNew) {
Tcl_Panic("cursor already registered in Tk_GetCursor");
}
Tcl_SetHashValue(nameHashPtr, cursorPtr);
@@ -322,7 +322,7 @@ Tk_GetCursorFromData(
DataKey dataKey;
Tcl_HashEntry *dataHashPtr;
register TkCursor *cursorPtr;
- int new;
+ int isNew;
XColor fgColor, bgColor;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -340,8 +340,8 @@ Tk_GetCursorFromData(
dataKey.bg = bg;
dataKey.display = Tk_Display(tkwin);
dataHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorDataTable,
- (char *) &dataKey, &new);
- if (!new) {
+ (char *) &dataKey, &isNew);
+ if (!isNew) {
cursorPtr = (TkCursor *) Tcl_GetHashValue(dataHashPtr);
cursorPtr->resourceRefCount++;
return cursorPtr->cursor;
@@ -373,10 +373,10 @@ Tk_GetCursorFromData(
cursorPtr->hashPtr = dataHashPtr;
cursorPtr->objRefCount = 0;
cursorPtr->idHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorIdTable,
- (char *) cursorPtr->cursor, &new);
+ (char *) cursorPtr->cursor, &isNew);
cursorPtr->nextPtr = NULL;
- if (!new) {
+ if (!isNew) {
Tcl_Panic("cursor already registered in Tk_GetCursorFromData");
}
Tcl_SetHashValue(dataHashPtr, cursorPtr);
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index ab628e9..6f97c0c 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.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: tkEntry.c,v 1.38 2005/08/10 22:02:22 dkf Exp $
+ * RCS: @(#) $Id: tkEntry.c,v 1.39 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkInt.h"
@@ -38,7 +38,7 @@
static char *stateStrings[] = {
- "disabled", "normal", "readonly", (char *) NULL
+ "disabled", "normal", "readonly", NULL
};
/*
@@ -46,7 +46,7 @@ static char *stateStrings[] = {
*/
static char *validateStrings[] = {
- "all", "key", "focus", "focusin", "focusout", "none", (char *) NULL
+ "all", "key", "focus", "focusin", "focusout", "none", NULL
};
enum validateType {
VALIDATE_ALL, VALIDATE_KEY, VALIDATE_FOCUS,
@@ -67,13 +67,12 @@ static Tk_OptionSpec entryOptSpec[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_ENTRY_BG_COLOR, -1, Tk_Offset(Entry, normalBorder),
0, (ClientData) DEF_ENTRY_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth),
- 0, 0, 0},
+ DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth), 0, 0, 0},
{TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor",
DEF_ENTRY_CURSOR, -1, Tk_Offset(Entry, cursor),
TK_OPTION_NULL_OK, 0, 0},
@@ -87,27 +86,22 @@ static Tk_OptionSpec entryOptSpec[] = {
{TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
"ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1,
Tk_Offset(Entry, exportSelection), 0, 0, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_ENTRY_FONT, -1, Tk_Offset(Entry, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0,
- 0, 0},
+ DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_ENTRY_HIGHLIGHT_BG,
- -1, Tk_Offset(Entry, highlightBgColorPtr),
- 0, 0, 0},
+ -1, Tk_Offset(Entry, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr),
- 0, 0, 0},
+ DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr), 0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
"HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1,
Tk_Offset(Entry, highlightWidth), 0, 0, 0},
{TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground",
- DEF_ENTRY_INSERT_BG,
- -1, Tk_Offset(Entry, insertBorder),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_BG, -1, Tk_Offset(Entry, insertBorder), 0, 0, 0},
{TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
"BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1,
Tk_Offset(Entry, insertBorderWidth), 0,
@@ -116,16 +110,14 @@ static Tk_OptionSpec entryOptSpec[] = {
DEF_ENTRY_INSERT_OFF_TIME, -1, Tk_Offset(Entry, insertOffTime),
0, 0, 0},
{TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime",
- DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime), 0, 0, 0},
{TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
- DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth), 0, 0, 0},
{TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand",
DEF_ENTRY_INVALIDCMD, -1, Tk_Offset(Entry, invalidCmd),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_SYNONYM, "-invcmd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-invalidcommand", 0},
+ {TK_OPTION_SYNONYM, "-invcmd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-invalidcommand", 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
DEF_ENTRY_JUSTIFY, -1, Tk_Offset(Entry, justify), 0, 0, 0},
{TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground",
@@ -133,8 +125,7 @@ static Tk_OptionSpec entryOptSpec[] = {
Tk_Offset(Entry, readonlyBorder), TK_OPTION_NULL_OK,
(ClientData) DEF_ENTRY_READONLY_BG_MONO, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief),
- 0, 0, 0},
+ DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief), 0, 0, 0},
{TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground",
DEF_ENTRY_SELECT_COLOR, -1, Tk_Offset(Entry, selBorder),
0, (ClientData) DEF_ENTRY_SELECT_MONO, 0},
@@ -160,18 +151,16 @@ static Tk_OptionSpec entryOptSpec[] = {
{TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate",
DEF_ENTRY_VALIDATE, -1, Tk_Offset(Entry, validate),
0, (ClientData) validateStrings, 0},
- {TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand",
- (char *) NULL, -1, Tk_Offset(Entry, validateCmd),
- TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_SYNONYM, "-vcmd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-validatecommand", 0},
+ {TK_OPTION_STRING, "-validatecommand", "validateCommand","ValidateCommand",
+ NULL, -1, Tk_Offset(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_SYNONYM, "-vcmd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-validatecommand", 0},
{TK_OPTION_INT, "-width", "width", "Width",
DEF_ENTRY_WIDTH, -1, Tk_Offset(Entry, prefWidth), 0, 0, 0},
{TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
DEF_ENTRY_SCROLL_COMMAND, -1, Tk_Offset(Entry, scrollCmd),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
/*
@@ -198,13 +187,12 @@ static Tk_OptionSpec sbOptSpec[] = {
{TK_OPTION_BORDER, "-background", "background", "Background",
DEF_ENTRY_BG_COLOR, -1, Tk_Offset(Entry, normalBorder),
0, (ClientData) DEF_ENTRY_BG_MONO, 0},
- {TK_OPTION_SYNONYM, "-bd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
- {TK_OPTION_SYNONYM, "-bg", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-background", 0},
+ {TK_OPTION_SYNONYM, "-bd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-borderwidth", 0},
+ {TK_OPTION_SYNONYM, "-bg", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-background", 0},
{TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth",
- DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth),
- 0, 0, 0},
+ DEF_ENTRY_BORDER_WIDTH, -1, Tk_Offset(Entry, borderWidth), 0, 0, 0},
{TK_OPTION_BORDER, "-buttonbackground", "Button.background", "Background",
DEF_BUTTON_BG_COLOR, -1, Tk_Offset(Spinbox, buttonBorder),
0, (ClientData) DEF_BUTTON_BG_MONO, 0},
@@ -212,11 +200,9 @@ static Tk_OptionSpec sbOptSpec[] = {
DEF_BUTTON_CURSOR, -1, Tk_Offset(Spinbox, bCursor),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_RELIEF, "-buttondownrelief", "Button.relief", "Relief",
- DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, bdRelief),
- 0, 0, 0},
+ DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, bdRelief), 0, 0, 0},
{TK_OPTION_RELIEF, "-buttonuprelief", "Button.relief", "Relief",
- DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, buRelief),
- 0, 0, 0},
+ DEF_BUTTON_RELIEF, -1, Tk_Offset(Spinbox, buRelief), 0, 0, 0},
{TK_OPTION_STRING, "-command", "command", "Command",
DEF_SPINBOX_CMD, -1, Tk_Offset(Spinbox, command),
TK_OPTION_NULL_OK, 0, 0},
@@ -233,13 +219,12 @@ static Tk_OptionSpec sbOptSpec[] = {
{TK_OPTION_BOOLEAN, "-exportselection", "exportSelection",
"ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1,
Tk_Offset(Entry, exportSelection), 0, 0, 0},
- {TK_OPTION_SYNONYM, "-fg", "foreground", (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-foreground", 0},
+ {TK_OPTION_SYNONYM, "-fg", "foreground", NULL,
+ NULL, 0, -1, 0, (ClientData) "-foreground", 0},
{TK_OPTION_FONT, "-font", "font", "Font",
DEF_ENTRY_FONT, -1, Tk_Offset(Entry, tkfont), 0, 0, 0},
{TK_OPTION_COLOR, "-foreground", "foreground", "Foreground",
- DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0,
- 0, 0},
+ DEF_ENTRY_FG, -1, Tk_Offset(Entry, fgColorPtr), 0, 0, 0},
{TK_OPTION_STRING, "-format", "format", "Format",
DEF_SPINBOX_FORMAT, -1, Tk_Offset(Spinbox, reqFormat),
TK_OPTION_NULL_OK, 0, 0},
@@ -247,19 +232,16 @@ static Tk_OptionSpec sbOptSpec[] = {
DEF_SPINBOX_FROM, -1, Tk_Offset(Spinbox, fromValue), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightbackground", "highlightBackground",
"HighlightBackground", DEF_ENTRY_HIGHLIGHT_BG,
- -1, Tk_Offset(Entry, highlightBgColorPtr),
- 0, 0, 0},
+ -1, Tk_Offset(Entry, highlightBgColorPtr), 0, 0, 0},
{TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor",
- DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr),
- 0, 0, 0},
+ DEF_ENTRY_HIGHLIGHT, -1, Tk_Offset(Entry, highlightColorPtr), 0, 0, 0},
{TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness",
"HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1,
Tk_Offset(Entry, highlightWidth), 0, 0, 0},
{TK_OPTION_DOUBLE, "-increment", "increment", "Increment",
DEF_SPINBOX_INCREMENT, -1, Tk_Offset(Spinbox, increment), 0, 0, 0},
{TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground",
- DEF_ENTRY_INSERT_BG, -1, Tk_Offset(Entry, insertBorder),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_BG, -1, Tk_Offset(Entry, insertBorder), 0, 0, 0},
{TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth",
"BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1,
Tk_Offset(Entry, insertBorderWidth), 0,
@@ -268,21 +250,18 @@ static Tk_OptionSpec sbOptSpec[] = {
DEF_ENTRY_INSERT_OFF_TIME, -1, Tk_Offset(Entry, insertOffTime),
0, 0, 0},
{TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime",
- DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_ON_TIME, -1, Tk_Offset(Entry, insertOnTime), 0, 0, 0},
{TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
- DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth),
- 0, 0, 0},
+ DEF_ENTRY_INSERT_WIDTH, -1, Tk_Offset(Entry, insertWidth), 0, 0, 0},
{TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand",
DEF_ENTRY_INVALIDCMD, -1, Tk_Offset(Entry, invalidCmd),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_SYNONYM, "-invcmd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-invalidcommand", 0},
+ {TK_OPTION_SYNONYM, "-invcmd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-invalidcommand", 0},
{TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
DEF_ENTRY_JUSTIFY, -1, Tk_Offset(Entry, justify), 0, 0, 0},
{TK_OPTION_RELIEF, "-relief", "relief", "Relief",
- DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief),
- 0, 0, 0},
+ DEF_ENTRY_RELIEF, -1, Tk_Offset(Entry, relief), 0, 0, 0},
{TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground",
"ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, -1,
Tk_Offset(Entry, readonlyBorder), TK_OPTION_NULL_OK,
@@ -317,14 +296,13 @@ static Tk_OptionSpec sbOptSpec[] = {
{TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate",
DEF_ENTRY_VALIDATE, -1, Tk_Offset(Entry, validate),
0, (ClientData) validateStrings, 0},
- {TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand",
- (char *) NULL, -1, Tk_Offset(Entry, validateCmd),
- TK_CONFIG_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-validatecommand", "validateCommand","ValidateCommand",
+ NULL, -1, Tk_Offset(Entry, validateCmd), TK_CONFIG_NULL_OK, 0, 0},
{TK_OPTION_STRING, "-values", "values", "Values",
DEF_SPINBOX_VALUES, -1, Tk_Offset(Spinbox, valueStr),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_SYNONYM, "-vcmd", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, (ClientData) "-validatecommand", 0},
+ {TK_OPTION_SYNONYM, "-vcmd", NULL, NULL,
+ NULL, 0, -1, 0, (ClientData) "-validatecommand", 0},
{TK_OPTION_INT, "-width", "width", "Width",
DEF_ENTRY_WIDTH, -1, Tk_Offset(Entry, prefWidth), 0, 0, 0},
{TK_OPTION_BOOLEAN, "-wrap", "wrap", "Wrap",
@@ -332,8 +310,7 @@ static Tk_OptionSpec sbOptSpec[] = {
{TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand",
DEF_ENTRY_SCROLL_COMMAND, -1, Tk_Offset(Entry, scrollCmd),
TK_CONFIG_NULL_OK, 0, 0},
- {TK_OPTION_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, -1, 0, 0, 0}
+ {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0}
};
/*
@@ -344,7 +321,7 @@ static Tk_OptionSpec sbOptSpec[] = {
static CONST char *entryCmdNames[] = {
"bbox", "cget", "configure", "delete", "get", "icursor", "index",
- "insert", "scan", "selection", "validate", "xview", (char *) NULL
+ "insert", "scan", "selection", "validate", "xview", NULL
};
enum entryCmd {
@@ -354,7 +331,7 @@ enum entryCmd {
};
static CONST char *selCmdNames[] = {
- "adjust", "clear", "from", "present", "range", "to", (char *) NULL
+ "adjust", "clear", "from", "present", "range", "to", NULL
};
enum selCmd {
@@ -371,7 +348,7 @@ enum selCmd {
static CONST char *sbCmdNames[] = {
"bbox", "cget", "configure", "delete", "get", "icursor", "identify",
"index", "insert", "invoke", "scan", "selection", "set",
- "validate", "xview", (char *) NULL
+ "validate", "xview", NULL
};
enum sbCmd {
@@ -382,8 +359,7 @@ enum sbCmd {
};
static CONST char *sbSelCmdNames[] = {
- "adjust", "clear", "element", "from", "present", "range", "to",
- (char *) NULL
+ "adjust", "clear", "element", "from", "present", "range", "to", NULL
};
enum sbselCmd {
@@ -401,7 +377,7 @@ enum sbselCmd {
*/
static CONST char *selElementNames[] = {
- "none", "buttondown", "buttonup", (char *) NULL, "entry"
+ "none", "buttondown", "buttonup", NULL, "entry"
};
/*
@@ -439,9 +415,9 @@ static char * EntryTextVarProc(ClientData clientData,
static void EntryUpdateScrollbar(Entry *entryPtr);
static int EntryValidate(Entry *entryPtr, char *cmd);
static int EntryValidateChange(Entry *entryPtr, char *change,
- CONST char *new, int index, int type);
+ CONST char *newStr, int index, int type);
static void ExpandPercents(Entry *entryPtr, CONST char *before,
- char *change, CONST char *new, int index,
+ CONST char *change, CONST char *newStr, int index,
int type, Tcl_DString *dsPtr);
static void EntryValueChanged(Entry *entryPtr,
CONST char *newValue);
@@ -496,11 +472,11 @@ static Tk_ClassProcs entryClass = {
*/
int
-Tk_EntryObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_EntryObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register Entry *entryPtr;
Tk_OptionTable optionTable;
@@ -513,7 +489,7 @@ Tk_EntryObjCmd(clientData, interp, objc, objv)
}
tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetString(objv[1]), (char *) NULL);
+ Tcl_GetString(objv[1]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -607,11 +583,11 @@ Tk_EntryObjCmd(clientData, interp, objc, objv)
*/
static int
-EntryWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about entry widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+EntryWidgetObjCmd(
+ ClientData clientData, /* Information about entry widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Entry *entryPtr = (Entry *) clientData;
int cmdIndex, selIndex, result;
@@ -676,7 +652,7 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
if (objc <= 3) {
objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr,
entryPtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL,
+ (objc == 3) ? objv[2] : NULL,
entryPtr->tkwin);
if (objPtr == NULL) {
goto error;
@@ -713,7 +689,7 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
case COMMAND_GET:
if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
goto error;
}
Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
@@ -786,7 +762,7 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
} else {
Tcl_AppendResult(interp, "bad scan option \"",
Tcl_GetString(objv[2]), "\": must be mark or dragto",
- (char *) NULL);
+ NULL);
goto error;
}
break;
@@ -852,7 +828,7 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
case SELECTION_CLEAR:
if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
goto error;
}
if (entryPtr->selectFirst >= 0) {
@@ -876,7 +852,7 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
case SELECTION_PRESENT:
if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
goto error;
}
Tcl_SetObjResult(interp,
@@ -931,12 +907,12 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
int code;
if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
goto error;
}
selIndex = entryPtr->validate;
entryPtr->validate = VALIDATE_ALL;
- code = EntryValidateChange(entryPtr, (char *) NULL, entryPtr->string,
+ code = EntryValidateChange(entryPtr, NULL, entryPtr->string,
-1, VALIDATE_FORCED);
if (entryPtr->validate != VALIDATE_NONE) {
entryPtr->validate = selIndex;
@@ -1031,8 +1007,8 @@ EntryWidgetObjCmd(clientData, interp, objc, objv)
*/
static void
-DestroyEntry(memPtr)
- char *memPtr; /* Info about entry widget. */
+DestroyEntry(
+ char *memPtr) /* Info about entry widget. */
{
Entry *entryPtr = (Entry *) memPtr;
@@ -1099,13 +1075,13 @@ DestroyEntry(memPtr)
*/
static int
-ConfigureEntry(interp, entryPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- Entry *entryPtr; /* Information about widget; may or may not
+ConfigureEntry(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Entry *entryPtr, /* Information about widget; may or may not
* already have values for some fields. */
- int objc; /* Number of valid entries in argv. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ int objc, /* Number of valid entries in argv. */
+ Tcl_Obj *CONST objv[], /* Argument objects. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
Tk_SavedOptions savedOptions;
Tk_3DBorder border;
@@ -1154,7 +1130,7 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
if (Tk_SetOptions(interp, (char *) entryPtr,
entryPtr->optionTable, objc, objv,
- entryPtr->tkwin, &savedOptions, (int *) NULL) != TCL_OK) {
+ entryPtr->tkwin, &savedOptions, NULL) != TCL_OK) {
continue;
}
} else {
@@ -1213,7 +1189,7 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
if ((fmt[0] != '%') || (fmt[formatLen-1] != 'f')) {
badFormatOpt:
Tcl_AppendResult(interp, "bad spinbox format specifier \"",
- sbPtr->reqFormat, "\"", (char *) NULL);
+ sbPtr->reqFormat, "\"", NULL);
continue;
}
if ((sscanf(fmt, "%%%d.%d%[f]", &min, &max, fbuf) == 3)
@@ -1412,8 +1388,8 @@ ConfigureEntry(interp, entryPtr, objc, objv, flags)
*/
static void
-EntryWorldChanged(instanceData)
- ClientData instanceData; /* Information about widget. */
+EntryWorldChanged(
+ ClientData instanceData) /* Information about widget. */
{
XGCValues gcValues;
GC gc = None;
@@ -1513,10 +1489,10 @@ EntryWorldChanged(instanceData)
*/
int
-TkpDrawEntryBorderAndFocus(entryPtr, pixmap, isSpinbox)
- Entry *entryPtr;
- Drawable pixmap;
- int isSpinbox;
+TkpDrawEntryBorderAndFocus(
+ Entry *entryPtr,
+ Drawable pixmap,
+ int isSpinbox)
{
return 0;
}
@@ -1542,9 +1518,9 @@ TkpDrawEntryBorderAndFocus(entryPtr, pixmap, isSpinbox)
*/
int
-TkpDrawSpinboxButtons(sbPtr, pixmap)
- Spinbox *sbPtr;
- Pixmap pixmap;
+TkpDrawSpinboxButtons(
+ Spinbox *sbPtr,
+ Pixmap pixmap)
{
return 0;
}
@@ -1567,8 +1543,8 @@ TkpDrawSpinboxButtons(sbPtr, pixmap)
*/
static void
-DisplayEntry(clientData)
- ClientData clientData; /* Information about window. */
+DisplayEntry(
+ ClientData clientData) /* Information about window. */
{
Entry *entryPtr = (Entry *) clientData;
Tk_Window tkwin = entryPtr->tkwin;
@@ -1879,8 +1855,8 @@ DisplayEntry(clientData)
*/
static void
-EntryComputeGeometry(entryPtr)
- Entry *entryPtr; /* Widget record for entry. */
+EntryComputeGeometry(
+ Entry *entryPtr) /* Widget record for entry. */
{
int totalLength, overflow, maxOffScreen, rightX;
int height, width, i;
@@ -2012,16 +1988,16 @@ EntryComputeGeometry(entryPtr)
*/
static void
-InsertChars(entryPtr, index, value)
- Entry *entryPtr; /* Entry that is to get the new elements. */
- int index; /* Add the new elements before this character
+InsertChars(
+ Entry *entryPtr, /* Entry that is to get the new elements. */
+ int index, /* Add the new elements before this character
* index. */
- char *value; /* New characters to add (NULL-terminated
+ char *value) /* New characters to add (NULL-terminated
* string). */
{
int byteIndex, byteCount, oldChars, charsAdded, newByteCount;
CONST char *string;
- char *new;
+ char *newStr;
string = entryPtr->string;
byteIndex = Tcl_UtfAtIndex(string, index) - string;
@@ -2031,21 +2007,21 @@ InsertChars(entryPtr, index, value)
}
newByteCount = entryPtr->numBytes + byteCount + 1;
- new = (char *) ckalloc((unsigned) newByteCount);
- memcpy(new, string, (size_t) byteIndex);
- strcpy(new + byteIndex, value);
- strcpy(new + byteIndex + byteCount, string + byteIndex);
+ newStr = (char *) ckalloc((unsigned) newByteCount);
+ memcpy(newStr, string, (size_t) byteIndex);
+ strcpy(newStr + byteIndex, value);
+ strcpy(newStr + byteIndex + byteCount, string + byteIndex);
if ((entryPtr->validate == VALIDATE_KEY ||
entryPtr->validate == VALIDATE_ALL) &&
- EntryValidateChange(entryPtr, value, new, index,
+ EntryValidateChange(entryPtr, value, newStr, index,
VALIDATE_INSERT) != TCL_OK) {
- ckfree(new);
+ ckfree(newStr);
return;
}
ckfree((char *)string);
- entryPtr->string = new;
+ entryPtr->string = newStr;
/*
* The following construction is used because inserting improperly formed
@@ -2057,12 +2033,12 @@ InsertChars(entryPtr, index, value)
*/
oldChars = entryPtr->numChars;
- entryPtr->numChars = Tcl_NumUtfChars(new, -1);
+ entryPtr->numChars = Tcl_NumUtfChars(newStr, -1);
charsAdded = entryPtr->numChars - oldChars;
entryPtr->numBytes += byteCount;
if (entryPtr->displayString == string) {
- entryPtr->displayString = new;
+ entryPtr->displayString = newStr;
entryPtr->numDisplayBytes = entryPtr->numBytes;
}
@@ -2110,14 +2086,14 @@ InsertChars(entryPtr, index, value)
*/
static void
-DeleteChars(entryPtr, index, count)
- Entry *entryPtr; /* Entry widget to modify. */
- int index; /* Index of first character to delete. */
- int count; /* How many characters to delete. */
+DeleteChars(
+ Entry *entryPtr, /* Entry widget to modify. */
+ int index, /* Index of first character to delete. */
+ int count) /* How many characters to delete. */
{
int byteIndex, byteCount, newByteCount;
CONST char *string;
- char *new, *todelete;
+ char *newStr, *toDelete;
if ((index + count) > entryPtr->numChars) {
count = entryPtr->numChars - index;
@@ -2131,31 +2107,31 @@ DeleteChars(entryPtr, index, count)
byteCount = Tcl_UtfAtIndex(string + byteIndex, count) - (string+byteIndex);
newByteCount = entryPtr->numBytes + 1 - byteCount;
- new = (char *) ckalloc((unsigned) newByteCount);
- memcpy(new, string, (size_t) byteIndex);
- strcpy(new + byteIndex, string + byteIndex + byteCount);
+ newStr = (char *) ckalloc((unsigned) newByteCount);
+ memcpy(newStr, string, (size_t) byteIndex);
+ strcpy(newStr + byteIndex, string + byteIndex + byteCount);
- todelete = (char *) ckalloc((unsigned) (byteCount + 1));
- memcpy(todelete, string + byteIndex, (size_t) byteCount);
- todelete[byteCount] = '\0';
+ toDelete = (char *) ckalloc((unsigned) (byteCount + 1));
+ memcpy(toDelete, string + byteIndex, (size_t) byteCount);
+ toDelete[byteCount] = '\0';
if ((entryPtr->validate == VALIDATE_KEY ||
entryPtr->validate == VALIDATE_ALL) &&
- EntryValidateChange(entryPtr, todelete, new, index,
+ EntryValidateChange(entryPtr, toDelete, newStr, index,
VALIDATE_DELETE) != TCL_OK) {
- ckfree(new);
- ckfree(todelete);
+ ckfree(newStr);
+ ckfree(toDelete);
return;
}
- ckfree(todelete);
+ ckfree(toDelete);
ckfree((char *)entryPtr->string);
- entryPtr->string = new;
+ entryPtr->string = newStr;
entryPtr->numChars -= count;
entryPtr->numBytes -= byteCount;
if (entryPtr->displayString == string) {
- entryPtr->displayString = new;
+ entryPtr->displayString = newStr;
entryPtr->numDisplayBytes = entryPtr->numBytes;
}
@@ -2226,9 +2202,9 @@ DeleteChars(entryPtr, index, count)
*/
static void
-EntryValueChanged(entryPtr, newValue)
- Entry *entryPtr; /* Entry whose value just changed. */
- CONST char *newValue; /* If this value is not NULL, we first force
+EntryValueChanged(
+ Entry *entryPtr, /* Entry whose value just changed. */
+ CONST char *newValue) /* If this value is not NULL, we first force
* the value of the entry to this. */
{
if (newValue != NULL) {
@@ -2286,9 +2262,9 @@ EntryValueChanged(entryPtr, newValue)
*/
static void
-EntrySetValue(entryPtr, value)
- Entry *entryPtr; /* Entry whose value is to be changed. */
- CONST char *value; /* New text to display in entry. */
+EntrySetValue(
+ Entry *entryPtr, /* Entry whose value is to be changed. */
+ CONST char *value) /* New text to display in entry. */
{
CONST char *oldSource;
int valueLen, malloced = 0;
@@ -2314,7 +2290,7 @@ EntrySetValue(entryPtr, value)
malloced = 1;
entryPtr->flags |= VALIDATE_VAR;
- (void) EntryValidateChange(entryPtr, (char *) NULL, value, -1,
+ (void) EntryValidateChange(entryPtr, NULL, value, -1,
VALIDATE_FORCED);
entryPtr->flags &= ~VALIDATE_VAR;
@@ -2392,9 +2368,9 @@ EntrySetValue(entryPtr, value)
*/
static void
-EntryEventProc(clientData, eventPtr)
- ClientData clientData; /* Information about window. */
- XEvent *eventPtr; /* Information about event. */
+EntryEventProc(
+ ClientData clientData, /* Information about window. */
+ XEvent *eventPtr) /* Information about event. */
{
Entry *entryPtr = (Entry *) clientData;
@@ -2474,8 +2450,8 @@ EntryEventProc(clientData, eventPtr)
*/
static void
-EntryCmdDeletedProc(clientData)
- ClientData clientData; /* Pointer to widget record for widget. */
+EntryCmdDeletedProc(
+ ClientData clientData) /* Pointer to widget record for widget. */
{
Entry *entryPtr = (Entry *) clientData;
@@ -2512,13 +2488,12 @@ EntryCmdDeletedProc(clientData)
*/
static int
-GetEntryIndex(interp, entryPtr, string, indexPtr)
- Tcl_Interp *interp; /* For error messages. */
- Entry *entryPtr; /* Entry for which the index is being
+GetEntryIndex(
+ Tcl_Interp *interp, /* For error messages. */
+ Entry *entryPtr, /* Entry for which the index is being
* specified. */
- char *string; /* Specifies character in entryPtr. */
- int *indexPtr; /* Where to store converted character
- * index. */
+ char *string, /* Specifies character in entryPtr. */
+ int *indexPtr) /* Where to store converted character index */
{
size_t length;
@@ -2535,10 +2510,10 @@ GetEntryIndex(interp, entryPtr, string, indexPtr)
* so we have to clear it out before storing our own message.
*/
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
Tcl_AppendResult(interp, "bad ",
(entryPtr->type == TK_ENTRY) ? "entry" : "spinbox",
- " index \"", string, "\"", (char *) NULL);
+ " index \"", string, "\"", NULL);
return TCL_ERROR;
}
} else if (string[0] == 'e') {
@@ -2555,9 +2530,9 @@ GetEntryIndex(interp, entryPtr, string, indexPtr)
}
} else if (string[0] == 's') {
if (entryPtr->selectFirst < 0) {
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
Tcl_AppendResult(interp, "selection isn't in widget ",
- Tk_PathName(entryPtr->tkwin), (char *) NULL);
+ Tk_PathName(entryPtr->tkwin), NULL);
return TCL_ERROR;
}
if (length < 5) {
@@ -2630,9 +2605,9 @@ GetEntryIndex(interp, entryPtr, string, indexPtr)
*/
static void
-EntryScanTo(entryPtr, x)
- Entry *entryPtr; /* Information about widget. */
- int x; /* X-coordinate to use for scan operation. */
+EntryScanTo(
+ Entry *entryPtr, /* Information about widget. */
+ int x) /* X-coordinate to use for scan operation. */
{
int newLeftIndex;
@@ -2688,9 +2663,9 @@ EntryScanTo(entryPtr, x)
*/
static void
-EntrySelectTo(entryPtr, index)
- Entry *entryPtr; /* Information about widget. */
- int index; /* Character index of element that is to
+EntrySelectTo(
+ Entry *entryPtr, /* Information about widget. */
+ int index) /* Character index of element that is to
* become the "other" end of the selection. */
{
int newFirst, newLast;
@@ -2753,14 +2728,13 @@ EntrySelectTo(entryPtr, index)
*/
static int
-EntryFetchSelection(clientData, offset, buffer, maxBytes)
- ClientData clientData; /* Information about entry widget. */
- int offset; /* Byte offset within selection of first
+EntryFetchSelection(
+ ClientData clientData, /* Information about entry widget. */
+ int offset, /* Byte offset within selection of first
* character to be returned. */
- char *buffer; /* Location in which to place selection. */
- int maxBytes; /* Maximum number of bytes to place at buffer,
- * not including terminating NULL
- * character. */
+ char *buffer, /* Location in which to place selection. */
+ int maxBytes) /* Maximum number of bytes to place at buffer,
+ * not including terminating NUL character. */
{
Entry *entryPtr = (Entry *) clientData;
int byteCount;
@@ -2805,8 +2779,8 @@ EntryFetchSelection(clientData, offset, buffer, maxBytes)
*/
static void
-EntryLostSelection(clientData)
- ClientData clientData; /* Information about entry widget. */
+EntryLostSelection(
+ ClientData clientData) /* Information about entry widget. */
{
Entry *entryPtr = (Entry *) clientData;
@@ -2847,8 +2821,8 @@ EntryLostSelection(clientData)
*/
static void
-EventuallyRedraw(entryPtr)
- Entry *entryPtr; /* Information about widget. */
+EventuallyRedraw(
+ Entry *entryPtr) /* Information about widget. */
{
if ((entryPtr->flags & ENTRY_DELETED) || !Tk_IsMapped(entryPtr->tkwin)) {
return;
@@ -2885,11 +2859,11 @@ EventuallyRedraw(entryPtr)
*/
static void
-EntryVisibleRange(entryPtr, firstPtr, lastPtr)
- Entry *entryPtr; /* Information about widget. */
- double *firstPtr; /* Return position of first visible character
+EntryVisibleRange(
+ Entry *entryPtr, /* Information about widget. */
+ double *firstPtr, /* Return position of first visible character
* in widget. */
- double *lastPtr; /* Return position of char just after last
+ double *lastPtr) /* Return position of char just after last
* visible one. */
{
int charsInWindow;
@@ -2936,8 +2910,8 @@ EntryVisibleRange(entryPtr, firstPtr, lastPtr)
*/
static void
-EntryUpdateScrollbar(entryPtr)
- Entry *entryPtr; /* Information about widget. */
+EntryUpdateScrollbar(
+ Entry *entryPtr) /* Information about widget. */
{
char args[TCL_DOUBLE_SPACE * 2];
int code;
@@ -2952,7 +2926,7 @@ EntryUpdateScrollbar(entryPtr)
Tcl_Preserve((ClientData) interp);
EntryVisibleRange(entryPtr, &first, &last);
sprintf(args, " %g %g", first, last);
- code = Tcl_VarEval(interp, entryPtr->scrollCmd, args, (char *) NULL);
+ code = Tcl_VarEval(interp, entryPtr->scrollCmd, args, NULL);
if (code != TCL_OK) {
Tcl_AddErrorInfo(interp,
"\n (horizontal scrolling command executed by ");
@@ -2960,7 +2934,7 @@ EntryUpdateScrollbar(entryPtr)
Tcl_AddErrorInfo(interp, ")");
Tcl_BackgroundError(interp);
}
- Tcl_SetResult(interp, (char *) NULL, TCL_STATIC);
+ Tcl_SetResult(interp, NULL, TCL_STATIC);
Tcl_Release((ClientData) interp);
}
@@ -2983,8 +2957,8 @@ EntryUpdateScrollbar(entryPtr)
*/
static void
-EntryBlinkProc(clientData)
- ClientData clientData; /* Pointer to record describing entry. */
+EntryBlinkProc(
+ ClientData clientData) /* Pointer to record describing entry. */
{
Entry *entryPtr = (Entry *) clientData;
@@ -3024,9 +2998,9 @@ EntryBlinkProc(clientData)
*/
static void
-EntryFocusProc(entryPtr, gotFocus)
- Entry *entryPtr; /* Entry that got or lost focus. */
- int gotFocus; /* 1 means window is getting focus, 0 means
+EntryFocusProc(
+ Entry *entryPtr, /* Entry that got or lost focus. */
+ int gotFocus) /* 1 means window is getting focus, 0 means
* it's losing it. */
{
Tcl_DeleteTimerHandler(entryPtr->insertBlinkHandler);
@@ -3040,7 +3014,7 @@ EntryFocusProc(entryPtr, gotFocus)
if (entryPtr->validate == VALIDATE_ALL ||
entryPtr->validate == VALIDATE_FOCUS ||
entryPtr->validate == VALIDATE_FOCUSIN) {
- EntryValidateChange(entryPtr, (char *) NULL,
+ EntryValidateChange(entryPtr, NULL,
entryPtr->string, -1, VALIDATE_FOCUSIN);
}
} else {
@@ -3049,7 +3023,7 @@ EntryFocusProc(entryPtr, gotFocus)
if (entryPtr->validate == VALIDATE_ALL ||
entryPtr->validate == VALIDATE_FOCUS ||
entryPtr->validate == VALIDATE_FOCUSOUT) {
- EntryValidateChange(entryPtr, (char *) NULL,
+ EntryValidateChange(entryPtr, NULL,
entryPtr->string, -1, VALIDATE_FOCUSOUT);
}
}
@@ -3075,12 +3049,12 @@ EntryFocusProc(entryPtr, gotFocus)
/* ARGSUSED */
static char *
-EntryTextVarProc(clientData, interp, name1, name2, flags)
- ClientData clientData; /* Information about button. */
- Tcl_Interp *interp; /* Interpreter containing variable. */
- CONST char *name1; /* Not used. */
- CONST char *name2; /* Not used. */
- int flags; /* Information about what happened. */
+EntryTextVarProc(
+ ClientData clientData, /* Information about button. */
+ Tcl_Interp *interp, /* Interpreter containing variable. */
+ CONST char *name1, /* Not used. */
+ CONST char *name2, /* Not used. */
+ int flags) /* Information about what happened. */
{
Entry *entryPtr = (Entry *) clientData;
CONST char *value;
@@ -3089,7 +3063,7 @@ EntryTextVarProc(clientData, interp, name1, name2, flags)
/*
* Just abort early if we entered here while being deleted.
*/
- return (char *) NULL;
+ return NULL;
}
/*
@@ -3106,7 +3080,7 @@ EntryTextVarProc(clientData, interp, name1, name2, flags)
EntryTextVarProc, clientData);
entryPtr->flags |= ENTRY_VAR_TRACED;
}
- return (char *) NULL;
+ return NULL;
}
/*
@@ -3120,7 +3094,7 @@ EntryTextVarProc(clientData, interp, name1, name2, flags)
value = "";
}
EntrySetValue(entryPtr, value);
- return (char *) NULL;
+ return NULL;
}
/*
@@ -3144,9 +3118,9 @@ EntryTextVarProc(clientData, interp, name1, name2, flags)
*/
static int
-EntryValidate(entryPtr, cmd)
- register Entry *entryPtr; /* Entry that needs validation. */
- register char *cmd; /* Validation command (NULL-terminated
+EntryValidate(
+ register Entry *entryPtr, /* Entry that needs validation. */
+ register char *cmd) /* Validation command (NULL-terminated
* string). */
{
register Tcl_Interp *interp = entryPtr->interp;
@@ -3204,13 +3178,13 @@ EntryValidate(entryPtr, cmd)
*/
static int
-EntryValidateChange(entryPtr, change, new, index, type)
- register Entry *entryPtr; /* Entry that needs validation. */
- char *change; /* Characters to be added/deleted
- * (NULL-terminated string). */
- CONST char *new; /* Potential new value of entry string */
- int index; /* index of insert/delete, -1 otherwise */
- int type; /* forced, delete, insert, focusin or
+EntryValidateChange(
+ register Entry *entryPtr, /* Entry that needs validation. */
+ char *change, /* Characters to be added/deleted
+ * (NUL-terminated string). */
+ CONST char *newValue, /* Potential new value of entry string */
+ int index, /* index of insert/delete, -1 otherwise */
+ int type) /* forced, delete, insert, focusin or
* focusout */
{
int code, varValidate = (entryPtr->flags & VALIDATE_VAR);
@@ -3241,7 +3215,7 @@ EntryValidateChange(entryPtr, change, new, index, type)
Tcl_DStringInit(&script);
ExpandPercents(entryPtr, entryPtr->validateCmd,
- change, new, index, type, &script);
+ change, newValue, index, type, &script);
Tcl_DStringAppend(&script, "", 1);
p = Tcl_DStringValue(&script);
@@ -3291,7 +3265,7 @@ EntryValidateChange(entryPtr, change, new, index, type)
} else if (entryPtr->invalidCmd != NULL) {
Tcl_DStringInit(&script);
ExpandPercents(entryPtr, entryPtr->invalidCmd,
- change, new, index, type, &script);
+ change, newValue, index, type, &script);
Tcl_DStringAppend(&script, "", 1);
p = Tcl_DStringValue(&script);
if (Tcl_EvalEx(entryPtr->interp, p, -1,
@@ -3340,18 +3314,18 @@ EntryValidateChange(entryPtr, change, new, index, type)
*/
static void
-ExpandPercents(entryPtr, before, change, new, index, type, dsPtr)
- register Entry *entryPtr; /* Entry that needs validation. */
- register CONST char *before;
+ExpandPercents(
+ register Entry *entryPtr, /* Entry that needs validation. */
+ register CONST char *before,
/* Command containing percent expressions to
* be replaced. */
- char *change; /* Characters to added/deleted
- * (NULL-terminated string). */
- CONST char *new; /* Potential new value of entry string */
- int index; /* index of insert/delete */
- int type; /* INSERT or DELETE */
- Tcl_DString *dsPtr; /* Dynamic string in which to append
- * new command. */
+ CONST char *change, /* Characters to added/deleted (NUL-terminated
+ * string). */
+ CONST char *newValue, /* Potential new value of entry string */
+ int index, /* index of insert/delete */
+ int type, /* INSERT or DELETE */
+ Tcl_DString *dsPtr) /* Dynamic string in which to append new
+ * command. */
{
int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl
* list element. */
@@ -3376,7 +3350,7 @@ ExpandPercents(entryPtr, before, change, new, index, type, dsPtr)
*/
string = Tcl_UtfFindFirst(before, '%');
- if (string == (char *) NULL) {
+ if (string == NULL) {
Tcl_DStringAppend(dsPtr, before, -1);
break;
} else if (string != before) {
@@ -3441,7 +3415,7 @@ ExpandPercents(entryPtr, before, change, new, index, type, dsPtr)
string = numStorage;
break;
case 'P': /* 'Peeked' new value of the string */
- string = new;
+ string = newValue;
break;
case 's': /* Current string value of spinbox */
string = entryPtr->string;
@@ -3505,11 +3479,11 @@ ExpandPercents(entryPtr, before, change, new, index, type, dsPtr)
*/
int
-Tk_SpinboxObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* NULL. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_SpinboxObjCmd(
+ ClientData clientData, /* NULL. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
register Entry *entryPtr;
register Spinbox *sbPtr;
@@ -3523,7 +3497,7 @@ Tk_SpinboxObjCmd(clientData, interp, objc, objv)
}
tkwin = Tk_CreateWindowFromPath(interp, Tk_MainWindow(interp),
- Tcl_GetString(objv[1]), (char *) NULL);
+ Tcl_GetString(objv[1]), NULL);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -3636,11 +3610,11 @@ Tk_SpinboxObjCmd(clientData, interp, objc, objv)
*/
static int
-SpinboxWidgetObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Information about spinbox widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+SpinboxWidgetObjCmd(
+ ClientData clientData, /* Information about spinbox widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Entry *entryPtr = (Entry *) clientData;
Spinbox *sbPtr = (Spinbox *) clientData;
@@ -3707,7 +3681,7 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
if (objc <= 3) {
objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr,
entryPtr->optionTable,
- (objc == 3) ? objv[2] : (Tcl_Obj *) NULL,
+ (objc == 3) ? objv[2] : NULL,
entryPtr->tkwin);
if (objPtr == NULL) {
goto error;
@@ -3746,7 +3720,7 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
case SB_CMD_GET:
if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
goto error;
}
Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1);
@@ -3855,7 +3829,7 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
} else {
Tcl_AppendResult(interp, "bad scan option \"",
Tcl_GetString(objv[2]), "\": must be mark or dragto",
- (char *) NULL);
+ NULL);
goto error;
}
break;
@@ -3921,7 +3895,7 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
case SB_SEL_CLEAR:
if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
goto error;
}
if (entryPtr->selectFirst >= 0) {
@@ -3945,7 +3919,7 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
case SB_SEL_PRESENT:
if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
goto error;
}
Tcl_SetObjResult(interp,
@@ -4033,12 +4007,12 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
int code;
if (objc != 2) {
- Tcl_WrongNumArgs(interp, 2, objv, (char *) NULL);
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
goto error;
}
selIndex = entryPtr->validate;
entryPtr->validate = VALIDATE_ALL;
- code = EntryValidateChange(entryPtr, (char *) NULL, entryPtr->string,
+ code = EntryValidateChange(entryPtr, NULL, entryPtr->string,
-1, VALIDATE_FORCED);
if (entryPtr->validate != VALIDATE_NONE) {
entryPtr->validate = selIndex;
@@ -4132,11 +4106,10 @@ SpinboxWidgetObjCmd(clientData, interp, objc, objv)
*/
static int
-GetSpinboxElement(sbPtr, x, y)
- Spinbox *sbPtr; /* Spinbox for which the index is being
+GetSpinboxElement(
+ Spinbox *sbPtr, /* Spinbox for which the index is being
* specified. */
- int x; /* x coord */
- int y; /* y coord */
+ int x, int y) /* Widget-relative coordinates. */
{
Entry *entryPtr = (Entry *) sbPtr;
@@ -4174,10 +4147,10 @@ GetSpinboxElement(sbPtr, x, y)
*/
static int
-SpinboxInvoke(interp, sbPtr, element)
- register Tcl_Interp *interp;/* Current interpreter. */
- register Spinbox *sbPtr; /* Spinbox to invoke. */
- int element; /* Element to invoke, either the "up" or
+SpinboxInvoke(
+ register Tcl_Interp *interp,/* Current interpreter. */
+ register Spinbox *sbPtr, /* Spinbox to invoke. */
+ int element) /* Element to invoke, either the "up" or
* "down" button. */
{
Entry *entryPtr = (Entry *) sbPtr;
@@ -4338,9 +4311,10 @@ SpinboxInvoke(interp, sbPtr, element)
*
*----------------------------------------------------------------------
*/
+
static int
-ComputeFormat(sbPtr)
- Spinbox *sbPtr; /* Information about dial widget. */
+ComputeFormat(
+ Spinbox *sbPtr) /* Information about dial widget. */
{
double maxValue, x;
int mostSigDigit, numDigits, leastSigDigit, afterDecimal;
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 72a0630..3316bf3 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.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: tkFont.c,v 1.24 2005/11/07 15:40:18 dkf Exp $
+ * RCS: @(#) $Id: tkFont.c,v 1.25 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -890,14 +890,14 @@ CreateNamedFont(
{
TkFontInfo *fiPtr;
Tcl_HashEntry *namedHashPtr;
- int new;
+ int isNew;
NamedFont *nfPtr;
fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr;
- namedHashPtr = Tcl_CreateHashEntry(&fiPtr->namedTable, name, &new);
+ namedHashPtr = Tcl_CreateHashEntry(&fiPtr->namedTable, name, &isNew);
- if (new == 0) {
+ if (!isNew) {
nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr);
if (nfPtr->deletePending == 0) {
Tcl_ResetResult(interp);
@@ -998,7 +998,7 @@ Tk_AllocFontFromObj(
TkFontInfo *fiPtr;
Tcl_HashEntry *cacheHashPtr, *namedHashPtr;
TkFont *fontPtr, *firstFontPtr, *oldFontPtr;
- int new, descent;
+ int isNew, descent;
NamedFont *nfPtr;
fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr;
@@ -1028,13 +1028,13 @@ Tk_AllocFontFromObj(
* one of them is for the right screen.
*/
- new = 0;
+ isNew = 0;
if (oldFontPtr != NULL) {
cacheHashPtr = oldFontPtr->cacheHashPtr;
FreeFontObjProc(objPtr);
} else {
cacheHashPtr = Tcl_CreateHashEntry(&fiPtr->fontCache,
- Tcl_GetString(objPtr), &new);
+ Tcl_GetString(objPtr), &isNew);
}
firstFontPtr = (TkFont *) Tcl_GetHashValue(cacheHashPtr);
for (fontPtr = firstFontPtr; (fontPtr != NULL);
@@ -1073,7 +1073,7 @@ Tk_AllocFontFromObj(
Tcl_Obj *dupObjPtr = Tcl_DuplicateObj(objPtr);
if (ParseFontNameObj(interp, tkwin, dupObjPtr, &fa) != TCL_OK) {
- if (new) {
+ if (isNew) {
Tcl_DeleteHashEntry(cacheHashPtr);
}
Tcl_DecrRefCount(dupObjPtr);
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 9163a62..e18ff0c 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.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: tkFrame.c,v 1.23 2005/11/07 15:50:35 dkf Exp $
+ * RCS: @(#) $Id: tkFrame.c,v 1.24 2005/11/17 10:57:35 dkf Exp $
*/
#include "default.h"
@@ -459,7 +459,7 @@ CreateFrame(
Tk_Window tkwin;
Frame *framePtr;
Tk_OptionTable optionTable;
- Tk_Window new;
+ Tk_Window newWin;
CONST char *className, *screenName, *visualName, *colormapName, *arg, *useOption;
int i, c, length, depth;
unsigned int mask;
@@ -536,7 +536,7 @@ CreateFrame(
tkwin = Tk_MainWindow(interp);
if (tkwin != NULL) {
- new = Tk_CreateWindowFromPath(interp, tkwin, Tcl_GetString(objv[1]),
+ newWin = Tk_CreateWindowFromPath(interp, tkwin, Tcl_GetString(objv[1]),
screenName);
} else if (appName == NULL) {
/*
@@ -546,55 +546,55 @@ CreateFrame(
Tcl_AppendResult(interp, "unable to create widget \"",
Tcl_GetString(objv[1]), "\"", NULL);
- new = NULL;
+ newWin = NULL;
} else {
/*
* We were called from Tk_Init; create a new application.
*/
- new = TkCreateMainWindow(interp, screenName, appName);
+ newWin = TkCreateMainWindow(interp, screenName, appName);
}
- if (new == NULL) {
+ if (newWin == NULL) {
goto error;
}
if (className == NULL) {
- className = Tk_GetOption(new, "class", "Class");
+ className = Tk_GetOption(newWin, "class", "Class");
if (className == NULL) {
className = classNames[type];
}
}
- Tk_SetClass(new, className);
+ Tk_SetClass(newWin, className);
if (useOption == NULL) {
- useOption = Tk_GetOption(new, "use", "Use");
+ useOption = Tk_GetOption(newWin, "use", "Use");
}
if ((useOption != NULL) && (*useOption != 0)) {
- if (TkpUseWindow(interp, new, useOption) != TCL_OK) {
+ if (TkpUseWindow(interp, newWin, useOption) != TCL_OK) {
goto error;
}
}
if (visualName == NULL) {
- visualName = Tk_GetOption(new, "visual", "Visual");
+ visualName = Tk_GetOption(newWin, "visual", "Visual");
}
if (colormapName == NULL) {
- colormapName = Tk_GetOption(new, "colormap", "Colormap");
+ colormapName = Tk_GetOption(newWin, "colormap", "Colormap");
}
if ((colormapName != NULL) && (*colormapName == 0)) {
colormapName = NULL;
}
if (visualName != NULL) {
- visual = Tk_GetVisual(interp, new, visualName, &depth,
+ visual = Tk_GetVisual(interp, newWin, visualName, &depth,
(colormapName == NULL) ? &colormap : NULL);
if (visual == NULL) {
goto error;
}
- Tk_SetWindowVisual(new, visual, depth, colormap);
+ Tk_SetWindowVisual(newWin, visual, depth, colormap);
}
if (colormapName != NULL) {
- colormap = Tk_GetColormap(interp, new, colormapName);
+ colormap = Tk_GetColormap(interp, newWin, colormapName);
if (colormap == None) {
goto error;
}
- Tk_SetWindowColormap(new, colormap);
+ Tk_SetWindowColormap(newWin, colormap);
}
/*
@@ -604,7 +604,7 @@ CreateFrame(
*/
if (type == TYPE_TOPLEVEL) {
- Tk_GeometryRequest(new, 200, 200);
+ Tk_GeometryRequest(newWin, 200, 200);
}
/*
@@ -620,11 +620,11 @@ CreateFrame(
framePtr = (Frame *) ckalloc(sizeof(Frame));
memset((void *) framePtr, 0, (sizeof(Frame)));
}
- framePtr->tkwin = new;
- framePtr->display = Tk_Display(new);
+ framePtr->tkwin = newWin;
+ framePtr->display = Tk_Display(newWin);
framePtr->interp = interp;
framePtr->widgetCmd = Tcl_CreateObjCommand(interp,
- Tk_PathName(new), FrameWidgetObjCmd,
+ Tk_PathName(newWin), FrameWidgetObjCmd,
(ClientData) framePtr, FrameCmdDeletedProc);
framePtr->optionTable = optionTable;
framePtr->type = type;
@@ -642,14 +642,14 @@ CreateFrame(
* Store backreference to frame widget in window structure.
*/
- Tk_SetClassProcs(new, &frameClass, (ClientData) framePtr);
+ Tk_SetClassProcs(newWin, &frameClass, (ClientData) framePtr);
mask = ExposureMask | StructureNotifyMask | FocusChangeMask;
if (type == TYPE_TOPLEVEL) {
mask |= ActivateMask;
}
- Tk_CreateEventHandler(new, mask, FrameEventProc, (ClientData) framePtr);
- if ((Tk_InitOptions(interp, (char *) framePtr, optionTable, new)
+ Tk_CreateEventHandler(newWin, mask, FrameEventProc, (ClientData) framePtr);
+ if ((Tk_InitOptions(interp, (char *) framePtr, optionTable, newWin)
!= TCL_OK) ||
(ConfigureFrame(interp, framePtr, objc-2, objv+2) != TCL_OK)) {
goto error;
@@ -666,12 +666,12 @@ CreateFrame(
if (type == TYPE_TOPLEVEL) {
Tcl_DoWhenIdle(MapFrame, (ClientData) framePtr);
}
- Tcl_SetResult(interp, Tk_PathName(new), TCL_STATIC);
+ Tcl_SetResult(interp, Tk_PathName(newWin), TCL_STATIC);
return TCL_OK;
error:
- if (new != NULL) {
- Tk_DestroyWindow(new);
+ if (newWin != NULL) {
+ Tk_DestroyWindow(newWin);
}
return TCL_ERROR;
}
diff --git a/generic/tkGC.c b/generic/tkGC.c
index d6fb348..d0c8091 100644
--- a/generic/tkGC.c
+++ b/generic/tkGC.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: tkGC.c,v 1.6 2005/11/13 00:45:47 dkf Exp $
+ * RCS: @(#) $Id: tkGC.c,v 1.7 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -80,7 +80,7 @@ Tk_GetGC(
ValueKey valueKey;
Tcl_HashEntry *valueHashPtr, *idHashPtr;
register TkGC *gcPtr;
- int new;
+ int isNew;
Drawable d, freeDrawable;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -219,8 +219,8 @@ Tk_GetGC(
valueKey.screenNum = Tk_ScreenNumber(tkwin);
valueKey.depth = Tk_Depth(tkwin);
valueHashPtr = Tcl_CreateHashEntry(&dispPtr->gcValueTable,
- (char *) &valueKey, &new);
- if (!new) {
+ (char *) &valueKey, &isNew);
+ if (!isNew) {
gcPtr = (TkGC *) Tcl_GetHashValue(valueHashPtr);
gcPtr->refCount++;
return gcPtr->gc;
@@ -257,8 +257,8 @@ Tk_GetGC(
gcPtr->refCount = 1;
gcPtr->valueHashPtr = valueHashPtr;
idHashPtr = Tcl_CreateHashEntry(&dispPtr->gcIdTable,
- (char *) gcPtr->gc, &new);
- if (!new) {
+ (char *) gcPtr->gc, &isNew);
+ if (!isNew) {
Tcl_Panic("GC already registered in Tk_GetGC");
}
Tcl_SetHashValue(valueHashPtr, gcPtr);
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index 46df67e..15c2199 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.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: tkGeometry.c,v 1.6 2005/09/08 23:52:52 dkf Exp $
+ * RCS: @(#) $Id: tkGeometry.c,v 1.7 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -341,7 +341,7 @@ Tk_MaintainGeometry(slave, master, x, y, width, height)
Tcl_HashEntry *hPtr;
MaintainMaster *masterPtr;
register MaintainSlave *slavePtr;
- int new, map;
+ int isNew, map;
Tk_Window ancestor, parent;
TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr;
@@ -379,8 +379,8 @@ Tk_MaintainGeometry(slave, master, x, y, width, height)
parent = Tk_Parent(slave);
hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable,
- (char *) master, &new);
- if (!new) {
+ (char *) master, &isNew);
+ if (!isNew) {
masterPtr = (MaintainMaster *) Tcl_GetHashValue(hPtr);
} else {
masterPtr = (MaintainMaster *) ckalloc(sizeof(MaintainMaster));
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 1844bcf..0caf89f 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkGrid.c,v 1.39 2005/08/11 01:32:26 dgp Exp $
+ * RCS: @(#) $Id: tkGrid.c,v 1.40 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkInt.h"
@@ -2337,7 +2337,7 @@ GetGrid(tkwin)
{
register Gridder *gridPtr;
Tcl_HashEntry *hPtr;
- int new;
+ int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->gridInit) {
@@ -2350,8 +2350,8 @@ GetGrid(tkwin)
* one.
*/
- hPtr = Tcl_CreateHashEntry(&dispPtr->gridHashTable, (char *) tkwin, &new);
- if (!new) {
+ hPtr = Tcl_CreateHashEntry(&dispPtr->gridHashTable, (char*) tkwin, &isNew);
+ if (!isNew) {
return (Gridder *) Tcl_GetHashValue(hPtr);
}
gridPtr = (Gridder *) ckalloc(sizeof(Gridder));
diff --git a/generic/tkImage.c b/generic/tkImage.c
index a4ee9fd..58a60de 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.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: tkImage.c,v 1.25 2005/08/11 02:02:34 dgp Exp $
+ * RCS: @(#) $Id: tkImage.c,v 1.26 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkInt.h"
@@ -166,7 +166,7 @@ Tk_ImageObjCmd(clientData, interp, objc, objv)
IMAGE_TYPE, IMAGE_TYPES, IMAGE_WIDTH
};
TkWindow *winPtr = (TkWindow *) clientData;
- int i, new, firstOption, index;
+ int i, isNew, firstOption, index;
Tk_ImageType *typePtr;
ImageMaster *masterPtr;
Image *imagePtr;
@@ -261,8 +261,8 @@ Tk_ImageObjCmd(clientData, interp, objc, objv)
* Create the data structure for the new image.
*/
- hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable, name, &new);
- if (new) {
+ hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable, name, &isNew);
+ if (isNew) {
masterPtr = (ImageMaster *) ckalloc(sizeof(ImageMaster));
masterPtr->typePtr = NULL;
masterPtr->masterData = NULL;
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index e949dfc..ec49093 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.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: tkListbox.c,v 1.32 2005/09/08 23:52:53 dkf Exp $
+ * RCS: @(#) $Id: tkListbox.c,v 1.33 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -1386,12 +1386,12 @@ ListboxGetItemAttributes(interp, listPtr, index)
int index; /* Index of the item to retrieve attributes
* for. */
{
- int new;
+ int isNew;
Tcl_HashEntry *entry;
ItemAttr *attrs;
- entry = Tcl_CreateHashEntry(listPtr->itemAttrTable, (char *)index, &new);
- if (new) {
+ entry = Tcl_CreateHashEntry(listPtr->itemAttrTable, (char *)index, &isNew);
+ if (isNew) {
attrs = (ItemAttr *) ckalloc(sizeof(ItemAttr));
attrs->border = NULL;
attrs->selBorder = NULL;
@@ -3020,7 +3020,7 @@ ListboxSelect(listPtr, first, last, select)
{
int i, firstRedisplay, oldCount;
Tcl_HashEntry *entry;
- int new;
+ int isNew;
if (last < first) {
i = first;
@@ -3057,8 +3057,8 @@ ListboxSelect(listPtr, first, last, select)
}
} else {
if (select) {
- entry = Tcl_CreateHashEntry(listPtr->selection,
- (char *)i, &new);
+ entry = Tcl_CreateHashEntry(listPtr->selection, (char *)i,
+ &isNew);
Tcl_SetHashValue(entry, (ClientData) NULL);
listPtr->numSelected++;
if (firstRedisplay < 0) {
@@ -3506,7 +3506,7 @@ MigrateHashEntries(table, first, last, offset)
int last;
int offset;
{
- int i, new;
+ int i, isNew;
Tcl_HashEntry *entry;
ClientData clientData;
@@ -3526,7 +3526,8 @@ MigrateHashEntries(table, first, last, offset)
if (entry != NULL) {
clientData = Tcl_GetHashValue(entry);
Tcl_DeleteHashEntry(entry);
- entry = Tcl_CreateHashEntry(table, (char *)(i + offset), &new);
+ entry = Tcl_CreateHashEntry(table, (char *)(i + offset),
+ &isNew);
Tcl_SetHashValue(entry, clientData);
}
}
@@ -3536,7 +3537,8 @@ MigrateHashEntries(table, first, last, offset)
if (entry != NULL) {
clientData = Tcl_GetHashValue(entry);
Tcl_DeleteHashEntry(entry);
- entry = Tcl_CreateHashEntry(table, (char *)(i + offset), &new);
+ entry = Tcl_CreateHashEntry(table, (char *)(i + offset),
+ &isNew);
Tcl_SetHashValue(entry, clientData);
}
}
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 563ec0f..69ff080 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.31 2005/10/12 09:43:37 dkf Exp $
+ * RCS: @(#) $Id: tkMenu.c,v 1.32 2005/11/17 10:57:35 dkf Exp $
*/
/*
@@ -460,13 +460,13 @@ MenuCmd(clientData, interp, objc, objv)
Tcl_Obj *CONST objv[]; /* Argument strings. */
{
Tk_Window tkwin = Tk_MainWindow(interp);
- Tk_Window new;
+ Tk_Window newWin;
register TkMenu *menuPtr;
TkMenuReferences *menuRefPtr;
int i, index;
int toplevel;
char *windowName;
- static CONST char *typeStringList[] = {"-type", (char *) NULL};
+ static CONST char *typeStringList[] = {"-type", NULL};
TkMenuOptionTables *optionTablesPtr = (TkMenuOptionTables *) clientData;
if (objc < 2) {
@@ -489,9 +489,9 @@ MenuCmd(clientData, interp, objc, objv)
}
windowName = Tcl_GetStringFromObj(objv[1], NULL);
- new = Tk_CreateWindowFromPath(interp, tkwin, windowName, toplevel ? ""
- : NULL);
- if (new == NULL) {
+ newWin = Tk_CreateWindowFromPath(interp, tkwin, windowName,
+ toplevel ? "" : NULL);
+ if (newWin == NULL) {
return TCL_ERROR;
}
@@ -503,8 +503,8 @@ MenuCmd(clientData, interp, objc, objv)
menuPtr = (TkMenu *) ckalloc(sizeof(TkMenu));
memset(menuPtr, 0, sizeof(TkMenu));
- menuPtr->tkwin = new;
- menuPtr->display = Tk_Display(new);
+ menuPtr->tkwin = newWin;
+ menuPtr->display = Tk_Display(newWin);
menuPtr->interp = interp;
menuPtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd,
@@ -518,7 +518,8 @@ MenuCmd(clientData, interp, objc, objv)
Tk_SetClass(menuPtr->tkwin, "Menu");
Tk_SetClassProcs(menuPtr->tkwin, &menuClass, (ClientData) menuPtr);
- Tk_CreateEventHandler(new, ExposureMask|StructureNotifyMask|ActivateMask,
+ Tk_CreateEventHandler(newWin,
+ ExposureMask|StructureNotifyMask|ActivateMask,
TkMenuEventProc, (ClientData) menuPtr);
if (Tk_InitOptions(interp, (char *) menuPtr,
menuPtr->optionTablesPtr->menuOptionTable, menuPtr->tkwin)
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 3b34eed..6c96364 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkObj.c,v 1.13 2005/08/10 22:02:22 dkf Exp $
+ * RCS: @(#) $Id: tkObj.c,v 1.14 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkInt.h"
@@ -58,6 +58,7 @@ typedef struct MMRep {
* A WindowRep caches name-to-window lookups. The cache is invalid if tkwin is
* NULL or if mainPtr->deletionEpoch does not match epoch.
*/
+
typedef struct WindowRep {
Tk_Window tkwin; /* Cached window; NULL if not found. */
TkMainInfo *mainPtr; /* MainWindow associated with tkwin. */
@@ -143,11 +144,11 @@ static Tcl_ObjType windowObjType = {
*/
int
-Tk_GetPixelsFromObj(interp, tkwin, objPtr, intPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tk_Window tkwin;
- Tcl_Obj *objPtr; /* The object from which to get pixels. */
- int *intPtr; /* Place to store resulting pixels. */
+Tk_GetPixelsFromObj(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr, /* The object from which to get pixels. */
+ int *intPtr) /* Place to store resulting pixels. */
{
int result;
double d;
@@ -204,8 +205,8 @@ Tk_GetPixelsFromObj(interp, tkwin, objPtr, intPtr)
*/
static void
-FreePixelInternalRep(objPtr)
- Tcl_Obj *objPtr; /* Pixel object with internal rep to free. */
+FreePixelInternalRep(
+ Tcl_Obj *objPtr) /* Pixel object with internal rep to free. */
{
PixelRep *pixelPtr;
@@ -236,9 +237,9 @@ FreePixelInternalRep(objPtr)
*/
static void
-DupPixelInternalRep(srcPtr, copyPtr)
- register Tcl_Obj *srcPtr; /* Object with internal rep to copy. */
- register Tcl_Obj *copyPtr; /* Object with internal rep to set. */
+DupPixelInternalRep(
+ register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
+ register Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
PixelRep *oldPtr, *newPtr;
@@ -277,9 +278,9 @@ DupPixelInternalRep(srcPtr, copyPtr)
*/
static int
-SetPixelFromAny(interp, objPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr; /* The object to convert. */
+SetPixelFromAny(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr) /* The object to convert. */
{
Tcl_ObjType *typePtr;
char *string, *rest;
@@ -379,11 +380,11 @@ SetPixelFromAny(interp, objPtr)
*/
int
-Tk_GetMMFromObj(interp, tkwin, objPtr, doublePtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tk_Window tkwin;
- Tcl_Obj *objPtr; /* The object from which to get mms. */
- double *doublePtr; /* Place to store resulting millimeters. */
+Tk_GetMMFromObj(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tk_Window tkwin,
+ Tcl_Obj *objPtr, /* The object from which to get mms. */
+ double *doublePtr) /* Place to store resulting millimeters. */
{
int result;
double d;
@@ -435,8 +436,8 @@ Tk_GetMMFromObj(interp, tkwin, objPtr, doublePtr)
*/
static void
-FreeMMInternalRep(objPtr)
- Tcl_Obj *objPtr; /* MM object with internal rep to free. */
+FreeMMInternalRep(
+ Tcl_Obj *objPtr) /* MM object with internal rep to free. */
{
ckfree((char *) objPtr->internalRep.otherValuePtr);
objPtr->internalRep.otherValuePtr = NULL;
@@ -462,9 +463,9 @@ FreeMMInternalRep(objPtr)
*/
static void
-DupMMInternalRep(srcPtr, copyPtr)
- register Tcl_Obj *srcPtr; /* Object with internal rep to copy. */
- register Tcl_Obj *copyPtr; /* Object with internal rep to set. */
+DupMMInternalRep(
+ register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
+ register Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
MMRep *oldPtr, *newPtr;
@@ -498,8 +499,8 @@ DupMMInternalRep(srcPtr, copyPtr)
*/
static void
-UpdateStringOfMM(objPtr)
- register Tcl_Obj *objPtr; /* pixel obj with string rep to update. */
+UpdateStringOfMM(
+ register Tcl_Obj *objPtr) /* pixel obj with string rep to update. */
{
MMRep *mmPtr;
char buffer[TCL_DOUBLE_SPACE];
@@ -539,9 +540,9 @@ UpdateStringOfMM(objPtr)
*/
static int
-SetMMFromAny(interp, objPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tcl_Obj *objPtr; /* The object to convert. */
+SetMMFromAny(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tcl_Obj *objPtr) /* The object to convert. */
{
Tcl_ObjType *typePtr;
char *string, *rest;
@@ -665,11 +666,11 @@ SetMMFromAny(interp, objPtr)
*/
int
-TkGetWindowFromObj(interp, tkwin, objPtr, windowPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- Tk_Window tkwin; /* A token to get the main window from. */
- Tcl_Obj *objPtr; /* The object from which to get window. */
- Tk_Window *windowPtr; /* Place to store resulting window. */
+TkGetWindowFromObj(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ Tk_Window tkwin, /* A token to get the main window from. */
+ Tcl_Obj *objPtr, /* The object from which to get window. */
+ Tk_Window *windowPtr) /* Place to store resulting window. */
{
TkMainInfo *mainPtr = ((TkWindow *)tkwin)->mainPtr;
register WindowRep *winPtr;
@@ -724,9 +725,9 @@ TkGetWindowFromObj(interp, tkwin, objPtr, windowPtr)
*/
static int
-SetWindowFromAny(interp, objPtr)
- Tcl_Interp *interp; /* Used for error reporting if not NULL. */
- register Tcl_Obj *objPtr; /* The object to convert. */
+SetWindowFromAny(
+ Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ register Tcl_Obj *objPtr) /* The object to convert. */
{
Tcl_ObjType *typePtr;
WindowRep *winPtr;
@@ -771,9 +772,9 @@ SetWindowFromAny(interp, objPtr)
*/
static void
-DupWindowInternalRep(srcPtr, copyPtr)
- register Tcl_Obj *srcPtr;
- register Tcl_Obj *copyPtr;
+DupWindowInternalRep(
+ register Tcl_Obj *srcPtr,
+ register Tcl_Obj *copyPtr)
{
register WindowRep *oldPtr, *newPtr;
@@ -805,8 +806,8 @@ DupWindowInternalRep(srcPtr, copyPtr)
*/
static void
-FreeWindowInternalRep(objPtr)
- Tcl_Obj *objPtr; /* Window object with internal rep to free. */
+FreeWindowInternalRep(
+ Tcl_Obj *objPtr) /* Window object with internal rep to free. */
{
ckfree((char *) objPtr->internalRep.otherValuePtr);
objPtr->internalRep.otherValuePtr = NULL;
@@ -836,13 +837,13 @@ FreeWindowInternalRep(objPtr)
*/
int
-TkParsePadAmount(interp, tkwin, specObj, halfPtr, allPtr)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Window tkwin; /* A window. Needed by Tk_GetPixels() */
- Tcl_Obj *specObj; /* The argument to "-padx", "-pady", "-ipadx",
+TkParsePadAmount(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Window tkwin, /* A window. Needed by Tk_GetPixels() */
+ Tcl_Obj *specObj, /* The argument to "-padx", "-pady", "-ipadx",
* or "-ipady". The thing to be parsed. */
- int *halfPtr; /* Write the left/top part of padding here */
- int *allPtr; /* Write the total padding here */
+ int *halfPtr, /* Write the left/top part of padding here */
+ int *allPtr) /* Write the total padding here */
{
int firstInt, secondInt; /* The two components of the padding */
int objc; /* The length of the list (should be 1 or 2) */
@@ -937,7 +938,7 @@ TkParsePadAmount(interp, tkwin, specObj, halfPtr, allPtr)
*/
void
-TkRegisterObjTypes()
+TkRegisterObjTypes(void)
{
Tcl_RegisterObjType(&tkBorderObjType);
Tcl_RegisterObjType(&tkBitmapObjType);
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 345fa3d..c0b40b7 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.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: tkOldConfig.c,v 1.18 2005/09/14 22:51:09 dkf Exp $
+ * RCS: @(#) $Id: tkOldConfig.c,v 1.19 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -373,19 +373,19 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec)
}
break;
case TK_CONFIG_STRING: {
- char *old, *new;
+ char *oldStr, *newStr;
if (nullValue) {
- new = NULL;
+ newStr = NULL;
} else {
- new = (char *) ckalloc((unsigned) (strlen(value) + 1));
- strcpy(new, value);
+ newStr = (char *) ckalloc((unsigned) (strlen(value) + 1));
+ strcpy(newStr, value);
}
- old = *((char **) ptr);
- if (old != NULL) {
- ckfree(old);
+ oldStr = *((char **) ptr);
+ if (oldStr != NULL) {
+ ckfree(oldStr);
}
- *((char **) ptr) = new;
+ *((char **) ptr) = newStr;
break;
}
case TK_CONFIG_UID:
@@ -416,56 +416,56 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec)
break;
}
case TK_CONFIG_FONT: {
- Tk_Font new;
+ Tk_Font newFont;
if (nullValue) {
- new = NULL;
+ newFont = NULL;
} else {
- new = Tk_GetFont(interp, tkwin, value);
- if (new == NULL) {
+ newFont = Tk_GetFont(interp, tkwin, value);
+ if (newFont == NULL) {
return TCL_ERROR;
}
}
Tk_FreeFont(*((Tk_Font *) ptr));
- *((Tk_Font *) ptr) = new;
+ *((Tk_Font *) ptr) = newFont;
break;
}
case TK_CONFIG_BITMAP: {
- Pixmap new, old;
+ Pixmap newBmp, oldBmp;
if (nullValue) {
- new = None;
+ newBmp = None;
} else {
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- new = Tk_GetBitmap(interp, tkwin, uid);
- if (new == None) {
+ newBmp = Tk_GetBitmap(interp, tkwin, uid);
+ if (newBmp == None) {
return TCL_ERROR;
}
}
- old = *((Pixmap *) ptr);
- if (old != None) {
- Tk_FreeBitmap(Tk_Display(tkwin), old);
+ oldBmp = *((Pixmap *) ptr);
+ if (oldBmp != None) {
+ Tk_FreeBitmap(Tk_Display(tkwin), oldBmp);
}
- *((Pixmap *) ptr) = new;
+ *((Pixmap *) ptr) = newBmp;
break;
}
case TK_CONFIG_BORDER: {
- Tk_3DBorder new, old;
+ Tk_3DBorder newBorder, oldBorder;
if (nullValue) {
- new = NULL;
+ newBorder = NULL;
} else {
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- new = Tk_Get3DBorder(interp, tkwin, uid);
- if (new == NULL) {
+ newBorder = Tk_Get3DBorder(interp, tkwin, uid);
+ if (newBorder == NULL) {
return TCL_ERROR;
}
}
- old = *((Tk_3DBorder *) ptr);
- if (old != NULL) {
- Tk_Free3DBorder(old);
+ oldBorder = *((Tk_3DBorder *) ptr);
+ if (oldBorder != NULL) {
+ Tk_Free3DBorder(oldBorder);
}
- *((Tk_3DBorder *) ptr) = new;
+ *((Tk_3DBorder *) ptr) = newBorder;
break;
}
case TK_CONFIG_RELIEF:
@@ -476,24 +476,24 @@ DoConfig(interp, tkwin, specPtr, value, valueIsUid, widgRec)
break;
case TK_CONFIG_CURSOR:
case TK_CONFIG_ACTIVE_CURSOR: {
- Tk_Cursor new, old;
+ Tk_Cursor newCursor, oldCursor;
if (nullValue) {
- new = None;
+ newCursor = None;
} else {
uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value);
- new = Tk_GetCursor(interp, tkwin, uid);
- if (new == None) {
+ newCursor = Tk_GetCursor(interp, tkwin, uid);
+ if (newCursor == None) {
return TCL_ERROR;
}
}
- old = *((Tk_Cursor *) ptr);
- if (old != None) {
- Tk_FreeCursor(Tk_Display(tkwin), old);
+ oldCursor = *((Tk_Cursor *) ptr);
+ if (oldCursor != None) {
+ Tk_FreeCursor(Tk_Display(tkwin), oldCursor);
}
- *((Tk_Cursor *) ptr) = new;
+ *((Tk_Cursor *) ptr) = newCursor;
if (specPtr->type == TK_CONFIG_ACTIVE_CURSOR) {
- Tk_DefineCursor(tkwin, new);
+ Tk_DefineCursor(tkwin, newCursor);
}
break;
}
diff --git a/generic/tkOption.c b/generic/tkOption.c
index a0080fc..6e521ce 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.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: tkOption.c,v 1.16 2005/08/10 22:02:22 dkf Exp $
+ * RCS: @(#) $Id: tkOption.c,v 1.17 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -57,24 +57,24 @@
*/
typedef struct Element {
- Tk_Uid nameUid; /* Name or class from one element of
- * an option spec. */
+ Tk_Uid nameUid; /* Name or class from one element of an option
+ * spec. */
union {
- struct ElArray *arrayPtr; /* If this is an intermediate node, a
- * pointer to a structure describing
- * the remaining elements of all
- * options whose prefixes are the same
- * up through this element. */
- Tk_Uid valueUid; /* For leaf nodes, this is the string
- * value of the option. */
+ struct ElArray *arrayPtr;
+ /* If this is an intermediate node, a pointer
+ * to a structure describing the remaining
+ * elements of all options whose prefixes are
+ * the same up through this element. */
+ Tk_Uid valueUid; /* For leaf nodes, this is the string value of
+ * the option. */
} child;
- int priority; /* Used to select among matching
- * options. Includes both the priority
- * level and a serial #. Greater value
- * means higher priority. Irrelevant
- * except in leaf nodes. */
- int flags; /* OR-ed combination of bits. See
- * below for values. */
+ int priority; /* Used to select among matching options.
+ * Includes both the priority level and a
+ * serial #. Greater value means higher
+ * priority. Irrelevant except in leaf
+ * nodes. */
+ int flags; /* OR-ed combination of bits. See below for
+ * values. */
} Element;
/*
@@ -247,12 +247,12 @@ static void SetupStacks(TkWindow *winPtr, int leaf);
*/
void
-Tk_AddOption(tkwin, name, value, priority)
- Tk_Window tkwin; /* Window token; option will be associated
+Tk_AddOption(
+ Tk_Window tkwin, /* Window token; option will be associated
* with main window for this window. */
- CONST char *name; /* Multi-element name of option. */
- CONST char *value; /* String value for option. */
- int priority; /* Overall priority level to use for this
+ CONST char *name, /* Multi-element name of option. */
+ CONST char *value, /* String value for option. */
+ int priority) /* Overall priority level to use for this
* option, such as TK_USER_DEFAULT_PRIO or
* TK_INTERACTIVE_PRIO. Must be between 0 and
* TK_MAX_PRIO. */
@@ -399,11 +399,11 @@ Tk_AddOption(tkwin, name, value, priority)
*/
Tk_Uid
-Tk_GetOption(tkwin, name, className)
- Tk_Window tkwin; /* Token for window that option is associated
+Tk_GetOption(
+ Tk_Window tkwin, /* Token for window that option is associated
* with. */
- CONST char *name; /* Name of option. */
- CONST char *className; /* Class of option. NULL means there is no
+ CONST char *name, /* Name of option. */
+ CONST char *className) /* Class of option. NULL means there is no
* class for this option: just check for
* name. */
{
@@ -610,11 +610,11 @@ Tk_GetOption(tkwin, name, className)
*/
int
-Tk_OptionObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of Tcl_Obj arguments. */
- Tcl_Obj *CONST objv[]; /* Tcl_Obj arguments. */
+Tk_OptionObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of Tcl_Obj arguments. */
+ Tcl_Obj *CONST objv[]) /* Tcl_Obj arguments. */
{
Tk_Window tkwin = (Tk_Window) clientData;
int index, result;
@@ -740,8 +740,8 @@ Tk_OptionObjCmd(clientData, interp, objc, objv)
*/
void
-TkOptionDeadWindow(winPtr)
- register TkWindow *winPtr; /* Window to be cleaned up. */
+TkOptionDeadWindow(
+ register TkWindow *winPtr) /* Window to be cleaned up. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -790,8 +790,8 @@ TkOptionDeadWindow(winPtr)
*/
void
-TkOptionClassChanged(winPtr)
- TkWindow *winPtr; /* Window whose class changed. */
+TkOptionClassChanged(
+ TkWindow *winPtr) /* Window whose class changed. */
{
int i, j, *basePtr;
ElArray *arrayPtr;
@@ -848,9 +848,9 @@ TkOptionClassChanged(winPtr)
*/
static int
-ParsePriority(interp, string)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- char *string; /* Describes a priority level, either
+ParsePriority(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ char *string) /* Describes a priority level, either
* symbolically or numerically. */
{
int priority, c;
@@ -878,8 +878,7 @@ ParsePriority(interp, string)
|| (priority > 100)) {
Tcl_AppendResult(interp, "bad priority level \"", string,
"\": must be widgetDefault, startupFile, userDefault, ",
- "interactive, or a number between 0 and 100",
- (char *) NULL);
+ "interactive, or a number between 0 and 100", NULL);
return -1;
}
}
@@ -910,12 +909,12 @@ ParsePriority(interp, string)
*/
static int
-AddFromString(interp, tkwin, string, priority)
- Tcl_Interp *interp; /* Interpreter to use for reporting results. */
- Tk_Window tkwin; /* Token for window: options are entered for
+AddFromString(
+ Tcl_Interp *interp, /* Interpreter to use for reporting results. */
+ Tk_Window tkwin, /* Token for window: options are entered for
* this window's main window. */
- char *string; /* String containing option specifiers. */
- int priority; /* Priority level to use for options in this
+ char *string, /* String containing option specifiers. */
+ int priority) /* Priority level to use for options in this
* string, such as TK_USER_DEFAULT_PRIO or
* TK_INTERACTIVE_PRIO. Must be between 0 and
* TK_MAX_PRIO. */
@@ -1060,12 +1059,12 @@ AddFromString(interp, tkwin, string, priority)
*/
static int
-ReadOptionFile(interp, tkwin, fileName, priority)
- Tcl_Interp *interp; /* Interpreter to use for reporting results. */
- Tk_Window tkwin; /* Token for window: options are entered for
+ReadOptionFile(
+ Tcl_Interp *interp, /* Interpreter to use for reporting results. */
+ Tk_Window tkwin, /* Token for window: options are entered for
* this window's main window. */
- char *fileName; /* Name of file containing options. */
- int priority; /* Priority level to use for options in this
+ char *fileName, /* Name of file containing options. */
+ int priority) /* Priority level to use for options in this
* file, such as TK_USER_DEFAULT_PRIO or
* TK_INTERACTIVE_PRIO. Must be between 0 and
* TK_MAX_PRIO. */
@@ -1082,7 +1081,7 @@ ReadOptionFile(interp, tkwin, fileName, priority)
if (Tcl_IsSafe(interp)) {
Tcl_AppendResult(interp, "can't read options from a file in a",
- " safe interpreter", (char *) NULL);
+ " safe interpreter", NULL);
return TCL_ERROR;
}
@@ -1095,7 +1094,7 @@ ReadOptionFile(interp, tkwin, fileName, priority)
if (chan == NULL) {
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "couldn't open \"", fileName,
- "\": ", Tcl_PosixError(interp), (char *) NULL);
+ "\": ", Tcl_PosixError(interp), NULL);
return TCL_ERROR;
}
@@ -1109,7 +1108,7 @@ ReadOptionFile(interp, tkwin, fileName, priority)
if (bufferSize < 0) {
Tcl_AppendResult(interp, "error seeking to end of file \"",
- fileName, "\":", Tcl_PosixError(interp), (char *) NULL);
+ fileName, "\":", Tcl_PosixError(interp), NULL);
Tcl_Close(NULL, chan);
return TCL_ERROR;
@@ -1118,7 +1117,7 @@ ReadOptionFile(interp, tkwin, fileName, priority)
bufferSize = Tcl_Read(chan, buffer, bufferSize);
if (bufferSize < 0) {
Tcl_AppendResult(interp, "error reading file \"", fileName, "\":",
- Tcl_PosixError(interp), (char *) NULL);
+ Tcl_PosixError(interp), NULL);
Tcl_Close(NULL, chan);
return TCL_ERROR;
}
@@ -1147,8 +1146,8 @@ ReadOptionFile(interp, tkwin, fileName, priority)
*/
static ElArray *
-NewArray(numEls)
- int numEls; /* How many elements of space to allocate. */
+NewArray(
+ int numEls) /* How many elements of space to allocate. */
{
register ElArray *arrayPtr;
@@ -1177,9 +1176,9 @@ NewArray(numEls)
*/
static ElArray *
-ExtendArray(arrayPtr, elPtr)
- register ElArray *arrayPtr; /* Array to be extended. */
- register Element *elPtr; /* Element to be copied into array. */
+ExtendArray(
+ register ElArray *arrayPtr, /* Array to be extended. */
+ register Element *elPtr) /* Element to be copied into array. */
{
/*
* If the current array has filled up, make it bigger.
@@ -1223,10 +1222,10 @@ ExtendArray(arrayPtr, elPtr)
*/
static void
-SetupStacks(winPtr, leaf)
- TkWindow *winPtr; /* Window for which information is to be
+SetupStacks(
+ TkWindow *winPtr, /* Window for which information is to be
* cached. */
- int leaf; /* Non-zero means this is the leaf window
+ int leaf) /* Non-zero means this is the leaf window
* being probed. Zero means this is an
* ancestor of the desired leaf. */
{
@@ -1388,9 +1387,9 @@ SetupStacks(winPtr, leaf)
*/
static void
-ExtendStacks(arrayPtr, leaf)
- ElArray *arrayPtr; /* Array of elements to copy onto stacks. */
- int leaf; /* If zero, then don't copy exact leaf
+ExtendStacks(
+ ElArray *arrayPtr, /* Array of elements to copy onto stacks. */
+ int leaf) /* If zero, then don't copy exact leaf
* elements. */
{
register int count;
@@ -1425,14 +1424,15 @@ ExtendStacks(arrayPtr, leaf)
*/
static void
-OptionThreadExitProc(clientData)
- ClientData clientData; /* not used */
+OptionThreadExitProc(
+ ClientData clientData) /* not used */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->initialized) {
int i;
+
for (i = 0; i < NUM_STACKS; i++) {
ckfree((char *) tsdPtr->stacks[i]);
}
@@ -1458,8 +1458,8 @@ OptionThreadExitProc(clientData)
*/
static void
-OptionInit(mainPtr)
- register TkMainInfo *mainPtr;
+OptionInit(
+ register TkMainInfo *mainPtr)
/* Top-level information about window that
* isn't initialized yet. */
{
@@ -1524,8 +1524,8 @@ OptionInit(mainPtr)
*/
static void
-ClearOptionTree(arrayPtr)
- ElArray *arrayPtr; /* Array of options; delete everything
+ClearOptionTree(
+ ElArray *arrayPtr) /* Array of options; delete everything
* referred to recursively by this. */
{
register Element *elPtr;
@@ -1560,9 +1560,9 @@ ClearOptionTree(arrayPtr)
*/
static int
-GetDefaultOptions(interp, winPtr)
- Tcl_Interp *interp; /* Interpreter to use for error reporting. */
- TkWindow *winPtr; /* Fetch option defaults for main window
+GetDefaultOptions(
+ Tcl_Interp *interp, /* Interpreter to use for error reporting. */
+ TkWindow *winPtr) /* Fetch option defaults for main window
* associated with this. */
{
char *regProp;
diff --git a/generic/tkPack.c b/generic/tkPack.c
index bdc1f37..416d197 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.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: tkPack.c,v 1.23 2005/08/11 01:32:26 dgp Exp $
+ * RCS: @(#) $Id: tkPack.c,v 1.24 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -18,7 +18,7 @@
typedef enum {TOP, BOTTOM, LEFT, RIGHT} Side;
static CONST char *sideNames[] = {
- "top", "bottom", "left", "right", (char *) NULL
+ "top", "bottom", "left", "right", NULL
};
/* For each window that the packer cares about (either because
@@ -149,12 +149,12 @@ static int YExpansion(Packer *slavePtr, int cavityHeight);
*/
void
-TkPrintPadAmount(interp, switchName, halfSpace, allSpace)
- Tcl_Interp *interp; /* The interpreter into which the result is
+TkPrintPadAmount(
+ Tcl_Interp *interp, /* The interpreter into which the result is
* written. */
- char *switchName; /* One of "padx", "pady", "ipadx" or "ipady" */
- int halfSpace; /* The left or top padding amount */
- int allSpace; /* The total amount of padding */
+ char *switchName, /* One of "padx", "pady", "ipadx" or "ipady" */
+ int halfSpace, /* The left or top padding amount */
+ int allSpace) /* The total amount of padding */
{
char buffer[60 + 2*TCL_INTEGER_SPACE];
if (halfSpace*2 == allSpace) {
@@ -163,9 +163,8 @@ TkPrintPadAmount(interp, switchName, halfSpace, allSpace)
sprintf(buffer, " -%.10s {%d %d}", switchName, halfSpace,
allSpace - halfSpace);
}
- Tcl_AppendResult(interp, buffer, (char *)NULL);
+ Tcl_AppendResult(interp, buffer, NULL);
}
-
/*
*--------------------------------------------------------------
@@ -185,18 +184,18 @@ TkPrintPadAmount(interp, switchName, halfSpace, allSpace)
*/
int
-Tk_PackObjCmd(clientData, interp, objc, objv)
- ClientData clientData; /* Main window associated with interpreter. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. */
+Tk_PackObjCmd(
+ ClientData clientData, /* Main window associated with interpreter. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. */
{
Tk_Window tkwin = (Tk_Window) clientData;
char *argv2;
static CONST char *optionStrings[] = {
/* after, append, before and unpack are deprecated */
"after", "append", "before", "unpack",
- "configure", "forget", "info", "propagate", "slaves", (char *) NULL };
+ "configure", "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 };
@@ -239,7 +238,7 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
prevPtr = GetPacker(tkwin2);
if (prevPtr->masterPtr == NULL) {
Tcl_AppendResult(interp, "window \"", argv2,
- "\" isn't packed", (char *) NULL);
+ "\" isn't packed", NULL);
return TCL_ERROR;
}
return PackAfter(interp, prevPtr, prevPtr->masterPtr, objc-3, objv+3);
@@ -272,7 +271,7 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
packPtr = GetPacker(tkwin2);
if (packPtr->masterPtr == NULL) {
Tcl_AppendResult(interp, "window \"", argv2,
- "\" isn't packed", (char *) NULL);
+ "\" isn't packed", NULL);
return TCL_ERROR;
}
masterPtr = packPtr->masterPtr;
@@ -294,7 +293,7 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
case PACK_CONFIGURE:
if (argv2[0] != '.') {
Tcl_AppendResult(interp, "bad argument \"", argv2,
- "\": must be name of window", (char *) NULL);
+ "\": must be name of window", NULL);
return TCL_ERROR;
}
return ConfigureSlaves(interp, tkwin, objc-2, objv+2);
@@ -309,7 +308,7 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
}
slavePtr = GetPacker(slave);
if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
- Tk_ManageGeometry(slave, (Tk_GeomMgr *) NULL,
+ Tk_ManageGeometry(slave, NULL,
(ClientData) NULL);
if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
Tk_UnmaintainGeometry(slavePtr->tkwin,
@@ -335,7 +334,7 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
slavePtr = GetPacker(slave);
if (slavePtr->masterPtr == NULL) {
Tcl_AppendResult(interp, "window \"", argv2,
- "\" isn't packed", (char *) NULL);
+ "\" isn't packed", NULL);
return TCL_ERROR;
}
Tcl_AppendElement(interp, "-in");
@@ -343,28 +342,26 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
Tcl_AppendElement(interp, "-anchor");
Tcl_AppendElement(interp, Tk_NameOfAnchor(slavePtr->anchor));
Tcl_AppendResult(interp, " -expand ",
- (slavePtr->flags & EXPAND) ? "1" : "0", " -fill ",
- (char *) NULL);
+ (slavePtr->flags & EXPAND) ? "1" : "0", " -fill ", NULL);
switch (slavePtr->flags & (FILLX|FILLY)) {
case 0:
- Tcl_AppendResult(interp, "none", (char *) NULL);
+ Tcl_AppendResult(interp, "none", NULL);
break;
case FILLX:
- Tcl_AppendResult(interp, "x", (char *) NULL);
+ Tcl_AppendResult(interp, "x", NULL);
break;
case FILLY:
- Tcl_AppendResult(interp, "y", (char *) NULL);
+ Tcl_AppendResult(interp, "y", NULL);
break;
case FILLX|FILLY:
- Tcl_AppendResult(interp, "both", (char *) NULL);
+ Tcl_AppendResult(interp, "both", NULL);
break;
}
TkPrintPadAmount(interp, "ipadx", slavePtr->iPadX/2, slavePtr->iPadX);
TkPrintPadAmount(interp, "ipady", slavePtr->iPadY/2, slavePtr->iPadY);
TkPrintPadAmount(interp, "padx", slavePtr->padLeft, slavePtr->padX);
TkPrintPadAmount(interp, "pady", slavePtr->padTop, slavePtr->padY);
- Tcl_AppendResult(interp, " -side ", sideNames[slavePtr->side],
- (char *) NULL);
+ Tcl_AppendResult(interp, " -side ", sideNames[slavePtr->side], NULL);
break;
}
case PACK_PROPAGATE: {
@@ -439,7 +436,7 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
}
packPtr = GetPacker(tkwin2);
if ((packPtr != NULL) && (packPtr->masterPtr != NULL)) {
- Tk_ManageGeometry(tkwin2, (Tk_GeomMgr *) NULL,
+ Tk_ManageGeometry(tkwin2, NULL,
(ClientData) NULL);
if (packPtr->masterPtr->tkwin != Tk_Parent(packPtr->tkwin)) {
Tk_UnmaintainGeometry(packPtr->tkwin,
@@ -475,10 +472,10 @@ Tk_PackObjCmd(clientData, interp, objc, objv)
/* ARGSUSED */
static void
-PackReqProc(clientData, tkwin)
- ClientData clientData; /* Packer's information about window that got
+PackReqProc(
+ ClientData clientData, /* Packer's information about window that got
* new preferred geometry. */
- Tk_Window tkwin; /* Other Tk-related information about the
+ Tk_Window tkwin) /* Other Tk-related information about the
* window. */
{
register Packer *packPtr = (Packer *) clientData;
@@ -509,10 +506,10 @@ PackReqProc(clientData, tkwin)
/* ARGSUSED */
static void
-PackLostSlaveProc(clientData, tkwin)
- ClientData clientData; /* Packer structure for slave window that was
+PackLostSlaveProc(
+ ClientData clientData, /* Packer structure for slave window that was
* stolen away. */
- Tk_Window tkwin; /* Tk's handle for the slave window. */
+ Tk_Window tkwin) /* Tk's handle for the slave window. */
{
register Packer *slavePtr = (Packer *) clientData;
@@ -543,8 +540,8 @@ PackLostSlaveProc(clientData, tkwin)
*/
static void
-ArrangePacking(clientData)
- ClientData clientData; /* Structure describing master whose slaves
+ArrangePacking(
+ ClientData clientData) /* Structure describing master whose slaves
* are to be re-layed out. */
{
register Packer *masterPtr = (Packer *) clientData;
@@ -869,9 +866,9 @@ ArrangePacking(clientData)
*/
static int
-XExpansion(slavePtr, cavityWidth)
- register Packer *slavePtr; /* First in list of remaining slaves. */
- int cavityWidth; /* Horizontal space left for all remaining
+XExpansion(
+ register Packer *slavePtr, /* First in list of remaining slaves. */
+ int cavityWidth) /* Horizontal space left for all remaining
* slaves. */
{
int numExpand, minExpand, curExpand;
@@ -931,9 +928,9 @@ XExpansion(slavePtr, cavityWidth)
*/
static int
-YExpansion(slavePtr, cavityHeight)
- register Packer *slavePtr; /* First in list of remaining slaves. */
- int cavityHeight; /* Vertical space left for all remaining
+YExpansion(
+ register Packer *slavePtr, /* First in list of remaining slaves. */
+ int cavityHeight) /* Vertical space left for all remaining
* slaves. */
{
int numExpand, minExpand, curExpand;
@@ -987,13 +984,13 @@ YExpansion(slavePtr, cavityHeight)
*/
static Packer *
-GetPacker(tkwin)
- Tk_Window tkwin; /* Token for window for which packer structure
+GetPacker(
+ Tk_Window tkwin) /* Token for window for which packer structure
* is desired. */
{
register Packer *packPtr;
Tcl_HashEntry *hPtr;
- int new;
+ int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->packInit) {
@@ -1007,8 +1004,8 @@ GetPacker(tkwin)
*/
hPtr = Tcl_CreateHashEntry(&dispPtr->packerHashTable, (char *) tkwin,
- &new);
- if (!new) {
+ &isNew);
+ if (!isNew) {
return (Packer *) Tcl_GetHashValue(hPtr);
}
packPtr = (Packer *) ckalloc(sizeof(Packer));
@@ -1049,14 +1046,14 @@ GetPacker(tkwin)
*/
static int
-PackAfter(interp, prevPtr, masterPtr, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Packer *prevPtr; /* Pack windows in argv just after this
+PackAfter(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Packer *prevPtr, /* Pack windows in argv just after this
* window; NULL means pack as first child of
* masterPtr. */
- Packer *masterPtr; /* Master in which to pack windows. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Array of lists, each containing 2 elements:
+ Packer *masterPtr, /* Master in which to pack windows. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of lists, each containing 2 elements:
* window name and side against which to
* pack. */
{
@@ -1076,7 +1073,7 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
if (objc < 2) {
Tcl_AppendResult(interp, "wrong # args: window \"",
Tcl_GetString(objv[0]), "\" should be followed by options",
- (char *) NULL);
+ NULL);
return TCL_ERROR;
}
@@ -1099,8 +1096,7 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_HIERARCHY) {
badWindow:
Tcl_AppendResult(interp, "can't pack ", Tcl_GetString(objv[0]),
- " inside ", Tk_PathName(masterPtr->tkwin),
- (char *) NULL);
+ " inside ", Tk_PathName(masterPtr->tkwin), NULL);
return TCL_ERROR;
}
}
@@ -1160,7 +1156,7 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
missingPad:
Tcl_AppendResult(interp, "wrong # args: \"", curOpt,
"\" option must be followed by screen distance",
- (char *) NULL);
+ NULL);
return TCL_ERROR;
}
if (TkParsePadAmount(interp, tkwin, options[index+1],
@@ -1187,8 +1183,7 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
&& (strncmp(curOpt, "frame", (size_t) length) == 0)) {
if (optionCount < (index+2)) {
Tcl_AppendResult(interp, "wrong # args: \"frame\" ",
- "option must be followed by anchor point",
- (char *) NULL);
+ "option must be followed by anchor point", NULL);
return TCL_ERROR;
}
if (Tk_GetAnchorFromObj(interp, options[index+1],
@@ -1198,9 +1193,8 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
index++;
} else {
Tcl_AppendResult(interp, "bad option \"", curOpt,
- "\": should be top, bottom, left, right, ",
- "expand, fill, fillx, filly, padx, pady, or frame",
- (char *) NULL);
+ "\": should be top, bottom, left, right, expand, ",
+ "fill, fillx, filly, padx, pady, or frame", NULL);
return TCL_ERROR;
}
}
@@ -1269,8 +1263,8 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
*/
static void
-Unlink(packPtr)
- register Packer *packPtr; /* Window to unlink. */
+Unlink(
+ register Packer *packPtr) /* Window to unlink. */
{
register Packer *masterPtr, *packPtr2;
@@ -1321,9 +1315,9 @@ Unlink(packPtr)
*/
static void
-DestroyPacker(memPtr)
- char *memPtr; /* Info about packed window that
- * is now dead. */
+DestroyPacker(
+ char *memPtr) /* Info about packed window that is now
+ * dead. */
{
register Packer *packPtr = (Packer *) memPtr;
ckfree((char *) packPtr);
@@ -1348,10 +1342,10 @@ DestroyPacker(memPtr)
*/
static void
-PackStructureProc(clientData, eventPtr)
- ClientData clientData; /* Our information about window referred to by
+PackStructureProc(
+ ClientData clientData, /* Our information about window referred to by
* eventPtr. */
- XEvent *eventPtr; /* Describes what just happened. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
register Packer *packPtr = (Packer *) clientData;
@@ -1378,7 +1372,7 @@ PackStructureProc(clientData, eventPtr)
for (slavePtr = packPtr->slavePtr; slavePtr != NULL;
slavePtr = nextPtr) {
- Tk_ManageGeometry(slavePtr->tkwin, (Tk_GeomMgr *) NULL,
+ Tk_ManageGeometry(slavePtr->tkwin, NULL,
(ClientData) NULL);
Tk_UnmapWindow(slavePtr->tkwin);
slavePtr->masterPtr = NULL;
@@ -1443,12 +1437,12 @@ PackStructureProc(clientData, eventPtr)
*/
static int
-ConfigureSlaves(interp, tkwin, objc, objv)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Window tkwin; /* Any window in application containing
+ConfigureSlaves(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Window tkwin, /* Any window in application containing
* slaves. Used to look up slave names. */
- int objc; /* Number of elements in argv. */
- Tcl_Obj *CONST objv[]; /* Argument objects: contains one or more
+ int objc, /* Number of elements in argv. */
+ Tcl_Obj *CONST objv[]) /* Argument objects: contains one or more
* window names followed by any number of
* "option value" pairs. Caller must make sure
* that there is at least one window name. */
@@ -1459,7 +1453,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
char *string;
static CONST char *optionStrings[] = {
"-after", "-anchor", "-before", "-expand", "-fill",
- "-in", "-ipadx", "-ipady", "-padx", "-pady", "-side", (char *) NULL };
+ "-in", "-ipadx", "-ipady", "-padx", "-pady", "-side", NULL };
enum options {
CONF_AFTER, CONF_ANCHOR, CONF_BEFORE, CONF_EXPAND, CONF_FILL,
CONF_IN, CONF_IPADX, CONF_IPADY, CONF_PADX, CONF_PADY, CONF_SIDE };
@@ -1495,7 +1489,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
if (Tk_TopWinHierarchy(slave)) {
Tcl_AppendResult(interp, "can't pack \"", Tcl_GetString(objv[j]),
- "\": it's a top-level window", (char *) NULL);
+ "\": it's a top-level window", NULL);
return TCL_ERROR;
}
slavePtr = GetPacker(slave);
@@ -1520,7 +1514,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
if ((i+2) > objc) {
Tcl_AppendResult(interp, "extra option \"",
Tcl_GetString(objv[i]),
- "\" (option with no value?)", (char *) NULL);
+ "\" (option with no value?)", NULL);
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option",
@@ -1537,10 +1531,10 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
prevPtr = GetPacker(other);
if (prevPtr->masterPtr == NULL) {
- notPacked:
+ notPacked:
Tcl_AppendResult(interp, "window \"",
Tcl_GetString(objv[i+1]),
- "\" isn't packed", (char *) NULL);
+ "\" isn't packed", NULL);
return TCL_ERROR;
}
masterPtr = prevPtr->masterPtr;
@@ -1596,7 +1590,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
slavePtr->flags |= FILLX|FILLY;
} else {
Tcl_AppendResult(interp, "bad fill style \"", string,
- "\": must be none, x, y, or both", (char *) NULL);
+ "\": must be none, x, y, or both", NULL);
return TCL_ERROR;
}
break;
@@ -1623,8 +1617,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad ipadx value \"",
Tcl_GetString(objv[i+1]),
- "\": must be positive screen distance",
- (char *) NULL);
+ "\": must be positive screen distance", NULL);
return TCL_ERROR;
}
slavePtr->iPadX = tmp * 2;
@@ -1636,8 +1629,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad ipady value \"",
Tcl_GetString(objv[i+1]),
- "\": must be positive screen distance",
- (char *) NULL);
+ "\": must be positive screen distance", NULL);
return TCL_ERROR;
}
slavePtr->iPadY = tmp * 2;
@@ -1715,14 +1707,13 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_AppendResult(interp, "can't pack ", Tcl_GetString(objv[j]),
- " inside ", Tk_PathName(masterPtr->tkwin),
- (char *) NULL);
+ " inside ", Tk_PathName(masterPtr->tkwin), NULL);
return TCL_ERROR;
}
}
if (slave == masterPtr->tkwin) {
Tcl_AppendResult(interp, "can't pack ", Tcl_GetString(objv[j]),
- " inside itself", (char *) NULL);
+ " inside itself", NULL);
return TCL_ERROR;
}
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index 36002b4..ca1c1b6 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.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: tkPanedWindow.c,v 1.24 2005/11/15 15:18:22 dkf Exp $
+ * RCS: @(#) $Id: tkPanedWindow.c,v 1.25 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -752,7 +752,7 @@ ConfigureSlaves(
int i, firstOptionArg, j, found, doubleBw, index, numNewSlaves, haveLoc;
int insertIndex;
Tk_Window tkwin = NULL, ancestor, parent;
- Slave *slavePtr, **inserts, **new;
+ Slave *slavePtr, **inserts, **newSlaves;
Slave options;
char *arg;
@@ -986,16 +986,16 @@ ConfigureSlaves(
*/
i = sizeof(Slave *) * (pwPtr->numSlaves+numNewSlaves);
- new = (Slave **)ckalloc((unsigned) i);
- memset(new, 0, (size_t) i);
+ newSlaves = (Slave **)ckalloc((unsigned) i);
+ memset(newSlaves, 0, (size_t) i);
if (index == -1) {
/*
* If none of the existing slaves have to be moved, just copy the old
* and append the new.
*/
- memcpy((void *)&(new[0]), pwPtr->slaves,
+ memcpy((void *)&(newSlaves[0]), pwPtr->slaves,
sizeof(Slave *) * pwPtr->numSlaves);
- memcpy((void *)&(new[pwPtr->numSlaves]), inserts,
+ memcpy((void *)&(newSlaves[pwPtr->numSlaves]), inserts,
sizeof(Slave *) * numNewSlaves);
} else {
/*
@@ -1009,17 +1009,17 @@ ConfigureSlaves(
for (i = 0, j = 0; i < index; i++) {
if (pwPtr->slaves[i] != NULL) {
- new[j] = pwPtr->slaves[i];
+ newSlaves[j] = pwPtr->slaves[i];
j++;
}
}
- memcpy((void *)&(new[j]), inserts, sizeof(Slave *) * (insertIndex));
+ memcpy((void *)&(newSlaves[j]), inserts, sizeof(Slave *)*insertIndex);
j += firstOptionArg - 2;
for (i = index; i < pwPtr->numSlaves; i++) {
if (pwPtr->slaves[i] != NULL) {
- new[j] = pwPtr->slaves[i];
+ newSlaves[j] = pwPtr->slaves[i];
j++;
}
}
@@ -1031,7 +1031,7 @@ ConfigureSlaves(
ckfree((void *)pwPtr->slaves);
ckfree((void *)inserts);
- pwPtr->slaves = new;
+ pwPtr->slaves = newSlaves;
/*
* Set the paned window's slave count to the new value.
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 5024344..f41138a 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.17 2005/11/15 15:18:22 dkf Exp $
+ * RCS: @(#) $Id: tkPlace.c,v 1.18 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -376,11 +376,11 @@ CreateSlave(
{
Tcl_HashEntry *hPtr;
register Slave *slavePtr;
- int new;
+ int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &new);
- if (new) {
+ hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew);
+ if (isNew) {
slavePtr = (Slave *) ckalloc(sizeof(Slave));
memset(slavePtr, 0, sizeof(Slave));
slavePtr->tkwin = tkwin;
@@ -523,11 +523,11 @@ CreateMaster(
{
Tcl_HashEntry *hPtr;
register Master *masterPtr;
- int new;
+ int isNew;
TkDisplay * dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &new);
- if (new) {
+ hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew);
+ if (isNew) {
masterPtr = (Master *) ckalloc(sizeof(Master));
masterPtr->tkwin = tkwin;
masterPtr->slavePtr = NULL;
diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c
index 7e612f9..07c4ced 100644
--- a/generic/tkRectOval.c
+++ b/generic/tkRectOval.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkRectOval.c,v 1.13 2005/08/10 22:02:22 dkf Exp $
+ * RCS: @(#) $Id: tkRectOval.c,v 1.14 2005/11/17 10:57:35 dkf Exp $
*/
#include <stdio.h>
@@ -69,73 +69,65 @@ static Tk_CustomOption pixelOption = {
};
static Tk_ConfigSpec configSpecs[] = {
- {TK_CONFIG_CUSTOM, "-activedash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.activeDash),
+ {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.activeDash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_COLOR, "-activefill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, activeFillColor),
+ {TK_CONFIG_COLOR, "-activefill", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, activeFillColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_COLOR, "-activeoutline", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.activeColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.activeStipple),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-activeoutline", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.activeColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-activeoutlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.activeStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-activestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, activeFillStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-activewidth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, activeFillStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
"0.0", Tk_Offset(RectOvalItem, outline.activeWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_CUSTOM, "-dash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.dash),
+ {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_PIXELS, "-dashoffset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
"0", Tk_Offset(RectOvalItem, outline.offset),
TK_CONFIG_DONT_SET_DEFAULT},
- {TK_CONFIG_CUSTOM, "-disableddash", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.disabledDash),
+ {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.disabledDash),
TK_CONFIG_NULL_OK, &dashOption},
- {TK_CONFIG_COLOR, "-disabledfill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, disabledFillColor),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_COLOR, "-disabledoutline", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.disabledColor),
+ {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, disabledFillColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.disabledColor),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-disabledoutlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.disabledStipple),
+ {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.disabledStipple),
TK_CONFIG_NULL_OK},
- {TK_CONFIG_BITMAP, "-disabledstipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, disabledFillStipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_PIXELS, "-disabledwidth", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, disabledFillStipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_PIXELS, "-disabledwidth", NULL, NULL,
"0.0", Tk_Offset(RectOvalItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_COLOR, "-fill", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, fillColor), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-offset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-fill", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, fillColor), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
"0,0", Tk_Offset(RectOvalItem, tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
- {TK_CONFIG_COLOR, "-outline", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_COLOR, "-outline", NULL, NULL,
"black", Tk_Offset(RectOvalItem, outline.color), TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-outlineoffset", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL,
"0,0", Tk_Offset(RectOvalItem, outline.tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
- {TK_CONFIG_BITMAP, "-outlinestipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, outline.stipple),
- TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-state", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(Tk_Item, state),TK_CONFIG_NULL_OK,
- &stateOption},
- {TK_CONFIG_BITMAP, "-stipple", (char *) NULL, (char *) NULL,
- (char *) NULL, Tk_Offset(RectOvalItem, fillStipple),TK_CONFIG_NULL_OK},
- {TK_CONFIG_CUSTOM, "-tags", (char *) NULL, (char *) NULL,
- (char *) NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
- {TK_CONFIG_CUSTOM, "-width", (char *) NULL, (char *) NULL,
+ {TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, outline.stipple), TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-state", NULL, NULL,
+ NULL, Tk_Offset(Tk_Item, state),TK_CONFIG_NULL_OK, &stateOption},
+ {TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
+ NULL, Tk_Offset(RectOvalItem, fillStipple),TK_CONFIG_NULL_OK},
+ {TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
+ NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
+ {TK_CONFIG_CUSTOM, "-width", NULL, NULL,
"1.0", Tk_Offset(RectOvalItem, outline.width),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_END, (char *) NULL, (char *) NULL, (char *) NULL,
- (char *) NULL, 0, 0}
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
};
/*
@@ -192,12 +184,12 @@ Tk_ItemType tkRectangleType = {
RectOvalToPostscript, /* postscriptProc */
ScaleRectOval, /* scaleProc */
TranslateRectOval, /* translateProc */
- (Tk_ItemIndexProc *) NULL, /* indexProc */
- (Tk_ItemCursorProc *) NULL, /* icursorProc */
- (Tk_ItemSelectionProc *) NULL, /* selectionProc */
- (Tk_ItemInsertProc *) NULL, /* insertProc */
- (Tk_ItemDCharsProc *) NULL, /* dTextProc */
- (Tk_ItemType *) NULL, /* nextPtr */
+ NULL, /* indexProc */
+ NULL, /* icursorProc */
+ NULL, /* selectionProc */
+ NULL, /* insertProc */
+ NULL, /* dTextProc */
+ NULL, /* nextPtr */
};
Tk_ItemType tkOvalType = {
@@ -215,12 +207,12 @@ Tk_ItemType tkOvalType = {
RectOvalToPostscript, /* postscriptProc */
ScaleRectOval, /* scaleProc */
TranslateRectOval, /* translateProc */
- (Tk_ItemIndexProc *) NULL, /* indexProc */
- (Tk_ItemCursorProc *) NULL, /* cursorProc */
- (Tk_ItemSelectionProc *) NULL, /* selectionProc */
- (Tk_ItemInsertProc *) NULL, /* insertProc */
- (Tk_ItemDCharsProc *) NULL, /* dTextProc */
- (Tk_ItemType *) NULL, /* nextPtr */
+ NULL, /* indexProc */
+ NULL, /* cursorProc */
+ NULL, /* selectionProc */
+ NULL, /* insertProc */
+ NULL, /* dTextProc */
+ NULL, /* nextPtr */
};
/*
@@ -244,13 +236,13 @@ Tk_ItemType tkOvalType = {
*/
static int
-CreateRectOval(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* For error reporting. */
- Tk_Canvas canvas; /* Canvas to hold new item. */
- Tk_Item *itemPtr; /* Record to hold new item; header has been
+CreateRectOval(
+ Tcl_Interp *interp, /* For error reporting. */
+ Tk_Canvas canvas, /* Canvas to hold new item. */
+ Tk_Item *itemPtr, /* Record to hold new item; header has been
* initialized by caller. */
- int objc; /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing rectangle. */
+ int objc, /* Number of arguments in objv. */
+ Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
int i;
@@ -282,6 +274,7 @@ CreateRectOval(interp, canvas, itemPtr, objc, objv)
for (i = 1; i < objc; i++) {
char *arg = Tcl_GetString(objv[i]);
+
if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
break;
}
@@ -318,13 +311,13 @@ CreateRectOval(interp, canvas, itemPtr, objc, objv)
*/
static int
-RectOvalCoords(interp, canvas, itemPtr, objc, objv)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item whose coordinates are to be read or
+RectOvalCoords(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item whose coordinates are to be read or
* modified. */
- int objc; /* Number of coordinates supplied in objv. */
- Tcl_Obj *CONST objv[]; /* Array of coordinates: x1,y1,x2,y2,... */
+ int objc, /* Number of coordinates supplied in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of coordinates: x1,y1,x2,y2,... */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
@@ -408,13 +401,13 @@ RectOvalCoords(interp, canvas, itemPtr, objc, objv)
*/
static int
-ConfigureRectOval(interp, canvas, itemPtr, objc, objv, flags)
- Tcl_Interp *interp; /* Used for error reporting. */
- Tk_Canvas canvas; /* Canvas containing itemPtr. */
- Tk_Item *itemPtr; /* Rectangle item to reconfigure. */
- int objc; /* Number of elements in objv. */
- Tcl_Obj *CONST objv[]; /* Arguments describing things to configure. */
- int flags; /* Flags to pass to Tk_ConfigureWidget. */
+ConfigureRectOval(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ Tk_Canvas canvas, /* Canvas containing itemPtr. */
+ Tk_Item *itemPtr, /* Rectangle item to reconfigure. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
XGCValues gcValues;
@@ -577,10 +570,10 @@ ConfigureRectOval(interp, canvas, itemPtr, objc, objv, flags)
*/
static void
-DeleteRectOval(canvas, itemPtr, display)
- Tk_Canvas canvas; /* Info about overall widget. */
- Tk_Item *itemPtr; /* Item that is being deleted. */
- Display *display; /* Display containing window for canvas. */
+DeleteRectOval(
+ Tk_Canvas canvas, /* Info about overall widget. */
+ Tk_Item *itemPtr, /* Item that is being deleted. */
+ Display *display) /* Display containing window for canvas. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
@@ -627,9 +620,9 @@ DeleteRectOval(canvas, itemPtr, display)
/* ARGSUSED */
static void
-ComputeRectOvalBbox(canvas, rectOvalPtr)
- Tk_Canvas canvas; /* Canvas that contains item. */
- RectOvalItem *rectOvalPtr; /* Item whose bbox is to be recomputed. */
+ComputeRectOvalBbox(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ RectOvalItem *rectOvalPtr) /* Item whose bbox is to be recomputed. */
{
int bloat, tmp;
double dtmp, width;
@@ -743,12 +736,13 @@ ComputeRectOvalBbox(canvas, rectOvalPtr)
*/
static void
-DisplayRectOval(canvas, itemPtr, display, drawable, x, y, width, height)
- Tk_Canvas canvas; /* Canvas that contains item. */
- Tk_Item *itemPtr; /* Item to be displayed. */
- Display *display; /* Display on which to draw item. */
- Drawable drawable; /* Pixmap or window in which to draw item. */
- int x, y, width, height; /* Describes region of canvas that must be
+DisplayRectOval(
+ Tk_Canvas canvas, /* Canvas that contains item. */
+ Tk_Item *itemPtr, /* Item to be displayed. */
+ Display *display, /* Display on which to draw item. */
+ Drawable drawable, /* Pixmap or window in which to draw item. */
+ int x, int y, int width, int height)
+ /* Describes region of canvas that must be
* redisplayed (not used). */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
@@ -874,10 +868,10 @@ DisplayRectOval(canvas, itemPtr, display, drawable, x, y, width, height)
/* ARGSUSED */
static double
-RectToPoint(canvas, itemPtr, pointPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against point. */
- double *pointPtr; /* Pointer to x and y coordinates. */
+RectToPoint(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against point. */
+ double *pointPtr) /* Pointer to x and y coordinates. */
{
RectOvalItem *rectPtr = (RectOvalItem *) itemPtr;
double xDiff, yDiff, x1, y1, x2, y2, inc, tmp;
@@ -994,10 +988,10 @@ RectToPoint(canvas, itemPtr, pointPtr)
/* ARGSUSED */
static double
-OvalToPoint(canvas, itemPtr, pointPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against point. */
- double *pointPtr; /* Pointer to x and y coordinates. */
+OvalToPoint(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against point. */
+ double *pointPtr) /* Pointer to x and y coordinates. */
{
RectOvalItem *ovalPtr = (RectOvalItem *) itemPtr;
double width;
@@ -1049,10 +1043,10 @@ OvalToPoint(canvas, itemPtr, pointPtr)
/* ARGSUSED */
static int
-RectToArea(canvas, itemPtr, areaPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against rectangle. */
- double *areaPtr; /* Pointer to array of four coordinates (x1,
+RectToArea(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against rectangle. */
+ double *areaPtr) /* Pointer to array of four coordinates (x1,
* y1, x2, y2) describing rectangular area. */
{
RectOvalItem *rectPtr = (RectOvalItem *) itemPtr;
@@ -1123,10 +1117,10 @@ RectToArea(canvas, itemPtr, areaPtr)
/* ARGSUSED */
static int
-OvalToArea(canvas, itemPtr, areaPtr)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item to check against oval. */
- double *areaPtr; /* Pointer to array of four coordinates (x1,
+OvalToArea(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item to check against oval. */
+ double *areaPtr) /* Pointer to array of four coordinates (x1,
* y1, x2, y2) describing rectangular area. */
{
RectOvalItem *ovalPtr = (RectOvalItem *) itemPtr;
@@ -1219,12 +1213,13 @@ OvalToArea(canvas, itemPtr, areaPtr)
*/
static void
-ScaleRectOval(canvas, itemPtr, originX, originY, scaleX, scaleY)
- Tk_Canvas canvas; /* Canvas containing rectangle. */
- Tk_Item *itemPtr; /* Rectangle to be scaled. */
- double originX, originY; /* Origin about which to scale rect. */
- double scaleX; /* Amount to scale in X direction. */
- double scaleY; /* Amount to scale in Y direction. */
+ScaleRectOval(
+ Tk_Canvas canvas, /* Canvas containing rectangle. */
+ Tk_Item *itemPtr, /* Rectangle to be scaled. */
+ double originX, double originY,
+ /* Origin about which to scale rect. */
+ double scaleX, /* Amount to scale in X direction. */
+ double scaleY) /* Amount to scale in Y direction. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
@@ -1254,10 +1249,11 @@ ScaleRectOval(canvas, itemPtr, originX, originY, scaleX, scaleY)
*/
static void
-TranslateRectOval(canvas, itemPtr, deltaX, deltaY)
- Tk_Canvas canvas; /* Canvas containing item. */
- Tk_Item *itemPtr; /* Item that is being moved. */
- double deltaX, deltaY; /* Amount by which item is to be moved. */
+TranslateRectOval(
+ Tk_Canvas canvas, /* Canvas containing item. */
+ Tk_Item *itemPtr, /* Item that is being moved. */
+ double deltaX, double deltaY)
+ /* Amount by which item is to be moved. */
{
RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr;
@@ -1289,11 +1285,11 @@ TranslateRectOval(canvas, itemPtr, deltaX, deltaY)
*/
static int
-RectOvalToPostscript(interp, canvas, itemPtr, prepass)
- Tcl_Interp *interp; /* Interpreter for error reporting. */
- Tk_Canvas canvas; /* Information about overall canvas. */
- Tk_Item *itemPtr; /* Item for which Postscript is wanted. */
- int prepass; /* 1 means this is a prepass to collect font
+RectOvalToPostscript(
+ Tcl_Interp *interp, /* Interpreter for error reporting. */
+ Tk_Canvas canvas, /* Information about overall canvas. */
+ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */
+ int prepass) /* 1 means this is a prepass to collect font
* information; 0 means final Postscript is
* being created. */
{
@@ -1357,20 +1353,20 @@ RectOvalToPostscript(interp, canvas, itemPtr, prepass)
*/
if (fillColor != NULL) {
- Tcl_AppendResult(interp, pathCmd, (char *) NULL);
+ Tcl_AppendResult(interp, pathCmd, NULL);
if (Tk_CanvasPsColor(interp, canvas, fillColor) != TCL_OK) {
return TCL_ERROR;
}
if (fillStipple != None) {
- Tcl_AppendResult(interp, "clip ", (char *) NULL);
+ Tcl_AppendResult(interp, "clip ", NULL);
if (Tk_CanvasPsStipple(interp, canvas, fillStipple) != TCL_OK) {
return TCL_ERROR;
}
if (color != NULL) {
- Tcl_AppendResult(interp, "grestore gsave\n", (char *) NULL);
+ Tcl_AppendResult(interp, "grestore gsave\n", NULL);
}
} else {
- Tcl_AppendResult(interp, "fill\n", (char *) NULL);
+ Tcl_AppendResult(interp, "fill\n", NULL);
}
}
@@ -1380,7 +1376,7 @@ RectOvalToPostscript(interp, canvas, itemPtr, prepass)
if (color != NULL) {
Tcl_AppendResult(interp, pathCmd, "0 setlinejoin 2 setlinecap\n",
- (char *) NULL);
+ NULL);
if (Tk_CanvasPsOutline(canvas, itemPtr,
&(rectOvalPtr->outline))!= TCL_OK) {
return TCL_ERROR;
diff --git a/generic/tkScale.c b/generic/tkScale.c
index 12973b2..2b688b5 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -16,7 +16,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkScale.c,v 1.20 2005/10/17 21:41:54 dkf Exp $
+ * RCS: @(#) $Id: tkScale.c,v 1.21 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -1125,24 +1125,24 @@ TkRoundToResolution(
TkScale *scalePtr, /* Information about scale widget. */
double value) /* Value to round. */
{
- double rem, new, tick;
+ double rem, rounded, tick;
if (scalePtr->resolution <= 0) {
return value;
}
tick = floor(value/scalePtr->resolution);
- new = scalePtr->resolution * tick;
- rem = value - new;
+ rounded = scalePtr->resolution * tick;
+ rem = value - rounded;
if (rem < 0) {
if (rem <= -scalePtr->resolution/2) {
- new = (tick - 1.0) * scalePtr->resolution;
+ rounded = (tick - 1.0) * scalePtr->resolution;
}
} else {
if (rem >= scalePtr->resolution/2) {
- new = (tick + 1.0) * scalePtr->resolution;
+ rounded = (tick + 1.0) * scalePtr->resolution;
}
}
- return new;
+ return rounded;
}
/*
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index 5ed8ecb..c73aca7 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.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: tkScrollbar.c,v 1.7 2005/11/13 00:45:47 dkf Exp $
+ * RCS: @(#) $Id: tkScrollbar.c,v 1.8 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -130,7 +130,7 @@ Tk_ScrollbarCmd(
{
Tk_Window tkwin = (Tk_Window) clientData;
register TkScrollbar *scrollPtr;
- Tk_Window new;
+ Tk_Window newWin;
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
@@ -138,15 +138,15 @@ Tk_ScrollbarCmd(
return TCL_ERROR;
}
- new = Tk_CreateWindowFromPath(interp, tkwin, argv[1], NULL);
- if (new == NULL) {
+ newWin = Tk_CreateWindowFromPath(interp, tkwin, argv[1], NULL);
+ if (newWin == NULL) {
return TCL_ERROR;
}
- Tk_SetClass(new, "Scrollbar");
- scrollPtr = TkpCreateScrollbar(new);
+ Tk_SetClass(newWin, "Scrollbar");
+ scrollPtr = TkpCreateScrollbar(newWin);
- Tk_SetClassProcs(new, &tkpScrollbarProcs, (ClientData) scrollPtr);
+ Tk_SetClassProcs(newWin, &tkpScrollbarProcs, (ClientData) scrollPtr);
/*
* Initialize fields that won't be initialized by ConfigureScrollbar, or
@@ -154,8 +154,8 @@ Tk_ScrollbarCmd(
* resource pointers).
*/
- scrollPtr->tkwin = new;
- scrollPtr->display = Tk_Display(new);
+ scrollPtr->tkwin = newWin;
+ scrollPtr->display = Tk_Display(newWin);
scrollPtr->interp = interp;
scrollPtr->widgetCmd = Tcl_CreateCommand(interp,
Tk_PathName(scrollPtr->tkwin), ScrollbarWidgetCmd,
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 846d87e..7b24555 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTest.c,v 1.25 2005/05/24 02:32:42 das Exp $
+ * RCS: @(#) $Id: tkTest.c,v 1.26 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkInt.h"
@@ -2462,7 +2462,7 @@ CustomOptionSet(clientData,interp, tkwin, value, recordPtr, internalOffset,
int flags;
{
int objEmpty, length;
- char *new, *string, *internalPtr;
+ char *newStr, *string, *internalPtr;
objEmpty = 0;
@@ -2500,13 +2500,13 @@ CustomOptionSet(clientData,interp, tkwin, value, recordPtr, internalOffset,
if (internalPtr != NULL) {
if ((*value) != NULL) {
string = Tcl_GetStringFromObj((*value), &length);
- new = ckalloc((size_t) (length + 1));
- strcpy(new, string);
+ newStr = ckalloc((size_t) (length + 1));
+ strcpy(newStr, string);
} else {
- new = NULL;
+ newStr = NULL;
}
*((char **) saveInternalPtr) = *((char **) internalPtr);
- *((char **) internalPtr) = new;
+ *((char **) internalPtr) = newStr;
}
return TCL_OK;
diff --git a/generic/tkText.c b/generic/tkText.c
index 1a6477f..59071cd 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -13,7 +13,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.61 2005/10/31 23:21:08 vincentdarley Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.62 2005/11/17 10:57:35 dkf Exp $
*/
#include "default.h"
@@ -489,15 +489,15 @@ CreateWidget(sharedPtr, tkwin, interp, parent, objc, objv)
register TkText *textPtr;
Tk_OptionTable optionTable;
TkTextIndex startIndex;
- Tk_Window new;
+ Tk_Window newWin;
/*
* Create the window.
*/
- new = Tk_CreateWindowFromPath(interp, tkwin, Tcl_GetString(objv[1]),
+ newWin = Tk_CreateWindowFromPath(interp, tkwin, Tcl_GetString(objv[1]),
(char *) NULL);
- if (new == NULL) {
+ if (newWin == NULL) {
return TCL_ERROR;
}
@@ -510,8 +510,8 @@ CreateWidget(sharedPtr, tkwin, interp, parent, objc, objv)
textPtr = (TkText *) ckalloc(sizeof(TkText));
memset((VOID *) textPtr, 0, sizeof(TkText));
- textPtr->tkwin = new;
- textPtr->display = Tk_Display(new);
+ textPtr->tkwin = newWin;
+ textPtr->display = Tk_Display(newWin);
textPtr->interp = interp;
textPtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(textPtr->tkwin), TextWidgetObjCmd,
@@ -581,8 +581,8 @@ CreateWidget(sharedPtr, tkwin, interp, parent, objc, objv)
textPtr->charWidth = 1;
textPtr->charHeight = 10;
textPtr->wrapMode = TEXT_WRAPMODE_CHAR;
- textPtr->prevWidth = Tk_Width(new);
- textPtr->prevHeight = Tk_Height(new);
+ textPtr->prevWidth = Tk_Width(newWin);
+ textPtr->prevHeight = Tk_Height(newWin);
/*
* This will add refCounts to textPtr.
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index dfa7dd3..df0230f 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.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: tkTextDisp.c,v 1.53 2005/10/10 10:36:35 vincentdarley Exp $
+ * RCS: @(#) $Id: tkTextDisp.c,v 1.54 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -100,7 +100,7 @@ typedef struct StyleValues {
int spacing3; /* Spacing below last dline in text line. */
TkTextTabArray *tabArrayPtr;/* Locations and types of tab stops (may be
* NULL). */
- int tabStyle; /* One of TABULAR or WORDPROCESSOR. */
+ int tabStyle; /* One of TABULAR or WORDPROCESSOR. */
int underline; /* Non-zero means draw underline underneath
* text. */
int elide; /* Zero means draw text, otherwise not */
@@ -149,6 +149,14 @@ typedef struct TextStyle {
(fabs((double1)-(double2))*((scaleFactor)+1.0) < 0.3)
/*
+ * Macro to make debugging/testing logging a little easier.
+ */
+
+#define LOG(toVar,what) \
+ Tcl_SetVar2(textPtr->interp, toVar, NULL, (what), \
+ TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT)
+
+/*
* The following structure describes one line of the display, which may be
* either part or all of one line of the text.
*/
@@ -192,7 +200,7 @@ typedef struct DLine {
* line, and (b) can have gaps where DLine's
* have been deleted because they're out of
* date. */
- int flags; /* Various flag bits: see below for values. */
+ int flags; /* Various flag bits: see below for values. */
} DLine;
/*
@@ -416,22 +424,21 @@ static int lineHeightsRecalculated;
* Forward declarations for functions defined later in this file:
*/
-static void AdjustForTab _ANSI_ARGS_((TkText *textPtr,
+static void AdjustForTab(TkText *textPtr,
TkTextTabArray *tabArrayPtr, int index,
- TkTextDispChunk *chunkPtr));
-static void CharBboxProc _ANSI_ARGS_((TkText *textPtr,
+ TkTextDispChunk *chunkPtr);
+static void CharBboxProc(TkText *textPtr,
TkTextDispChunk *chunkPtr,
int index, int y, int lineHeight, int baseline,
int *xPtr, int *yPtr, int *widthPtr,
- int *heightPtr));
-static void CharDisplayProc _ANSI_ARGS_((TkText *textPtr,
+ int *heightPtr);
+static void CharDisplayProc(TkText *textPtr,
TkTextDispChunk *chunkPtr,
int x, int y, int height, int baseline,
- Display *display, Drawable dst, int screenY));
-static int CharMeasureProc _ANSI_ARGS_((TkTextDispChunk *chunkPtr,
- int x));
-static void CharUndisplayProc _ANSI_ARGS_((TkText *textPtr,
- TkTextDispChunk *chunkPtr));
+ Display *display, Drawable dst, int screenY);
+static int CharMeasureProc(TkTextDispChunk *chunkPtr, int x);
+static void CharUndisplayProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr);
/*
* Definitions of elided procs. Compiler can't inline these since we use
@@ -440,76 +447,63 @@ static void CharUndisplayProc _ANSI_ARGS_((TkText *textPtr,
* tag toggle-filled elided region.
*/
-static void ElideBboxProc _ANSI_ARGS_((TkText *textPtr,
+static void ElideBboxProc(TkText *textPtr,
TkTextDispChunk *chunkPtr,
int index, int y, int lineHeight, int baseline,
int *xPtr, int *yPtr, int *widthPtr,
- int *heightPtr));
-static int ElideMeasureProc _ANSI_ARGS_((
- TkTextDispChunk *chunkPtr, int x));
-
-static void DisplayDLine _ANSI_ARGS_((TkText *textPtr,
- DLine *dlPtr, DLine *prevPtr, Pixmap pixmap));
-static void DisplayLineBackground _ANSI_ARGS_((TkText *textPtr,
- DLine *dlPtr, DLine *prevPtr, Pixmap pixmap));
-static void DisplayText _ANSI_ARGS_((ClientData clientData));
-static DLine * FindDLine _ANSI_ARGS_((DLine *dlPtr,
- CONST TkTextIndex *indexPtr));
-static void FreeDLines _ANSI_ARGS_((TkText *textPtr,
- DLine *firstPtr, DLine *lastPtr, int action));
-static void FreeStyle _ANSI_ARGS_((TkText *textPtr,
- TextStyle *stylePtr));
-static TextStyle * GetStyle _ANSI_ARGS_((TkText *textPtr,
- CONST TkTextIndex *indexPtr));
-static void GetXView _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, int report));
-static void GetYView _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, int report));
-static int GetYPixelCount _ANSI_ARGS_((TkText *textPtr,
- DLine *dlPtr));
-static DLine * LayoutDLine _ANSI_ARGS_((TkText *textPtr,
- CONST TkTextIndex *indexPtr));
-static int MeasureChars _ANSI_ARGS_((Tk_Font tkfont,
- CONST char *source, int maxBytes, int startX,
- int maxX, int *nextXPtr));
-static void MeasureUp _ANSI_ARGS_((TkText *textPtr,
+ int *heightPtr);
+static int ElideMeasureProc(TkTextDispChunk *chunkPtr, int x);
+static void DisplayDLine(TkText *textPtr,
+ DLine *dlPtr, DLine *prevPtr, Pixmap pixmap);
+static void DisplayLineBackground(TkText *textPtr,
+ DLine *dlPtr, DLine *prevPtr, Pixmap pixmap);
+static void DisplayText(ClientData clientData);
+static DLine * FindDLine(DLine *dlPtr, CONST TkTextIndex *indexPtr);
+static void FreeDLines(TkText *textPtr, DLine *firstPtr,
+ DLine *lastPtr, int action);
+static void FreeStyle(TkText *textPtr, TextStyle *stylePtr);
+static TextStyle * GetStyle(TkText *textPtr, CONST TkTextIndex *indexPtr);
+static void GetXView(Tcl_Interp *interp,
+ TkText *textPtr, int report);
+static void GetYView(Tcl_Interp *interp,
+ TkText *textPtr, int report);
+static int GetYPixelCount(TkText *textPtr, DLine *dlPtr);
+static DLine * LayoutDLine(TkText *textPtr,
+ CONST TkTextIndex *indexPtr);
+static int MeasureChars(Tk_Font tkfont, CONST char *source,
+ int maxBytes, int startX, int maxX, int *nextXPtr);
+static void MeasureUp(TkText *textPtr,
CONST TkTextIndex *srcPtr, int distance,
- TkTextIndex *dstPtr, int *overlap));
-static int NextTabStop _ANSI_ARGS_((Tk_Font tkfont, int x,
- int tabOrigin));
-static void UpdateDisplayInfo _ANSI_ARGS_((TkText *textPtr));
-static void YScrollByLines _ANSI_ARGS_((TkText *textPtr,
- int offset));
-static void YScrollByPixels _ANSI_ARGS_((TkText *textPtr,
- int offset));
-static int SizeOfTab _ANSI_ARGS_((TkText *textPtr,
- int tabStyle, TkTextTabArray *tabArrayPtr,
- int *indexPtr, int x, int maxX));
-static void TextChanged _ANSI_ARGS_((TkText *textPtr,
+ TkTextIndex *dstPtr, int *overlap);
+static int NextTabStop(Tk_Font tkfont, int x, int tabOrigin);
+static void UpdateDisplayInfo(TkText *textPtr);
+static void YScrollByLines(TkText *textPtr, int offset);
+static void YScrollByPixels(TkText *textPtr, int offset);
+static int SizeOfTab(TkText *textPtr, int tabStyle,
+ TkTextTabArray *tabArrayPtr, int *indexPtr, int x,
+ int maxX);
+static void TextChanged(TkText *textPtr,
CONST TkTextIndex *index1Ptr,
- CONST TkTextIndex *index2Ptr));
-static void TextInvalidateRegion _ANSI_ARGS_((TkText *textPtr,
- TkRegion region));
-static void TextRedrawTag _ANSI_ARGS_((TkText *textPtr,
+ CONST TkTextIndex *index2Ptr);
+static void TextInvalidateRegion(TkText *textPtr, TkRegion region);
+static void TextRedrawTag(TkText *textPtr,
TkTextIndex *index1Ptr, TkTextIndex *index2Ptr,
- TkTextTag *tagPtr, int withTag));
-static void TextInvalidateLineMetrics _ANSI_ARGS_((TkText *textPtr,
- TkTextLine *linePtr, int lineCount, int action));
-static int CalculateDisplayLineHeight _ANSI_ARGS_((
- TkText *textPtr, CONST TkTextIndex *indexPtr,
- int *byteCountPtr, int *mergedLinePtr));
-static void DlineIndexOfX _ANSI_ARGS_((TkText *textPtr,
- DLine *dlPtr, int x, TkTextIndex *indexPtr));
-static int DlineXOfIndex _ANSI_ARGS_((TkText *textPtr,
- DLine *dlPtr, int byteIndex));
-static int TextGetScrollInfoObj _ANSI_ARGS_((Tcl_Interp *interp,
+ TkTextTag *tagPtr, int withTag);
+static void TextInvalidateLineMetrics(TkText *textPtr,
+ TkTextLine *linePtr, int lineCount, int action);
+static int CalculateDisplayLineHeight(TkText *textPtr,
+ CONST TkTextIndex *indexPtr, int *byteCountPtr,
+ int *mergedLinePtr);
+static void DlineIndexOfX(TkText *textPtr,
+ DLine *dlPtr, int x, TkTextIndex *indexPtr);
+static int DlineXOfIndex(TkText *textPtr,
+ DLine *dlPtr, int byteIndex);
+static int TextGetScrollInfoObj(Tcl_Interp *interp,
TkText *textPtr, int objc,
Tcl_Obj *CONST objv[], double *dblPtr,
- int *intPtr));
-static void AsyncUpdateLineMetrics _ANSI_ARGS_((ClientData
- clientData));
-static void AsyncUpdateYScrollbar _ANSI_ARGS_((ClientData
- clientData));
+ int *intPtr);
+static void AsyncUpdateLineMetrics(ClientData clientData);
+static void AsyncUpdateYScrollbar(ClientData clientData);
/*
* Result values returned by TextGetScrollInfoObj:
@@ -520,7 +514,6 @@ static void AsyncUpdateYScrollbar _ANSI_ARGS_((ClientData
#define TKTEXT_SCROLL_UNITS 3
#define TKTEXT_SCROLL_ERROR 4
#define TKTEXT_SCROLL_PIXELS 5
-
/*
*----------------------------------------------------------------------
@@ -541,8 +534,8 @@ static void AsyncUpdateYScrollbar _ANSI_ARGS_((ClientData
*/
void
-TkTextCreateDInfo(textPtr)
- TkText *textPtr; /* Overall information for text widget. */
+TkTextCreateDInfo(
+ TkText *textPtr) /* Overall information for text widget. */
{
register TextDInfo *dInfoPtr;
XGCValues gcValues;
@@ -609,8 +602,8 @@ TkTextCreateDInfo(textPtr)
*/
void
-TkTextFreeDInfo(textPtr)
- TkText *textPtr; /* Overall information for text widget. */
+TkTextFreeDInfo(
+ TkText *textPtr) /* Overall information for text widget. */
{
register TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -621,7 +614,7 @@ TkTextFreeDInfo(textPtr)
* will be empty.
*/
- FreeDLines(textPtr, dInfoPtr->dLinePtr, (DLine *) NULL, DLINE_UNLINK);
+ FreeDLines(textPtr, dInfoPtr->dLinePtr, NULL, DLINE_UNLINK);
Tcl_DeleteHashTable(&dInfoPtr->styleTable);
if (dInfoPtr->copyGC != None) {
Tk_FreeGC(textPtr->display, dInfoPtr->copyGC);
@@ -662,9 +655,9 @@ TkTextFreeDInfo(textPtr)
*/
static TextStyle *
-GetStyle(textPtr, indexPtr)
- TkText *textPtr; /* Overall information about text widget. */
- CONST TkTextIndex *indexPtr;/* The character in the text for which display
+GetStyle(
+ TkText *textPtr, /* Overall information about text widget. */
+ CONST TkTextIndex *indexPtr)/* The character in the text for which display
* information is wanted. */
{
TkTextTag **tagPtrs;
@@ -672,7 +665,7 @@ GetStyle(textPtr, indexPtr)
StyleValues styleValues;
TextStyle *stylePtr;
Tcl_HashEntry *hPtr;
- int numTags, new, i;
+ int numTags, isNew, i;
XGCValues gcValues;
unsigned long mask;
@@ -849,8 +842,8 @@ GetStyle(textPtr, indexPtr)
*/
hPtr = Tcl_CreateHashEntry(&textPtr->dInfoPtr->styleTable,
- (char *) &styleValues, &new);
- if (!new) {
+ (char *) &styleValues, &isNew);
+ if (!isNew) {
stylePtr = (TextStyle *) Tcl_GetHashValue(hPtr);
stylePtr->refCount++;
return stylePtr;
@@ -911,10 +904,10 @@ GetStyle(textPtr, indexPtr)
*/
static void
-FreeStyle(textPtr, stylePtr)
- TkText *textPtr; /* Information about overall widget. */
- register TextStyle *stylePtr; /* Information about style to free. */
-
+FreeStyle(
+ TkText *textPtr, /* Information about overall widget. */
+ register TextStyle *stylePtr)
+ /* Information about style to free. */
{
stylePtr->refCount--;
if (stylePtr->refCount == 0) {
@@ -946,7 +939,7 @@ FreeStyle(textPtr, stylePtr)
* Storage is allocated for the new DLine.
*
* See the comments in 'GetYView' for some thoughts on what the side-
- * effects of this call (or its callers) should be - the synchronisation
+ * effects of this call (or its callers) should be; the synchronisation
* of TkTextLine->pixelHeight with the sum of the results of this
* function operating on all display lines within each logical line.
* Ideally the code should be refactored to ensure the cached pixel
@@ -964,64 +957,61 @@ FreeStyle(textPtr, stylePtr)
*/
static DLine *
-LayoutDLine(textPtr, indexPtr)
- TkText *textPtr; /* Overall information about text widget. */
- CONST TkTextIndex *indexPtr;/* Beginning of display line. May not
+LayoutDLine(
+ TkText *textPtr, /* Overall information about text widget. */
+ CONST TkTextIndex *indexPtr)/* Beginning of display line. May not
* necessarily point to a character
* segment. */
{
- register DLine *dlPtr; /* New display line. */
- TkTextSegment *segPtr; /* Current segment in text. */
- TkTextDispChunk *lastChunkPtr; /* Last chunk allocated so far for
- * line. */
- TkTextDispChunk *chunkPtr; /* Current chunk. */
+ register DLine *dlPtr; /* New display line. */
+ TkTextSegment *segPtr; /* Current segment in text. */
+ TkTextDispChunk *lastChunkPtr;
+ /* Last chunk allocated so far for line. */
+ TkTextDispChunk *chunkPtr; /* Current chunk. */
TkTextIndex curIndex;
- TkTextDispChunk *breakChunkPtr; /* Chunk containing best word break
- * point, if any. */
- TkTextIndex breakIndex; /* Index of first character in
- * breakChunkPtr. */
- int breakByteOffset; /* Byte offset of character within
- * breakChunkPtr just to right of best
- * break point. */
- int noCharsYet; /* Non-zero means that no characters
- * have been placed on the line
- * yet. */
- int paragraphStart; /* Non-zero means that we are
- * on the first line of a
- * paragraph (Used to choose
- * between lmargin1, lmargin2). */
- int justify; /* How to justify line: taken from
- * style for the first character in
- * line. */
- int jIndent; /* Additional indentation (beyond
- * margins) due to justification. */
- int rMargin; /* Right margin width for line. */
- TkWrapMode wrapMode; /* Wrap mode to use for this line. */
- int x = 0, maxX = 0; /* Initializations needed only to stop
- * compiler warnings. */
- int wholeLine; /* Non-zero means this display line
- * runs to the end of the text
- * line. */
- int tabIndex; /* Index of the current tab stop. */
- int gotTab; /* Non-zero means the current chunk
- * contains a tab. */
- TkTextDispChunk *tabChunkPtr; /* Pointer to the chunk containing the
- * previous tab stop. */
- int maxBytes; /* Maximum number of bytes to include
- * in this chunk. */
- TkTextTabArray *tabArrayPtr; /* Tab stops for line; taken from
- * style for the first character on
- * line. */
- int tabStyle; /* One of TABULAR or WORDPROCESSOR. */
- int tabSize; /* Number of pixels consumed by
- * current tab stop. */
- TkTextDispChunk *lastCharChunkPtr; /* Pointer to last chunk in display
- * lines with numBytes > 0. Used to
- * drop 0-sized chunks from the end of
- * the line. */
+ TkTextDispChunk *breakChunkPtr;
+ /* Chunk containing best word break point, if
+ * any. */
+ TkTextIndex breakIndex; /* Index of first character in
+ * breakChunkPtr. */
+ int breakByteOffset; /* Byte offset of character within
+ * breakChunkPtr just to right of best break
+ * point. */
+ int noCharsYet; /* Non-zero means that no characters have been
+ * placed on the line yet. */
+ int paragraphStart; /* Non-zero means that we are on the first
+ * line of a paragraph (used to choose between
+ * lmargin1, lmargin2). */
+ int justify; /* How to justify line: taken from style for
+ * the first character in line. */
+ int jIndent; /* Additional indentation (beyond margins) due
+ * to justification. */
+ int rMargin; /* Right margin width for line. */
+ TkWrapMode wrapMode; /* Wrap mode to use for this line. */
+ int x = 0, maxX = 0; /* Initializations needed only to stop
+ * compiler warnings. */
+ int wholeLine; /* Non-zero means this display line runs to
+ * the end of the text line. */
+ int tabIndex; /* Index of the current tab stop. */
+ int gotTab; /* Non-zero means the current chunk contains a
+ * tab. */
+ TkTextDispChunk *tabChunkPtr;
+ /* Pointer to the chunk containing the
+ * previous tab stop. */
+ int maxBytes; /* Maximum number of bytes to include in this
+ * chunk. */
+ TkTextTabArray *tabArrayPtr;/* Tab stops for line; taken from style for
+ * the first character on line. */
+ int tabStyle; /* One of TABULAR or WORDPROCESSOR. */
+ int tabSize; /* Number of pixels consumed by current tab
+ * stop. */
+ TkTextDispChunk *lastCharChunkPtr;
+ /* Pointer to last chunk in display lines with
+ * numBytes > 0. Used to drop 0-sized chunks
+ * from the end of the line. */
int byteOffset, ascent, descent, code, elide, elidesize;
StyleValues *sValuePtr;
- TkTextElideInfo info; /* Keep track of elide state */
+ TkTextElideInfo info; /* Keep track of elide state */
/*
* Create and initialize a new DLine structure.
@@ -1031,7 +1021,7 @@ LayoutDLine(textPtr, indexPtr)
dlPtr->index = *indexPtr;
dlPtr->byteCount = 0;
dlPtr->y = 0;
- dlPtr->oldY = 0; /* Only setting this to avoid compiler warnings */
+ dlPtr->oldY = 0; /* Only set to avoid compiler warnings */
dlPtr->height = 0;
dlPtr->baseline = 0;
dlPtr->chunkPtr = NULL;
@@ -1039,13 +1029,14 @@ LayoutDLine(textPtr, indexPtr)
dlPtr->flags = NEW_LAYOUT | OLD_Y_INVALID;
dlPtr->logicalLinesMerged = 0;
- /*
- * This is not necessarily totally correct, where we have merged
- * logical lines. Fixing this would require a quite significant
- * overhaul, though, so currently we make do with this.
+ /*
+ * This is not necessarily totally correct, where we have merged logical
+ * lines. Fixing this would require a quite significant overhaul, though,
+ * so currently we make do with this.
*/
+
paragraphStart = (indexPtr->byteIndex == 0);
-
+
/*
* Special case entirely elide line as there may be 1000s or more
*/
@@ -1289,18 +1280,25 @@ LayoutDLine(textPtr, indexPtr)
justify = chunkPtr->stylePtr->sValuePtr->justify;
rMargin = chunkPtr->stylePtr->sValuePtr->rMargin;
wrapMode = chunkPtr->stylePtr->sValuePtr->wrapMode;
-
- /*
- * See above - this test may not be entirely correct where
- * we have partially elided lines (and therefore merged
- * logical lines). In such a case a byteIndex of zero
- * doesn't necessarily mean the beginning of a logical line.
+
+ /*
+ * See above - this test may not be entirely correct where we have
+ * partially elided lines (and therefore merged logical lines).
+ * In such a case a byteIndex of zero doesn't necessarily mean the
+ * beginning of a logical line.
*/
+
if (paragraphStart) {
- /* Beginning of logical line */
- x = chunkPtr->stylePtr->sValuePtr->lMargin1;
+ /*
+ * Beginning of logical line.
+ */
+
+ x = chunkPtr->stylePtr->sValuePtr->lMargin1;
} else {
- /* Beginning of display line */
+ /*
+ * Beginning of display line.
+ */
+
x = chunkPtr->stylePtr->sValuePtr->lMargin2;
}
if (wrapMode == TEXT_WRAPMODE_NONE) {
@@ -1325,7 +1323,7 @@ LayoutDLine(textPtr, indexPtr)
if (segPtr->typePtr == &tkTextCharType) {
char *p;
- for (p = segPtr->body.chars + byteOffset; *p != 0; p++) {
+ for (p = segPtr->body.chars + byteOffset; *p != 0; p++) {
if (*p == '\t') {
maxBytes = (p + 1 - segPtr->body.chars) - byteOffset;
gotTab = 1;
@@ -1347,9 +1345,12 @@ LayoutDLine(textPtr, indexPtr)
chunkPtr->minAscent = chunkPtr->minDescent
= chunkPtr->minHeight = 0;
- /* Would just like to point to canonical empty chunk */
- chunkPtr->displayProc = (Tk_ChunkDisplayProc *) NULL;
- chunkPtr->undisplayProc = (Tk_ChunkUndisplayProc *) NULL;
+ /*
+ * Would just like to point to canonical empty chunk.
+ */
+
+ chunkPtr->displayProc = NULL;
+ chunkPtr->undisplayProc = NULL;
chunkPtr->measureProc = ElideMeasureProc;
chunkPtr->bboxProc = ElideBboxProc;
@@ -1382,16 +1383,18 @@ LayoutDLine(textPtr, indexPtr)
}
break;
}
- /*
- * We currently say we have some characters (and therefore
- * something from which to examine tag values for the first
- * character of the line) even if those characters are actually
- * elided. This behaviour is not well documented, and it might
- * be more consistent to completely ignore such elided
- * characters and their tags. To do so change this to:
- *
+
+ /*
+ * We currently say we have some characters (and therefore something
+ * from which to examine tag values for the first character of the
+ * line) even if those characters are actually elided. This behaviour
+ * is not well documented, and it might be more consistent to
+ * completely ignore such elided characters and their tags. To do so
+ * change this to:
+ *
* if (!elide && chunkPtr->numBytes > 0).
*/
+
if (!elide && chunkPtr->numBytes > 0) {
noCharsYet = 0;
lastCharChunkPtr = chunkPtr;
@@ -1425,8 +1428,8 @@ LayoutDLine(textPtr, indexPtr)
x = chunkPtr->x + chunkPtr->width;
}
tabChunkPtr = chunkPtr;
- tabSize = SizeOfTab(textPtr, tabStyle, tabArrayPtr,
- &tabIndex, x, maxX);
+ tabSize = SizeOfTab(textPtr, tabStyle, tabArrayPtr, &tabIndex, x,
+ maxX);
if ((maxX >= 0) && (tabSize >= maxX - x)) {
break;
}
@@ -1587,7 +1590,7 @@ LayoutDLine(textPtr, indexPtr)
dlPtr->baseline += dlPtr->spaceAbove;
/*
- * Recompute line length: may have changed because of justification.
+ * Recompute line length: may have changed because of justification.
*/
dlPtr->length = lastChunkPtr->x + lastChunkPtr->width;
@@ -1623,8 +1626,8 @@ LayoutDLine(textPtr, indexPtr)
*/
static void
-UpdateDisplayInfo(textPtr)
- TkText *textPtr; /* Text widget to update. */
+UpdateDisplayInfo(
+ TkText *textPtr) /* Text widget to update. */
{
register TextDInfo *dInfoPtr = textPtr->dInfoPtr;
register DLine *dlPtr, *prevPtr;
@@ -1653,10 +1656,8 @@ UpdateDisplayInfo(textPtr)
}
/*
- *--------------------------------------------------------------
* Scan through the contents of the window from top to bottom, recomputing
* information for lines that are missing.
- *--------------------------------------------------------------
*/
lastLinePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr,
@@ -1693,7 +1694,6 @@ UpdateDisplayInfo(textPtr)
*/
if ((dlPtr == NULL) || (dlPtr->index.linePtr != index.linePtr)) {
-
/*
* Case (b) -- must make new DLine.
*/
@@ -1708,9 +1708,7 @@ UpdateDisplayInfo(textPtr)
*/
TkTextPrintIndex(textPtr, &index, string);
- Tcl_SetVar2(textPtr->interp, "tk_textRelayout", (char *) NULL,
- string,
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ LOG("tk_textRelayout", string);
}
newPtr = LayoutDLine(textPtr, &index);
if (prevPtr == NULL) {
@@ -1839,10 +1837,9 @@ UpdateDisplayInfo(textPtr)
* Delete any DLine structures that don't fit on the screen.
*/
- FreeDLines(textPtr, dlPtr, (DLine *) NULL, DLINE_UNLINK);
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_UNLINK);
/*
- *--------------------------------------------------------------
* If there is extra space at the bottom of the window (because we've hit
* the end of the text), then bring in more lines at the top of the
* window, if there are any, to fill in the view.
@@ -1850,7 +1847,6 @@ UpdateDisplayInfo(textPtr)
* Since the top line may only be partially visible, we try first to
* simply show more pixels from that line (newTopPixelOffset). If that
* isn't enough, we have to layout more lines.
- *--------------------------------------------------------------
*/
if (y < maxY) {
@@ -1899,7 +1895,7 @@ UpdateDisplayInfo(textPtr)
*/
lineNum = -1;
- bytesToCount = 0; /* Stop compiler warning */
+ bytesToCount = 0; /* Stop compiler warning */
} else {
lineNum = TkBTreeLinesTo(textPtr,
dInfoPtr->dLinePtr->index.linePtr);
@@ -1923,7 +1919,8 @@ UpdateDisplayInfo(textPtr)
dlPtr->nextPtr = lowestPtr;
lowestPtr = dlPtr;
if (dlPtr->length == 0 && dlPtr->height == 0) {
- bytesToCount--; break;
+ bytesToCount--;
+ break;
} /* elide */
TkTextIndexForwBytes(textPtr, &index, dlPtr->byteCount,
&index);
@@ -1968,15 +1965,13 @@ UpdateDisplayInfo(textPtr)
char string[TK_POS_CHARS];
TkTextPrintIndex(textPtr, &dlPtr->index, string);
- Tcl_SetVar2(textPtr->interp, "tk_textRelayout",
- (char *) NULL, string,
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ LOG("tk_textRelayout", string);
}
if (spaceLeft <= 0) {
break;
}
}
- FreeDLines(textPtr, lowestPtr, (DLine *) NULL, DLINE_FREE);
+ FreeDLines(textPtr, lowestPtr, NULL, DLINE_FREE);
bytesToCount = INT_MAX;
}
@@ -2027,14 +2022,12 @@ UpdateDisplayInfo(textPtr)
}
/*
- *--------------------------------------------------------------
* If the old top or bottom line has scrolled elsewhere on the screen, we
* may not be able to re-use its old contents by copying bits (e.g., a
* beveled edge that was drawn when it was at the top or bottom won't be
* drawn when the line is in the middle and its neighbor has a matching
* background). Similarly, if the new top or bottom line came from
* somewhere else on the screen, we may not be able to copy the old bits.
- *--------------------------------------------------------------
*/
dlPtr = dInfoPtr->dLinePtr;
@@ -2085,14 +2078,12 @@ UpdateDisplayInfo(textPtr)
textPtr->flags |= UPDATE_SCROLLBARS;
/*
- *--------------------------------------------------------------
* Deal with horizontal scrolling:
* 1. If there's empty space to the right of the longest line, shift the
* screen to the right to fill in the empty space.
* 2. If the desired horizontal scroll position has changed, force a full
* redisplay of all the lines in the widget.
* 3. If the wrap mode isn't "none" then re-scroll to the base position.
- *--------------------------------------------------------------
*/
dInfoPtr->maxLength = 0;
@@ -2153,13 +2144,13 @@ UpdateDisplayInfo(textPtr)
*/
static void
-FreeDLines(textPtr, firstPtr, lastPtr, action)
- TkText *textPtr; /* Information about overall text widget. */
- register DLine *firstPtr; /* Pointer to first DLine to free up. */
- DLine *lastPtr; /* Pointer to DLine just after last one to
+FreeDLines(
+ TkText *textPtr, /* Information about overall text widget. */
+ register DLine *firstPtr, /* Pointer to first DLine to free up. */
+ DLine *lastPtr, /* Pointer to DLine just after last one to
* free (NULL means everything starting with
* firstPtr). */
- int action; /* DLINE_UNLINK means DLines are currently
+ int action) /* DLINE_UNLINK means DLines are currently
* linked into the list rooted at
* textPtr->dInfoPtr->dLinePtr and they have
* to be unlinked. DLINE_FREE means just free
@@ -2182,14 +2173,14 @@ FreeDLines(textPtr, firstPtr, lastPtr, action)
*/
TkTextPrintIndex(textPtr, &firstPtr->index, string);
- Tcl_SetVar2(textPtr->interp, "tk_textHeightCalc", (char *) NULL,
- string, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ LOG("tk_textHeightCalc", string);
}
} else if (action == DLINE_UNLINK) {
if (textPtr->dInfoPtr->dLinePtr == firstPtr) {
textPtr->dInfoPtr->dLinePtr = lastPtr;
} else {
register DLine *prevPtr;
+
for (prevPtr = textPtr->dInfoPtr->dLinePtr;
prevPtr->nextPtr != firstPtr; prevPtr = prevPtr->nextPtr) {
/* Empty loop body. */
@@ -2234,12 +2225,12 @@ FreeDLines(textPtr, firstPtr, lastPtr, action)
*/
static void
-DisplayDLine(textPtr, dlPtr, prevPtr, pixmap)
- TkText *textPtr; /* Text widget in which to draw line. */
- register DLine *dlPtr; /* Information about line to draw. */
- DLine *prevPtr; /* Line just before one to draw, or NULL if
+DisplayDLine(
+ TkText *textPtr, /* Text widget in which to draw line. */
+ register DLine *dlPtr, /* Information about line to draw. */
+ DLine *prevPtr, /* Line just before one to draw, or NULL if
* dlPtr is the top line. */
- Pixmap pixmap; /* Pixmap to use for double-buffering. Caller
+ Pixmap pixmap) /* Pixmap to use for double-buffering. Caller
* must make sure it's large enough to hold
* line. */
{
@@ -2277,7 +2268,9 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap)
chunkPtr = chunkPtr->nextPtr) {
if (chunkPtr->displayProc == TkTextInsertDisplayProc) {
int x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curXPixelOffset;
- (*chunkPtr->displayProc)(textPtr, chunkPtr, x, dlPtr->spaceAbove,
+
+ (*chunkPtr->displayProc)(textPtr, chunkPtr, x,
+ dlPtr->spaceAbove,
dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
dlPtr->baseline - dlPtr->spaceAbove, display, pixmap,
dlPtr->y + dlPtr->spaceAbove);
@@ -2381,12 +2374,12 @@ DisplayDLine(textPtr, dlPtr, prevPtr, pixmap)
*/
static void
-DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
- TkText *textPtr; /* Text widget containing line. */
- register DLine *dlPtr; /* Information about line to draw. */
- DLine *prevPtr; /* Line just above dlPtr, or NULL if dlPtr is
+DisplayLineBackground(
+ TkText *textPtr, /* Text widget containing line. */
+ register DLine *dlPtr, /* Information about line to draw. */
+ DLine *prevPtr, /* Line just above dlPtr, or NULL if dlPtr is
* the top-most line in the window. */
- Pixmap pixmap; /* Pixmap to use for double-buffering. Caller
+ Pixmap pixmap) /* Pixmap to use for double-buffering. Caller
* must make sure it's large enough to hold
* line. Caller must also have filled it with
* the background color for the widget. */
@@ -2729,14 +2722,13 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
*
* AsyncUpdateLineMetrics --
*
- * This function is invoked as a background handler to update the
- * pixel-height calculations of individual lines in an asychronous
- * manner.
+ * This function is invoked as a background handler to update the pixel-
+ * height calculations of individual lines in an asychronous manner.
*
* Currently a timer-handler is used for this purpose, which continuously
* reschedules itself. It may well be better to use some other approach
- * (e.g. a background thread). We can't use an idle-callback because of a
- * known bug in Tcl/Tk in which idle callbacks are not allowed to
+ * (e.g., a background thread). We can't use an idle-callback because of
+ * a known bug in Tcl/Tk in which idle callbacks are not allowed to
* re-schedule themselves. This just causes an effective infinite loop.
*
* Results:
@@ -2749,8 +2741,8 @@ DisplayLineBackground(textPtr, dlPtr, prevPtr, pixmap)
*/
static void
-AsyncUpdateLineMetrics(clientData)
- ClientData clientData; /* Information about widget. */
+AsyncUpdateLineMetrics(
+ ClientData clientData) /* Information about widget. */
{
register TkText *textPtr = (TkText *) clientData;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -2760,7 +2752,7 @@ AsyncUpdateLineMetrics(clientData)
if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
/*
- * The widget has been deleted. Don't do anything.
+ * The widget has been deleted. Don't do anything.
*/
if (--textPtr->refCount == 0) {
@@ -2792,8 +2784,7 @@ AsyncUpdateLineMetrics(clientData)
char buffer[2 * TCL_INTEGER_SPACE + 1];
sprintf(buffer, "%d %d", lineNum, dInfoPtr->lastMetricUpdateLine);
- Tcl_SetVar2(textPtr->interp, "tk_textInvalidateLine", (char *) NULL,
- buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ LOG("tk_textInvalidateLine", buffer);
}
/*
@@ -2836,8 +2827,8 @@ AsyncUpdateLineMetrics(clientData)
* doThisMuch is positive, then the function may return earlier, once a
* certain number of lines has been examined. The line counts are from 0.
*
- * If doThisMuch is -1, then all lines in the range will be updated.
- * This will potentially take quite some time for a large text widget.
+ * If doThisMuch is -1, then all lines in the range will be updated. This
+ * will potentially take quite some time for a large text widget.
*
* Note: with bad input for lineNum and endLine, this function can loop
* indefinitely.
@@ -2854,13 +2845,14 @@ AsyncUpdateLineMetrics(clientData)
*/
int
-TkTextUpdateLineMetrics(textPtr, lineNum, endLine, doThisMuch)
- TkText *textPtr; /* Information about widget. */
- int lineNum; /* Start at this line */
- int endLine; /* Go no further than this line */
- int doThisMuch; /* How many lines to check, or how many 10s of lines
- * to recalculate. If '-1' then do everything in the
- * range (which may take a while). */
+TkTextUpdateLineMetrics(
+ TkText *textPtr, /* Information about widget. */
+ int lineNum, /* Start at this line */
+ int endLine, /* Go no further than this line */
+ int doThisMuch) /* How many lines to check, or how many 10s of
+ * lines to recalculate. If '-1' then do
+ * everything in the range (which may take a
+ * while). */
{
TkTextLine *linePtr = NULL;
int count = 0;
@@ -2910,11 +2902,9 @@ TkTextUpdateLineMetrics(textPtr, lineNum, endLine, doThisMuch)
if (tkTextDebug) {
char buffer[4 * TCL_INTEGER_SPACE + 3];
- sprintf(buffer, "%d %d %d %d", lineNum, endLine,
- totalLines, count);
- Tcl_SetVar2(textPtr->interp, "tk_textInvalidateLine",
- (char *) NULL, buffer,
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ sprintf(buffer, "%d %d %d %d",
+ lineNum, endLine, totalLines, count);
+ LOG("tk_textInvalidateLine", buffer);
}
/*
@@ -3062,13 +3052,13 @@ TkTextUpdateLineMetrics(textPtr, lineNum, endLine, doThisMuch)
*/
void
-TkTextInvalidateLineMetrics(sharedTextPtr, textPtr, linePtr, lineCount, action)
- TkSharedText *sharedTextPtr;/* Shared widget section for all peers, or
+TkTextInvalidateLineMetrics(
+ TkSharedText *sharedTextPtr,/* Shared widget section for all peers, or
* NULL. */
- TkText *textPtr; /* Widget record for text widget. */
- TkTextLine *linePtr; /* Invalidation starts from this line. */
- int lineCount; /* And includes this many following lines. */
- int action; /* Indicates what type of invalidation
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextLine *linePtr, /* Invalidation starts from this line. */
+ int lineCount, /* And includes this many following lines. */
+ int action) /* Indicates what type of invalidation
* occurred (insert, delete, or simple). */
{
if (sharedTextPtr == NULL) {
@@ -3083,11 +3073,11 @@ TkTextInvalidateLineMetrics(sharedTextPtr, textPtr, linePtr, lineCount, action)
}
static void
-TextInvalidateLineMetrics(textPtr, linePtr, lineCount, action)
- TkText *textPtr; /* Widget record for text widget. */
- TkTextLine *linePtr; /* Invalidation starts from this line. */
- int lineCount; /* And includes this many following lines. */
- int action; /* Indicates what type of invalidation
+TextInvalidateLineMetrics(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextLine *linePtr, /* Invalidation starts from this line. */
+ int lineCount, /* And includes this many following lines. */
+ int action) /* Indicates what type of invalidation
* occurred (insert, delete, or simple). */
{
int fromLine;
@@ -3170,7 +3160,7 @@ TextInvalidateLineMetrics(textPtr, linePtr, lineCount, action)
dInfoPtr->currentMetricUpdateLine = fromLine;
}
if (dInfoPtr->lastMetricUpdateLine != -1
- && toLine > dInfoPtr->lastMetricUpdateLine) {
+ && toLine > dInfoPtr->lastMetricUpdateLine) {
dInfoPtr->lastMetricUpdateLine = toLine;
}
}
@@ -3243,12 +3233,12 @@ TextInvalidateLineMetrics(textPtr, linePtr, lineCount, action)
*/
void
-TkTextFindDisplayLineEnd(textPtr, indexPtr, end, xOffset)
- TkText *textPtr; /* Widget record for text widget. */
- TkTextIndex *indexPtr; /* Index we will adjust to the display line
+TkTextFindDisplayLineEnd(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextIndex *indexPtr, /* Index we will adjust to the display line
* start or end. */
- int end; /* 0 = start, 1 = end. */
- int *xOffset; /* NULL, or used to store the x-pixel offset
+ int end, /* 0 = start, 1 = end. */
+ int *xOffset) /* NULL, or used to store the x-pixel offset
* of the original index within its display
* line. */
{
@@ -3389,16 +3379,15 @@ TkTextFindDisplayLineEnd(textPtr, indexPtr, end, xOffset)
*/
static int
-CalculateDisplayLineHeight(textPtr, indexPtr, byteCountPtr, mergedLinePtr)
- TkText *textPtr; /* Widget record for text widget. */
- CONST TkTextIndex *indexPtr; /* The index at the beginning of the display
- * line of interest. */
- int *byteCountPtr; /* NULL or used to return the number of byte
- * indices on the given display line. */
- int *mergedLinePtr; /* NULL or used to return if the given
- * display line merges with a following
- * logical line (because the eol is
- * elided). */
+CalculateDisplayLineHeight(
+ TkText *textPtr, /* Widget record for text widget. */
+ CONST TkTextIndex *indexPtr,/* The index at the beginning of the display
+ * line of interest. */
+ int *byteCountPtr, /* NULL or used to return the number of byte
+ * indices on the given display line. */
+ int *mergedLinePtr) /* NULL or used to return if the given display
+ * line merges with a following logical line
+ * (because the eol is elided). */
{
DLine *dlPtr;
int pixelHeight;
@@ -3461,11 +3450,11 @@ CalculateDisplayLineHeight(textPtr, indexPtr, byteCountPtr, mergedLinePtr)
*/
int
-TkTextIndexYPixels(textPtr, indexPtr)
- TkText *textPtr; /* Widget record for text widget. */
- CONST TkTextIndex *indexPtr; /* The index of which we want the pixel
- * distance from top of logical line to top
- * of index. */
+TkTextIndexYPixels(
+ TkText *textPtr, /* Widget record for text widget. */
+ CONST TkTextIndex *indexPtr)/* The index of which we want the pixel
+ * distance from top of logical line to top of
+ * index. */
{
int pixelHeight;
TkTextIndex index;
@@ -3536,26 +3525,29 @@ TkTextIndexYPixels(textPtr, indexPtr)
* Side effects:
* Line heights may be recalculated, and a timer to update the scrollbar
* may be installed. Also see the called function
- * 'CalculateDisplayLineHeight' for its side effects.
+ * CalculateDisplayLineHeight for its side effects.
*
*----------------------------------------------------------------------
*/
int
-TkTextUpdateOneLine(textPtr, linePtr, pixelHeight, indexPtr, partialCalc)
- TkText *textPtr; /* Widget record for text widget. */
- TkTextLine *linePtr; /* The line of which to calculate the height. */
- int pixelHeight; /* If indexPtr is non-NULL, then this is the
- * number of pixels in the logical line linePtr,
- * up to the index which has been given. */
- TkTextIndex *indexPtr; /* Either NULL or an index at the start of a
- * display line belonging to linePtr, at which we
- * wish to start (e.g. up to which we have already
- * calculated). On return this will be set to the
- * first index on the next line. */
- int partialCalc; /* Set to 1 if we are allowed to do partial height
- * calculations of long-lines. In this case we'll
- * only return what we know so far. */
+TkTextUpdateOneLine(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextLine *linePtr, /* The line of which to calculate the
+ * height. */
+ int pixelHeight, /* If indexPtr is non-NULL, then this is the
+ * number of pixels in the logical line
+ * linePtr, up to the index which has been
+ * given. */
+ TkTextIndex *indexPtr, /* Either NULL or an index at the start of a
+ * display line belonging to linePtr, at which
+ * we wish to start (e.g. up to which we have
+ * already calculated). On return this will be
+ * set to the first index on the next line. */
+ int partialCalc) /* Set to 1 if we are allowed to do partial
+ * height calculations of long-lines. In this
+ * case we'll only return what we know so
+ * far. */
{
TkTextIndex index;
int displayLines;
@@ -3724,9 +3716,8 @@ TkTextUpdateOneLine(textPtr, linePtr, pixelHeight, indexPtr, partialCalc)
Tcl_Panic("Mustn't ever update line height of last artificial line");
}
- sprintf(buffer, "%d %d", TkBTreeLinesTo(textPtr, linePtr), pixelHeight);
- Tcl_SetVar2(textPtr->interp, "tk_textNumPixels", (char *) NULL,
- buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ sprintf(buffer, "%d %d", TkBTreeLinesTo(textPtr,linePtr), pixelHeight);
+ LOG("tk_textNumPixels", buffer);
}
if (textPtr->dInfoPtr->scrollbarTimer == NULL) {
textPtr->refCount++;
@@ -3754,8 +3745,8 @@ TkTextUpdateOneLine(textPtr, linePtr, pixelHeight, indexPtr, partialCalc)
*/
static void
-DisplayText(clientData)
- ClientData clientData; /* Information about widget. */
+DisplayText(
+ ClientData clientData) /* Information about widget. */
{
register TkText *textPtr = (TkText *) clientData;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -3779,8 +3770,7 @@ DisplayText(clientData)
Tcl_Preserve((ClientData) interp);
if (tkTextDebug) {
- Tcl_SetVar2(interp, "tk_textRelayout", (char *) NULL, "",
- TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "tk_textRelayout", NULL, "", TCL_GLOBAL_ONLY);
}
if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
@@ -3799,13 +3789,12 @@ DisplayText(clientData)
}
numRedisplays++;
if (tkTextDebug) {
- Tcl_SetVar2(interp, "tk_textRedraw", (char *) NULL, "",
- TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "tk_textRedraw", NULL, "", TCL_GLOBAL_ONLY);
}
if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
/*
- * The widget has been deleted. Don't do anything.
+ * The widget has been deleted. Don't do anything.
*/
goto end;
@@ -3984,8 +3973,7 @@ DisplayText(clientData)
if (dInfoPtr->flags & REDRAW_BORDERS) {
if (tkTextDebug) {
- Tcl_SetVar2(interp, "tk_textRedraw", (char *) NULL, "borders",
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ LOG("tk_textRedraw", "borders");
}
if (textPtr->tkwin == NULL) {
@@ -4006,7 +3994,7 @@ DisplayText(clientData)
GC fgGC, bgGC;
bgGC = Tk_GCForColor(textPtr->highlightBgColorPtr,
- Tk_WindowId(textPtr->tkwin));
+ Tk_WindowId(textPtr->tkwin));
if (textPtr->flags & GOT_FOCUS) {
fgGC = Tk_GCForColor(textPtr->highlightColorPtr,
Tk_WindowId(textPtr->tkwin));
@@ -4047,15 +4035,15 @@ DisplayText(clientData)
/*
* Now we have to redraw the lines that couldn't be updated by scrolling.
- * First, compute the height of the largest line and allocate an
- * off-screen pixmap to use for double-buffered displays.
+ * First, compute the height of the largest line and allocate an off-
+ * screen pixmap to use for double-buffered displays.
*/
maxHeight = -1;
for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL;
dlPtr = dlPtr->nextPtr) {
- if ((dlPtr->height > maxHeight)
- && ((dlPtr->flags & OLD_Y_INVALID) || (dlPtr->oldY != dlPtr->y))) {
+ if ((dlPtr->height > maxHeight) &&
+ ((dlPtr->flags&OLD_Y_INVALID) || (dlPtr->oldY != dlPtr->y))) {
maxHeight = dlPtr->height;
}
bottomY = dlPtr->y + dlPtr->height;
@@ -4086,9 +4074,7 @@ DisplayText(clientData)
char string[TK_POS_CHARS];
TkTextPrintIndex(textPtr, &dlPtr->index, string);
- Tcl_SetVar2(textPtr->interp, "tk_textRedraw",
- (char *) NULL, string,
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ LOG("tk_textRedraw", string);
}
DisplayDLine(textPtr, dlPtr, prevPtr, pixmap);
if (dInfoPtr->dLinesInvalidated) {
@@ -4141,7 +4127,7 @@ DisplayText(clientData)
dlPtr->spaceAbove,
dlPtr->height-dlPtr->spaceAbove-dlPtr->spaceBelow,
dlPtr->baseline - dlPtr->spaceAbove,
- (Display *) NULL, (Drawable) None,
+ NULL, (Drawable) None,
dlPtr->y + dlPtr->spaceAbove);
}
@@ -4162,9 +4148,7 @@ DisplayText(clientData)
}
if (bottomY < dInfoPtr->topOfEof) {
if (tkTextDebug) {
- Tcl_SetVar2(textPtr->interp, "tk_textRedraw",
- (char *) NULL, "eof",
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ LOG("tk_textRedraw", "eof");
}
if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
@@ -4236,8 +4220,8 @@ DisplayText(clientData)
/* ARGSUSED */
void
-TkTextEventuallyRepick(textPtr)
- TkText *textPtr; /* Widget record for text widget. */
+TkTextEventuallyRepick(
+ TkText *textPtr) /* Widget record for text widget. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -4268,12 +4252,12 @@ TkTextEventuallyRepick(textPtr)
/* ARGSUSED */
void
-TkTextRedrawRegion(textPtr, x, y, width, height)
- TkText *textPtr; /* Widget record for text widget. */
- int x, y; /* Coordinates of upper-left corner of area to
+TkTextRedrawRegion(
+ TkText *textPtr, /* Widget record for text widget. */
+ int x, int y, /* Coordinates of upper-left corner of area to
* be redrawn, in pixels relative to textPtr's
* window. */
- int width, height; /* Width and height of area to be redrawn. */
+ int width, int height) /* Width and height of area to be redrawn. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
TkRegion damageRgn = TkCreateRegion();
@@ -4311,9 +4295,9 @@ TkTextRedrawRegion(textPtr, x, y, width, height)
*/
static void
-TextInvalidateRegion(textPtr, region)
- TkText *textPtr; /* Widget record for text widget. */
- TkRegion region; /* Region of area to redraw. */
+TextInvalidateRegion(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkRegion region) /* Region of area to redraw. */
{
register DLine *dlPtr;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -4380,13 +4364,12 @@ TextInvalidateRegion(textPtr, region)
*/
void
-TkTextChanged(sharedTextPtr, textPtr, index1Ptr, index2Ptr)
- TkSharedText *sharedTextPtr; /* Shared widget section, or NULL */
- TkText *textPtr; /* Widget record for text widget, or
- * NULL. */
- CONST TkTextIndex *index1Ptr; /* Index of first character to redisplay. */
- CONST TkTextIndex *index2Ptr; /* Index of character just after last one to
- * redisplay. */
+TkTextChanged(
+ TkSharedText *sharedTextPtr,/* Shared widget section, or NULL */
+ TkText *textPtr, /* Widget record for text widget, or NULL. */
+ CONST TkTextIndex*index1Ptr,/* Index of first character to redisplay. */
+ CONST TkTextIndex*index2Ptr)/* Index of character just after last one to
+ * redisplay. */
{
if (sharedTextPtr == NULL) {
TextChanged(textPtr, index1Ptr, index2Ptr);
@@ -4400,12 +4383,11 @@ TkTextChanged(sharedTextPtr, textPtr, index1Ptr, index2Ptr)
}
static void
-TextChanged(textPtr, index1Ptr, index2Ptr)
- TkText *textPtr; /* Widget record for text widget, or
- * NULL. */
- CONST TkTextIndex *index1Ptr; /* Index of first character to redisplay. */
- CONST TkTextIndex *index2Ptr; /* Index of character just after last one to
- * redisplay. */
+TextChanged(
+ TkText *textPtr, /* Widget record for text widget, or NULL. */
+ CONST TkTextIndex*index1Ptr,/* Index of first character to redisplay. */
+ CONST TkTextIndex*index2Ptr)/* Index of character just after last one to
+ * redisplay. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
DLine *firstPtr, *lastPtr;
@@ -4481,17 +4463,17 @@ TextChanged(textPtr, index1Ptr, index2Ptr)
*/
void
-TkTextRedrawTag(sharedTextPtr, textPtr, index1Ptr, index2Ptr, tagPtr, withTag)
- TkSharedText *sharedTextPtr;/* Shared widget section, or NULL */
- TkText *textPtr; /* Widget record for text widget. */
- TkTextIndex *index1Ptr; /* First character in range to consider for
+TkTextRedrawTag(
+ TkSharedText *sharedTextPtr,/* Shared widget section, or NULL */
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextIndex *index1Ptr, /* First character in range to consider for
* redisplay. NULL means start at beginning of
* text. */
- TkTextIndex *index2Ptr; /* Character just after last one to consider
+ TkTextIndex *index2Ptr, /* Character just after last one to consider
* for redisplay. NULL means process all the
* characters in the text. */
- TkTextTag *tagPtr; /* Information about tag. */
- int withTag; /* 1 means redraw characters that have the
+ TkTextTag *tagPtr, /* Information about tag. */
+ int withTag) /* 1 means redraw characters that have the
* tag, 0 means redraw those without. */
{
if (sharedTextPtr == NULL) {
@@ -4506,16 +4488,16 @@ TkTextRedrawTag(sharedTextPtr, textPtr, index1Ptr, index2Ptr, tagPtr, withTag)
}
static void
-TextRedrawTag(textPtr, index1Ptr, index2Ptr, tagPtr, withTag)
- TkText *textPtr; /* Widget record for text widget. */
- TkTextIndex *index1Ptr; /* First character in range to consider for
+TextRedrawTag(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextIndex *index1Ptr, /* First character in range to consider for
* redisplay. NULL means start at beginning of
* text. */
- TkTextIndex *index2Ptr; /* Character just after last one to consider
+ TkTextIndex *index2Ptr, /* Character just after last one to consider
* for redisplay. NULL means process all the
* characters in the text. */
- TkTextTag *tagPtr; /* Information about tag. */
- int withTag; /* 1 means redraw characters that have the
+ TkTextTag *tagPtr, /* Information about tag. */
+ int withTag) /* 1 means redraw characters that have the
* tag, 0 means redraw those without. */
{
register DLine *dlPtr;
@@ -4700,13 +4682,13 @@ TextRedrawTag(textPtr, index1Ptr, index2Ptr, tagPtr, withTag)
*/
void
-TkTextRelayoutWindow(textPtr, mask)
- TkText *textPtr; /* Widget record for text widget. */
- int mask; /* OR'd collection of bits showing what has
+TkTextRelayoutWindow(
+ TkText *textPtr, /* Widget record for text widget. */
+ int mask) /* OR'd collection of bits showing what has
* changed */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- GC new;
+ GC newGC;
XGCValues gcValues;
/*
@@ -4725,17 +4707,17 @@ TkTextRelayoutWindow(textPtr, mask)
*/
gcValues.graphics_exposures = False;
- new = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues);
+ newGC = Tk_GetGC(textPtr->tkwin, GCGraphicsExposures, &gcValues);
if (dInfoPtr->copyGC != None) {
Tk_FreeGC(textPtr->display, dInfoPtr->copyGC);
}
- dInfoPtr->copyGC = new;
+ dInfoPtr->copyGC = newGC;
/*
* Throw away all the current layout information.
*/
- FreeDLines(textPtr, dInfoPtr->dLinePtr, (DLine *) NULL, DLINE_UNLINK);
+ FreeDLines(textPtr, dInfoPtr->dLinePtr, NULL, DLINE_UNLINK);
dInfoPtr->dLinePtr = NULL;
/*
@@ -4820,8 +4802,8 @@ TkTextRelayoutWindow(textPtr, mask)
*
* TkTextSetYView --
*
- * This function is called to specify what lines are to be displayed in
- * a text widget.
+ * This function is called to specify what lines are to be displayed in a
+ * text widget.
*
* Results:
* None.
@@ -4835,23 +4817,22 @@ TkTextRelayoutWindow(textPtr, mask)
*/
void
-TkTextSetYView(textPtr, indexPtr, pickPlace)
- TkText *textPtr; /* Widget record for text widget. */
- TkTextIndex *indexPtr; /* Position that is to appear somewhere in the
+TkTextSetYView(
+ TkText *textPtr, /* Widget record for text widget. */
+ TkTextIndex *indexPtr, /* Position that is to appear somewhere in the
* view. */
- int pickPlace; /* 0 means the given index must appear exactly
- * at the top of the screen.
- * TK_TEXT_PICKPLACE (-1) means we get to pick
- * where it appears: minimize screen motion or
- * else display line at center of screen.
- * TK_TEXT_NOPIXELADJUST (-2) indicates to
- * make the given index the top line, but if
- * it is already the top line, don't nudge it
- * up or down by a few pixels just to make
- * sure it is entirely displayed. Positive
- * numbers indicate the number of pixels of
- * the index's line which are to be off the
- * top of the screen. */
+ int pickPlace) /* 0 means the given index must appear exactly
+ * at the top of the screen. TK_TEXT_PICKPLACE
+ * (-1) means we get to pick where it appears:
+ * minimize screen motion or else display line
+ * at center of screen. TK_TEXT_NOPIXELADJUST
+ * (-2) indicates to make the given index the
+ * top line, but if it is already the top
+ * line, don't nudge it up or down by a few
+ * pixels just to make sure it is entirely
+ * displayed. Positive numbers indicate the
+ * number of pixels of the index's line which
+ * are to be off the top of the screen. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
register DLine *dlPtr;
@@ -5021,11 +5002,11 @@ TkTextSetYView(textPtr, indexPtr, pickPlace)
*/
int
-TkTextMeasureDown(textPtr, srcPtr, distance)
- TkText *textPtr; /* Text widget in which to measure. */
- TkTextIndex *srcPtr; /* Index of character from which to start
+TkTextMeasureDown(
+ TkText *textPtr, /* Text widget in which to measure. */
+ TkTextIndex *srcPtr, /* Index of character from which to start
* measuring. */
- int distance; /* Vertical distance in pixels measured from
+ int distance) /* Vertical distance in pixels measured from
* the top pixel in srcPtr's logical line. */
{
TkTextLine *lastLinePtr;
@@ -5040,12 +5021,12 @@ TkTextMeasureDown(textPtr, srcPtr, distance)
dlPtr->nextPtr = NULL;
if (distance < dlPtr->height) {
- FreeDLines(textPtr, dlPtr, (DLine *) NULL, DLINE_FREE_TEMP);
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
break;
}
distance -= dlPtr->height;
TkTextIndexForwBytes(textPtr, srcPtr, dlPtr->byteCount, &loop);
- FreeDLines(textPtr, dlPtr, (DLine *) NULL, DLINE_FREE_TEMP);
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
if (loop.linePtr == lastLinePtr) {
break;
}
@@ -5084,15 +5065,15 @@ TkTextMeasureDown(textPtr, srcPtr, distance)
*/
static void
-MeasureUp(textPtr, srcPtr, distance, dstPtr, overlap)
- TkText *textPtr; /* Text widget in which to measure. */
- CONST TkTextIndex *srcPtr; /* Index of character from which to start
+MeasureUp(
+ TkText *textPtr, /* Text widget in which to measure. */
+ CONST TkTextIndex *srcPtr, /* Index of character from which to start
* measuring. */
- int distance; /* Vertical distance in pixels measured from
+ int distance, /* Vertical distance in pixels measured from
* the pixel just below the lowest one in
* srcPtr's line. */
- TkTextIndex *dstPtr; /* Index to fill in with result. */
- int *overlap; /* Used to store how much of the final index
+ TkTextIndex *dstPtr, /* Index to fill in with result. */
+ int *overlap) /* Used to store how much of the final index
* returned was not covered by 'distance'. */
{
int lineNum; /* Number of current line. */
@@ -5149,7 +5130,7 @@ MeasureUp(textPtr, srcPtr, distance, dstPtr, overlap)
* next display line to lay out.
*/
- FreeDLines(textPtr, lowestPtr, (DLine *) NULL, DLINE_FREE);
+ FreeDLines(textPtr, lowestPtr, NULL, DLINE_FREE);
if (distance <= 0) {
return;
}
@@ -5186,11 +5167,11 @@ MeasureUp(textPtr, srcPtr, distance, dstPtr, overlap)
*/
int
-TkTextSeeCmd(textPtr, interp, objc, objv)
- TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. Someone else has already
+TkTextSeeCmd(
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "see". */
{
@@ -5315,11 +5296,11 @@ TkTextSeeCmd(textPtr, interp, objc, objv)
*/
int
-TkTextXviewCmd(textPtr, interp, objc, objv)
- TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. Someone else has already
+TkTextXviewCmd(
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "xview". */
{
@@ -5353,6 +5334,7 @@ TkTextXviewCmd(textPtr, interp, objc, objv)
break;
case TKTEXT_SCROLL_PAGES: {
int pixelsPerPage;
+
pixelsPerPage = (dInfoPtr->maxX-dInfoPtr->x) - 2*textPtr->charWidth;
if (pixelsPerPage < 1) {
pixelsPerPage = 1;
@@ -5388,16 +5370,15 @@ TkTextXviewCmd(textPtr, interp, objc, objv)
* None.
*
* Side effects:
- * The view in textPtr's window changes to reflect the value
- * of "offset".
+ * The view in textPtr's window changes to reflect the value of "offset".
*
*----------------------------------------------------------------------
*/
static void
-YScrollByPixels(textPtr, offset)
- TkText *textPtr; /* Widget to scroll. */
- int offset; /* Amount by which to scroll, in pixels.
+YScrollByPixels(
+ TkText *textPtr, /* Widget to scroll. */
+ int offset) /* Amount by which to scroll, in pixels.
* Positive means that information later in
* text becomes visible, negative means that
* information earlier in the text becomes
@@ -5419,7 +5400,7 @@ YScrollByPixels(textPtr, offset)
} else if (offset > 0) {
DLine *dlPtr;
TkTextLine *lastLinePtr;
- TkTextIndex new;
+ TkTextIndex newIdx;
/*
* Scrolling down by pixels. Layout lines starting at the top index
@@ -5434,7 +5415,7 @@ YScrollByPixels(textPtr, offset)
dlPtr = LayoutDLine(textPtr, &textPtr->topIndex);
dlPtr->nextPtr = NULL;
TkTextIndexForwBytes(textPtr, &textPtr->topIndex,
- dlPtr->byteCount, &new);
+ dlPtr->byteCount, &newIdx);
if (offset <= dlPtr->height) {
/*
* Adjust the top overlap accordingly.
@@ -5443,11 +5424,11 @@ YScrollByPixels(textPtr, offset)
dInfoPtr->newTopPixelOffset = offset;
}
offset -= dlPtr->height;
- FreeDLines(textPtr, dlPtr, (DLine *) NULL, DLINE_FREE_TEMP);
- if (new.linePtr == lastLinePtr || offset <= 0) {
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
+ if (newIdx.linePtr == lastLinePtr || offset <= 0) {
break;
}
- textPtr->topIndex = new;
+ textPtr->topIndex = newIdx;
}
} else {
/*
@@ -5480,16 +5461,16 @@ YScrollByPixels(textPtr, offset)
*/
static void
-YScrollByLines(textPtr, offset)
- TkText *textPtr; /* Widget to scroll. */
- int offset; /* Amount by which to scroll, in display
+YScrollByLines(
+ TkText *textPtr, /* Widget to scroll. */
+ int offset) /* Amount by which to scroll, in display
* lines. Positive means that information
* later in text becomes visible, negative
* means that information earlier in the text
* becomes visible. */
{
int i, bytesToCount, lineNum;
- TkTextIndex new, index;
+ TkTextIndex newIdx, index;
TkTextLine *lastLinePtr;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
DLine *dlPtr, *lowestPtr;
@@ -5532,7 +5513,7 @@ YScrollByLines(textPtr, offset)
* the next display line to lay out.
*/
- FreeDLines(textPtr, lowestPtr, (DLine *) NULL, DLINE_FREE);
+ FreeDLines(textPtr, lowestPtr, NULL, DLINE_FREE);
if (offset >= 0) {
goto scheduleUpdate;
}
@@ -5563,12 +5544,12 @@ YScrollByLines(textPtr, offset)
}
dlPtr->nextPtr = NULL;
TkTextIndexForwBytes(textPtr, &textPtr->topIndex,
- dlPtr->byteCount, &new);
- FreeDLines(textPtr, dlPtr, (DLine *) NULL, DLINE_FREE);
- if (new.linePtr == lastLinePtr) {
+ dlPtr->byteCount, &newIdx);
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE);
+ if (newIdx.linePtr == lastLinePtr) {
break;
}
- textPtr->topIndex = new;
+ textPtr->topIndex = newIdx;
}
}
@@ -5598,11 +5579,11 @@ YScrollByLines(textPtr, offset)
*/
int
-TkTextYviewCmd(textPtr, interp, objc, objv)
- TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. Someone else has already
+TkTextYviewCmd(
+ TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "yview". */
{
@@ -5628,10 +5609,11 @@ TkTextYviewCmd(textPtr, interp, objc, objv)
pickPlace = 0;
if (Tcl_GetString(objv[2])[0] == '-') {
- switchLength = strlen(Tcl_GetString(objv[2]));
+ register CONST char *switchStr =
+ Tcl_GetStringFromObj(objv[2], &switchLength);
+
if ((switchLength >= 2)
- && (strncmp(Tcl_GetString(objv[2]),
- "-pickplace", switchLength) == 0)) {
+ && (strncmp(switchStr, "-pickplace", switchLength) == 0)) {
pickPlace = 1;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 3, objv, "lineNum|index");
@@ -5641,9 +5623,10 @@ TkTextYviewCmd(textPtr, interp, objc, objv)
}
if ((objc == 3) || pickPlace) {
int lineNum;
+
if (Tcl_GetIntFromObj(interp, objv[2+pickPlace], &lineNum) == TCL_OK) {
TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
- lineNum, 0, &index);
+ lineNum, 0, &index);
TkTextSetYView(textPtr, &index, 0);
return TCL_OK;
}
@@ -5720,6 +5703,7 @@ TkTextYviewCmd(textPtr, interp, objc, objv)
*/
int height = dInfoPtr->maxY - dInfoPtr->y;
+
if (textPtr->charHeight * 4 >= height) {
/*
* A single line is more than a quarter of the display. We choose
@@ -5776,11 +5760,11 @@ TkTextYviewCmd(textPtr, interp, objc, objv)
*/
int
-TkTextScanCmd(textPtr, interp, objc, objv)
- register TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. Someone else has already
+TkTextScanCmd(
+ register TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "scan". */
{
@@ -5790,10 +5774,13 @@ TkTextScanCmd(textPtr, interp, objc, objv)
size_t length;
if ((objc != 5) && (objc != 6)) {
- Tcl_AppendResult(interp, "wrong # args: should be \"",
- Tcl_GetString(objv[0]), " scan mark x y\" or \"",
- Tcl_GetString(objv[0]), " scan dragto x y ?gain?\"",
- (char *) NULL);
+ Tcl_WrongNumArgs(interp, 2, objv, "mark x y");
+ Tcl_AppendResult(interp, " or \"", Tcl_GetString(objv[0]),
+ " scan dragto x y ?gain?\"", NULL);
+ /*
+ * Ought to be:
+ * Tcl_WrongNumArgs(interp, 2, objc, "dragto x y ?gain?");
+ */
return TCL_ERROR;
}
if (Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) {
@@ -5857,7 +5844,7 @@ TkTextScanCmd(textPtr, interp, objc, objv)
dInfoPtr->scanMarkY = y;
} else {
Tcl_AppendResult(interp, "bad scan option \"", Tcl_GetString(objv[2]),
- "\": must be mark or dragto", (char *) NULL);
+ "\": must be mark or dragto", NULL);
return TCL_ERROR;
}
return TCL_OK;
@@ -5889,12 +5876,12 @@ TkTextScanCmd(textPtr, interp, objc, objv)
*/
static void
-GetXView(interp, textPtr, report)
- Tcl_Interp *interp; /* If "report" is FALSE, string describing
+GetXView(
+ Tcl_Interp *interp, /* If "report" is FALSE, string describing
* visible range gets stored in the interp's
* result. */
- TkText *textPtr; /* Information about text widget. */
- int report; /* Non-zero means report info to scrollbar if
+ TkText *textPtr, /* Information about text widget. */
+ int report) /* Non-zero means report info to scrollbar if
* it has changed. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -5977,9 +5964,9 @@ GetXView(interp, textPtr, report)
*/
static int
-GetYPixelCount(textPtr, dlPtr)
- TkText *textPtr; /* Information about text widget. */
- DLine *dlPtr; /* Information about the layout of a given
+GetYPixelCount(
+ TkText *textPtr, /* Information about text widget. */
+ DLine *dlPtr) /* Information about the layout of a given
* index */
{
TkTextLine *linePtr = dlPtr->index.linePtr;
@@ -6037,7 +6024,7 @@ GetYPixelCount(textPtr, dlPtr)
TkTextIndexForwBytes(textPtr, &dlPtr->index,
dlPtr->byteCount, &index);
if (notFirst) {
- FreeDLines(textPtr, dlPtr, (DLine *)NULL, DLINE_FREE_TEMP);
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
}
if (index.linePtr != linePtr) {
break;
@@ -6054,9 +6041,7 @@ GetYPixelCount(textPtr, dlPtr)
*/
TkTextPrintIndex(textPtr, &index, string);
- Tcl_SetVar2(textPtr->interp, "tk_textHeightCalc",
- (char *) NULL, string,
- TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ LOG("tk_textHeightCalc", string);
}
count -= dlPtr->height;
notFirst = 1;
@@ -6075,9 +6060,9 @@ GetYPixelCount(textPtr, dlPtr)
*
* GetYView --
*
- * This function computes the fractions that indicate what's visible in
- * a text window and, optionally, evaluates a Tcl script to report them
- * to the text's associated scrollbar.
+ * This function computes the fractions that indicate what's visible in a
+ * text window and, optionally, evaluates a Tcl script to report them to
+ * the text's associated scrollbar.
*
* Results:
* If report is zero, then the interp's result is filled in with two real
@@ -6095,12 +6080,12 @@ GetYPixelCount(textPtr, dlPtr)
*/
static void
-GetYView(interp, textPtr, report)
- Tcl_Interp *interp; /* If "report" is FALSE, string describing
+GetYView(
+ Tcl_Interp *interp, /* If "report" is FALSE, string describing
* visible range gets stored in the interp's
* result. */
- TkText *textPtr; /* Information about text widget. */
- int report; /* Non-zero means report info to scrollbar if
+ TkText *textPtr, /* Information about text widget. */
+ int report) /* Non-zero means report info to scrollbar if
* it has changed. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -6205,7 +6190,7 @@ GetYView(interp, textPtr, report)
}
if (FP_EQUAL_SCALE(first, dInfoPtr->yScrollFirst, totalPixels) &&
- FP_EQUAL_SCALE(last, dInfoPtr->yScrollLast, totalPixels)) {
+ FP_EQUAL_SCALE(last, dInfoPtr->yScrollLast, totalPixels)) {
return;
}
@@ -6247,8 +6232,8 @@ GetYView(interp, textPtr, report)
*/
static void
-AsyncUpdateYScrollbar(clientData)
- ClientData clientData; /* Information about widget. */
+AsyncUpdateYScrollbar(
+ ClientData clientData) /* Information about widget. */
{
register TkText *textPtr = (TkText *) clientData;
@@ -6283,10 +6268,10 @@ AsyncUpdateYScrollbar(clientData)
*/
static DLine *
-FindDLine(dlPtr, indexPtr)
- register DLine *dlPtr; /* Pointer to first in list of DLines to
+FindDLine(
+ register DLine *dlPtr, /* Pointer to first in list of DLines to
* search. */
- CONST TkTextIndex *indexPtr;/* Index of desired character. */
+ CONST TkTextIndex *indexPtr)/* Index of desired character. */
{
TkTextLine *linePtr;
@@ -6361,13 +6346,13 @@ FindDLine(dlPtr, indexPtr)
*/
void
-TkTextPixelIndex(textPtr, x, y, indexPtr, nearest)
- TkText *textPtr; /* Widget record for text widget. */
- int x, y; /* Pixel coordinates of point in widget's
+TkTextPixelIndex(
+ TkText *textPtr, /* Widget record for text widget. */
+ int x, int y, /* Pixel coordinates of point in widget's
* window. */
- TkTextIndex *indexPtr; /* This index gets filled in with the index of
+ TkTextIndex *indexPtr, /* This index gets filled in with the index of
* the character nearest to (x,y). */
- int *nearest; /* If non-NULL then gets set to 0 if (x,y) is
+ int *nearest) /* If non-NULL then gets set to 0 if (x,y) is
* actually over the returned index, and 1 if
* it is just nearby (e.g. if x,y is on the
* border of the widget). */
@@ -6411,7 +6396,7 @@ TkTextPixelIndex(textPtr, x, y, indexPtr, nearest)
if (dInfoPtr->dLinePtr == NULL) {
if (nearest != NULL) {
- *nearest = 1;
+ *nearest = 1;
}
*indexPtr = textPtr->topIndex;
return;
@@ -6462,13 +6447,13 @@ TkTextPixelIndex(textPtr, x, y, indexPtr, nearest)
*/
static void
-DlineIndexOfX(textPtr, dlPtr, x, indexPtr)
- TkText *textPtr; /* Widget record for text widget. */
- DLine *dlPtr; /* Display information for this display
+DlineIndexOfX(
+ TkText *textPtr, /* Widget record for text widget. */
+ DLine *dlPtr, /* Display information for this display
* line. */
- int x; /* Pixel x coordinate of point in widget's
+ int x, /* Pixel x coordinate of point in widget's
* window. */
- TkTextIndex *indexPtr; /* This index gets filled in with the index of
+ TkTextIndex *indexPtr) /* This index gets filled in with the index of
* the character nearest to x. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -6549,11 +6534,11 @@ DlineIndexOfX(textPtr, dlPtr, x, indexPtr)
*/
void
-TkTextIndexOfX(textPtr, x, indexPtr)
- TkText *textPtr; /* Widget record for text widget. */
- int x; /* The x coordinate for which we want the
+TkTextIndexOfX(
+ TkText *textPtr, /* Widget record for text widget. */
+ int x, /* The x coordinate for which we want the
* index */
- TkTextIndex *indexPtr; /* Index of display line start, which will be
+ TkTextIndex *indexPtr) /* Index of display line start, which will be
* adjusted to the index under the given x
* coordinate. */
{
@@ -6588,11 +6573,11 @@ TkTextIndexOfX(textPtr, x, indexPtr)
*/
static int
-DlineXOfIndex(textPtr, dlPtr, byteIndex)
- TkText *textPtr; /* Widget record for text widget. */
- DLine *dlPtr; /* Display information for this display
+DlineXOfIndex(
+ TkText *textPtr, /* Widget record for text widget. */
+ DLine *dlPtr, /* Display information for this display
* line. */
- int byteIndex; /* The byte index for which we want the
+ int byteIndex) /* The byte index for which we want the
* coordinate. */
{
register TkTextDispChunk *chunkPtr = dlPtr->chunkPtr;
@@ -6638,10 +6623,10 @@ DlineXOfIndex(textPtr, dlPtr, byteIndex)
* the entity (character, window, image) at that index.
*
* Results:
- * Zero is returned if the index is on the screen. -1 means the
- * index isn't on the screen. If the return value is 0, then the
- * bounding box of the part of the index that's visible on the screen
- * is returned to *xPtr, *yPtr, *widthPtr, and *heightPtr.
+ * Zero is returned if the index is on the screen. -1 means the index
+ * isn't on the screen. If the return value is 0, then the bounding box
+ * of the part of the index that's visible on the screen is returned to
+ * *xPtr, *yPtr, *widthPtr, and *heightPtr.
*
* Side effects:
* None.
@@ -6650,17 +6635,17 @@ DlineXOfIndex(textPtr, dlPtr, byteIndex)
*/
int
-TkTextIndexBbox(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr, charWidthPtr)
- TkText *textPtr; /* Widget record for text widget. */
- CONST TkTextIndex *indexPtr;/* Index whose bounding box is desired. */
- int *xPtr, *yPtr; /* Filled with index's upper-left
+TkTextIndexBbox(
+ TkText *textPtr, /* Widget record for text widget. */
+ CONST TkTextIndex *indexPtr,/* Index whose bounding box is desired. */
+ int *xPtr, int *yPtr, /* Filled with index's upper-left
* coordinate. */
- int *widthPtr, *heightPtr; /* Filled in with index's dimensions. */
- int *charWidthPtr; /* If the 'index' is at the end of
- * a display line and therefore takes
- * up a very large width, this is
- * used to return the smaller width
- * actually desired by the index. */
+ int *widthPtr, int *heightPtr,
+ /* Filled in with index's dimensions. */
+ int *charWidthPtr) /* If the 'index' is at the end of a display
+ * line and therefore takes up a very large
+ * width, this is used to return the smaller
+ * width actually desired by the index. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
DLine *dlPtr;
@@ -6731,11 +6716,11 @@ TkTextIndexBbox(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr, charWidthPtr
}
}
if (*widthPtr == 0) {
- /*
- * With zero width (e.g. elided text) we just need to
- * make sure it is onscreen, where the '=' case here is
- * ok.
+ /*
+ * With zero width (e.g. elided text) we just need to make sure it is
+ * onscreen, where the '=' case here is ok.
*/
+
if (*xPtr < dInfoPtr->x) {
return -1;
}
@@ -6780,14 +6765,15 @@ TkTextIndexBbox(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr, charWidthPtr
*/
int
-TkTextDLineInfo(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr, basePtr)
- TkText *textPtr; /* Widget record for text widget. */
- CONST TkTextIndex *indexPtr;/* Index of character whose bounding box is
+TkTextDLineInfo(
+ TkText *textPtr, /* Widget record for text widget. */
+ CONST TkTextIndex *indexPtr,/* Index of character whose bounding box is
* desired. */
- int *xPtr, *yPtr; /* Filled with line's upper-left
+ int *xPtr, int *yPtr, /* Filled with line's upper-left
* coordinate. */
- int *widthPtr, *heightPtr; /* Filled in with line's dimensions. */
- int *basePtr; /* Filled in with the baseline position,
+ int *widthPtr, int *heightPtr,
+ /* Filled in with line's dimensions. */
+ int *basePtr) /* Filled in with the baseline position,
* measured as an offset down from *yPtr. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
@@ -6829,23 +6815,22 @@ TkTextDLineInfo(textPtr, indexPtr, xPtr, yPtr, widthPtr, heightPtr, basePtr)
*/
static void
-ElideBboxProc(textPtr, chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
- widthPtr, heightPtr)
- TkText *textPtr;
- TkTextDispChunk *chunkPtr; /* Chunk containing desired char. */
- int index; /* Index of desired character within the
+ElideBboxProc(
+ TkText *textPtr,
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
+ int index, /* Index of desired character within the
* chunk. */
- int y; /* Topmost pixel in area allocated for this
+ int y, /* Topmost pixel in area allocated for this
* line. */
- int lineHeight; /* Height of line, in pixels. */
- int baseline; /* Location of line's baseline, in pixels
+ int lineHeight, /* Height of line, in pixels. */
+ int baseline, /* Location of line's baseline, in pixels
* measured down from y. */
- int *xPtr, *yPtr; /* Gets filled in with coords of character's
+ int *xPtr, int *yPtr, /* Gets filled in with coords of character's
* upper-left pixel. X-coord is in same
* coordinate system as chunkPtr->x. */
- int *widthPtr; /* Gets filled in with width of character, in
+ int *widthPtr, /* Gets filled in with width of character, in
* pixels. */
- int *heightPtr; /* Gets filled in with height of character, in
+ int *heightPtr) /* Gets filled in with height of character, in
* pixels. */
{
*xPtr = chunkPtr->x;
@@ -6858,9 +6843,9 @@ ElideBboxProc(textPtr, chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
*/
static int
-ElideMeasureProc(chunkPtr, x)
- TkTextDispChunk *chunkPtr; /* Chunk containing desired coord. */
- int x; /* X-coordinate, in same coordinate system as
+ElideMeasureProc(
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired coord. */
+ int x) /* X-coordinate, in same coordinate system as
* chunkPtr->x. */
{
return 0 /*chunkPtr->numBytes - 1*/;
@@ -6888,24 +6873,23 @@ ElideMeasureProc(chunkPtr, x)
*/
int
-TkTextCharLayoutProc(textPtr, indexPtr, segPtr, byteOffset, maxX, maxBytes,
- noCharsYet, wrapMode, chunkPtr)
- TkText *textPtr; /* Text widget being layed out. */
- TkTextIndex *indexPtr; /* Index of first character to lay out
+TkTextCharLayoutProc(
+ TkText *textPtr, /* Text widget being layed out. */
+ TkTextIndex *indexPtr, /* Index of first character to lay out
* (corresponds to segPtr and offset). */
- TkTextSegment *segPtr; /* Segment being layed out. */
- int byteOffset; /* Byte offset within segment of first
+ TkTextSegment *segPtr, /* Segment being layed out. */
+ int byteOffset, /* Byte offset within segment of first
* character to consider. */
- int maxX; /* Chunk must not occupy pixels at this
+ int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxBytes; /* Chunk must not include more than this many
+ int maxBytes, /* Chunk must not include more than this many
* characters. */
- int noCharsYet; /* Non-zero means no characters have been
+ int noCharsYet, /* Non-zero means no characters have been
* assigned to this display line yet. */
- TkWrapMode wrapMode; /* How to handle line wrapping:
+ TkWrapMode wrapMode, /* How to handle line wrapping:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr;
+ register TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
@@ -6918,13 +6902,13 @@ TkTextCharLayoutProc(textPtr, indexPtr, segPtr, byteOffset, maxX, maxBytes,
Tk_FontMetrics fm;
/*
- * Figure out how many characters will fit in the space we've got.
- * Include the next character, even though it won't fit completely, if any
- * of the following is true:
+ * Figure out how many characters will fit in the space we've got. Include
+ * the next character, even though it won't fit completely, if any of the
+ * following is true:
* (a) the chunk contains no characters and the display line contains no
* characters yet (i.e. the line isn't wide enough to hold even a
* single character).
- * (b) at least one pixel of the character is visible, we haven't
+ * (b) at least one pixel of the character is visible, we have not
* already exceeded the character limit, and the next character is a
* white space character.
*/
@@ -7040,19 +7024,19 @@ TkTextCharLayoutProc(textPtr, indexPtr, segPtr, byteOffset, maxX, maxBytes,
*/
static void
-CharDisplayProc(textPtr, chunkPtr, x, y, height, baseline, display, dst, screenY)
- TkText *textPtr;
- TkTextDispChunk *chunkPtr; /* Chunk that is to be drawn. */
- int x; /* X-position in dst at which to draw this
+CharDisplayProc(
+ TkText *textPtr,
+ TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ int x, /* X-position in dst at which to draw this
* chunk (may differ from the x-position in
* the chunk because of scrolling). */
- int y; /* Y-position at which to draw this chunk in
+ int y, /* Y-position at which to draw this chunk in
* dst. */
- int height; /* Total height of line. */
- int baseline; /* Offset of baseline from y. */
- Display *display; /* Display to use for drawing. */
- Drawable dst; /* Pixmap or window in which to draw chunk. */
- int screenY; /* Y-coordinate in text window that
+ int height, /* Total height of line. */
+ int baseline, /* Offset of baseline from y. */
+ Display *display, /* Display to use for drawing. */
+ Drawable dst, /* Pixmap or window in which to draw chunk. */
+ int screenY) /* Y-coordinate in text window that
* corresponds to y. */
{
CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
@@ -7138,9 +7122,9 @@ CharDisplayProc(textPtr, chunkPtr, x, y, height, baseline, display, dst, screenY
*/
static void
-CharUndisplayProc(textPtr, chunkPtr)
- TkText *textPtr; /* Overall information about text widget. */
- TkTextDispChunk *chunkPtr; /* Chunk that is about to be freed. */
+CharUndisplayProc(
+ TkText *textPtr, /* Overall information about text widget. */
+ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
@@ -7166,9 +7150,9 @@ CharUndisplayProc(textPtr, chunkPtr)
*/
static int
-CharMeasureProc(chunkPtr, x)
- TkTextDispChunk *chunkPtr; /* Chunk containing desired coord. */
- int x; /* X-coordinate, in same coordinate system as
+CharMeasureProc(
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired coord. */
+ int x) /* X-coordinate, in same coordinate system as
* chunkPtr->x. */
{
CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
@@ -7201,23 +7185,22 @@ CharMeasureProc(chunkPtr, x)
*/
static void
-CharBboxProc(textPtr, chunkPtr, byteIndex, y, lineHeight, baseline, xPtr, yPtr,
- widthPtr, heightPtr)
- TkText *textPtr;
- TkTextDispChunk *chunkPtr; /* Chunk containing desired char. */
- int byteIndex; /* Byte offset of desired character within the
+CharBboxProc(
+ TkText *textPtr,
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
+ int byteIndex, /* Byte offset of desired character within the
* chunk. */
- int y; /* Topmost pixel in area allocated for this
+ int y, /* Topmost pixel in area allocated for this
* line. */
- int lineHeight; /* Height of line, in pixels. */
- int baseline; /* Location of line's baseline, in pixels
+ int lineHeight, /* Height of line, in pixels. */
+ int baseline, /* Location of line's baseline, in pixels
* measured down from y. */
- int *xPtr, *yPtr; /* Gets filled in with coords of character's
+ int *xPtr, int *yPtr, /* Gets filled in with coords of character's
* upper-left pixel. X-coord is in same
* coordinate system as chunkPtr->x. */
- int *widthPtr; /* Gets filled in with width of character, in
+ int *widthPtr, /* Gets filled in with width of character, in
* pixels. */
- int *heightPtr; /* Gets filled in with height of character, in
+ int *heightPtr) /* Gets filled in with height of character, in
* pixels. */
{
CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
@@ -7277,14 +7260,14 @@ CharBboxProc(textPtr, chunkPtr, byteIndex, y, lineHeight, baseline, xPtr, yPtr,
*/
static void
-AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
- TkText *textPtr; /* Information about the text widget as a
+AdjustForTab(
+ TkText *textPtr, /* Information about the text widget as a
* whole. */
- TkTextTabArray *tabArrayPtr;/* Information about the tab stops that apply
+ TkTextTabArray *tabArrayPtr,/* Information about the tab stops that apply
* to this line. May be NULL to indicate
* default tabbing (every 8 chars). */
- int index; /* Index of current tab stop. */
- TkTextDispChunk *chunkPtr; /* Chunk whose last character is the tab; the
+ int index, /* Index of current tab stop. */
+ TkTextDispChunk *chunkPtr) /* Chunk whose last character is the tab; the
* following chunks contain information to be
* shifted right. */
{
@@ -7297,7 +7280,7 @@ AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
if (chunkPtr->nextPtr == NULL) {
/*
- * Nothing after the actual tab; just return.
+ * Nothing after the actual tab; just return.
*/
return;
@@ -7306,9 +7289,9 @@ AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
x = chunkPtr->nextPtr->x;
/*
- * If no tab information has been given, assuming tab stops are
- * at 8 average-sized characters. Still ensure we respect the
- * tabular versus wordprocessor tab style.
+ * If no tab information has been given, assuming tab stops are at 8
+ * average-sized characters. Still ensure we respect the tabular versus
+ * wordprocessor tab style.
*/
if ((tabArrayPtr == NULL) || (tabArrayPtr->numTabs == 0)) {
@@ -7327,7 +7310,7 @@ AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
} else {
desired = NextTabStop(textPtr->tkfont, x, 0);
}
-
+
goto update;
}
@@ -7466,19 +7449,19 @@ AdjustForTab(textPtr, tabArrayPtr, index, chunkPtr)
*/
static int
-SizeOfTab(textPtr, tabStyle, tabArrayPtr, indexPtr, x, maxX)
- TkText *textPtr; /* Information about the text widget as a
+SizeOfTab(
+ TkText *textPtr, /* Information about the text widget as a
* whole. */
- int tabStyle; /* One of TK_TEXT_TABSTYLE_TABULAR
- * or TK_TEXT_TABSTYLE_WORDPROCESSOR. */
- TkTextTabArray *tabArrayPtr;/* Information about the tab stops that apply
+ int tabStyle, /* One of TK_TEXT_TABSTYLE_TABULAR
+ * or TK_TEXT_TABSTYLE_WORDPROCESSOR. */
+ TkTextTabArray *tabArrayPtr,/* Information about the tab stops that apply
* to this line. NULL means use default
* tabbing (every 8 chars.) */
- int *indexPtr; /* Contains index of previous tab stop, will
+ int *indexPtr, /* Contains index of previous tab stop, will
* be updated to reflect the number of stops
* used. */
- int x; /* Current x-location in line. */
- int maxX; /* X-location of pixel just past the right
+ int x, /* Current x-location in line. */
+ int maxX) /* X-location of pixel just past the right
* edge of the line. */
{
int tabX, result, index, spaceWidth, tabWidth;
@@ -7487,7 +7470,10 @@ SizeOfTab(textPtr, tabStyle, tabArrayPtr, indexPtr, x, maxX)
index = *indexPtr;
if ((tabArrayPtr == NULL) || (tabArrayPtr->numTabs == 0)) {
- /* We're using a default tab spacing of 8 characters */
+ /*
+ * We're using a default tab spacing of 8 characters.
+ */
+
tabWidth = Tk_TextWidth(textPtr->tkfont, "0", 1) * 8;
if (tabWidth == 0) {
tabWidth = 1;
@@ -7495,16 +7481,19 @@ SizeOfTab(textPtr, tabStyle, tabArrayPtr, indexPtr, x, maxX)
} else {
tabWidth = 0; /* Avoid compiler error */
}
-
+
do {
/*
* We were given the count before this tab, so increment it first.
*/
index++;
-
+
if ((tabArrayPtr == NULL) || (tabArrayPtr->numTabs == 0)) {
- /* We're using a default tab spacing calculated above */
+ /*
+ * We're using a default tab spacing calculated above.
+ */
+
tabX = tabWidth * (index + 1);
alignment = LEFT;
} else if (index < tabArrayPtr->numTabs) {
@@ -7522,14 +7511,13 @@ SizeOfTab(textPtr, tabStyle, tabArrayPtr, indexPtr, x, maxX)
}
/*
- * If this tab stop is before the current x position, then we
- * have two cases:
- *
- * With 'wordprocessor' style tabs, we must obviously continue
- * until we reach the text tab stop.
- *
- * With 'tabular' style tabs, we always use the index'th tab
- * stop.
+ * If this tab stop is before the current x position, then we have two
+ * cases:
+ *
+ * With 'wordprocessor' style tabs, we must obviously continue until
+ * we reach the text tab stop.
+ *
+ * With 'tabular' style tabs, we always use the index'th tab stop.
*/
} while (tabX < x && (tabStyle == TK_TEXT_TABSTYLE_WORDPROCESSOR));
@@ -7585,8 +7573,7 @@ SizeOfTab(textPtr, tabStyle, tabArrayPtr, indexPtr, x, maxX)
* Given the current position, determine where the next default tab stop
* would be located. This function is called when the current chunk in
* the text has no tabs defined and so the default tab spacing for the
- * font should be used, provided we are using wordprocessor
- * style tabs.
+ * font should be used, provided we are using wordprocessor style tabs.
*
* Results:
* The location in pixels of the next tab stop.
@@ -7598,13 +7585,13 @@ SizeOfTab(textPtr, tabStyle, tabArrayPtr, indexPtr, x, maxX)
*/
static int
-NextTabStop(tkfont, x, tabOrigin)
- Tk_Font tkfont; /* Font in which chunk that contains tab stop
+NextTabStop(
+ Tk_Font tkfont, /* Font in which chunk that contains tab stop
* will be drawn. */
- int x; /* X-position in pixels where last character
+ int x, /* X-position in pixels where last character
* was drawn. The next tab stop occurs
* somewhere after this location. */
- int tabOrigin; /* The origin for tab stops. May be non-zero
+ int tabOrigin) /* The origin for tab stops. May be non-zero
* if text has been scrolled. */
{
int tabWidth, rem;
@@ -7626,7 +7613,7 @@ NextTabStop(tkfont, x, tabOrigin)
/*
*---------------------------------------------------------------------------
*
- * MeasureChars --
+ * MeasureChars --
*
* Determine the number of characters from the string that will fit in
* the given horizontal span. The measurement is done under the
@@ -7652,17 +7639,17 @@ NextTabStop(tkfont, x, tabOrigin)
*/
static int
-MeasureChars(tkfont, source, maxBytes, startX, maxX, nextXPtr)
- Tk_Font tkfont; /* Font in which to draw characters. */
- CONST char *source; /* Characters to be displayed. Need not be
+MeasureChars(
+ Tk_Font tkfont, /* Font in which to draw characters. */
+ CONST char *source, /* Characters to be displayed. Need not be
* NULL-terminated. */
- int maxBytes; /* Maximum # of bytes to consider from
+ int maxBytes, /* Maximum # of bytes to consider from
* source. */
- int startX; /* X-position at which first character will be
+ int startX, /* X-position at which first character will be
* drawn. */
- int maxX; /* Don't consider any character that would
+ int maxX, /* Don't consider any character that would
* cross this x-position. */
- int *nextXPtr; /* Return x-position of terminating character
+ int *nextXPtr) /* Return x-position of terminating character
* here. */
{
int curX, width, ch;
@@ -7694,8 +7681,8 @@ MeasureChars(tkfont, source, maxBytes, startX, maxX, nextXPtr)
if ((maxX >= 0) && (curX >= maxX)) {
break;
}
- start += Tk_MeasureChars(tkfont, start, special - start,
- maxX - curX, 0, &width);
+ start += Tk_MeasureChars(tkfont, start, special - start, maxX - curX,
+ 0, &width);
curX += width;
if (start < special) {
/*
@@ -7746,70 +7733,81 @@ MeasureChars(tkfont, source, maxBytes, startX, maxX, nextXPtr)
*/
static int
-TextGetScrollInfoObj(interp, textPtr, objc, objv, dblPtr, intPtr)
- Tcl_Interp *interp; /* Used for error reporting. */
- TkText *textPtr; /* Information about the text widget. */
- int objc; /* # arguments for command. */
- Tcl_Obj *CONST objv[]; /* Arguments for command. */
- double *dblPtr; /* Filled in with argument "moveto" option, if
+TextGetScrollInfoObj(
+ Tcl_Interp *interp, /* Used for error reporting. */
+ TkText *textPtr, /* Information about the text widget. */
+ int objc, /* # arguments for command. */
+ Tcl_Obj *CONST objv[], /* Arguments for command. */
+ double *dblPtr, /* Filled in with argument "moveto" option, if
* any. */
- int *intPtr; /* Filled in with number of pages or lines or
+ int *intPtr) /* Filled in with number of pages or lines or
* pixels to scroll, if any. */
{
- char c;
- int length;
- CONST char *arg2;
-
- arg2 = Tcl_GetStringFromObj(objv[2], &length);
- c = arg2[0];
- if (c=='m' && strncmp(arg2, "moveto", (unsigned) length)==0) {
+ static CONST char *subcommands[] = {
+ "moveto", "scroll", NULL
+ };
+ enum viewSubcmds {
+ VIEW_MOVETO, VIEW_SCROLL
+ };
+ static CONST char *units[] = {
+ "units", "pages", "pixels", NULL
+ };
+ enum viewUnits {
+ VIEW_SCROLL_UNITS, VIEW_SCROLL_PAGES, VIEW_SCROLL_PIXELS
+ };
+ int index;
+
+ if (Tcl_GetIndexFromObj(interp, objv[2], subcommands, "option", 0,
+ &index) != TCL_OK) {
+ return TKTEXT_SCROLL_ERROR;
+ }
+
+ switch ((enum viewSubcmds) index) {
+ case VIEW_MOVETO:
if (objc != 4) {
- Tcl_WrongNumArgs(interp, 2, objv, "moveto fraction");
+ Tcl_WrongNumArgs(interp, 3, objv, "fraction");
return TKTEXT_SCROLL_ERROR;
}
if (Tcl_GetDoubleFromObj(interp, objv[3], dblPtr) != TCL_OK) {
return TKTEXT_SCROLL_ERROR;
}
return TKTEXT_SCROLL_MOVETO;
- } else if (c=='s' && strncmp(arg2, "scroll", (unsigned) length)==0) {
- CONST char *arg4;
- size_t argLen;
-
+ case VIEW_SCROLL:
if (objc != 5) {
- Tcl_WrongNumArgs(interp, 2, objv,
- "scroll number units|pages|pixels");
+ Tcl_WrongNumArgs(interp, 3, objv, "number units|pages|pixels");
return TKTEXT_SCROLL_ERROR;
}
- arg4 = Tcl_GetStringFromObj(objv[4], &length);
- argLen = (size_t) length;
- c = arg4[0];
- if (c=='p' && length==1) {
- Tcl_AppendResult(interp, "ambiguous argument \"", arg4,
- "\": must be units, pages or pixels", (char *) NULL);
+ if (Tcl_GetIndexFromObj(interp, objv[4], units, "argument", 0,
+ &index) != TCL_OK) {
return TKTEXT_SCROLL_ERROR;
- } else if (c=='p' && strncmp(arg4, "pages", argLen)==0) {
+ }
+ switch ((enum viewUnits) index) {
+ case VIEW_SCROLL_PAGES:
if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
return TKTEXT_SCROLL_ERROR;
}
return TKTEXT_SCROLL_PAGES;
- } else if (c=='p' && strncmp(arg4, "pixels", argLen)==0) {
+ case VIEW_SCROLL_PIXELS:
if (Tk_GetPixelsFromObj(interp, textPtr->tkwin, objv[3],
intPtr) != TCL_OK) {
return TKTEXT_SCROLL_ERROR;
}
return TKTEXT_SCROLL_PIXELS;
- } else if (c=='u' && strncmp(arg4, "units", argLen)==0) {
+ case VIEW_SCROLL_UNITS:
if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
return TKTEXT_SCROLL_ERROR;
}
return TKTEXT_SCROLL_UNITS;
- } else {
- Tcl_AppendResult(interp, "bad argument \"", arg4,
- "\": must be units, pages or pixels", (char *) NULL);
- return TKTEXT_SCROLL_ERROR;
}
}
- Tcl_AppendResult(interp, "unknown option \"", arg2,
- "\": must be moveto or scroll", (char *) NULL);
+ Tcl_Panic("unexpected switch fallthrough");
return TKTEXT_SCROLL_ERROR;
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c
index 767fef9..474e941 100644
--- a/generic/tkTextImage.c
+++ b/generic/tkTextImage.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextImage.c,v 1.16 2005/10/10 10:36:35 vincentdarley Exp $
+ * RCS: @(#) $Id: tkTextImage.c,v 1.17 2005/11/17 10:57:35 dkf Exp $
*/
#include "tk.h"
@@ -73,7 +73,7 @@ static Tk_SegType tkTextEmbImageType = {
*/
static char *alignStrings[] = {
- "baseline", "bottom", "center", "top", (char *) NULL
+ "baseline", "bottom", "center", "top", NULL
};
typedef enum {
@@ -85,20 +85,18 @@ typedef enum {
*/
static Tk_OptionSpec optionSpecs[] = {
- {TK_OPTION_STRING_TABLE, "-align", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING_TABLE, "-align", NULL, NULL,
"center", -1, Tk_Offset(TkTextEmbImage, align),
0, (ClientData) alignStrings, 0},
- {TK_OPTION_PIXELS, "-padx", (char *) NULL, (char *) NULL,
- "0", -1, Tk_Offset(TkTextEmbImage, padX),
- 0, 0, 0},
- {TK_OPTION_PIXELS, "-pady", (char *) NULL, (char *) NULL,
- "0", -1, Tk_Offset(TkTextEmbImage, padY),
- 0, 0, 0},
- {TK_OPTION_STRING, "-image", (char *) NULL, (char *) NULL,
- (char *) NULL, -1, Tk_Offset(TkTextEmbImage, imageString),
+ {TK_OPTION_PIXELS, "-padx", NULL, NULL,
+ "0", -1, Tk_Offset(TkTextEmbImage, padX), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-pady", NULL, NULL,
+ "0", -1, Tk_Offset(TkTextEmbImage, padY), 0, 0, 0},
+ {TK_OPTION_STRING, "-image", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextEmbImage, imageString),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_STRING, "-name", (char *) NULL, (char *) NULL,
- (char *) NULL, -1, Tk_Offset(TkTextEmbImage, imageName),
+ {TK_OPTION_STRING, "-name", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextEmbImage, imageName),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END}
};
@@ -122,11 +120,11 @@ static Tk_OptionSpec optionSpecs[] = {
*/
int
-TkTextImageCmd(textPtr, interp, objc, objv)
- register TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. Someone else has already
+TkTextImageCmd(
+ register TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "image". */
{
@@ -159,10 +157,10 @@ TkTextImageCmd(textPtr, interp, objc, objv)
if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
return TCL_ERROR;
}
- eiPtr = TkTextIndexToSeg(&index, (int *) NULL);
+ eiPtr = TkTextIndexToSeg(&index, NULL);
if (eiPtr->typePtr != &tkTextEmbImageType) {
Tcl_AppendResult(interp, "no embedded image at index \"",
- Tcl_GetString(objv[3]), "\"", (char *) NULL);
+ Tcl_GetString(objv[3]), "\"", NULL);
return TCL_ERROR;
}
objPtr = Tk_GetOptionValue(interp, (char *) &eiPtr->body.ei,
@@ -182,16 +180,16 @@ TkTextImageCmd(textPtr, interp, objc, objv)
if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
return TCL_ERROR;
}
- eiPtr = TkTextIndexToSeg(&index, (int *) NULL);
+ eiPtr = TkTextIndexToSeg(&index, NULL);
if (eiPtr->typePtr != &tkTextEmbImageType) {
Tcl_AppendResult(interp, "no embedded image at index \"",
- Tcl_GetString(objv[3]), "\"", (char *) NULL);
+ Tcl_GetString(objv[3]), "\"", NULL);
return TCL_ERROR;
}
if (objc <= 5) {
- Tcl_Obj* objPtr = Tk_GetOptionInfo(interp,
+ Tcl_Obj *objPtr = Tk_GetOptionInfo(interp,
(char *) &eiPtr->body.ei, eiPtr->body.ei.optionTable,
- (objc == 5) ? objv[4] : (Tcl_Obj *) NULL, textPtr->tkwin);
+ (objc == 5) ? objv[4] : NULL, textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
} else {
@@ -316,19 +314,18 @@ TkTextImageCmd(textPtr, interp, objc, objv)
*/
static int
-EmbImageConfigure(textPtr, eiPtr, objc, objv)
- TkText *textPtr; /* Information about text widget that contains
+EmbImageConfigure(
+ TkText *textPtr, /* Information about text widget that contains
* embedded image. */
- TkTextSegment *eiPtr; /* Embedded image to be configured. */
- int objc; /* Number of strings in objv. */
- Tcl_Obj *CONST objv[]; /* Array of strings describing configuration
+ TkTextSegment *eiPtr, /* Embedded image to be configured. */
+ int objc, /* Number of strings in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of strings describing configuration
* options. */
{
Tk_Image image;
Tcl_DString newName;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
- int new;
char *name;
int count = 0; /* The counter for picking a unique name */
int conflict = 0; /* True if we have a name conflict */
@@ -376,9 +373,9 @@ EmbImageConfigure(textPtr, eiPtr, objc, objv)
name = eiPtr->body.ei.imageString;
}
if (name == NULL) {
- Tcl_AppendResult(textPtr->interp,"Either a \"-name\" ",
+ Tcl_AppendResult(textPtr->interp, "Either a \"-name\" ",
"or a \"-image\" argument must be provided ",
- "to the \"image create\" subcommand.", (char *) NULL);
+ "to the \"image create\" subcommand.", NULL);
return TCL_ERROR;
}
len = strlen(name);
@@ -388,10 +385,11 @@ EmbImageConfigure(textPtr, eiPtr, objc, objv)
Tcl_GetHashKey(&textPtr->sharedTextPtr->imageTable, hPtr);
if (strncmp(name, haveName, len) == 0) {
- new = 0;
- sscanf(haveName+len, "#%d", &new);
- if (new > count) {
- count = new;
+ int newVal = 0;
+
+ sscanf(haveName+len, "#%d", &newVal);
+ if (newVal > count) {
+ count = newVal;
}
if (len == strlen(haveName)) {
conflict = 1;
@@ -400,7 +398,7 @@ EmbImageConfigure(textPtr, eiPtr, objc, objv)
}
Tcl_DStringInit(&newName);
- Tcl_DStringAppend(&newName,name, -1);
+ Tcl_DStringAppend(&newName, name, -1);
if (conflict) {
char buf[4 + TCL_INTEGER_SPACE];
@@ -409,11 +407,16 @@ EmbImageConfigure(textPtr, eiPtr, objc, objv)
Tcl_DStringAppend(&newName, buf, -1);
}
name = Tcl_DStringValue(&newName);
- hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->imageTable, name,&new);
+ {
+ int dummy;
+
+ hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->imageTable, name,
+ &dummy);
+ }
Tcl_SetHashValue(hPtr, eiPtr);
- Tcl_AppendResult(textPtr->interp, name , (char *) NULL);
+ Tcl_AppendResult(textPtr->interp, name, NULL);
eiPtr->body.ei.name = ckalloc((unsigned) Tcl_DStringLength(&newName)+1);
- strcpy(eiPtr->body.ei.name,name);
+ strcpy(eiPtr->body.ei.name, name);
Tcl_DStringFree(&newName);
return TCL_OK;
@@ -439,10 +442,10 @@ EmbImageConfigure(textPtr, eiPtr, objc, objv)
/* ARGSUSED */
static int
-EmbImageDeleteProc(eiPtr, linePtr, treeGone)
- TkTextSegment *eiPtr; /* Segment being deleted. */
- TkTextLine *linePtr; /* Line containing segment. */
- int treeGone; /* Non-zero means the entire tree is being
+EmbImageDeleteProc(
+ TkTextSegment *eiPtr, /* Segment being deleted. */
+ TkTextLine *linePtr, /* Line containing segment. */
+ int treeGone) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
@@ -492,9 +495,9 @@ EmbImageDeleteProc(eiPtr, linePtr, treeGone)
*/
static TkTextSegment *
-EmbImageCleanupProc(eiPtr, linePtr)
- TkTextSegment *eiPtr; /* Mark segment that's being moved. */
- TkTextLine *linePtr; /* Line that now contains segment. */
+EmbImageCleanupProc(
+ TkTextSegment *eiPtr, /* Mark segment that's being moved. */
+ TkTextLine *linePtr) /* Line that now contains segment. */
{
eiPtr->body.ei.linePtr = linePtr;
return eiPtr;
@@ -519,23 +522,22 @@ EmbImageCleanupProc(eiPtr, linePtr)
/*ARGSUSED*/
static int
-EmbImageLayoutProc(textPtr, indexPtr, eiPtr, offset, maxX, maxChars,
- noCharsYet, wrapMode, chunkPtr)
- TkText *textPtr; /* Text widget being layed out. */
- TkTextIndex *indexPtr; /* Identifies first character in chunk. */
- TkTextSegment *eiPtr; /* Segment corresponding to indexPtr. */
- int offset; /* Offset within segPtr corresponding to
+EmbImageLayoutProc(
+ TkText *textPtr, /* Text widget being layed out. */
+ TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TkTextSegment *eiPtr, /* Segment corresponding to indexPtr. */
+ int offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
- int maxX; /* Chunk must not occupy pixels at this
+ int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars; /* Chunk must not include more than this many
+ int maxChars, /* Chunk must not include more than this many
* characters. */
- int noCharsYet; /* Non-zero means no characters have been
+ int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode; /* Wrap mode to use for line:
+ TkWrapMode wrapMode, /* Wrap mode to use for line:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr;
+ register TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
@@ -568,8 +570,8 @@ EmbImageLayoutProc(textPtr, indexPtr, eiPtr, offset, maxX, maxChars,
*/
chunkPtr->displayProc = EmbImageDisplayProc;
- chunkPtr->undisplayProc = (Tk_ChunkUndisplayProc *) NULL;
- chunkPtr->measureProc = (Tk_ChunkMeasureProc *) NULL;
+ chunkPtr->undisplayProc = NULL;
+ chunkPtr->measureProc = NULL;
chunkPtr->bboxProc = EmbImageBboxProc;
chunkPtr->numBytes = 1;
if (eiPtr->body.ei.align == ALIGN_BASELINE) {
@@ -608,9 +610,9 @@ EmbImageLayoutProc(textPtr, indexPtr, eiPtr, offset, maxX, maxChars,
*/
static void
-EmbImageCheckProc(eiPtr, linePtr)
- TkTextSegment *eiPtr; /* Segment to check. */
- TkTextLine *linePtr; /* Line containing segment. */
+EmbImageCheckProc(
+ TkTextSegment *eiPtr, /* Segment to check. */
+ TkTextLine *linePtr) /* Line containing segment. */
{
if (eiPtr->nextPtr == NULL) {
Tcl_Panic("EmbImageCheckProc: embedded image is last segment in line");
@@ -640,21 +642,20 @@ EmbImageCheckProc(eiPtr, linePtr)
*/
static void
-EmbImageDisplayProc(textPtr, chunkPtr, x, y, lineHeight, baseline, display,
- dst, screenY)
- TkText *textPtr;
- TkTextDispChunk *chunkPtr; /* Chunk that is to be drawn. */
- int x; /* X-position in dst at which to draw this
+EmbImageDisplayProc(
+ TkText *textPtr,
+ TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ int x, /* X-position in dst at which to draw this
* chunk (differs from the x-position in the
* chunk because of scrolling). */
- int y; /* Top of rectangular bounding box for line:
+ int y, /* Top of rectangular bounding box for line:
* tells where to draw this chunk in dst
* (x-position is in the chunk itself). */
- int lineHeight; /* Total height of line. */
- int baseline; /* Offset of baseline from y. */
- Display *display; /* Display to use for drawing. */
- Drawable dst; /* Pixmap or window in which to draw */
- int screenY; /* Y-coordinate in text window that
+ int lineHeight, /* Total height of line. */
+ int baseline, /* Offset of baseline from y. */
+ Display *display, /* Display to use for drawing. */
+ Drawable dst, /* Pixmap or window in which to draw */
+ int screenY) /* Y-coordinate in text window that
* corresponds to y. */
{
TkTextSegment *eiPtr = (TkTextSegment *) chunkPtr->clientData;
@@ -704,22 +705,21 @@ EmbImageDisplayProc(textPtr, chunkPtr, x, y, lineHeight, baseline, display,
*/
static void
-EmbImageBboxProc(textPtr, chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
- widthPtr, heightPtr)
- TkText *textPtr;
- TkTextDispChunk *chunkPtr; /* Chunk containing desired char. */
- int index; /* Index of desired character within the
+EmbImageBboxProc(
+ TkText *textPtr,
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
+ int index, /* Index of desired character within the
* chunk. */
- int y; /* Topmost pixel in area allocated for this
+ int y, /* Topmost pixel in area allocated for this
* line. */
- int lineHeight; /* Total height of line. */
- int baseline; /* Location of line's baseline, in pixels
+ int lineHeight, /* Total height of line. */
+ int baseline, /* Location of line's baseline, in pixels
* measured down from y. */
- int *xPtr, *yPtr; /* Gets filled in with coords of character's
+ int *xPtr, int *yPtr, /* Gets filled in with coords of character's
* upper-left pixel. */
- int *widthPtr; /* Gets filled in with width of image, in
+ int *widthPtr, /* Gets filled in with width of image, in
* pixels. */
- int *heightPtr; /* Gets filled in with height of image, in
+ int *heightPtr) /* Gets filled in with height of image, in
* pixels. */
{
TkTextSegment *eiPtr = (TkTextSegment *) chunkPtr->clientData;
@@ -771,10 +771,10 @@ EmbImageBboxProc(textPtr, chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
*/
int
-TkTextImageIndex(textPtr, name, indexPtr)
- TkText *textPtr; /* Text widget containing image. */
- CONST char *name; /* Name of image. */
- TkTextIndex *indexPtr; /* Index information gets stored here. */
+TkTextImageIndex(
+ TkText *textPtr, /* Text widget containing image. */
+ CONST char *name, /* Name of image. */
+ TkTextIndex *indexPtr) /* Index information gets stored here. */
{
Tcl_HashEntry *hPtr;
TkTextSegment *eiPtr;
@@ -808,13 +808,13 @@ TkTextImageIndex(textPtr, name, indexPtr)
*/
static void
-EmbImageProc(clientData, x, y, width, height, imgWidth, imgHeight)
- ClientData clientData; /* Pointer to widget record. */
- int x, y; /* Upper left pixel (within image) that must
+EmbImageProc(
+ ClientData clientData, /* Pointer to widget record. */
+ int x, int y, /* Upper left pixel (within image) that must
* be redisplayed. */
- int width, height; /* Dimensions of area to redisplay (may be
+ int width, int height, /* Dimensions of area to redisplay (may be
* <= 0). */
- int imgWidth, imgHeight; /* New dimensions of image. */
+ int imgWidth, int imgHeight)/* New dimensions of image. */
{
TkTextSegment *eiPtr = (TkTextSegment *) clientData;
@@ -834,3 +834,11 @@ EmbImageProc(clientData, x, y, width, height, imgWidth, imgHeight)
TkTextInvalidateLineMetrics(eiPtr->body.ei.sharedTextPtr, NULL,
index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index 4354ede..50aa4af 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -1,16 +1,16 @@
-/*
+/*
* tkTextMark.c --
*
- * This file contains the procedure that implement marks for
- * text widgets.
+ * This file contains the functions that implement marks for text
+ * widgets.
*
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextMark.c,v 1.15 2005/10/10 10:36:35 vincentdarley Exp $
+ * RCS: @(#) $Id: tkTextMark.c,v 1.16 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkInt.h"
@@ -25,26 +25,25 @@
+ sizeof(TkTextMark)))
/*
- * Forward references for procedures defined in this file:
+ * Forward references for functions defined in this file:
*/
-static void InsertUndisplayProc _ANSI_ARGS_((TkText *textPtr,
- TkTextDispChunk *chunkPtr));
-static int MarkDeleteProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr, int treeGone));
-static TkTextSegment * MarkCleanupProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static void MarkCheckProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static int MarkLayoutProc _ANSI_ARGS_((TkText *textPtr,
- TkTextIndex *indexPtr, TkTextSegment *segPtr,
- int offset, int maxX, int maxChars,
- int noCharsYet, TkWrapMode wrapMode,
- TkTextDispChunk *chunkPtr));
-static int MarkFindNext _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, CONST char *markName));
-static int MarkFindPrev _ANSI_ARGS_((Tcl_Interp *interp,
- TkText *textPtr, CONST char *markName));
+static void InsertUndisplayProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr);
+static int MarkDeleteProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr, int treeGone);
+static TkTextSegment * MarkCleanupProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static void MarkCheckProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static int MarkLayoutProc(TkText *textPtr, TkTextIndex *indexPtr,
+ TkTextSegment *segPtr, int offset, int maxX,
+ int maxChars, int noCharsYet, TkWrapMode wrapMode,
+ TkTextDispChunk *chunkPtr);
+static int MarkFindNext(Tcl_Interp *interp,
+ TkText *textPtr, CONST char *markName);
+static int MarkFindPrev(Tcl_Interp *interp,
+ TkText *textPtr, CONST char *markName);
/*
@@ -55,25 +54,25 @@ static int MarkFindPrev _ANSI_ARGS_((Tcl_Interp *interp,
*/
Tk_SegType tkTextRightMarkType = {
- "mark", /* name */
- 0, /* leftGravity */
- (Tk_SegSplitProc *) NULL, /* splitProc */
- MarkDeleteProc, /* deleteProc */
- MarkCleanupProc, /* cleanupProc */
- (Tk_SegLineChangeProc *) NULL, /* lineChangeProc */
- MarkLayoutProc, /* layoutProc */
- MarkCheckProc /* checkProc */
+ "mark", /* name */
+ 0, /* leftGravity */
+ NULL, /* splitProc */
+ MarkDeleteProc, /* deleteProc */
+ MarkCleanupProc, /* cleanupProc */
+ NULL, /* lineChangeProc */
+ MarkLayoutProc, /* layoutProc */
+ MarkCheckProc /* checkProc */
};
Tk_SegType tkTextLeftMarkType = {
- "mark", /* name */
- 1, /* leftGravity */
- (Tk_SegSplitProc *) NULL, /* splitProc */
- MarkDeleteProc, /* deleteProc */
- MarkCleanupProc, /* cleanupProc */
- (Tk_SegLineChangeProc *) NULL, /* lineChangeProc */
- MarkLayoutProc, /* layoutProc */
- MarkCheckProc /* checkProc */
+ "mark", /* name */
+ 1, /* leftGravity */
+ NULL, /* splitProc */
+ MarkDeleteProc, /* deleteProc */
+ MarkCleanupProc, /* cleanupProc */
+ NULL, /* lineChangeProc */
+ MarkLayoutProc, /* layoutProc */
+ MarkCheckProc /* checkProc */
};
/*
@@ -81,9 +80,9 @@ Tk_SegType tkTextLeftMarkType = {
*
* TkTextMarkCmd --
*
- * This procedure is invoked to process the "mark" options of
- * the widget command for text widgets. See the user documentation
- * for details on what it does.
+ * This function is invoked to process the "mark" options of the widget
+ * command for text widgets. See the user documentation for details on
+ * what it does.
*
* Results:
* A standard Tcl result.
@@ -95,11 +94,11 @@ Tk_SegType tkTextLeftMarkType = {
*/
int
-TkTextMarkCmd(textPtr, interp, objc, objv)
- register TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. Someone else has already
+TkTextMarkCmd(
+ register TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "mark". */
{
@@ -110,13 +109,13 @@ TkTextMarkCmd(textPtr, interp, objc, objv)
Tk_SegType *newTypePtr;
int optionIndex;
-
+
static CONST char *markOptionStrings[] = {
- "gravity", "names", "next", "previous", "set",
- "unset", (char *) NULL
+ "gravity", "names", "next", "previous", "set",
+ "unset", NULL
};
enum markOptions {
- MARK_GRAVITY, MARK_NAMES, MARK_NEXT, MARK_PREVIOUS,
+ MARK_GRAVITY, MARK_NAMES, MARK_NEXT, MARK_PREVIOUS,
MARK_SET, MARK_UNSET
};
@@ -124,120 +123,120 @@ TkTextMarkCmd(textPtr, interp, objc, objv)
Tcl_WrongNumArgs(interp, 2, objv, "option ?arg arg ...?");
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[2], markOptionStrings,
- "mark option", 0, &optionIndex) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[2], markOptionStrings, "mark option",
+ 0, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
switch ((enum markOptions)optionIndex) {
- case MARK_GRAVITY: {
- char c;
- int length;
- char *str;
-
- if (objc < 4 || objc > 5) {
- Tcl_WrongNumArgs(interp, 3, objv, "markName ?gravity?");
+ case MARK_GRAVITY: {
+ char c;
+ int length;
+ char *str;
+
+ if (objc < 4 || objc > 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "markName ?gravity?");
+ return TCL_ERROR;
+ }
+ str = Tcl_GetStringFromObj(objv[3],&length);
+ if (length == 6 && !strcmp(str, "insert")) {
+ markPtr = textPtr->insertMarkPtr;
+ } else if (length == 7 && !strcmp(str, "current")) {
+ markPtr = textPtr->currentMarkPtr;
+ } else {
+ hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, str);
+ if (hPtr == NULL) {
+ Tcl_AppendResult(interp, "there is no mark named \"",
+ Tcl_GetString(objv[3]), "\"", NULL);
return TCL_ERROR;
}
- str = Tcl_GetStringFromObj(objv[3],&length);
- if (length == 6 && !strcmp(str, "insert")) {
- markPtr = textPtr->insertMarkPtr;
- } else if (length == 7 && !strcmp(str, "current")) {
- markPtr = textPtr->currentMarkPtr;
- } else {
- hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, str);
- if (hPtr == NULL) {
- Tcl_AppendResult(interp, "there is no mark named \"",
- Tcl_GetString(objv[3]), "\"", (char *) NULL);
- return TCL_ERROR;
- }
- markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
- }
- if (objc == 4) {
- if (markPtr->typePtr == &tkTextRightMarkType) {
- Tcl_SetResult(interp, "right", TCL_STATIC);
- } else {
- Tcl_SetResult(interp, "left", TCL_STATIC);
- }
- return TCL_OK;
- }
- str = Tcl_GetStringFromObj(objv[4],&length);
- c = str[0];
- if ((c == 'l') && (strncmp(str, "left", (unsigned)length) == 0)) {
- newTypePtr = &tkTextLeftMarkType;
- } else if ((c == 'r') &&
- (strncmp(str, "right", (unsigned)length) == 0)) {
- newTypePtr = &tkTextRightMarkType;
+ markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
+ }
+ if (objc == 4) {
+ if (markPtr->typePtr == &tkTextRightMarkType) {
+ Tcl_SetResult(interp, "right", TCL_STATIC);
} else {
- Tcl_AppendResult(interp, "bad mark gravity \"", str,
- "\": must be left or right", (char *) NULL);
- return TCL_ERROR;
+ Tcl_SetResult(interp, "left", TCL_STATIC);
}
- TkTextMarkSegToIndex(textPtr, markPtr, &index);
- TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
- markPtr->typePtr = newTypePtr;
- TkBTreeLinkSegment(markPtr, &index);
- break;
+ return TCL_OK;
}
- case MARK_NAMES: {
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, NULL);
- return TCL_ERROR;
- }
- Tcl_AppendElement(interp, "insert");
- Tcl_AppendElement(interp, "current");
- for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->markTable, &search);
- hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- Tcl_AppendElement(interp,
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr));
- }
- break;
+ str = Tcl_GetStringFromObj(objv[4],&length);
+ c = str[0];
+ if ((c == 'l') && (strncmp(str, "left", (unsigned)length) == 0)) {
+ newTypePtr = &tkTextLeftMarkType;
+ } else if ((c == 'r') &&
+ (strncmp(str, "right", (unsigned)length) == 0)) {
+ newTypePtr = &tkTextRightMarkType;
+ } else {
+ Tcl_AppendResult(interp, "bad mark gravity \"", str,
+ "\": must be left or right", NULL);
+ return TCL_ERROR;
}
- case MARK_NEXT: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index");
- return TCL_ERROR;
- }
- return MarkFindNext(interp, textPtr, Tcl_GetString(objv[3]));
+ TkTextMarkSegToIndex(textPtr, markPtr, &index);
+ TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
+ markPtr->typePtr = newTypePtr;
+ TkBTreeLinkSegment(markPtr, &index);
+ break;
+ }
+ case MARK_NAMES:
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ return TCL_ERROR;
}
- case MARK_PREVIOUS: {
- if (objc != 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index");
- return TCL_ERROR;
- }
- return MarkFindPrev(interp, textPtr, Tcl_GetString(objv[3]));
+ Tcl_AppendElement(interp, "insert");
+ Tcl_AppendElement(interp, "current");
+ for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->markTable,
+ &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ Tcl_AppendElement(interp,
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr));
}
- case MARK_SET: {
- if (objc != 5) {
- Tcl_WrongNumArgs(interp, 3, objv, "markName index");
- return TCL_ERROR;
- }
- if (TkTextGetObjIndex(interp, textPtr, objv[4], &index) != TCL_OK) {
- return TCL_ERROR;
- }
- TkTextSetMark(textPtr, Tcl_GetString(objv[3]), &index);
- return TCL_OK;
+ break;
+ case MARK_NEXT:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
+ return TCL_ERROR;
+ }
+ return MarkFindNext(interp, textPtr, Tcl_GetString(objv[3]));
+ case MARK_PREVIOUS:
+ if (objc != 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index");
+ return TCL_ERROR;
+ }
+ return MarkFindPrev(interp, textPtr, Tcl_GetString(objv[3]));
+ case MARK_SET:
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "markName index");
+ return TCL_ERROR;
}
- case MARK_UNSET: {
- int i;
- for (i = 3; i < objc; i++) {
- hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable,
- Tcl_GetString(objv[i]));
- if (hPtr != NULL) {
- markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
- /* Special case not needed with peer widgets */
- if ((markPtr == textPtr->insertMarkPtr)
- || (markPtr == textPtr->currentMarkPtr)) {
- continue;
- }
- TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
- Tcl_DeleteHashEntry(hPtr);
- ckfree((char *) markPtr);
+ if (TkTextGetObjIndex(interp, textPtr, objv[4], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ TkTextSetMark(textPtr, Tcl_GetString(objv[3]), &index);
+ return TCL_OK;
+ case MARK_UNSET: {
+ int i;
+
+ for (i = 3; i < objc; i++) {
+ hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable,
+ Tcl_GetString(objv[i]));
+ if (hPtr != NULL) {
+ markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
+
+ /*
+ * Special case not needed with peer widgets.
+ */
+
+ if ((markPtr == textPtr->insertMarkPtr)
+ || (markPtr == textPtr->currentMarkPtr)) {
+ continue;
}
+ TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr);
+ Tcl_DeleteHashEntry(hPtr);
+ ckfree((char *) markPtr);
}
- break;
}
-
+ break;
+ }
}
return TCL_OK;
}
@@ -247,8 +246,8 @@ TkTextMarkCmd(textPtr, interp, objc, objv)
*
* TkTextSetMark --
*
- * Set a mark to a particular position, creating a new mark if
- * one doesn't already exist.
+ * Set a mark to a particular position, creating a new mark if one
+ * doesn't already exist.
*
* Results:
* The return value is a pointer to the mark that was just set.
@@ -260,50 +259,54 @@ TkTextMarkCmd(textPtr, interp, objc, objv)
*/
TkTextSegment *
-TkTextSetMark(textPtr, name, indexPtr)
- TkText *textPtr; /* Text widget in which to create mark. */
- CONST char *name; /* Name of mark to set. */
- TkTextIndex *indexPtr; /* Where to set mark. */
+TkTextSetMark(
+ TkText *textPtr, /* Text widget in which to create mark. */
+ CONST char *name, /* Name of mark to set. */
+ TkTextIndex *indexPtr) /* Where to set mark. */
{
Tcl_HashEntry *hPtr = NULL;
TkTextSegment *markPtr;
TkTextIndex insertIndex;
- int new;
+ int isNew;
int widgetSpecific;
-
+
if (!strcmp(name, "insert")) {
widgetSpecific = 1;
markPtr = textPtr->insertMarkPtr;
- new = (markPtr == NULL ? 1 : 0);
+ isNew = (markPtr == NULL ? 1 : 0);
} else if (!strcmp(name, "current")) {
widgetSpecific = 2;
markPtr = textPtr->currentMarkPtr;
- new = (markPtr == NULL ? 1 : 0);
+ isNew = (markPtr == NULL ? 1 : 0);
} else {
widgetSpecific = 0;
- hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->markTable, name, &new);
+ hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->markTable, name,
+ &isNew);
markPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
}
- if (!new) {
+ if (!isNew) {
/*
- * If this is the insertion point that's being moved, be sure
- * to force a display update at the old position. Also, don't
- * let the insertion cursor be after the final newline of the
- * file.
+ * If this is the insertion point that's being moved, be sure to force
+ * a display update at the old position. Also, don't let the insertion
+ * cursor be after the final newline of the file.
*/
if (markPtr == textPtr->insertMarkPtr) {
TkTextIndex index, index2;
+
TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
TkTextIndexForwChars(NULL,&index, 1, &index2, COUNT_INDICES);
- /*
- * While we wish to redisplay, no heights have changed, so
- * no need to call TkTextInvalidateLineMetrics.
+
+ /*
+ * While we wish to redisplay, no heights have changed, so no need
+ * to call TkTextInvalidateLineMetrics.
*/
+
TkTextChanged(NULL, textPtr, &index, &index2);
- if (TkBTreeLinesTo(textPtr, indexPtr->linePtr)
- == TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr)) {
- TkTextIndexBackChars(NULL,indexPtr, 1, &insertIndex, COUNT_INDICES);
+ if (TkBTreeLinesTo(textPtr, indexPtr->linePtr) ==
+ TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr)) {
+ TkTextIndexBackChars(NULL,indexPtr, 1, &insertIndex,
+ COUNT_INDICES);
indexPtr = &insertIndex;
}
}
@@ -334,10 +337,12 @@ TkTextSetMark(textPtr, name, indexPtr)
TkTextIndex index2;
TkTextIndexForwChars(NULL,indexPtr, 1, &index2, COUNT_INDICES);
- /*
- * While we wish to redisplay, no heights have changed, so
- * no need to call TkTextInvalidateLineMetrics
+
+ /*
+ * While we wish to redisplay, no heights have changed, so no need to
+ * call TkTextInvalidateLineMetrics
*/
+
TkTextChanged(NULL, textPtr, indexPtr, &index2);
}
return markPtr;
@@ -348,9 +353,9 @@ TkTextSetMark(textPtr, name, indexPtr)
*
* TkTextMarkSegToIndex --
*
- * Given a segment that is a mark, create an index that
- * refers to the next text character (or other text segment
- * with non-zero size) after the mark.
+ * Given a segment that is a mark, create an index that refers to the
+ * next text character (or other text segment with non-zero size) after
+ * the mark.
*
* Results:
* *IndexPtr is filled in with index information.
@@ -362,10 +367,10 @@ TkTextSetMark(textPtr, name, indexPtr)
*/
void
-TkTextMarkSegToIndex(textPtr, markPtr, indexPtr)
- TkText *textPtr; /* Text widget containing mark. */
- TkTextSegment *markPtr; /* Mark segment. */
- TkTextIndex *indexPtr; /* Index information gets stored here. */
+TkTextMarkSegToIndex(
+ TkText *textPtr, /* Text widget containing mark. */
+ TkTextSegment *markPtr, /* Mark segment. */
+ TkTextIndex *indexPtr) /* Index information gets stored here. */
{
TkTextSegment *segPtr;
@@ -383,15 +388,14 @@ TkTextMarkSegToIndex(textPtr, markPtr, indexPtr)
*
* TkTextMarkNameToIndex --
*
- * Given the name of a mark, return an index corresponding
- * to the mark name.
+ * Given the name of a mark, return an index corresponding to the mark
+ * name.
*
* Results:
- * The return value is TCL_OK if "name" exists as a mark in
- * the text widget. In this case *indexPtr is filled in with
- * the next segment whose after the mark whose size is
- * non-zero. TCL_ERROR is returned if the mark doesn't exist
- * in the text widget.
+ * The return value is TCL_OK if "name" exists as a mark in the text
+ * widget. In this case *indexPtr is filled in with the next segment
+ * whose after the mark whose size is non-zero. TCL_ERROR is returned if
+ * the mark doesn't exist in the text widget.
*
* Side effects:
* None.
@@ -400,17 +404,17 @@ TkTextMarkSegToIndex(textPtr, markPtr, indexPtr)
*/
int
-TkTextMarkNameToIndex(textPtr, name, indexPtr)
- TkText *textPtr; /* Text widget containing mark. */
- CONST char *name; /* Name of mark. */
- TkTextIndex *indexPtr; /* Index information gets stored here. */
+TkTextMarkNameToIndex(
+ TkText *textPtr, /* Text widget containing mark. */
+ CONST char *name, /* Name of mark. */
+ TkTextIndex *indexPtr) /* Index information gets stored here. */
{
TkTextSegment *segPtr;
if (textPtr == NULL) {
return TCL_ERROR;
}
-
+
if (!strcmp(name, "insert")) {
segPtr = textPtr->insertMarkPtr;
} else if (!strcmp(name, "current")) {
@@ -432,27 +436,27 @@ TkTextMarkNameToIndex(textPtr, name, indexPtr)
*
* MarkDeleteProc --
*
- * This procedure is invoked by the text B-tree code whenever
- * a mark lies in a range of characters being deleted.
+ * This function is invoked by the text B-tree code whenever a mark lies
+ * in a range of characters being deleted.
*
* Results:
* Returns 1 to indicate that deletion has been rejected.
*
* Side effects:
- * None (even if the whole tree is being deleted we don't
- * free up the mark; it will be done elsewhere).
+ * None (even if the whole tree is being deleted we don't free up the
+ * mark; it will be done elsewhere).
*
*--------------------------------------------------------------
*/
/* ARGSUSED */
static int
-MarkDeleteProc(segPtr, linePtr, treeGone)
- TkTextSegment *segPtr; /* Segment being deleted. */
- TkTextLine *linePtr; /* Line containing segment. */
- int treeGone; /* Non-zero means the entire tree is
- * being deleted, so everything must
- * get cleaned up. */
+MarkDeleteProc(
+ TkTextSegment *segPtr, /* Segment being deleted. */
+ TkTextLine *linePtr, /* Line containing segment. */
+ int treeGone) /* Non-zero means the entire tree is being
+ * deleted, so everything must get cleaned
+ * up. */
{
return 1;
}
@@ -462,8 +466,8 @@ MarkDeleteProc(segPtr, linePtr, treeGone)
*
* MarkCleanupProc --
*
- * This procedure is invoked by the B-tree code whenever a
- * mark segment is moved from one line to another.
+ * This function is invoked by the B-tree code whenever a mark segment is
+ * moved from one line to another.
*
* Results:
* None.
@@ -475,9 +479,9 @@ MarkDeleteProc(segPtr, linePtr, treeGone)
*/
static TkTextSegment *
-MarkCleanupProc(markPtr, linePtr)
- TkTextSegment *markPtr; /* Mark segment that's being moved. */
- TkTextLine *linePtr; /* Line that now contains segment. */
+MarkCleanupProc(
+ TkTextSegment *markPtr, /* Mark segment that's being moved. */
+ TkTextLine *linePtr) /* Line that now contains segment. */
{
markPtr->body.mark.linePtr = linePtr;
return markPtr;
@@ -488,13 +492,13 @@ MarkCleanupProc(markPtr, linePtr)
*
* MarkLayoutProc --
*
- * This procedure is the "layoutProc" for mark segments.
+ * This function is the "layoutProc" for mark segments.
*
* Results:
- * If the mark isn't the insertion cursor then the return
- * value is -1 to indicate that this segment shouldn't be
- * displayed. If the mark is the insertion character then
- * 1 is returned and the chunkPtr structure is filled in.
+ * If the mark isn't the insertion cursor then the return value is -1 to
+ * indicate that this segment shouldn't be displayed. If the mark is the
+ * insertion character then 1 is returned and the chunkPtr structure is
+ * filled in.
*
* Side effects:
* None, except for filling in chunkPtr.
@@ -504,24 +508,23 @@ MarkCleanupProc(markPtr, linePtr)
/*ARGSUSED*/
static int
-MarkLayoutProc(textPtr, indexPtr, segPtr, offset, maxX, maxChars,
- noCharsYet, wrapMode, chunkPtr)
- TkText *textPtr; /* Text widget being layed out. */
- TkTextIndex *indexPtr; /* Identifies first character in chunk. */
- TkTextSegment *segPtr; /* Segment corresponding to indexPtr. */
- int offset; /* Offset within segPtr corresponding to
+MarkLayoutProc(
+ TkText *textPtr, /* Text widget being layed out. */
+ TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TkTextSegment *segPtr, /* Segment corresponding to indexPtr. */
+ int offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
- int maxX; /* Chunk must not occupy pixels at this
+ int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars; /* Chunk must not include more than this
- * many characters. */
- int noCharsYet; /* Non-zero means no characters have been
+ int maxChars, /* Chunk must not include more than this many
+ * characters. */
+ int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode; /* Not used. */
- register TkTextDispChunk *chunkPtr;
- /* Structure to fill in with information
- * about this chunk. The x field has already
- * been set by the caller. */
+ TkWrapMode wrapMode, /* Not used. */
+ register TkTextDispChunk *chunkPtr)
+ /* Structure to fill in with information about
+ * this chunk. The x field has already been
+ * set by the caller. */
{
if (segPtr != textPtr->insertMarkPtr) {
return -1;
@@ -529,8 +532,8 @@ MarkLayoutProc(textPtr, indexPtr, segPtr, offset, maxX, maxChars,
chunkPtr->displayProc = TkTextInsertDisplayProc;
chunkPtr->undisplayProc = InsertUndisplayProc;
- chunkPtr->measureProc = (Tk_ChunkMeasureProc *) NULL;
- chunkPtr->bboxProc = (Tk_ChunkBboxProc *) NULL;
+ chunkPtr->measureProc = NULL;
+ chunkPtr->bboxProc = NULL;
chunkPtr->numBytes = 0;
chunkPtr->minAscent = 0;
chunkPtr->minDescent = 0;
@@ -538,9 +541,8 @@ MarkLayoutProc(textPtr, indexPtr, segPtr, offset, maxX, maxChars,
chunkPtr->width = 0;
/*
- * Note: can't break a line after the insertion cursor: this
- * prevents the insertion cursor from being stranded at the end
- * of a line.
+ * Note: can't break a line after the insertion cursor: this prevents the
+ * insertion cursor from being stranded at the end of a line.
*/
chunkPtr->breakIndex = -1;
@@ -553,8 +555,7 @@ MarkLayoutProc(textPtr, indexPtr, segPtr, offset, maxX, maxChars,
*
* TkTextInsertDisplayProc --
*
- * This procedure is called to display the insertion
- * cursor.
+ * This function is called to display the insertion cursor.
*
* Results:
* None.
@@ -567,32 +568,31 @@ MarkLayoutProc(textPtr, indexPtr, segPtr, offset, maxX, maxChars,
/* ARGSUSED */
void
-TkTextInsertDisplayProc(textPtr, chunkPtr, x, y, height, baseline, display,
- dst, screenY)
- TkText *textPtr; /* The current text widget. */
- TkTextDispChunk *chunkPtr; /* Chunk that is to be drawn. */
- int x; /* X-position in dst at which to
- * draw this chunk (may differ from
- * the x-position in the chunk because
- * of scrolling). */
- int y; /* Y-position at which to draw this
- * chunk in dst (x-position is in
- * the chunk itself). */
- int height; /* Total height of line. */
- int baseline; /* Offset of baseline from y. */
- Display *display; /* Display to use for drawing. */
- Drawable dst; /* Pixmap or window in which to draw
- * chunk. */
- int screenY; /* Y-coordinate in text window that
- * corresponds to y. */
+TkTextInsertDisplayProc(
+ TkText *textPtr, /* The current text widget. */
+ TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ int x, /* X-position in dst at which to draw this
+ * chunk (may differ from the x-position in
+ * the chunk because of scrolling). */
+ int y, /* Y-position at which to draw this chunk in
+ * dst (x-position is in the chunk itself). */
+ int height, /* Total height of line. */
+ int baseline, /* Offset of baseline from y. */
+ Display *display, /* Display to use for drawing. */
+ Drawable dst, /* Pixmap or window in which to draw chunk. */
+ int screenY) /* Y-coordinate in text window that
+ * corresponds to y. */
{
- /* We have no need for the clientData */
+ /*
+ * We have no need for the clientData.
+ */
+
/* TkText *textPtr = (TkText *) chunkPtr->clientData; */
TkTextIndex index;
int halfWidth = textPtr->insertWidth/2;
int rightSideWidth;
int ix = 0, iy = 0, iw = 0, ih = 0, charWidth = 0;
-
+
if(textPtr->insertCursorType) {
TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
TkTextIndexBbox(textPtr, &index, &ix, &iy, &iw, &ih, &charWidth);
@@ -600,11 +600,11 @@ TkTextInsertDisplayProc(textPtr, chunkPtr, x, y, height, baseline, display,
} else {
rightSideWidth = halfWidth;
}
-
+
if ((x + rightSideWidth) < 0) {
/*
- * The insertion cursor is off-screen.
- * Indicate caret at 0,0 and return.
+ * The insertion cursor is off-screen. Indicate caret at 0,0 and
+ * return.
*/
Tk_SetCaretPos(textPtr->tkwin, 0, 0, height);
@@ -614,11 +614,11 @@ TkTextInsertDisplayProc(textPtr, chunkPtr, x, y, height, baseline, display,
Tk_SetCaretPos(textPtr->tkwin, x - halfWidth, screenY, height);
/*
- * As a special hack to keep the cursor visible on mono displays
- * (or anywhere else that the selection and insertion cursors
- * have the same color) write the default background in the cursor
- * area (instead of nothing) when the cursor isn't on. Otherwise
- * the selection might hide the cursor.
+ * As a special hack to keep the cursor visible on mono displays (or
+ * anywhere else that the selection and insertion cursors have the same
+ * color) write the default background in the cursor area (instead of
+ * nothing) when the cursor isn't on. Otherwise the selection might hide
+ * the cursor.
*/
if (textPtr->flags & INSERT_ON) {
@@ -637,9 +637,8 @@ TkTextInsertDisplayProc(textPtr, chunkPtr, x, y, height, baseline, display,
*
* InsertUndisplayProc --
*
- * This procedure is called when the insertion cursor is no
- * longer at a visible point on the display. It does nothing
- * right now.
+ * This function is called when the insertion cursor is no longer at a
+ * visible point on the display. It does nothing right now.
*
* Results:
* None.
@@ -652,10 +651,9 @@ TkTextInsertDisplayProc(textPtr, chunkPtr, x, y, height, baseline, display,
/* ARGSUSED */
static void
-InsertUndisplayProc(textPtr, chunkPtr)
- TkText *textPtr; /* Overall information about text
- * widget. */
- TkTextDispChunk *chunkPtr; /* Chunk that is about to be freed. */
+InsertUndisplayProc(
+ TkText *textPtr, /* Overall information about text widget. */
+ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
return;
}
@@ -665,23 +663,23 @@ InsertUndisplayProc(textPtr, chunkPtr)
*
* MarkCheckProc --
*
- * This procedure is invoked by the B-tree code to perform
- * consistency checks on mark segments.
+ * This function is invoked by the B-tree code to perform consistency
+ * checks on mark segments.
*
* Results:
* None.
*
* Side effects:
- * The procedure panics if it detects anything wrong with
+ * The function panics if it detects anything wrong with
* the mark.
*
*--------------------------------------------------------------
*/
static void
-MarkCheckProc(markPtr, linePtr)
- TkTextSegment *markPtr; /* Segment to check. */
- TkTextLine *linePtr; /* Line containing segment. */
+MarkCheckProc(
+ TkTextSegment *markPtr, /* Segment to check. */
+ TkTextLine *linePtr) /* Line containing segment. */
{
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
@@ -690,9 +688,10 @@ MarkCheckProc(markPtr, linePtr)
Tcl_Panic("MarkCheckProc: markPtr->body.mark.linePtr bogus");
}
- /*
- * These two marks are not in the hash table
+ /*
+ * These two marks are not in the hash table
*/
+
if (markPtr->body.mark.textPtr->insertMarkPtr == markPtr) {
return;
}
@@ -701,11 +700,11 @@ MarkCheckProc(markPtr, linePtr)
}
/*
- * Make sure that the mark is still present in the text's mark
- * hash table.
+ * Make sure that the mark is still present in the text's mark hash table.
*/
- for (hPtr = Tcl_FirstHashEntry(&markPtr->body.mark.textPtr->sharedTextPtr->markTable,
+ for (hPtr = Tcl_FirstHashEntry(
+ &markPtr->body.mark.textPtr->sharedTextPtr->markTable,
&search); hPtr != markPtr->body.mark.hPtr;
hPtr = Tcl_NextHashEntry(&search)) {
if (hPtr == NULL) {
@@ -719,7 +718,7 @@ MarkCheckProc(markPtr, linePtr)
*
* MarkFindNext --
*
- * This procedure searches forward for the next mark.
+ * This function searches forward for the next mark.
*
* Results:
* A standard Tcl result, which is a mark name or an empty string.
@@ -731,10 +730,10 @@ MarkCheckProc(markPtr, linePtr)
*/
static int
-MarkFindNext(interp, textPtr, string)
- Tcl_Interp *interp; /* For error reporting */
- TkText *textPtr; /* The widget */
- CONST char *string; /* The starting index or mark name */
+MarkFindNext(
+ Tcl_Interp *interp, /* For error reporting */
+ TkText *textPtr, /* The widget */
+ CONST char *string) /* The starting index or mark name */
{
TkTextIndex index;
Tcl_HashEntry *hPtr;
@@ -754,32 +753,36 @@ MarkFindNext(interp, textPtr, string)
if (hPtr != NULL) {
/*
* If given a mark name, return the next mark in the list of
- * segments, even if it happens to be at the same character position.
+ * segments, even if it happens to be at the same character
+ * position.
*/
+
segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
TkTextMarkSegToIndex(textPtr, segPtr, &index);
segPtr = segPtr->nextPtr;
} else {
/*
- * For non-mark name indices we want to return any marks that
- * are right at the index.
+ * For non-mark name indices we want to return any marks that are
+ * right at the index.
*/
+
if (TkTextGetIndex(interp, textPtr, string, &index) != TCL_OK) {
return TCL_ERROR;
}
- for (offset = 0, segPtr = index.linePtr->segPtr;
+ for (offset = 0, segPtr = index.linePtr->segPtr;
segPtr != NULL && offset < index.byteIndex;
- offset += segPtr->size, segPtr = segPtr->nextPtr) {
+ offset += segPtr->size, segPtr = segPtr->nextPtr) {
/* Empty loop body */ ;
}
}
}
-
+
while (1) {
/*
- * segPtr points at the first possible candidate,
- * or NULL if we ran off the end of the line.
+ * segPtr points at the first possible candidate, or NULL if we ran
+ * off the end of the line.
*/
+
for ( ; segPtr != NULL ; segPtr = segPtr->nextPtr) {
if (segPtr->typePtr == &tkTextRightMarkType ||
segPtr->typePtr == &tkTextLeftMarkType) {
@@ -788,19 +791,21 @@ MarkFindNext(interp, textPtr, string)
} else if (segPtr == textPtr->insertMarkPtr) {
Tcl_SetResult(interp, "insert", TCL_STATIC);
} else if (segPtr->body.mark.textPtr != textPtr) {
- /* Ignore widget-specific marks for the other widgets */
+ /*
+ * Ignore widget-specific marks for the other widgets.
+ */
+
continue;
} else {
Tcl_SetResult(interp,
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
- segPtr->body.mark.hPtr),
- TCL_STATIC);
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
+ segPtr->body.mark.hPtr), TCL_STATIC);
}
return TCL_OK;
}
}
index.linePtr = TkBTreeNextLine(textPtr, index.linePtr);
- if (index.linePtr == (TkTextLine *) NULL) {
+ if (index.linePtr == NULL) {
return TCL_OK;
}
index.byteIndex = 0;
@@ -813,7 +818,7 @@ MarkFindNext(interp, textPtr, string)
*
* MarkFindPrev --
*
- * This procedure searches backwards for the previous mark.
+ * This function searches backwards for the previous mark.
*
* Results:
* A standard Tcl result, which is a mark name or an empty string.
@@ -825,10 +830,10 @@ MarkFindNext(interp, textPtr, string)
*/
static int
-MarkFindPrev(interp, textPtr, string)
- Tcl_Interp *interp; /* For error reporting */
- TkText *textPtr; /* The widget */
- CONST char *string; /* The starting index or mark name */
+MarkFindPrev(
+ Tcl_Interp *interp, /* For error reporting */
+ TkText *textPtr, /* The widget */
+ CONST char *string) /* The starting index or mark name */
{
TkTextIndex index;
Tcl_HashEntry *hPtr;
@@ -846,31 +851,36 @@ MarkFindPrev(interp, textPtr, string)
if (hPtr != NULL) {
/*
* If given a mark name, return the previous mark in the list of
- * segments, even if it happens to be at the same character position.
+ * segments, even if it happens to be at the same character
+ * position.
*/
+
segPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
TkTextMarkSegToIndex(textPtr, segPtr, &index);
} else {
/*
- * For non-mark name indices we do not return any marks that
- * are right at the index.
+ * For non-mark name indices we do not return any marks that are
+ * right at the index.
*/
+
if (TkTextGetIndex(interp, textPtr, string, &index) != TCL_OK) {
return TCL_ERROR;
}
- for (offset = 0, segPtr = index.linePtr->segPtr;
+ for (offset = 0, segPtr = index.linePtr->segPtr;
segPtr != NULL && offset < index.byteIndex;
offset += segPtr->size, segPtr = segPtr->nextPtr) {
- /* Empty loop body */ ;
+ /* Empty loop body */
}
}
}
+
while (1) {
/*
- * segPtr points just past the first possible candidate,
- * or at the begining of the line.
+ * segPtr points just past the first possible candidate, or at the
+ * begining of the line.
*/
- for (prevPtr = NULL, seg2Ptr = index.linePtr->segPtr;
+
+ for (prevPtr = NULL, seg2Ptr = index.linePtr->segPtr;
seg2Ptr != NULL && seg2Ptr != segPtr;
seg2Ptr = seg2Ptr->nextPtr) {
if (seg2Ptr->typePtr == &tkTextRightMarkType ||
@@ -884,20 +894,30 @@ MarkFindPrev(interp, textPtr, string)
} else if (prevPtr == textPtr->insertMarkPtr) {
Tcl_SetResult(interp, "insert", TCL_STATIC);
} else if (prevPtr->body.mark.textPtr != textPtr) {
- /* Ignore widget-specific marks for the other widgets */
+ /*
+ * Ignore widget-specific marks for the other widgets.
+ */
+
continue;
} else {
- Tcl_SetResult(interp,
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
- prevPtr->body.mark.hPtr),
- TCL_STATIC);
+ Tcl_SetResult(interp,
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
+ prevPtr->body.mark.hPtr), TCL_STATIC);
}
return TCL_OK;
}
index.linePtr = TkBTreePreviousLine(textPtr, index.linePtr);
- if (index.linePtr == (TkTextLine *) NULL) {
+ if (index.linePtr == NULL) {
return TCL_OK;
}
segPtr = NULL;
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index 540c0af..900fff6 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.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: tkTextTag.c,v 1.21 2005/10/10 10:36:35 vincentdarley Exp $
+ * RCS: @(#) $Id: tkTextTag.c,v 1.22 2005/11/17 10:57:35 dkf Exp $
*/
#include "default.h"
@@ -27,7 +27,7 @@
*/
static char *wrapStrings[] = {
- "char", "none", "word", "", (char *) NULL
+ "char", "none", "word", "", NULL
};
/*
@@ -38,57 +38,57 @@ static char *wrapStrings[] = {
*/
static char *tabStyleStrings[] = {
- "tabular", "wordprocessor", "", (char *) NULL
+ "tabular", "wordprocessor", "", NULL
};
static Tk_OptionSpec tagOptionSpecs[] = {
- {TK_OPTION_BORDER, "-background", (char *) NULL, (char *) NULL,
+ {TK_OPTION_BORDER, "-background", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, border), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_BITMAP, "-bgstipple", (char *) NULL, (char *) NULL,
+ {TK_OPTION_BITMAP, "-bgstipple", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, bgStipple), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-borderwidth", (char *) NULL, (char *) NULL,
+ {TK_OPTION_PIXELS, "-borderwidth", NULL, NULL,
"0", Tk_Offset(TkTextTag, borderWidthPtr), Tk_Offset(TkTextTag, borderWidth),
TK_OPTION_DONT_SET_DEFAULT|TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_STRING, "-elide", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-elide", NULL, NULL,
"0", -1, Tk_Offset(TkTextTag, elideString),
TK_OPTION_DONT_SET_DEFAULT|TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_BITMAP, "-fgstipple", (char *) NULL, (char *) NULL,
+ {TK_OPTION_BITMAP, "-fgstipple", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_FONT, "-font", (char *) NULL, (char *) NULL,
+ {TK_OPTION_FONT, "-font", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, tkfont), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_COLOR, "-foreground", (char *) NULL, (char *) NULL,
+ {TK_OPTION_COLOR, "-foreground", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, fgColor), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_STRING, "-justify", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-justify", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, justifyString), TK_OPTION_NULL_OK, 0,0},
- {TK_OPTION_STRING, "-lmargin1", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-lmargin1", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, lMargin1String), TK_OPTION_NULL_OK,0,0},
- {TK_OPTION_STRING, "-lmargin2", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-lmargin2", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, lMargin2String), TK_OPTION_NULL_OK,0,0},
- {TK_OPTION_STRING, "-offset", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-offset", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, offsetString), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_STRING, "-overstrike", (char *) NULL, (char *) NULL,
- (char *) NULL, -1, Tk_Offset(TkTextTag, overstrikeString),
+ {TK_OPTION_STRING, "-overstrike", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, overstrikeString),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_STRING, "-relief", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-relief", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, reliefString), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_STRING, "-rmargin", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-rmargin", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, rMarginString), TK_OPTION_NULL_OK, 0,0},
- {TK_OPTION_STRING, "-spacing1", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-spacing1", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, spacing1String), TK_OPTION_NULL_OK,0,0},
- {TK_OPTION_STRING, "-spacing2", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-spacing2", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, spacing2String), TK_OPTION_NULL_OK,0,0},
- {TK_OPTION_STRING, "-spacing3", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-spacing3", NULL, NULL,
NULL, -1, Tk_Offset(TkTextTag, spacing3String), TK_OPTION_NULL_OK,0,0},
- {TK_OPTION_STRING, "-tabs", (char *) NULL, (char *) NULL,
+ {TK_OPTION_STRING, "-tabs", NULL, NULL,
NULL, Tk_Offset(TkTextTag, tabStringPtr), -1, TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_STRING_TABLE, "-tabstyle", (char *) NULL, (char *) NULL,
- (char *) NULL, -1, Tk_Offset(TkTextTag, tabStyle),
+ {TK_OPTION_STRING_TABLE, "-tabstyle", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, tabStyle),
TK_OPTION_NULL_OK, (ClientData) tabStyleStrings, 0},
- {TK_OPTION_STRING, "-underline", (char *) NULL, (char *) NULL,
- (char *) NULL, -1, Tk_Offset(TkTextTag, underlineString),
+ {TK_OPTION_STRING, "-underline", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, underlineString),
TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_STRING_TABLE, "-wrap", (char *) NULL, (char *) NULL,
- (char *) NULL, -1, Tk_Offset(TkTextTag, wrapMode),
+ {TK_OPTION_STRING_TABLE, "-wrap", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextTag, wrapMode),
TK_OPTION_NULL_OK, (ClientData) wrapStrings, 0},
{TK_OPTION_END}
};
@@ -125,11 +125,11 @@ static void TagBindEvent(TkText *textPtr, XEvent *eventPtr,
*/
int
-TkTextTagCmd(textPtr, interp, objc, objv)
- register TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. Someone else has already
+TkTextTagCmd(
+ register TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "tag". */
{
@@ -138,7 +138,7 @@ TkTextTagCmd(textPtr, interp, objc, objv)
static CONST char *tagOptionStrings[] = {
"add", "bind", "cget", "configure", "delete", "lower",
"names", "nextrange", "prevrange", "raise", "ranges",
- "remove", (char *) NULL
+ "remove", NULL
};
enum tagOptions {
TAG_ADD, TAG_BIND, TAG_CGET, TAG_CONFIGURE, TAG_DELETE,
@@ -286,7 +286,7 @@ TkTextTagCmd(textPtr, interp, objc, objv)
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "requested illegal events; ",
"only key, button, motion, enter, leave, and virtual ",
- "events may be used", (char *) NULL);
+ "events may be used", NULL);
return TCL_ERROR;
}
} else if (objc == 5) {
@@ -350,7 +350,7 @@ TkTextTagCmd(textPtr, interp, objc, objv)
if (objc <= 5) {
Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, (char *) tagPtr,
tagPtr->optionTable,
- (objc == 5) ? objv[4] : (Tcl_Obj *) NULL, textPtr->tkwin);
+ (objc == 5) ? objv[4] : NULL, textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -524,7 +524,7 @@ TkTextTagCmd(textPtr, interp, objc, objv)
*/
TkTextRedrawTag(textPtr->sharedTextPtr, NULL,
- (TkTextIndex *) NULL, (TkTextIndex *) NULL, tagPtr, 1);
+ NULL, NULL, tagPtr, 1);
}
return result;
}
@@ -555,7 +555,7 @@ TkTextTagCmd(textPtr, interp, objc, objv)
}
if (tagPtr->affectsDisplay) {
TkTextRedrawTag(textPtr->sharedTextPtr, NULL,
- (TkTextIndex *) NULL, (TkTextIndex *) NULL, tagPtr, 1);
+ NULL, NULL, tagPtr, 1);
}
TkTextDeleteTag(textPtr, tagPtr);
Tcl_DeleteHashEntry(hPtr);
@@ -594,8 +594,8 @@ TkTextTagCmd(textPtr, interp, objc, objv)
* for all peers.
*/
- TkTextRedrawTag(textPtr->sharedTextPtr, NULL, (TkTextIndex *) NULL,
- (TkTextIndex *) NULL, tagPtr, 1);
+ TkTextRedrawTag(textPtr->sharedTextPtr, NULL, NULL,
+ NULL, tagPtr, 1);
break;
}
case TAG_NAMES: {
@@ -657,7 +657,7 @@ TkTextTagCmd(textPtr, interp, objc, objv)
Tcl_WrongNumArgs(interp, 3, objv, "tagName index1 ?index2?");
return TCL_ERROR;
}
- tagPtr = FindTag((Tcl_Interp *) NULL, textPtr, objv[3]);
+ tagPtr = FindTag(NULL, textPtr, objv[3]);
if (tagPtr == NULL) {
return TCL_OK;
}
@@ -737,7 +737,7 @@ TkTextTagCmd(textPtr, interp, objc, objv)
Tcl_WrongNumArgs(interp, 3, objv, "tagName index1 ?index2?");
return TCL_ERROR;
}
- tagPtr = FindTag((Tcl_Interp *) NULL, textPtr, objv[3]);
+ tagPtr = FindTag(NULL, textPtr, objv[3]);
if (tagPtr == NULL) {
return TCL_OK;
}
@@ -866,8 +866,8 @@ TkTextTagCmd(textPtr, interp, objc, objv)
* for all peers.
*/
- TkTextRedrawTag(textPtr->sharedTextPtr, NULL, (TkTextIndex *) NULL,
- (TkTextIndex *) NULL, tagPtr, 1);
+ TkTextRedrawTag(textPtr->sharedTextPtr, NULL, NULL,
+ NULL, tagPtr, 1);
break;
}
case TAG_RANGES: {
@@ -880,7 +880,7 @@ TkTextTagCmd(textPtr, interp, objc, objv)
Tcl_WrongNumArgs(interp, 3, objv, "tagName");
return TCL_ERROR;
}
- tagPtr = FindTag((Tcl_Interp *) NULL, textPtr, objv[3]);
+ tagPtr = FindTag(NULL, textPtr, objv[3]);
if (tagPtr == NULL) {
return TCL_OK;
}
@@ -936,15 +936,15 @@ TkTextTagCmd(textPtr, interp, objc, objv)
*/
TkTextTag *
-TkTextCreateTag(textPtr, tagName, newTag)
- TkText *textPtr; /* Widget in which tag is being used. */
- CONST char *tagName; /* Name of desired tag. */
- int *newTag; /* If non-NULL, then return 1 if new, or 0 if
+TkTextCreateTag(
+ TkText *textPtr, /* Widget in which tag is being used. */
+ CONST char *tagName, /* Name of desired tag. */
+ int *newTag) /* If non-NULL, then return 1 if new, or 0 if
* already exists. */
{
register TkTextTag *tagPtr;
Tcl_HashEntry *hPtr = NULL;
- int new;
+ int isNew;
CONST char *name;
if (!strcmp(tagName, "sel")) {
@@ -961,11 +961,11 @@ TkTextCreateTag(textPtr, tagName, newTag)
name = "sel";
} else {
hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->tagTable,
- tagName, &new);
+ tagName, &isNew);
if (newTag != NULL) {
- *newTag = new;
+ *newTag = isNew;
}
- if (!new) {
+ if (!isNew) {
return (TkTextTag *) Tcl_GetHashValue(hPtr);
}
name = Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr);
@@ -1050,12 +1050,12 @@ TkTextCreateTag(textPtr, tagName, newTag)
*/
static TkTextTag *
-FindTag(interp, textPtr, tagName)
- Tcl_Interp *interp; /* Interpreter to use for error message; if
+FindTag(
+ Tcl_Interp *interp, /* Interpreter to use for error message; if
* NULL, then don't record an error
* message. */
- TkText *textPtr; /* Widget in which tag is being used. */
- Tcl_Obj *tagName; /* Name of desired tag. */
+ TkText *textPtr, /* Widget in which tag is being used. */
+ Tcl_Obj *tagName) /* Name of desired tag. */
{
Tcl_HashEntry *hPtr;
int len;
@@ -1072,7 +1072,7 @@ FindTag(interp, textPtr, tagName)
}
if (interp != NULL) {
Tcl_AppendResult(interp, "tag \"", Tcl_GetString(tagName),
- "\" isn't defined in text widget", (char *) NULL);
+ "\" isn't defined in text widget", NULL);
}
return NULL;
}
@@ -1103,9 +1103,9 @@ FindTag(interp, textPtr, tagName)
*/
void
-TkTextDeleteTag(textPtr, tagPtr)
- TkText *textPtr; /* Info about overall widget. */
- register TkTextTag *tagPtr; /* Tag being deleted. */
+TkTextDeleteTag(
+ TkText *textPtr, /* Info about overall widget. */
+ register TkTextTag *tagPtr) /* Tag being deleted. */
{
TkTextIndex first, last;
@@ -1162,9 +1162,9 @@ TkTextDeleteTag(textPtr, tagPtr)
*/
void
-TkTextFreeTag(textPtr, tagPtr)
- TkText *textPtr; /* Info about overall widget. */
- register TkTextTag *tagPtr; /* Tag being deleted. */
+TkTextFreeTag(
+ TkText *textPtr, /* Info about overall widget. */
+ register TkTextTag *tagPtr) /* Tag being deleted. */
{
int i;
@@ -1239,9 +1239,9 @@ TkTextFreeTag(textPtr, tagPtr)
*/
static void
-SortTags(numTags, tagArrayPtr)
- int numTags; /* Number of tag pointers at *tagArrayPtr. */
- TkTextTag **tagArrayPtr; /* Pointer to array of pointers. */
+SortTags(
+ int numTags, /* Number of tag pointers at *tagArrayPtr. */
+ TkTextTag **tagArrayPtr) /* Pointer to array of pointers. */
{
int i, j, prio;
register TkTextTag **tagPtrPtr;
@@ -1291,8 +1291,9 @@ SortTags(numTags, tagArrayPtr)
*/
static int
-TagSortProc(first, second)
- CONST VOID *first, *second; /* Elements to be compared. */
+TagSortProc(
+ CONST void *first,
+ CONST void *second) /* Elements to be compared. */
{
TkTextTag *tagPtr1, *tagPtr2;
@@ -1322,10 +1323,10 @@ TagSortProc(first, second)
*/
static void
-ChangeTagPriority(textPtr, tagPtr, prio)
- TkText *textPtr; /* Information about text widget. */
- TkTextTag *tagPtr; /* Tag whose priority is to be changed. */
- int prio; /* New priority for tag. */
+ChangeTagPriority(
+ TkText *textPtr, /* Information about text widget. */
+ TkTextTag *tagPtr, /* Tag whose priority is to be changed. */
+ int prio) /* New priority for tag. */
{
int low, high, delta;
register TkTextTag *tagPtr2;
@@ -1387,9 +1388,9 @@ ChangeTagPriority(textPtr, tagPtr, prio)
*/
void
-TkTextBindProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to canvas structure. */
- XEvent *eventPtr; /* Pointer to X event that just happened. */
+TkTextBindProc(
+ ClientData clientData, /* Pointer to canvas structure. */
+ XEvent *eventPtr) /* Pointer to X event that just happened. */
{
TkText *textPtr = (TkText *) clientData;
int repick = 0;
@@ -1499,10 +1500,10 @@ TkTextBindProc(clientData, eventPtr)
*/
void
-TkTextPickCurrent(textPtr, eventPtr)
- register TkText *textPtr; /* Text widget in which to select current
+TkTextPickCurrent(
+ register TkText *textPtr, /* Text widget in which to select current
* character. */
- XEvent *eventPtr; /* Event describing location of mouse cursor.
+ XEvent *eventPtr) /* Event describing location of mouse cursor.
* Must be EnterWindow, LeaveWindow,
* ButtonRelease, or MotionNotify. */
{
@@ -1691,11 +1692,11 @@ TkTextPickCurrent(textPtr, eventPtr)
*/
static void
-TagBindEvent(textPtr, eventPtr, numTags, tagArrayPtr)
- TkText *textPtr; /* Text widget to fire bindings in. */
- XEvent *eventPtr; /* What actually happened. */
- int numTags; /* Number of relevant tags. */
- TkTextTag **tagArrayPtr; /* Array of relevant tags. */
+TagBindEvent(
+ TkText *textPtr, /* Text widget to fire bindings in. */
+ XEvent *eventPtr, /* What actually happened. */
+ int numTags, /* Number of relevant tags. */
+ TkTextTag **tagArrayPtr) /* Array of relevant tags. */
{
#define NUM_BIND_TAGS 10
CONST char *nameArray[NUM_BIND_TAGS];
@@ -1739,3 +1740,11 @@ TagBindEvent(textPtr, eventPtr, numTags, tagArrayPtr)
ckfree((char*)nameArrPtr);
}
}
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index 73ea3a8..0988fee 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -1,17 +1,17 @@
-/*
+/*
* tkTextWind.c --
*
- * This file contains code that allows arbitrary windows to be
- * nested inside text widgets. It also implements the "window"
- * widget command for texts.
+ * This file contains code that allows arbitrary windows to be nested
+ * inside text widgets. It also implements the "window" widget command
+ * for texts.
*
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * See the file "license.terms" for information on usage and redistribution of
+ * this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextWind.c,v 1.16 2005/11/10 11:38:29 dkf Exp $
+ * RCS: @(#) $Id: tkTextWind.c,v 1.17 2005/11/17 10:57:35 dkf Exp $
*/
#include "tk.h"
@@ -19,14 +19,14 @@
#include "tkPort.h"
/*
- * The following structure is the official type record for the
- * embedded window geometry manager:
+ * The following structure is the official type record for the embedded window
+ * geometry manager:
*/
-static void EmbWinRequestProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
-static void EmbWinLostSlaveProc _ANSI_ARGS_((ClientData clientData,
- Tk_Window tkwin));
+static void EmbWinRequestProc(ClientData clientData,
+ Tk_Window tkwin);
+static void EmbWinLostSlaveProc(ClientData clientData,
+ Tk_Window tkwin);
static Tk_GeomMgr textGeomType = {
"text", /* name */
@@ -42,49 +42,48 @@ static Tk_GeomMgr textGeomType = {
+ sizeof(TkTextEmbWindow)))
/*
- * Prototypes for procedures defined in this file:
+ * Prototypes for functions defined in this file:
*/
-static TkTextSegment * EmbWinCleanupProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static void EmbWinCheckProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr));
-static void EmbWinBboxProc _ANSI_ARGS_((TkText *textPtr,
+static TkTextSegment * EmbWinCleanupProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static void EmbWinCheckProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr);
+static void EmbWinBboxProc(TkText *textPtr,
TkTextDispChunk *chunkPtr,
int index, int y, int lineHeight, int baseline,
int *xPtr, int *yPtr, int *widthPtr,
- int *heightPtr));
-static int EmbWinConfigure _ANSI_ARGS_((TkText *textPtr,
- TkTextSegment *ewPtr, int objc, Tcl_Obj *CONST objv[]));
-static void EmbWinDelayedUnmap _ANSI_ARGS_((
- ClientData clientData));
-static int EmbWinDeleteProc _ANSI_ARGS_((TkTextSegment *segPtr,
- TkTextLine *linePtr, int treeGone));
-static int EmbWinLayoutProc _ANSI_ARGS_((TkText *textPtr,
+ int *heightPtr);
+static int EmbWinConfigure(TkText *textPtr, TkTextSegment *ewPtr,
+ int objc, Tcl_Obj *CONST objv[]);
+static void EmbWinDelayedUnmap(ClientData clientData);
+static int EmbWinDeleteProc(TkTextSegment *segPtr,
+ TkTextLine *linePtr, int treeGone);
+static int EmbWinLayoutProc(TkText *textPtr,
TkTextIndex *indexPtr, TkTextSegment *segPtr,
int offset, int maxX, int maxChars,
int noCharsYet, TkWrapMode wrapMode,
- TkTextDispChunk *chunkPtr));
-static void EmbWinStructureProc _ANSI_ARGS_((ClientData clientData,
- XEvent *eventPtr));
-static void EmbWinUndisplayProc _ANSI_ARGS_((TkText *textPtr,
- TkTextDispChunk *chunkPtr));
-static TkTextEmbWindowClient* EmbWinGetClient _ANSI_ARGS_((CONST TkText *textPtr,
- TkTextSegment *ewPtr));
+ TkTextDispChunk *chunkPtr);
+static void EmbWinStructureProc(ClientData clientData,
+ XEvent *eventPtr);
+static void EmbWinUndisplayProc(TkText *textPtr,
+ TkTextDispChunk *chunkPtr);
+static TkTextEmbWindowClient* EmbWinGetClient(CONST TkText *textPtr,
+ TkTextSegment *ewPtr);
/*
* The following structure declares the "embedded window" segment type.
*/
static Tk_SegType tkTextEmbWindowType = {
- "window", /* name */
- 0, /* leftGravity */
- (Tk_SegSplitProc *) NULL, /* splitProc */
- EmbWinDeleteProc, /* deleteProc */
- EmbWinCleanupProc, /* cleanupProc */
- (Tk_SegLineChangeProc *) NULL, /* lineChangeProc */
- EmbWinLayoutProc, /* layoutProc */
- EmbWinCheckProc /* checkProc */
+ "window", /* name */
+ 0, /* leftGravity */
+ NULL, /* splitProc */
+ EmbWinDeleteProc, /* deleteProc */
+ EmbWinCleanupProc, /* cleanupProc */
+ NULL, /* lineChangeProc */
+ EmbWinLayoutProc, /* layoutProc */
+ EmbWinCheckProc /* checkProc */
};
/*
@@ -92,10 +91,10 @@ static Tk_SegType tkTextEmbWindowType = {
*/
static char *alignStrings[] = {
- "baseline", "bottom", "center", "top", (char *) NULL
+ "baseline", "bottom", "center", "top", NULL
};
-typedef enum {
+typedef enum {
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_TOP
} alignMode;
@@ -104,24 +103,19 @@ typedef enum {
*/
static Tk_OptionSpec optionSpecs[] = {
- {TK_OPTION_STRING_TABLE, "-align", (char *) NULL, (char *) NULL,
- "center", -1, Tk_Offset(TkTextEmbWindow, align),
+ {TK_OPTION_STRING_TABLE, "-align", NULL, NULL,
+ "center", -1, Tk_Offset(TkTextEmbWindow, align),
0, (ClientData) alignStrings, 0},
- {TK_OPTION_STRING, "-create", (char *) NULL, (char *) NULL,
- (char *) NULL, -1, Tk_Offset(TkTextEmbWindow, create),
- TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-padx", (char *) NULL, (char *) NULL,
- "0", -1, Tk_Offset(TkTextEmbWindow, padX),
- 0, 0, 0},
- {TK_OPTION_PIXELS, "-pady", (char *) NULL, (char *) NULL,
- "0", -1, Tk_Offset(TkTextEmbWindow, padY),
- 0, 0, 0},
- {TK_OPTION_BOOLEAN, "-stretch", (char *) NULL, (char *) NULL,
- "0", -1, Tk_Offset(TkTextEmbWindow, stretch),
- 0, 0, 0},
- {TK_OPTION_WINDOW, "-window", (char *) NULL, (char *) NULL,
- (char *) NULL, -1, Tk_Offset(TkTextEmbWindow, tkwin),
- TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_STRING, "-create", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextEmbWindow, create), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-padx", NULL, NULL,
+ "0", -1, Tk_Offset(TkTextEmbWindow, padX), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-pady", NULL, NULL,
+ "0", -1, Tk_Offset(TkTextEmbWindow, padY), 0, 0, 0},
+ {TK_OPTION_BOOLEAN, "-stretch", NULL, NULL,
+ "0", -1, Tk_Offset(TkTextEmbWindow, stretch), 0, 0, 0},
+ {TK_OPTION_WINDOW, "-window", NULL, NULL,
+ NULL, -1, Tk_Offset(TkTextEmbWindow, tkwin), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END}
};
@@ -130,9 +124,8 @@ static Tk_OptionSpec optionSpecs[] = {
*
* TkTextWindowCmd --
*
- * This procedure implements the "window" widget command
- * for text widgets. See the user documentation for details
- * on what it does.
+ * This function implements the "window" widget command for text widgets.
+ * See the user documentation for details on what it does.
*
* Results:
* A standard Tcl result or error.
@@ -144,18 +137,18 @@ static Tk_OptionSpec optionSpecs[] = {
*/
int
-TkTextWindowCmd(textPtr, interp, objc, objv)
- register TkText *textPtr; /* Information about text widget. */
- Tcl_Interp *interp; /* Current interpreter. */
- int objc; /* Number of arguments. */
- Tcl_Obj *CONST objv[]; /* Argument objects. Someone else has already
+TkTextWindowCmd(
+ register TkText *textPtr, /* Information about text widget. */
+ Tcl_Interp *interp, /* Current interpreter. */
+ int objc, /* Number of arguments. */
+ Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already
* parsed this command enough to know that
* objv[1] is "window". */
{
int optionIndex;
-
+
static CONST char *windOptionStrings[] = {
- "cget", "configure", "create", "names", (char *) NULL
+ "cget", "configure", "create", "names", NULL
};
enum windOptions {
WIND_CGET, WIND_CONFIGURE, WIND_CREATE, WIND_NAMES
@@ -167,193 +160,197 @@ TkTextWindowCmd(textPtr, interp, objc, objv)
Tcl_WrongNumArgs(interp, 2, objv, "option ?arg arg ...?");
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[2], windOptionStrings,
- "window option", 0, &optionIndex) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[2], windOptionStrings,
+ "window option", 0, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
switch ((enum windOptions)optionIndex) {
- case WIND_CGET: {
- TkTextIndex index;
- TkTextSegment *ewPtr;
- Tcl_Obj *objPtr;
+ case WIND_CGET: {
+ TkTextIndex index;
+ TkTextSegment *ewPtr;
+ Tcl_Obj *objPtr;
+ TkTextEmbWindowClient *client;
+
+ if (objc != 5) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index option");
+ return TCL_ERROR;
+ }
+ if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ ewPtr = TkTextIndexToSeg(&index, NULL);
+ if (ewPtr->typePtr != &tkTextEmbWindowType) {
+ Tcl_AppendResult(interp, "no embedded window at index \"",
+ Tcl_GetString(objv[3]), "\"", NULL);
+ return TCL_ERROR;
+ }
+
+ /*
+ * Copy over client specific value before querying.
+ */
+
+ client = EmbWinGetClient(textPtr, ewPtr);
+ if (client != NULL) {
+ ewPtr->body.ew.tkwin = client->tkwin;
+ } else {
+ ewPtr->body.ew.tkwin = NULL;
+ }
+
+ objPtr = Tk_GetOptionValue(interp, (char *) &ewPtr->body.ew,
+ ewPtr->body.ew.optionTable, objv[4], textPtr->tkwin);
+ if (objPtr == NULL) {
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, objPtr);
+ return TCL_OK;
+ }
+ case WIND_CONFIGURE: {
+ TkTextIndex index;
+ TkTextSegment *ewPtr;
+
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index ?option value ...?");
+ return TCL_ERROR;
+ }
+ if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ ewPtr = TkTextIndexToSeg(&index, NULL);
+ if (ewPtr->typePtr != &tkTextEmbWindowType) {
+ Tcl_AppendResult(interp, "no embedded window at index \"",
+ Tcl_GetString(objv[3]), "\"", NULL);
+ return TCL_ERROR;
+ }
+ if (objc <= 5) {
TkTextEmbWindowClient *client;
-
- if (objc != 5) {
- Tcl_WrongNumArgs(interp, 3, objv, "index option");
- return TCL_ERROR;
- }
- if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
- return TCL_ERROR;
- }
- ewPtr = TkTextIndexToSeg(&index, (int *) NULL);
- if (ewPtr->typePtr != &tkTextEmbWindowType) {
- Tcl_AppendResult(interp, "no embedded window at index \"",
- Tcl_GetString(objv[3]), "\"", (char *) NULL);
- return TCL_ERROR;
- }
-
- /* Copy over client specific value before querying */
+ Tcl_Obj* objPtr;
+
+ /*
+ * Copy over client specific value before querying.
+ */
+
client = EmbWinGetClient(textPtr, ewPtr);
if (client != NULL) {
ewPtr->body.ew.tkwin = client->tkwin;
} else {
ewPtr->body.ew.tkwin = NULL;
}
-
- objPtr = Tk_GetOptionValue(interp, (char *) &ewPtr->body.ew,
- ewPtr->body.ew.optionTable, objv[4], textPtr->tkwin);
+
+ objPtr = Tk_GetOptionInfo(interp, (char *) &ewPtr->body.ew,
+ ewPtr->body.ew.optionTable, (objc == 5) ? objv[4] : NULL,
+ textPtr->tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- return TCL_OK;
}
- break;
- }
- case WIND_CONFIGURE: {
- TkTextIndex index;
- TkTextSegment *ewPtr;
+ Tcl_SetObjResult(interp, objPtr);
+ return TCL_OK;
+ } else {
+ TkTextChanged(textPtr->sharedTextPtr, NULL, &index, &index);
- if (objc < 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index ?option value ...?");
- return TCL_ERROR;
- }
- if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
- return TCL_ERROR;
- }
- ewPtr = TkTextIndexToSeg(&index, (int *) NULL);
- if (ewPtr->typePtr != &tkTextEmbWindowType) {
- Tcl_AppendResult(interp, "no embedded window at index \"",
- Tcl_GetString(objv[3]), "\"", (char *) NULL);
- return TCL_ERROR;
- }
- if (objc <= 5) {
- TkTextEmbWindowClient *client;
- Tcl_Obj* objPtr;
-
- /* Copy over client specific value before querying */
- client = EmbWinGetClient(textPtr, ewPtr);
- if (client != NULL) {
- ewPtr->body.ew.tkwin = client->tkwin;
- } else {
- ewPtr->body.ew.tkwin = NULL;
- }
-
- objPtr = Tk_GetOptionInfo(interp, (char *) &ewPtr->body.ew,
- ewPtr->body.ew.optionTable,
- (objc == 5) ? objv[4] : (Tcl_Obj *) NULL,
- textPtr->tkwin);
- if (objPtr == NULL) {
- return TCL_ERROR;
- } else {
- Tcl_SetObjResult(interp, objPtr);
- return TCL_OK;
- }
- } else {
- TkTextChanged(textPtr->sharedTextPtr, NULL, &index, &index);
- /*
- * It's probably not true that all window configuration
- * can change the line height, so we could be more
- * efficient here and only call this when necessary.
- */
- TkTextInvalidateLineMetrics(textPtr->sharedTextPtr, NULL,
- index.linePtr, 0,
- TK_TEXT_INVALIDATE_ONLY);
- return EmbWinConfigure(textPtr, ewPtr, objc-4, objv+4);
- }
- break;
- }
- case WIND_CREATE: {
- TkTextIndex index;
- int lineIndex;
- TkTextEmbWindowClient *client;
- int res;
-
/*
- * Add a new window. Find where to put the new window, and
- * mark that position for redisplay.
+ * It's probably not true that all window configuration can change
+ * the line height, so we could be more efficient here and only
+ * call this when necessary.
*/
- if (objc < 4) {
- Tcl_WrongNumArgs(interp, 3, objv, "index ?option value ...?");
- return TCL_ERROR;
- }
- if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
- return TCL_ERROR;
- }
+ TkTextInvalidateLineMetrics(textPtr->sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
+ return EmbWinConfigure(textPtr, ewPtr, objc-4, objv+4);
+ }
+ }
+ case WIND_CREATE: {
+ TkTextIndex index;
+ int lineIndex;
+ TkTextEmbWindowClient *client;
+ int res;
- /*
- * Don't allow insertions on the last (dummy) line of the text.
- */
-
- lineIndex = TkBTreeLinesTo(textPtr, index.linePtr);
- if (lineIndex == TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr)) {
- lineIndex--;
- TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
- lineIndex, 1000000, &index);
- }
+ /*
+ * Add a new window. Find where to put the new window, and mark that
+ * position for redisplay.
+ */
- /*
- * Create the new window segment and initialize it.
- */
+ if (objc < 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "index ?option value ...?");
+ return TCL_ERROR;
+ }
+ if (TkTextGetObjIndex(interp, textPtr, objv[3], &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
- ewPtr = (TkTextSegment *) ckalloc(EW_SEG_SIZE);
- ewPtr->typePtr = &tkTextEmbWindowType;
- ewPtr->size = 1;
- ewPtr->body.ew.sharedTextPtr = textPtr->sharedTextPtr;
- ewPtr->body.ew.linePtr = NULL;
- ewPtr->body.ew.tkwin = NULL;
- ewPtr->body.ew.create = NULL;
- ewPtr->body.ew.align = ALIGN_CENTER;
- ewPtr->body.ew.padX = ewPtr->body.ew.padY = 0;
- ewPtr->body.ew.stretch = 0;
- ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs);
-
- client = (TkTextEmbWindowClient*) ckalloc(sizeof(TkTextEmbWindowClient));
- client->next = NULL;
- client->textPtr = textPtr;
- client->tkwin = NULL;
- client->chunkCount = 0;
- client->displayed = 0;
- client->parent = ewPtr;
- ewPtr->body.ew.clients = client;
+ /*
+ * Don't allow insertions on the last (dummy) line of the text.
+ */
- /*
- * Link the segment into the text widget, then configure it (delete
- * it again if the configuration fails).
- */
+ lineIndex = TkBTreeLinesTo(textPtr, index.linePtr);
+ if (lineIndex == TkBTreeNumLines(textPtr->sharedTextPtr->tree,
+ textPtr)) {
+ lineIndex--;
+ TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr,
+ lineIndex, 1000000, &index);
+ }
- TkTextChanged(textPtr->sharedTextPtr, NULL, &index, &index);
- TkBTreeLinkSegment(ewPtr, &index);
- res = EmbWinConfigure(textPtr, ewPtr, objc-4, objv+4);
- client->tkwin = ewPtr->body.ew.tkwin;
- if (res != TCL_OK) {
- TkTextIndex index2;
+ /*
+ * Create the new window segment and initialize it.
+ */
- TkTextIndexForwChars(NULL, &index, 1, &index2, COUNT_INDICES);
- TkBTreeDeleteIndexRange(textPtr->sharedTextPtr->tree, &index, &index2);
- return TCL_ERROR;
- }
- TkTextInvalidateLineMetrics(textPtr->sharedTextPtr, NULL,
- index.linePtr, 0,
- TK_TEXT_INVALIDATE_ONLY);
- break;
+ ewPtr = (TkTextSegment *) ckalloc(EW_SEG_SIZE);
+ ewPtr->typePtr = &tkTextEmbWindowType;
+ ewPtr->size = 1;
+ ewPtr->body.ew.sharedTextPtr = textPtr->sharedTextPtr;
+ ewPtr->body.ew.linePtr = NULL;
+ ewPtr->body.ew.tkwin = NULL;
+ ewPtr->body.ew.create = NULL;
+ ewPtr->body.ew.align = ALIGN_CENTER;
+ ewPtr->body.ew.padX = ewPtr->body.ew.padY = 0;
+ ewPtr->body.ew.stretch = 0;
+ ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs);
+
+ client = (TkTextEmbWindowClient *)
+ ckalloc(sizeof(TkTextEmbWindowClient));
+ client->next = NULL;
+ client->textPtr = textPtr;
+ client->tkwin = NULL;
+ client->chunkCount = 0;
+ client->displayed = 0;
+ client->parent = ewPtr;
+ ewPtr->body.ew.clients = client;
+
+ /*
+ * Link the segment into the text widget, then configure it (delete it
+ * again if the configuration fails).
+ */
+
+ TkTextChanged(textPtr->sharedTextPtr, NULL, &index, &index);
+ TkBTreeLinkSegment(ewPtr, &index);
+ res = EmbWinConfigure(textPtr, ewPtr, objc-4, objv+4);
+ client->tkwin = ewPtr->body.ew.tkwin;
+ if (res != TCL_OK) {
+ TkTextIndex index2;
+
+ TkTextIndexForwChars(NULL, &index, 1, &index2, COUNT_INDICES);
+ TkBTreeDeleteIndexRange(textPtr->sharedTextPtr->tree, &index,
+ &index2);
+ return TCL_ERROR;
}
- case WIND_NAMES: {
- Tcl_HashSearch search;
- Tcl_HashEntry *hPtr;
+ TkTextInvalidateLineMetrics(textPtr->sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
+ break;
+ }
+ case WIND_NAMES: {
+ Tcl_HashSearch search;
+ Tcl_HashEntry *hPtr;
- if (objc != 3) {
- Tcl_WrongNumArgs(interp, 3, objv, NULL);
- return TCL_ERROR;
- }
- for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->windowTable, &search);
- hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- Tcl_AppendElement(interp,
- Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr));
- }
- break;
+ if (objc != 3) {
+ Tcl_WrongNumArgs(interp, 3, objv, NULL);
+ return TCL_ERROR;
+ }
+ for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->windowTable,
+ &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ Tcl_AppendElement(interp,
+ Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr));
}
+ break;
+ }
}
return TCL_OK;
}
@@ -363,62 +360,63 @@ TkTextWindowCmd(textPtr, interp, objc, objv)
*
* EmbWinConfigure --
*
- * This procedure is called to handle configuration options
- * for an embedded window, using an objc/objv list.
+ * This function is called to handle configuration options for an
+ * embedded window, using an objc/objv list.
*
* Results:
- * The return value is a standard Tcl result. If TCL_ERROR is
- * returned, then the interp's result contains an error message..
+ * The return value is a standard Tcl result. If TCL_ERROR is returned,
+ * then the interp's result contains an error message..
*
* Side effects:
- * Configuration information for the embedded window changes,
- * such as alignment, stretching, or name of the embedded
- * window.
- *
- * Note that this procedure may leave widget specific client
- * information with a NULL tkwin attached to ewPtr. While we could
- * choose to clean up the client data structure here, there is no
- * need to do so, and it is likely that the user is going to adjust
- * the tkwin again soon.
+ * Configuration information for the embedded window changes, such as
+ * alignment, stretching, or name of the embedded window.
+ *
+ * Note that this function may leave widget specific client information
+ * with a NULL tkwin attached to ewPtr. While we could choose to clean up
+ * the client data structure here, there is no need to do so, and it is
+ * likely that the user is going to adjust the tkwin again soon.
*
*--------------------------------------------------------------
*/
static int
-EmbWinConfigure(textPtr, ewPtr, objc, objv)
- TkText *textPtr; /* Information about text widget that
- * contains embedded window. */
- TkTextSegment *ewPtr; /* Embedded window to be configured. */
- int objc; /* Number of strings in objv. */
- Tcl_Obj *CONST objv[]; /* Array of objects describing configuration
+EmbWinConfigure(
+ TkText *textPtr, /* Information about text widget that contains
+ * embedded window. */
+ TkTextSegment *ewPtr, /* Embedded window to be configured. */
+ int objc, /* Number of strings in objv. */
+ Tcl_Obj *CONST objv[]) /* Array of objects describing configuration
* options. */
{
Tk_Window oldWindow;
TkTextEmbWindowClient *client;
- /* Copy over client specific value before querying or setting */
+ /*
+ * Copy over client specific value before querying or setting.
+ */
+
client = EmbWinGetClient(textPtr, ewPtr);
if (client != NULL) {
ewPtr->body.ew.tkwin = client->tkwin;
} else {
ewPtr->body.ew.tkwin = NULL;
}
-
+
oldWindow = ewPtr->body.ew.tkwin;
- if (Tk_SetOptions(textPtr->interp, (char*)&ewPtr->body.ew,
- ewPtr->body.ew.optionTable,
- objc, objv, textPtr->tkwin, NULL, NULL) != TCL_OK) {
+ if (Tk_SetOptions(textPtr->interp, (char *) &ewPtr->body.ew,
+ ewPtr->body.ew.optionTable, objc, objv, textPtr->tkwin, NULL,
+ NULL) != TCL_OK) {
return TCL_ERROR;
}
if (oldWindow != ewPtr->body.ew.tkwin) {
if (oldWindow != NULL) {
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&textPtr->sharedTextPtr->windowTable,
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(
+ &textPtr->sharedTextPtr->windowTable,
Tk_PathName(oldWindow)));
Tk_DeleteEventHandler(oldWindow, StructureNotifyMask,
EmbWinStructureProc, (ClientData) client);
- Tk_ManageGeometry(oldWindow, (Tk_GeomMgr *) NULL,
- (ClientData) NULL);
+ Tk_ManageGeometry(oldWindow, NULL, (ClientData) NULL);
if (textPtr->tkwin != Tk_Parent(oldWindow)) {
Tk_UnmaintainGeometry(oldWindow, textPtr->tkwin);
} else {
@@ -431,26 +429,24 @@ EmbWinConfigure(textPtr, ewPtr, objc, objv)
if (ewPtr->body.ew.tkwin != NULL) {
Tk_Window ancestor, parent;
Tcl_HashEntry *hPtr;
- int new;
-
+ int isNew;
+
/*
- * Make sure that the text is either the parent of the
- * embedded window or a descendant of that parent. Also,
- * don't allow a top-level window to be managed inside
- * a text.
+ * Make sure that the text is either the parent of the embedded
+ * window or a descendant of that parent. Also, don't allow a
+ * top-level window to be managed inside a text.
*/
parent = Tk_Parent(ewPtr->body.ew.tkwin);
- for (ancestor = textPtr->tkwin; ;
- ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = textPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
- badMaster:
+ badMaster:
Tcl_AppendResult(textPtr->interp, "can't embed ",
Tk_PathName(ewPtr->body.ew.tkwin), " in ",
- Tk_PathName(textPtr->tkwin), (char *) NULL);
+ Tk_PathName(textPtr->tkwin), NULL);
ewPtr->body.ew.tkwin = NULL;
if (client != NULL) {
client->tkwin = NULL;
@@ -462,10 +458,14 @@ EmbWinConfigure(textPtr, ewPtr, objc, objv)
|| (ewPtr->body.ew.tkwin == textPtr->tkwin)) {
goto badMaster;
}
-
+
if (client == NULL) {
- /* Have to make the new client */
- client = (TkTextEmbWindowClient*) ckalloc(sizeof(TkTextEmbWindowClient));
+ /*
+ * Have to make the new client.
+ */
+
+ client = (TkTextEmbWindowClient *)
+ ckalloc(sizeof(TkTextEmbWindowClient));
client->next = ewPtr->body.ew.clients;
client->textPtr = textPtr;
client->tkwin = NULL;
@@ -477,8 +477,8 @@ EmbWinConfigure(textPtr, ewPtr, objc, objv)
client->tkwin = ewPtr->body.ew.tkwin;
/*
- * Take over geometry management for the window, plus create
- * an event handler to find out when it is deleted.
+ * Take over geometry management for the window, plus create an
+ * event handler to find out when it is deleted.
*/
Tk_ManageGeometry(ewPtr->body.ew.tkwin, &textGeomType,
@@ -487,17 +487,15 @@ EmbWinConfigure(textPtr, ewPtr, objc, objv)
EmbWinStructureProc, (ClientData) client);
/*
- * Special trick! Must enter into the hash table *after*
- * calling Tk_ManageGeometry: if the window was already managed
- * elsewhere in this text, the Tk_ManageGeometry call will cause
- * the entry to be removed, which could potentially lose the new
- * entry.
+ * Special trick! Must enter into the hash table *after* calling
+ * Tk_ManageGeometry: if the window was already managed elsewhere
+ * in this text, the Tk_ManageGeometry call will cause the entry
+ * to be removed, which could potentially lose the new entry.
*/
hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->windowTable,
- Tk_PathName(ewPtr->body.ew.tkwin), &new);
+ Tk_PathName(ewPtr->body.ew.tkwin), &isNew);
Tcl_SetHashValue(hPtr, ewPtr);
-
}
}
return TCL_OK;
@@ -508,50 +506,52 @@ EmbWinConfigure(textPtr, ewPtr, objc, objv)
*
* EmbWinStructureProc --
*
- * This procedure is invoked by the Tk event loop whenever
- * StructureNotify events occur for a window that's embedded
- * in a text widget. This procedure's only purpose is to
- * clean up when windows are deleted.
+ * This function is invoked by the Tk event loop whenever StructureNotify
+ * events occur for a window that's embedded in a text widget. This
+ * function's only purpose is to clean up when windows are deleted.
*
* Results:
* None.
*
* Side effects:
- * The window is disassociated from the window segment, and
- * the portion of the text is redisplayed.
+ * The window is disassociated from the window segment, and the portion
+ * of the text is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-EmbWinStructureProc(clientData, eventPtr)
- ClientData clientData; /* Pointer to record describing window item. */
- XEvent *eventPtr; /* Describes what just happened. */
+EmbWinStructureProc(
+ ClientData clientData, /* Pointer to record describing window item. */
+ XEvent *eventPtr) /* Describes what just happened. */
{
TkTextEmbWindowClient *client = (TkTextEmbWindowClient*)clientData;
TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
Tcl_HashEntry *hPtr;
-
+
if (eventPtr->type != DestroyNotify) {
return;
}
hPtr = Tcl_FindHashEntry(&ewPtr->body.ew.sharedTextPtr->windowTable,
- Tk_PathName(client->tkwin));
+ Tk_PathName(client->tkwin));
if (hPtr != NULL) {
- /* This may not exist if the entire widget is being deleted */
- Tcl_DeleteHashEntry(hPtr);
+ /*
+ * This may not exist if the entire widget is being deleted.
+ */
+
+ Tcl_DeleteHashEntry(hPtr);
}
-
+
ewPtr->body.ew.tkwin = NULL;
client->tkwin = NULL;
index.tree = ewPtr->body.ew.sharedTextPtr->tree;
index.linePtr = ewPtr->body.ew.linePtr;
index.byteIndex = TkTextSegToOffset(ewPtr, ewPtr->body.ew.linePtr);
TkTextChanged(ewPtr->body.ew.sharedTextPtr, NULL, &index, &index);
- TkTextInvalidateLineMetrics(ewPtr->body.ew.sharedTextPtr, NULL,
- index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
+ TkTextInvalidateLineMetrics(ewPtr->body.ew.sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
}
/*
@@ -559,8 +559,8 @@ EmbWinStructureProc(clientData, eventPtr)
*
* EmbWinRequestProc --
*
- * This procedure is invoked whenever a window that's associated
- * with a window canvas item changes its requested dimensions.
+ * This function is invoked whenever a window that's associated with a
+ * window canvas item changes its requested dimensions.
*
* Results:
* None.
@@ -574,10 +574,9 @@ EmbWinStructureProc(clientData, eventPtr)
/* ARGSUSED */
static void
-EmbWinRequestProc(clientData, tkwin)
- ClientData clientData; /* Pointer to record for window item. */
- Tk_Window tkwin; /* Window that changed its desired
- * size. */
+EmbWinRequestProc(
+ ClientData clientData, /* Pointer to record for window item. */
+ Tk_Window tkwin) /* Window that changed its desired size. */
{
TkTextEmbWindowClient *client = (TkTextEmbWindowClient*)clientData;
TkTextSegment *ewPtr = client->parent;
@@ -587,8 +586,8 @@ EmbWinRequestProc(clientData, tkwin)
index.linePtr = ewPtr->body.ew.linePtr;
index.byteIndex = TkTextSegToOffset(ewPtr, ewPtr->body.ew.linePtr);
TkTextChanged(ewPtr->body.ew.sharedTextPtr, NULL, &index, &index);
- TkTextInvalidateLineMetrics(ewPtr->body.ew.sharedTextPtr, NULL,
- index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
+ TkTextInvalidateLineMetrics(ewPtr->body.ew.sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
}
/*
@@ -596,24 +595,24 @@ EmbWinRequestProc(clientData, tkwin)
*
* EmbWinLostSlaveProc --
*
- * This procedure is invoked by the Tk geometry manager when
- * a slave window managed by a text widget is claimed away
- * by another geometry manager.
+ * This function is invoked by the Tk geometry manager when a slave
+ * window managed by a text widget is claimed away by another geometry
+ * manager.
*
* Results:
* None.
*
* Side effects:
- * The window is disassociated from the window segment, and
- * the portion of the text is redisplayed.
+ * The window is disassociated from the window segment, and the portion
+ * of the text is redisplayed.
*
*--------------------------------------------------------------
*/
static void
-EmbWinLostSlaveProc(clientData, tkwin)
- ClientData clientData; /* Pointer to record describing window item. */
- Tk_Window tkwin; /* Window that was claimed away by another
+EmbWinLostSlaveProc(
+ ClientData clientData, /* Pointer to record describing window item. */
+ Tk_Window tkwin) /* Window that was claimed away by another
* geometry manager. */
{
TkTextEmbWindowClient *client = (TkTextEmbWindowClient*)clientData;
@@ -621,7 +620,7 @@ EmbWinLostSlaveProc(clientData, tkwin)
TkTextIndex index;
Tcl_HashEntry *hPtr;
TkTextEmbWindowClient *loop;
-
+
Tk_DeleteEventHandler(client->tkwin, StructureNotifyMask,
EmbWinStructureProc, (ClientData) client);
Tcl_CancelIdleCall(EmbWinDelayedUnmap, (ClientData) client);
@@ -631,16 +630,18 @@ EmbWinLostSlaveProc(clientData, tkwin)
Tk_UnmapWindow(tkwin);
}
hPtr = Tcl_FindHashEntry(&ewPtr->body.ew.sharedTextPtr->windowTable,
- Tk_PathName(client->tkwin));
+ Tk_PathName(client->tkwin));
Tcl_DeleteHashEntry(hPtr);
client->tkwin = NULL;
ewPtr->body.ew.tkwin = NULL;
-
- /* Free up the memory allocation for this client */
-
+
+ /*
+ * Free up the memory allocation for this client.
+ */
+
loop = ewPtr->body.ew.clients;
if (loop == client) {
- ewPtr->body.ew.clients = client->next;
+ ewPtr->body.ew.clients = client->next;
} else {
while (loop->next != client) {
loop = loop->next;
@@ -648,13 +649,13 @@ EmbWinLostSlaveProc(clientData, tkwin)
loop->next = client->next;
}
ckfree((char *)client);
-
+
index.tree = ewPtr->body.ew.sharedTextPtr->tree;
index.linePtr = ewPtr->body.ew.linePtr;
index.byteIndex = TkTextSegToOffset(ewPtr, ewPtr->body.ew.linePtr);
TkTextChanged(ewPtr->body.ew.sharedTextPtr, NULL, &index, &index);
- TkTextInvalidateLineMetrics(ewPtr->body.ew.sharedTextPtr, NULL,
- index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
+ TkTextInvalidateLineMetrics(ewPtr->body.ew.sharedTextPtr, NULL,
+ index.linePtr, 0, TK_TEXT_INVALIDATE_ONLY);
}
/*
@@ -662,55 +663,57 @@ EmbWinLostSlaveProc(clientData, tkwin)
*
* TkTextWinFreeClient --
*
- * Free up the hash entry and client information for a
- * given embedded window.
- *
- * It is assumed the caller will manage the linked list
- * of clients associated with the relevant TkTextSegment.
+ * Free up the hash entry and client information for a given embedded
+ * window.
+ *
+ * It is assumed the caller will manage the linked list of clients
+ * associated with the relevant TkTextSegment.
*
* Results:
* Nothing.
*
* Side effects:
- * The embedded window information for a single client is deleted,
- * if it exists, and any resources associated with it are released.
+ * The embedded window information for a single client is deleted, if it
+ * exists, and any resources associated with it are released.
*
*--------------------------------------------------------------
*/
void
-TkTextWinFreeClient(hPtr, client)
- Tcl_HashEntry *hPtr; /* Hash entry corresponding to
- * this client, or NULL */
- TkTextEmbWindowClient *client; /* Client data structure, with
- * the 'tkwin' field to be
- * cleaned up. */
+TkTextWinFreeClient(
+ Tcl_HashEntry *hPtr, /* Hash entry corresponding to this client, or
+ * NULL */
+ TkTextEmbWindowClient *client)
+ /* Client data structure, with the 'tkwin'
+ * field to be cleaned up. */
{
if (hPtr != NULL) {
/*
- * (It's possible for there to be no hash table entry
- * for this window, if an error occurred while creating
- * the window segment but before the window got added to
- * the table)
+ * (It's possible for there to be no hash table entry for this window,
+ * if an error occurred while creating the window segment but before
+ * the window got added to the table)
*/
Tcl_DeleteHashEntry(hPtr);
}
-
+
/*
- * Delete the event handler for the window before destroying
- * the window, so that EmbWinStructureProc doesn't get called
- * (we'll already do everything that it would have done, and
- * it will just get confused).
+ * Delete the event handler for the window before destroying the window,
+ * so that EmbWinStructureProc doesn't get called (we'll already do
+ * everything that it would have done, and it will just get confused).
*/
if (client->tkwin != NULL) {
Tk_DeleteEventHandler(client->tkwin, StructureNotifyMask,
- EmbWinStructureProc, (ClientData) client);
+ EmbWinStructureProc, (ClientData) client);
Tk_DestroyWindow(client->tkwin);
}
Tcl_CancelIdleCall(EmbWinDelayedUnmap, (ClientData) client);
- /* Free up this client */
+
+ /*
+ * Free up this client.
+ */
+
ckfree((char *) client);
}
@@ -719,8 +722,8 @@ TkTextWinFreeClient(hPtr, client)
*
* EmbWinDeleteProc --
*
- * This procedure is invoked by the text B-tree code whenever
- * an embedded window lies in a range of characters being deleted.
+ * This function is invoked by the text B-tree code whenever an embedded
+ * window lies in a range of characters being deleted.
*
* Results:
* Returns 0 to indicate that the deletion has been accepted.
@@ -734,35 +737,38 @@ TkTextWinFreeClient(hPtr, client)
/* ARGSUSED */
static int
-EmbWinDeleteProc(ewPtr, linePtr, treeGone)
- TkTextSegment *ewPtr; /* Segment being deleted. */
- TkTextLine *linePtr; /* Line containing segment. */
- int treeGone; /* Non-zero means the entire tree is
- * being deleted, so everything must
- * get cleaned up. */
+EmbWinDeleteProc(
+ TkTextSegment *ewPtr, /* Segment being deleted. */
+ TkTextLine *linePtr, /* Line containing segment. */
+ int treeGone) /* Non-zero means the entire tree is being
+ * deleted, so everything must get cleaned
+ * up. */
{
TkTextEmbWindowClient *client;
client = ewPtr->body.ew.clients;
-
+
while (client != NULL) {
TkTextEmbWindowClient *next = client->next;
Tcl_HashEntry *hPtr = NULL;
-
- if (client->tkwin != NULL) {
- hPtr = Tcl_FindHashEntry(&ewPtr->body.ew.sharedTextPtr->windowTable,
- Tk_PathName(client->tkwin));
- }
+
+ if (client->tkwin != NULL) {
+ hPtr = Tcl_FindHashEntry(
+ &ewPtr->body.ew.sharedTextPtr->windowTable,
+ Tk_PathName(client->tkwin));
+ }
TkTextWinFreeClient(hPtr, client);
client = next;
}
ewPtr->body.ew.clients = NULL;
-
+
Tk_FreeConfigOptions((char *) &ewPtr->body.ew, ewPtr->body.ew.optionTable,
- NULL);
-
- /* Free up all memory allocated */
+ NULL);
+
+ /*
+ * Free up all memory allocated
+ */
+
ckfree((char *) ewPtr);
-
return 0;
}
@@ -771,9 +777,8 @@ EmbWinDeleteProc(ewPtr, linePtr, treeGone)
*
* EmbWinCleanupProc --
*
- * This procedure is invoked by the B-tree code whenever a
- * segment containing an embedded window is moved from one
- * line to another.
+ * This function is invoked by the B-tree code whenever a segment
+ * containing an embedded window is moved from one line to another.
*
* Results:
* None.
@@ -785,9 +790,9 @@ EmbWinDeleteProc(ewPtr, linePtr, treeGone)
*/
static TkTextSegment *
-EmbWinCleanupProc(ewPtr, linePtr)
- TkTextSegment *ewPtr; /* Mark segment that's being moved. */
- TkTextLine *linePtr; /* Line that now contains segment. */
+EmbWinCleanupProc(
+ TkTextSegment *ewPtr, /* Mark segment that's being moved. */
+ TkTextLine *linePtr) /* Line that now contains segment. */
{
ewPtr->body.ew.linePtr = linePtr;
return ewPtr;
@@ -798,12 +803,11 @@ EmbWinCleanupProc(ewPtr, linePtr)
*
* EmbWinLayoutProc --
*
- * This procedure is the "layoutProc" for embedded window
- * segments.
+ * This function is the "layoutProc" for embedded window segments.
*
* Results:
- * 1 is returned to indicate that the segment should be
- * displayed. The chunkPtr structure is filled in.
+ * 1 is returned to indicate that the segment should be displayed. The
+ * chunkPtr structure is filled in.
*
* Side effects:
* None, except for filling in chunkPtr.
@@ -813,29 +817,29 @@ EmbWinCleanupProc(ewPtr, linePtr)
/*ARGSUSED*/
static int
-EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
- noCharsYet, wrapMode, chunkPtr)
- TkText *textPtr; /* Text widget being layed out. */
- TkTextIndex *indexPtr; /* Identifies first character in chunk. */
- TkTextSegment *ewPtr; /* Segment corresponding to indexPtr. */
- int offset; /* Offset within segPtr corresponding to
+EmbWinLayoutProc(
+ TkText *textPtr, /* Text widget being layed out. */
+ TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TkTextSegment *ewPtr, /* Segment corresponding to indexPtr. */
+ int offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
- int maxX; /* Chunk must not occupy pixels at this
+ int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- int maxChars; /* Chunk must not include more than this
- * many characters. */
- int noCharsYet; /* Non-zero means no characters have been
+ int maxChars, /* Chunk must not include more than this many
+ * characters. */
+ int noCharsYet, /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode; /* Wrap mode to use for line: TEXT_WRAPMODE_CHAR,
- * TEXT_WRAPMODE_NONE, or TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr;
- /* Structure to fill in with information
- * about this chunk. The x field has already
- * been set by the caller. */
+ TkWrapMode wrapMode, /* Wrap mode to use for line:
+ * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
+ * TEXT_WRAPMODE_WORD. */
+ register TkTextDispChunk *chunkPtr)
+ /* Structure to fill in with information about
+ * this chunk. The x field has already been
+ * set by the caller. */
{
int width, height;
TkTextEmbWindowClient *client;
-
+
if (offset != 0) {
Tcl_Panic("Non-zero offset in EmbWinLayoutProc");
}
@@ -846,9 +850,9 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
} else {
ewPtr->body.ew.tkwin = client->tkwin;
}
-
+
if ((ewPtr->body.ew.tkwin == NULL) && (ewPtr->body.ew.create != NULL)) {
- int code, new;
+ int code, isNew;
Tcl_DString name;
Tk_Window ancestor;
Tcl_HashEntry *hPtr;
@@ -858,66 +862,63 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
Tcl_DString *dsPtr = NULL;
before = ewPtr->body.ew.create;
-
+
/*
- * Find everything up to the next % character and append it
- * to the result string.
+ * Find everything up to the next % character and append it to the
+ * result string.
*/
+
string = before;
while (*string != 0) {
- if (*string == '%') {
- if (string[1] == '%' || string[1] == 'W') {
- if (dsPtr == NULL) {
- Tcl_DStringInit(&buf);
- dsPtr = &buf;
- }
- if (string != before) {
- Tcl_DStringAppend(dsPtr, before,
- (int) (string-before));
- before = string;
- }
- if (string[1] == '%') {
- Tcl_DStringAppend(dsPtr, "%", 1);
- } else {
- /*
- * Substitute string as proper Tcl
- * list element.
- */
- int spaceNeeded, cvtFlags, length;
- CONST char *str = Tk_PathName(textPtr->tkwin);
- spaceNeeded = Tcl_ScanElement(str, &cvtFlags);
- length = Tcl_DStringLength(dsPtr);
- Tcl_DStringSetLength(dsPtr, length + spaceNeeded);
- spaceNeeded = Tcl_ConvertElement(str,
- Tcl_DStringValue(dsPtr) + length,
- cvtFlags | TCL_DONT_USE_BRACES);
- Tcl_DStringSetLength(dsPtr, length + spaceNeeded);
- }
- before += 2;
- string++;
+ if ((*string == '%') && (string[1] == '%' || string[1] == 'W')) {
+ if (dsPtr == NULL) {
+ Tcl_DStringInit(&buf);
+ dsPtr = &buf;
}
+ if (string != before) {
+ Tcl_DStringAppend(dsPtr, before, (int) (string-before));
+ before = string;
+ }
+ if (string[1] == '%') {
+ Tcl_DStringAppend(dsPtr, "%", 1);
+ } else {
+ /*
+ * Substitute string as proper Tcl list element.
+ */
+
+ int spaceNeeded, cvtFlags, length;
+ CONST char *str = Tk_PathName(textPtr->tkwin);
+
+ spaceNeeded = Tcl_ScanElement(str, &cvtFlags);
+ length = Tcl_DStringLength(dsPtr);
+ Tcl_DStringSetLength(dsPtr, length + spaceNeeded);
+ spaceNeeded = Tcl_ConvertElement(str,
+ Tcl_DStringValue(dsPtr) + length,
+ cvtFlags | TCL_DONT_USE_BRACES);
+ Tcl_DStringSetLength(dsPtr, length + spaceNeeded);
+ }
+ before += 2;
+ string++;
}
string++;
}
-
+
/*
- * The window doesn't currently exist. Create it by evaluating
- * the creation script. The script must return the window's
- * path name: look up that name to get back to the window
- * token. Then register ourselves as the geometry manager for
- * the window.
+ * The window doesn't currently exist. Create it by evaluating the
+ * creation script. The script must return the window's path name:
+ * look up that name to get back to the window token. Then register
+ * ourselves as the geometry manager for the window.
*/
if (dsPtr != NULL) {
- Tcl_DStringAppend(dsPtr, before,
- (int) (string-before));
+ Tcl_DStringAppend(dsPtr, before, (int) (string-before));
code = Tcl_GlobalEval(textPtr->interp, Tcl_DStringValue(dsPtr));
Tcl_DStringFree(dsPtr);
} else {
code = Tcl_GlobalEval(textPtr->interp, ewPtr->body.ew.create);
}
if (code != TCL_OK) {
- createError:
+ createError:
Tcl_BackgroundError(textPtr->interp);
goto gotWindow;
}
@@ -930,16 +931,15 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
if (ewPtr->body.ew.tkwin == NULL) {
goto createError;
}
- for (ancestor = textPtr->tkwin; ;
- ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = textPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == Tk_Parent(ewPtr->body.ew.tkwin)) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
- badMaster:
+ badMaster:
Tcl_AppendResult(textPtr->interp, "can't embed ",
Tk_PathName(ewPtr->body.ew.tkwin), " relative to ",
- Tk_PathName(textPtr->tkwin), (char *) NULL);
+ Tk_PathName(textPtr->tkwin), NULL);
Tcl_BackgroundError(textPtr->interp);
ewPtr->body.ew.tkwin = NULL;
goto gotWindow;
@@ -949,13 +949,15 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
|| (textPtr->tkwin == ewPtr->body.ew.tkwin)) {
goto badMaster;
}
-
+
if (client == NULL) {
- /*
- * We just used a '-create' script to make a new window,
- * which we now need to add to our client list.
+ /*
+ * We just used a '-create' script to make a new window, which we
+ * now need to add to our client list.
*/
- client = (TkTextEmbWindowClient*) ckalloc(sizeof(TkTextEmbWindowClient));
+
+ client = (TkTextEmbWindowClient *)
+ ckalloc(sizeof(TkTextEmbWindowClient));
client->next = ewPtr->body.ew.clients;
client->textPtr = textPtr;
client->tkwin = NULL;
@@ -964,7 +966,7 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
client->parent = ewPtr;
ewPtr->body.ew.clients = client;
}
-
+
client->tkwin = ewPtr->body.ew.tkwin;
Tk_ManageGeometry(client->tkwin, &textGeomType,
(ClientData) client);
@@ -972,15 +974,14 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
EmbWinStructureProc, (ClientData) client);
/*
- * Special trick! Must enter into the hash table *after*
- * calling Tk_ManageGeometry: if the window was already managed
- * elsewhere in this text, the Tk_ManageGeometry call will cause
- * the entry to be removed, which could potentially lose the new
- * entry.
+ * Special trick! Must enter into the hash table *after* calling
+ * Tk_ManageGeometry: if the window was already managed elsewhere in
+ * this text, the Tk_ManageGeometry call will cause the entry to be
+ * removed, which could potentially lose the new entry.
*/
hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->windowTable,
- Tk_PathName(client->tkwin), &new);
+ Tk_PathName(client->tkwin), &isNew);
Tcl_SetHashValue(hPtr, ewPtr);
}
@@ -988,7 +989,7 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
* See if there's room for this window on this line.
*/
- gotWindow:
+ gotWindow:
if (ewPtr->body.ew.tkwin == NULL) {
width = 0;
height = 0;
@@ -1007,7 +1008,7 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
chunkPtr->displayProc = TkTextEmbWinDisplayProc;
chunkPtr->undisplayProc = EmbWinUndisplayProc;
- chunkPtr->measureProc = (Tk_ChunkMeasureProc *) NULL;
+ chunkPtr->measureProc = NULL;
chunkPtr->bboxProc = EmbWinBboxProc;
chunkPtr->numBytes = 1;
if (ewPtr->body.ew.align == ALIGN_BASELINE) {
@@ -1024,7 +1025,7 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
chunkPtr->breakIndex = 1;
chunkPtr->clientData = (ClientData) ewPtr;
if (client != NULL) {
- client->chunkCount += 1;
+ client->chunkCount += 1;
}
return 1;
}
@@ -1034,23 +1035,23 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
*
* EmbWinCheckProc --
*
- * This procedure is invoked by the B-tree code to perform
- * consistency checks on embedded windows.
+ * This function is invoked by the B-tree code to perform consistency
+ * checks on embedded windows.
*
* Results:
* None.
*
* Side effects:
- * The procedure panics if it detects anything wrong with
- * the embedded window.
+ * The function panics if it detects anything wrong with the embedded
+ * window.
*
*--------------------------------------------------------------
*/
static void
-EmbWinCheckProc(ewPtr, linePtr)
- TkTextSegment *ewPtr; /* Segment to check. */
- TkTextLine *linePtr; /* Line containing segment. */
+EmbWinCheckProc(
+ TkTextSegment *ewPtr, /* Segment to check. */
+ TkTextLine *linePtr) /* Line containing segment. */
{
if (ewPtr->nextPtr == NULL) {
Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line");
@@ -1065,59 +1066,54 @@ EmbWinCheckProc(ewPtr, linePtr)
*
* TkTextEmbWinDisplayProc --
*
- * This procedure is invoked by the text displaying code
- * when it is time to actually draw an embedded window
- * chunk on the screen.
+ * This function is invoked by the text displaying code when it is time
+ * to actually draw an embedded window chunk on the screen.
*
* Results:
* None.
*
* Side effects:
- * The embedded window gets moved to the correct location
- * and mapped onto the screen.
+ * The embedded window gets moved to the correct location and mapped onto
+ * the screen.
*
*--------------------------------------------------------------
*/
void
-TkTextEmbWinDisplayProc(textPtr, chunkPtr, x, y, lineHeight, baseline,
- display, dst, screenY)
- TkText *textPtr; /* Information about text widget. */
- TkTextDispChunk *chunkPtr; /* Chunk that is to be drawn. */
- int x; /* X-position in dst at which to
- * draw this chunk (differs from
- * the x-position in the chunk because
- * of scrolling). */
- int y; /* Top of rectangular bounding box
- * for line: tells where to draw this
- * chunk in dst (x-position is in
- * the chunk itself). */
- int lineHeight; /* Total height of line. */
- int baseline; /* Offset of baseline from y. */
- Display *display; /* Display to use for drawing
- * (unused). */
- Drawable dst; /* Pixmap or window in which to draw
- * (unused). */
- int screenY; /* Y-coordinate in text window that
- * corresponds to y. */
+TkTextEmbWinDisplayProc(
+ TkText *textPtr, /* Information about text widget. */
+ TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ int x, /* X-position in dst at which to draw this
+ * chunk (differs from the x-position in the
+ * chunk because of scrolling). */
+ int y, /* Top of rectangular bounding box for line:
+ * tells where to draw this chunk in dst
+ * (x-position is in the chunk itself). */
+ int lineHeight, /* Total height of line. */
+ int baseline, /* Offset of baseline from y. */
+ Display *display, /* Display to use for drawing (unused). */
+ Drawable dst, /* Pixmap or window in which to draw
+ * (unused). */
+ int screenY) /* Y-coordinate in text window that
+ * corresponds to y. */
{
int lineX, windowX, windowY, width, height;
Tk_Window tkwin;
TkTextSegment *ewPtr = (TkTextSegment*) chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
-
+
if (client == NULL) {
- return;
+ return;
}
-
+
tkwin = client->tkwin;
if (tkwin == NULL) {
return;
}
-
+
if ((x + chunkPtr->width) <= 0) {
/*
- * The window is off-screen; just unmap it.
+ * The window is off-screen; just unmap it.
*/
if (textPtr->tkwin != Tk_Parent(tkwin)) {
@@ -1129,11 +1125,11 @@ TkTextEmbWinDisplayProc(textPtr, chunkPtr, x, y, lineHeight, baseline,
}
/*
- * Compute the window's location and size in the text widget, taking
- * into account the align and stretch values for the window.
+ * Compute the window's location and size in the text widget, taking into
+ * account the align and stretch values for the window.
*/
- EmbWinBboxProc(textPtr, chunkPtr, 0, screenY, lineHeight, baseline,
+ EmbWinBboxProc(textPtr, chunkPtr, 0, screenY, lineHeight, baseline,
&lineX, &windowY, &width, &height);
windowX = lineX - chunkPtr->x + x;
@@ -1146,7 +1142,7 @@ TkTextEmbWinDisplayProc(textPtr, chunkPtr, x, y, lineHeight, baseline,
Tk_MapWindow(tkwin);
} else {
Tk_MaintainGeometry(tkwin, textPtr->tkwin,
- windowX, windowY, width, height);
+ windowX, windowY, width, height);
}
/*
@@ -1161,9 +1157,9 @@ TkTextEmbWinDisplayProc(textPtr, chunkPtr, x, y, lineHeight, baseline,
*
* EmbWinUndisplayProc --
*
- * This procedure is called when the chunk for an embedded
- * window is no longer going to be displayed. It arranges
- * for the window associated with the chunk to be unmapped.
+ * This function is called when the chunk for an embedded window is no
+ * longer going to be displayed. It arranges for the window associated
+ * with the chunk to be unmapped.
*
* Results:
* None.
@@ -1175,24 +1171,23 @@ TkTextEmbWinDisplayProc(textPtr, chunkPtr, x, y, lineHeight, baseline,
*/
static void
-EmbWinUndisplayProc(textPtr, chunkPtr)
- TkText *textPtr; /* Overall information about text
- * widget. */
- TkTextDispChunk *chunkPtr; /* Chunk that is about to be freed. */
+EmbWinUndisplayProc(
+ TkText *textPtr, /* Overall information about text widget. */
+ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
TkTextSegment *ewPtr = (TkTextSegment*) chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
-
+
if (client == NULL) return;
-
+
client->chunkCount--;
if (client->chunkCount == 0) {
/*
* Don't unmap the window immediately, since there's a good chance
- * that it will immediately be redisplayed, perhaps even in the
- * same place. Instead, schedule the window to be unmapped later;
- * the call to EmbWinDelayedUnmap will be cancelled in the likely
- * event that the unmap becomes unnecessary.
+ * that it will immediately be redisplayed, perhaps even in the same
+ * place. Instead, schedule the window to be unmapped later; the call
+ * to EmbWinDelayedUnmap will be cancelled in the likely event that
+ * the unmap becomes unnecessary.
*/
client->displayed = 0;
@@ -1205,17 +1200,16 @@ EmbWinUndisplayProc(textPtr, chunkPtr)
*
* EmbWinBboxProc --
*
- * This procedure is called to compute the bounding box of
- * the area occupied by an embedded window.
+ * This function is called to compute the bounding box of the area
+ * occupied by an embedded window.
*
* Results:
- * There is no return value. *xPtr and *yPtr are filled in
- * with the coordinates of the upper left corner of the
- * window, and *widthPtr and *heightPtr are filled in with
- * the dimensions of the window in pixels. Note: not all
- * of the returned bbox is necessarily visible on the screen
- * (the rightmost part might be off-screen to the right,
- * and the bottommost part might be off-screen to the bottom).
+ * There is no return value. *xPtr and *yPtr are filled in with the
+ * coordinates of the upper left corner of the window, and *widthPtr and
+ * *heightPtr are filled in with the dimensions of the window in pixels.
+ * Note: not all of the returned bbox is necessarily visible on the
+ * screen (the rightmost part might be off-screen to the right, and the
+ * bottommost part might be off-screen to the bottom).
*
* Side effects:
* None.
@@ -1224,30 +1218,29 @@ EmbWinUndisplayProc(textPtr, chunkPtr)
*/
static void
-EmbWinBboxProc(textPtr, chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
- widthPtr, heightPtr)
- TkText *textPtr; /* Information about text widget. */
- TkTextDispChunk *chunkPtr; /* Chunk containing desired char. */
- int index; /* Index of desired character within
- * the chunk. */
- int y; /* Topmost pixel in area allocated
- * for this line. */
- int lineHeight; /* Total height of line. */
- int baseline; /* Location of line's baseline, in
- * pixels measured down from y. */
- int *xPtr, *yPtr; /* Gets filled in with coords of
- * character's upper-left pixel. */
- int *widthPtr; /* Gets filled in with width of
- * window, in pixels. */
- int *heightPtr; /* Gets filled in with height of
- * window, in pixels. */
+EmbWinBboxProc(
+ TkText *textPtr, /* Information about text widget. */
+ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
+ int index, /* Index of desired character within the
+ * chunk. */
+ int y, /* Topmost pixel in area allocated for this
+ * line. */
+ int lineHeight, /* Total height of line. */
+ int baseline, /* Location of line's baseline, in pixels
+ * measured down from y. */
+ int *xPtr, int *yPtr, /* Gets filled in with coords of character's
+ * upper-left pixel. */
+ int *widthPtr, /* Gets filled in with width of window, in
+ * pixels. */
+ int *heightPtr) /* Gets filled in with height of window, in
+ * pixels. */
{
Tk_Window tkwin;
TkTextSegment *ewPtr = (TkTextSegment*) chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
if (client == NULL) {
- tkwin = NULL;
+ tkwin = NULL;
} else {
tkwin = client->tkwin;
}
@@ -1267,18 +1260,18 @@ EmbWinBboxProc(textPtr, chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
}
}
switch (ewPtr->body.ew.align) {
- case ALIGN_BOTTOM:
- *yPtr = y + (lineHeight - *heightPtr - ewPtr->body.ew.padY);
- break;
- case ALIGN_CENTER:
- *yPtr = y + (lineHeight - *heightPtr)/2;
- break;
- case ALIGN_TOP:
- *yPtr = y + ewPtr->body.ew.padY;
- break;
- case ALIGN_BASELINE:
- *yPtr = y + (baseline - *heightPtr);
- break;
+ case ALIGN_BOTTOM:
+ *yPtr = y + (lineHeight - *heightPtr - ewPtr->body.ew.padY);
+ break;
+ case ALIGN_CENTER:
+ *yPtr = y + (lineHeight - *heightPtr)/2;
+ break;
+ case ALIGN_TOP:
+ *yPtr = y + ewPtr->body.ew.padY;
+ break;
+ case ALIGN_BASELINE:
+ *yPtr = y + (baseline - *heightPtr);
+ break;
}
}
@@ -1287,31 +1280,29 @@ EmbWinBboxProc(textPtr, chunkPtr, index, y, lineHeight, baseline, xPtr, yPtr,
*
* EmbWinDelayedUnmap --
*
- * This procedure is an idle handler that does the actual
- * work of unmapping an embedded window. See the comment
- * in EmbWinUndisplayProc for details.
+ * This function is an idle handler that does the actual work of
+ * unmapping an embedded window. See the comment in EmbWinUndisplayProc
+ * for details.
*
* Results:
* None.
*
* Side effects:
- * The window gets unmapped, unless its chunk reference count
- * has become non-zero again.
+ * The window gets unmapped, unless its chunk reference count has become
+ * non-zero again.
*
*--------------------------------------------------------------
*/
static void
-EmbWinDelayedUnmap(clientData)
- ClientData clientData; /* Token for the window to
- * be unmapped. */
+EmbWinDelayedUnmap(
+ ClientData clientData) /* Token for the window to be unmapped. */
{
TkTextEmbWindowClient *client = (TkTextEmbWindowClient*) clientData;
if (!client->displayed && (client->tkwin != NULL)) {
if (client->textPtr->tkwin != Tk_Parent(client->tkwin)) {
- Tk_UnmaintainGeometry(client->tkwin,
- client->textPtr->tkwin);
+ Tk_UnmaintainGeometry(client->tkwin, client->textPtr->tkwin);
} else {
Tk_UnmapWindow(client->tkwin);
}
@@ -1323,14 +1314,13 @@ EmbWinDelayedUnmap(clientData)
*
* TkTextWindowIndex --
*
- * Given the name of an embedded window within a text widget,
- * returns an index corresponding to the window's position
- * in the text.
+ * Given the name of an embedded window within a text widget, returns an
+ * index corresponding to the window's position in the text.
*
* Results:
- * The return value is 1 if there is an embedded window by
- * the given name in the text widget, 0 otherwise. If the
- * window exists, *indexPtr is filled in with its index.
+ * The return value is 1 if there is an embedded window by the given name
+ * in the text widget, 0 otherwise. If the window exists, *indexPtr is
+ * filled in with its index.
*
* Side effects:
* None.
@@ -1339,10 +1329,10 @@ EmbWinDelayedUnmap(clientData)
*/
int
-TkTextWindowIndex(textPtr, name, indexPtr)
- TkText *textPtr; /* Text widget containing window. */
- CONST char *name; /* Name of window. */
- TkTextIndex *indexPtr; /* Index information gets stored here. */
+TkTextWindowIndex(
+ TkText *textPtr, /* Text widget containing window. */
+ CONST char *name, /* Name of window. */
+ TkTextIndex *indexPtr) /* Index information gets stored here. */
{
Tcl_HashEntry *hPtr;
TkTextSegment *ewPtr;
@@ -1351,6 +1341,7 @@ TkTextWindowIndex(textPtr, name, indexPtr)
if (hPtr == NULL) {
return 0;
}
+
ewPtr = (TkTextSegment *) Tcl_GetHashValue(hPtr);
indexPtr->tree = textPtr->sharedTextPtr->tree;
indexPtr->linePtr = ewPtr->body.ew.linePtr;
@@ -1363,19 +1354,18 @@ TkTextWindowIndex(textPtr, name, indexPtr)
*
* EmbWinGetClient --
*
- * Given a text widget and a segment which contains an
- * embedded window, find the text-widget specific
- * information about the embedded window, if any.
- *
- * This procedure performs a completely linear lookup
- * for a matching data structure. If we envisage using
- * this code with dozens of peer widgets, then performance
- * could become an issue and a more sophisticated lookup
+ * Given a text widget and a segment which contains an embedded window,
+ * find the text-widget specific information about the embedded window,
+ * if any.
+ *
+ * This function performs a completely linear lookup for a matching data
+ * structure. If we envisage using this code with dozens of peer widgets,
+ * then performance could become an issue and a more sophisticated lookup
* mechanism might be desirable.
*
* Results:
- * NULL if no widget-specific info exists, otherwise
- * the structure is returned.
+ * NULL if no widget-specific info exists, otherwise the structure is
+ * returned.
*
* Side effects:
* None.
@@ -1384,18 +1374,24 @@ TkTextWindowIndex(textPtr, name, indexPtr)
*/
static TkTextEmbWindowClient*
-EmbWinGetClient(textPtr, ewPtr)
- CONST TkText *textPtr; /* Information about text widget. */
- TkTextSegment *ewPtr; /* Segment containing embedded
- * window. */
+EmbWinGetClient(
+ CONST TkText *textPtr, /* Information about text widget. */
+ TkTextSegment *ewPtr) /* Segment containing embedded window. */
{
TkTextEmbWindowClient *client = ewPtr->body.ew.clients;
while (client != NULL) {
- if (client->textPtr == textPtr) {
- return client;
- }
- client = client->next;
+ if (client->textPtr == textPtr) {
+ return client;
+ }
+ client = client->next;
}
return NULL;
}
-
+
+/*
+ * Local Variables:
+ * mode: c
+ * c-basic-offset: 4
+ * fill-column: 78
+ * End:
+ */
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 390325e..33589e7 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.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: tkWindow.c,v 1.69 2005/09/21 10:54:40 dkf Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.70 2005/11/17 10:57:35 dkf Exp $
*/
#include "tkPort.h"
@@ -721,7 +721,7 @@ NameWindow(interp, winPtr, parentPtr, name)
#define FIXED_SIZE 200
char staticSpace[FIXED_SIZE];
char *pathName;
- int new;
+ int isNew;
Tcl_HashEntry *hPtr;
int length1, length2;
@@ -791,13 +791,14 @@ NameWindow(interp, winPtr, parentPtr, name)
pathName[length1] = '.';
strcpy(pathName+length1+1, name);
}
- hPtr = Tcl_CreateHashEntry(&parentPtr->mainPtr->nameTable, pathName, &new);
+ hPtr = Tcl_CreateHashEntry(&parentPtr->mainPtr->nameTable, pathName,
+ &isNew);
if (pathName != staticSpace) {
ckfree(pathName);
}
- if (!new) {
+ if (!isNew) {
Tcl_AppendResult(interp, "window name \"", name,
- "\" already exists in parent", (char *) NULL);
+ "\" already exists in parent", NULL);
return TCL_ERROR;
}
Tcl_SetHashValue(hPtr, winPtr);
@@ -1668,7 +1669,7 @@ Tk_MakeWindowExist(tkwin)
Window parent;
Tcl_HashEntry *hPtr;
Tk_ClassCreateProc *createProc;
- int new;
+ int isNew;
if (winPtr->window != None) {
return;
@@ -1691,7 +1692,7 @@ Tk_MakeWindowExist(tkwin)
}
hPtr = Tcl_CreateHashEntry(&winPtr->dispPtr->winTable,
- (char *) winPtr->window, &new);
+ (char *) winPtr->window, &isNew);
Tcl_SetHashValue(hPtr, winPtr);
winPtr->dirtyAtts = 0;
winPtr->dirtyChanges = 0;