summaryrefslogtreecommitdiffstats
path: root/generic/tkButton.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-12-31 15:56:41 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-12-31 15:56:41 (GMT)
commit4224e39596e02ca9cf11a2c160d8f8e7b43a45f9 (patch)
treee78b5e9ecbd064bd24bc43894cd3dd4e9e075480 /generic/tkButton.c
parentccc7f53ac59980eae109a3314ba3599a8b851fb1 (diff)
parentf2b5a87d6dc6d3468828d48929583d950690a40b (diff)
downloadtk-4224e39596e02ca9cf11a2c160d8f8e7b43a45f9.zip
tk-4224e39596e02ca9cf11a2c160d8f8e7b43a45f9.tar.gz
tk-4224e39596e02ca9cf11a2c160d8f8e7b43a45f9.tar.bz2
As requested by Christian Werner/François Vogel and others: Undo many None -> 0 changes, in order to reduce the probability of merge conflicts with other branches.
Remark: Many usages of "None" in Tk are wrong, "NULL" should be used in many places where pointers are referenced in stead of XID's. Those places are corrected.
Diffstat (limited to 'generic/tkButton.c')
-rw-r--r--generic/tkButton.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 8e60428..1cf6247 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -688,7 +688,7 @@ ButtonCreate(
butPtr->textPtr = NULL;
butPtr->underline = -1;
butPtr->textVarNamePtr = NULL;
- butPtr->bitmap = 0;
+ butPtr->bitmap = None;
butPtr->imagePtr = NULL;
butPtr->image = NULL;
butPtr->selectImagePtr = NULL;
@@ -710,12 +710,12 @@ ButtonCreate(
butPtr->normalFg = NULL;
butPtr->activeFg = NULL;
butPtr->disabledFg = NULL;
- butPtr->normalTextGC = 0;
- butPtr->activeTextGC = 0;
- butPtr->disabledGC = 0;
- butPtr->stippleGC = 0;
- butPtr->gray = 0;
- butPtr->copyGC = 0;
+ butPtr->normalTextGC = NULL;
+ butPtr->activeTextGC = NULL;
+ butPtr->disabledGC = NULL;
+ butPtr->stippleGC = NULL;
+ butPtr->gray = None;
+ butPtr->copyGC = NULL;
butPtr->widthPtr = NULL;
butPtr->width = 0;
butPtr->heightPtr = NULL;
@@ -740,7 +740,7 @@ ButtonCreate(
butPtr->onValuePtr = NULL;
butPtr->offValuePtr = NULL;
butPtr->tristateValuePtr = NULL;
- butPtr->cursor = 0;
+ butPtr->cursor = NULL;
butPtr->takeFocusPtr = NULL;
butPtr->commandPtr = NULL;
butPtr->flags = 0;
@@ -972,37 +972,37 @@ DestroyButton(
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonTextVarProc, butPtr);
}
- if (butPtr->image) {
+ if (butPtr->image != NULL) {
Tk_FreeImage(butPtr->image);
}
- if (butPtr->selectImage) {
+ if (butPtr->selectImage != NULL) {
Tk_FreeImage(butPtr->selectImage);
}
- if (butPtr->tristateImage) {
+ if (butPtr->tristateImage != NULL) {
Tk_FreeImage(butPtr->tristateImage);
}
- if (butPtr->normalTextGC) {
+ if (butPtr->normalTextGC != None) {
Tk_FreeGC(butPtr->display, butPtr->normalTextGC);
}
- if (butPtr->activeTextGC) {
+ if (butPtr->activeTextGC != None) {
Tk_FreeGC(butPtr->display, butPtr->activeTextGC);
}
- if (butPtr->disabledGC) {
+ if (butPtr->disabledGC != None) {
Tk_FreeGC(butPtr->display, butPtr->disabledGC);
}
- if (butPtr->stippleGC) {
+ if (butPtr->stippleGC != None) {
Tk_FreeGC(butPtr->display, butPtr->stippleGC);
}
- if (butPtr->gray) {
+ if (butPtr->gray != None) {
Tk_FreeBitmap(butPtr->display, butPtr->gray);
}
- if (butPtr->copyGC) {
+ if (butPtr->copyGC != None) {
Tk_FreeGC(butPtr->display, butPtr->copyGC);
}
- if (butPtr->textLayout) {
+ if (butPtr->textLayout != NULL) {
Tk_FreeTextLayout(butPtr->textLayout);
}
- if (butPtr->selVarNamePtr) {
+ if (butPtr->selVarNamePtr != NULL) {
Tcl_UntraceVar2(butPtr->interp, Tcl_GetString(butPtr->selVarNamePtr),
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
ButtonVarProc, butPtr);
@@ -1187,7 +1187,7 @@ ConfigureButton(
* don't go to zero and cause image data to be discarded.
*/
- if (butPtr->imagePtr) {
+ if (butPtr->imagePtr != NULL) {
image = Tk_GetImage(butPtr->interp, butPtr->tkwin,
Tcl_GetString(butPtr->imagePtr), ButtonImageProc,
butPtr);
@@ -1201,7 +1201,7 @@ ConfigureButton(
Tk_FreeImage(butPtr->image);
}
butPtr->image = image;
- if (butPtr->selectImagePtr) {
+ if (butPtr->selectImagePtr != NULL) {
image = Tk_GetImage(butPtr->interp, butPtr->tkwin,
Tcl_GetString(butPtr->selectImagePtr),
ButtonSelectImageProc, butPtr);
@@ -1211,7 +1211,7 @@ ConfigureButton(
} else {
image = NULL;
}
- if (butPtr->selectImage) {
+ if (butPtr->selectImage != NULL) {
Tk_FreeImage(butPtr->selectImage);
}
butPtr->selectImage = image;
@@ -1231,7 +1231,7 @@ ConfigureButton(
butPtr->tristateImage = image;
haveImage = 0;
- if (butPtr->imagePtr || butPtr->bitmap) {
+ if (butPtr->imagePtr != NULL || butPtr->bitmap != None) {
haveImage = 1;
}
if ((!haveImage || butPtr->compound != COMPOUND_NONE)
@@ -1246,14 +1246,14 @@ ConfigureButton(
namePtr = butPtr->textVarNamePtr;
valuePtr = Tcl_ObjGetVar2(interp, namePtr, NULL, TCL_GLOBAL_ONLY);
- if (!valuePtr) {
+ if (valuePtr == NULL) {
if (Tcl_ObjSetVar2(interp, namePtr, NULL, butPtr->textPtr,
TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG)
== NULL) {
continue;
}
} else {
- if (butPtr->textPtr) {
+ if (butPtr->textPtr != NULL) {
Tcl_DecrRefCount(butPtr->textPtr);
}
butPtr->textPtr = valuePtr;
@@ -1261,7 +1261,7 @@ ConfigureButton(
}
}
- if (butPtr->bitmap || butPtr->imagePtr) {
+ if ((butPtr->bitmap != None) || (butPtr->imagePtr != NULL)) {
/*
* The button must display the contents of an image or bitmap.
*/
@@ -1367,17 +1367,17 @@ TkButtonWorldChanged(
gcValues.graphics_exposures = False;
mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures;
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
- if (butPtr->normalTextGC) {
+ if (butPtr->normalTextGC != None) {
Tk_FreeGC(butPtr->display, butPtr->normalTextGC);
}
butPtr->normalTextGC = newGC;
- if (butPtr->activeFg) {
+ if (butPtr->activeFg != NULL) {
gcValues.foreground = butPtr->activeFg->pixel;
gcValues.background = Tk_3DBorderColor(butPtr->activeBorder)->pixel;
mask = GCForeground | GCBackground | GCFont;
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
- if (butPtr->activeTextGC) {
+ if (butPtr->activeTextGC != None) {
Tk_FreeGC(butPtr->display, butPtr->activeTextGC);
}
butPtr->activeTextGC = newGC;
@@ -1389,13 +1389,13 @@ TkButtonWorldChanged(
* Create the GC that can be used for stippling
*/
- if (!butPtr->stippleGC) {
+ if (butPtr->stippleGC == None) {
gcValues.foreground = gcValues.background;
mask = GCForeground;
- if (!butPtr->gray) {
+ if (butPtr->gray == None) {
butPtr->gray = Tk_GetBitmap(NULL, butPtr->tkwin, "gray50");
}
- if (butPtr->gray) {
+ if (butPtr->gray != None) {
gcValues.fill_style = FillStippled;
gcValues.stipple = butPtr->gray;
mask |= GCFillStyle | GCStipple;
@@ -1409,18 +1409,18 @@ TkButtonWorldChanged(
*/
mask = GCForeground | GCBackground | GCFont;
- if (butPtr->disabledFg) {
+ if (butPtr->disabledFg != NULL) {
gcValues.foreground = butPtr->disabledFg->pixel;
} else {
gcValues.foreground = gcValues.background;
}
newGC = Tk_GetGC(butPtr->tkwin, mask, &gcValues);
- if (butPtr->disabledGC) {
+ if (butPtr->disabledGC != None) {
Tk_FreeGC(butPtr->display, butPtr->disabledGC);
}
butPtr->disabledGC = newGC;
- if (!butPtr->copyGC) {
+ if (butPtr->copyGC == None) {
butPtr->copyGC = Tk_GetGC(butPtr->tkwin, 0, &gcValues);
}