diff options
-rw-r--r-- | generic/tkButton.c | 24 | ||||
-rw-r--r-- | generic/tkInt.h | 3 | ||||
-rw-r--r-- | generic/tkMenubutton.c | 4 | ||||
-rw-r--r-- | generic/tkMessage.c | 42 | ||||
-rw-r--r-- | library/button.tcl | 6 | ||||
-rw-r--r-- | library/tk.tcl | 50 | ||||
-rw-r--r-- | macosx/tkMacOSXButton.c | 292 | ||||
-rw-r--r-- | tests/button.test | 8 | ||||
-rw-r--r-- | tests/menubut.test | 8 | ||||
-rw-r--r-- | win/tkWinButton.c | 16 |
10 files changed, 226 insertions, 227 deletions
diff --git a/generic/tkButton.c b/generic/tkButton.c index cbbe880..d129bca 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -783,7 +783,7 @@ ButtonWidgetObjCmd( Tcl_Obj *objPtr; if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); + Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } result = Tcl_GetIndexFromObjStruct(interp, objv[1], commandNames[butPtr->type], @@ -1129,13 +1129,13 @@ ConfigureButton( valuePtr = Tcl_ObjGetVar2(interp, namePtr, NULL, TCL_GLOBAL_ONLY); butPtr->flags &= ~SELECTED; - butPtr->flags &= ~TRISTATED; + butPtr->flags &= ~TRISTATED; if (valuePtr != NULL) { const char *value = Tcl_GetString(valuePtr); if (strcmp(value, Tcl_GetString(butPtr->onValuePtr)) == 0) { butPtr->flags |= SELECTED; } else if (strcmp(value, - Tcl_GetString(butPtr->tristateValuePtr)) == 0) { + Tcl_GetString(butPtr->tristateValuePtr)) == 0) { butPtr->flags |= TRISTATED; /* @@ -1148,7 +1148,7 @@ ConfigureButton( Tcl_GetString(butPtr->offValuePtr)) == 0) { butPtr->flags &= ~TRISTATED; } - } + } } else { if (Tcl_ObjSetVar2(interp, namePtr, NULL, (butPtr->type == TYPE_CHECK_BUTTON) @@ -1258,13 +1258,13 @@ ConfigureButton( if (Tk_GetPixelsFromObj(interp, butPtr->tkwin, butPtr->widthPtr, &butPtr->width) != TCL_OK) { widthError: - Tcl_AddErrorInfo(interp, "\n (processing -width option)"); + Tcl_AddErrorInfo(interp, "\n (processing \"-width\" option)"); continue; } if (Tk_GetPixelsFromObj(interp, butPtr->tkwin, butPtr->heightPtr, &butPtr->height) != TCL_OK) { heightError: - Tcl_AddErrorInfo(interp, "\n (processing -height option)"); + Tcl_AddErrorInfo(interp, "\n (processing \"-height\" option)"); continue; } } else { @@ -1656,7 +1656,7 @@ ButtonVarProc( return NULL; } butPtr->flags |= SELECTED; - butPtr->flags &= ~TRISTATED; + butPtr->flags &= ~TRISTATED; } else if (butPtr->offValuePtr && strcmp(value, Tcl_GetString(butPtr->offValuePtr)) == 0) { if (!(butPtr->flags & (SELECTED | TRISTATED))) { @@ -1664,11 +1664,11 @@ ButtonVarProc( } butPtr->flags &= ~(SELECTED | TRISTATED); } else if (strcmp(value, Tcl_GetString(butPtr->tristateValuePtr)) == 0) { - if (butPtr->flags & TRISTATED) { - return NULL; - } - butPtr->flags |= TRISTATED; - butPtr->flags &= ~SELECTED; + if (butPtr->flags & TRISTATED) { + return NULL; + } + butPtr->flags |= TRISTATED; + butPtr->flags &= ~SELECTED; } else if (butPtr->flags & (SELECTED | TRISTATED)) { butPtr->flags &= ~(SELECTED | TRISTATED); } else { diff --git a/generic/tkInt.h b/generic/tkInt.h index a9da4ec..dc2347c 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -971,8 +971,7 @@ typedef struct { # ifndef XMaxTransChars # define XMaxTransChars 7 # endif - char trans_chars[XMaxTransChars]; - /* translated characters */ + char trans_chars[XMaxTransChars]; /* translated characters */ unsigned char nbytes; #elif !defined(MAC_OSX_TK) char *charValuePtr; /* A pointer to a string that holds the key's diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 3f1f4e7..0dd8396 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -570,13 +570,13 @@ ConfigureMenuButton( if (Tk_GetPixels(interp, mbPtr->tkwin, mbPtr->widthString, &mbPtr->width) != TCL_OK) { widthError: - Tcl_AddErrorInfo(interp, "\n (processing -width option)"); + Tcl_AddErrorInfo(interp, "\n (processing \"-width\" option)"); continue; } if (Tk_GetPixels(interp, mbPtr->tkwin, mbPtr->heightString, &mbPtr->height) != TCL_OK) { heightError: - Tcl_AddErrorInfo(interp, "\n (processing -height option)"); + Tcl_AddErrorInfo(interp, "\n (processing \"-height\" option)"); continue; } } else { diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 07dad51..64531b6 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -853,27 +853,27 @@ MessageTextVarProc( */ if (flags & TCL_TRACE_UNSETS) { - if (!Tcl_InterpDeleted(interp) && msgPtr->textVarName) { - void *probe = NULL; - - do { - probe = Tcl_VarTraceInfo(interp, - msgPtr->textVarName, - TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MessageTextVarProc, probe); - if (probe == (void *)msgPtr) { - break; - } - } while (probe); - if (probe) { - /* - * We were able to fetch the unset trace for our - * textVarName, which means it is not unset and not - * the cause of this unset trace. Instead some outdated - * former variable must be, and we should ignore it. - */ - return NULL; - } + if (!Tcl_InterpDeleted(interp) && msgPtr->textVarName) { + void *probe = NULL; + + do { + probe = Tcl_VarTraceInfo(interp, + msgPtr->textVarName, + TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, + MessageTextVarProc, probe); + if (probe == (void *)msgPtr) { + break; + } + } while (probe); + if (probe) { + /* + * We were able to fetch the unset trace for our + * textVarName, which means it is not unset and not + * the cause of this unset trace. Instead some outdated + * former variable must be, and we should ignore it. + */ + return NULL; + } Tcl_SetVar2(interp, msgPtr->textVarName, NULL, msgPtr->string, TCL_GLOBAL_ONLY); Tcl_TraceVar2(interp, msgPtr->textVarName, NULL, diff --git a/library/button.tcl b/library/button.tcl index 4be16b1..03d70c5 100644 --- a/library/button.tcl +++ b/library/button.tcl @@ -752,9 +752,9 @@ proc ::tk::CheckLeave {w} { # has not changed it in the meantime. if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} { - if {[$w cget -selectcolor] eq $Priv($w,selectcolor) - || ([info exist Priv($w,aselectcolor)] && - [$w cget -selectcolor] eq $Priv($w,aselectcolor))} { + if {[$w cget -selectcolor] eq $Priv($w,selectcolor) + || ([info exist Priv($w,aselectcolor)] && + [$w cget -selectcolor] eq $Priv($w,aselectcolor))} { $w configure -selectcolor $Priv($w,selectcolor) } } diff --git a/library/tk.tcl b/library/tk.tcl index 27fa1de..7153974 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -18,28 +18,28 @@ namespace eval ::tk { # Set up the msgcat commands namespace eval msgcat { namespace export mc mcmax - if {[interp issafe] || [catch {package require msgcat}]} { - # The msgcat package is not available. Supply our own - # minimal replacement. - proc mc {src args} { - return [format $src {*}$args] - } - proc mcmax {args} { - set max 0 - foreach string $args { - set len [string length $string] - if {$len>$max} { - set max $len - } - } - return $max - } - } else { - # Get the commands from the msgcat package that Tk uses. - namespace import ::msgcat::mc - namespace import ::msgcat::mcmax - ::msgcat::mcload [file join $::tk_library msgs] - } + if {[interp issafe] || [catch {package require msgcat}]} { + # The msgcat package is not available. Supply our own + # minimal replacement. + proc mc {src args} { + return [format $src {*}$args] + } + proc mcmax {args} { + set max 0 + foreach string $args { + set len [string length $string] + if {$len>$max} { + set max $len + } + } + return $max + } + } else { + # Get the commands from the msgcat package that Tk uses. + namespace import ::msgcat::mc + namespace import ::msgcat::mcmax + ::msgcat::mcload [file join $::tk_library msgs] + } } namespace import ::tk::msgcat::* } @@ -498,7 +498,7 @@ switch -exact -- [tk windowingsystem] { if {$::tk_library ne ""} { proc ::tk::SourceLibFile {file} { - namespace eval :: [list source -encoding utf-8 [file join $::tk_library $file.tcl]] + namespace eval :: [list source -encoding utf-8 [file join $::tk_library $file.tcl]] } namespace eval ::tk { SourceLibFile icons @@ -724,8 +724,8 @@ if {[tk windowingsystem] eq "aqua"} { #This procedure is required to silence warnings generated #by inline AppleScript execution. proc ::tk::mac::GetDynamicSdef {} { - puts "" - } + puts "" + } } if {[info commands ::tk::endOfWord] eq ""} { diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 26d0c33..797fe4e 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -208,26 +208,26 @@ TkpDisplayButton( Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); } - /* + /* * Display image or bitmap or text for labels or custom controls. */ DrawButtonImageAndText(butPtr); - needhighlight = 1; + needhighlight = 1; } else { - /* + /* * Draw the native portion of the buttons. */ - TkMacOSXDrawButton(macButtonPtr, dpPtr->gc, pixmap); + TkMacOSXDrawButton(macButtonPtr, dpPtr->gc, pixmap); - /* + /* * Ask for the highlight border, if needed. */ - if (butPtr->highlightWidth < 3) { - needhighlight = 1; - } + if (butPtr->highlightWidth < 3) { + needhighlight = 1; + } } /* @@ -236,7 +236,7 @@ TkpDisplayButton( if (needhighlight) { GC gc = NULL; - if ((butPtr->flags & GOT_FOCUS) && butPtr->highlightColorPtr) { + if ((butPtr->flags & GOT_FOCUS) && butPtr->highlightColorPtr) { gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap); } else if (butPtr->type == TYPE_LABEL) { gc = Tk_GCForColor(Tk_3DBorderColor(butPtr->highlightBorder), pixmap); @@ -368,7 +368,7 @@ TkpComputeButtonGeometry( height += 2; } } else { /* Text only */ - width = txtWidth + butPtr->indicatorSpace; + width = txtWidth + butPtr->indicatorSpace; height = txtHeight; if (butPtr->width > 0) { charWidth = Tk_TextWidth(butPtr->tkfont, "0", 1); @@ -396,7 +396,7 @@ TkpComputeButtonGeometry( width += 12; } if (mbPtr->btnkind == kThemePushButton) { - HIRect tmpRect; + HIRect tmpRect; HIRect contBounds; /* @@ -407,13 +407,13 @@ TkpComputeButtonGeometry( */ tmpRect = CGRectMake(0, 0, width + 2*HI_PADX, height + 2*HI_PADY); - HIThemeGetButtonContentBounds(&tmpRect, &mbPtr->drawinfo, &contBounds); - if (height < contBounds.size.height) { + HIThemeGetButtonContentBounds(&tmpRect, &mbPtr->drawinfo, &contBounds); + if (height < contBounds.size.height) { height = (int)contBounds.size.height; - } - if (width < contBounds.size.width) { + } + if (width < contBounds.size.width) { width = (int)contBounds.size.width; - } + } height += 2*HI_PADY; width += 2*HI_PADX; } @@ -453,31 +453,31 @@ DrawButtonImageAndText( DrawParams *dpPtr = &mbPtr->drawParams; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { - return; + return; } pixmap = (Pixmap) Tk_WindowId(tkwin); if (butPtr->image != NULL) { - Tk_SizeOfImage(butPtr->image, &width, &height); - haveImage = 1; + Tk_SizeOfImage(butPtr->image, &width, &height); + haveImage = 1; } else if (butPtr->bitmap != None) { - Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); - haveImage = 1; + Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); + haveImage = 1; } imageWidth = width; imageHeight = height; if (mbPtr->drawinfo.state == kThemeStatePressed) { - pressed = 1; + pressed = 1; } haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0); if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) { /* Image and Text */ - int x, y; + int x, y; - switch ((enum compound) butPtr->compound) { + switch ((enum compound) butPtr->compound) { case COMPOUND_TOP: case COMPOUND_BOTTOM: /* Image is above or below text */ @@ -526,27 +526,27 @@ DrawButtonImageAndText( break; } - TkComputeAnchor(butPtr->anchor, tkwin, - butPtr->padX + butPtr->borderWidth, - butPtr->padY + butPtr->borderWidth, - fullWidth + butPtr->indicatorSpace, fullHeight, &x, &y); + TkComputeAnchor(butPtr->anchor, tkwin, + butPtr->padX + butPtr->borderWidth, + butPtr->padY + butPtr->borderWidth, + fullWidth + butPtr->indicatorSpace, fullHeight, &x, &y); x += butPtr->indicatorSpace; - if (dpPtr->relief == TK_RELIEF_SUNKEN) { - x += dpPtr->offset; - y += dpPtr->offset; - } else if (dpPtr->relief == TK_RELIEF_RAISED) { - x -= dpPtr->offset; - y -= dpPtr->offset; - } - if (pressed) { - x += dpPtr->offset; - y += dpPtr->offset; - } - imageXOffset += x; - imageYOffset += y; - - if (butPtr->image != NULL) { + if (dpPtr->relief == TK_RELIEF_SUNKEN) { + x += dpPtr->offset; + y += dpPtr->offset; + } else if (dpPtr->relief == TK_RELIEF_RAISED) { + x -= dpPtr->offset; + y -= dpPtr->offset; + } + if (pressed) { + x += dpPtr->offset; + y += dpPtr->offset; + } + imageXOffset += x; + imageYOffset += y; + + if (butPtr->image != NULL) { if ((butPtr->selectImage != NULL) && (butPtr->flags & SELECTED)) { Tk_RedrawImage(butPtr->selectImage, 0, 0, @@ -559,29 +559,29 @@ DrawButtonImageAndText( Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); } - } else { + } else { XSetClipOrigin(butPtr->display, dpPtr->gc, imageXOffset, imageYOffset); XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc, 0, 0, (unsigned int) width, (unsigned int) height, imageXOffset, imageYOffset, 1); XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); - } + } y += 1; /* Tweak to match native buttons. */ - Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, + Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1); - Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc, - butPtr->textLayout, - x + textXOffset, y + textYOffset, - butPtr->underline); + Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc, + butPtr->textLayout, + x + textXOffset, y + textYOffset, + butPtr->underline); } else if (haveImage) { /* Image only */ - int x = 0, y; + int x = 0, y; TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX + butPtr->borderWidth, butPtr->padY + butPtr->borderWidth, width + butPtr->indicatorSpace, height, &x, &y); - x += butPtr->indicatorSpace; + x += butPtr->indicatorSpace; if (pressed) { x += dpPtr->offset; y += dpPtr->offset; @@ -610,7 +610,7 @@ DrawButtonImageAndText( XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); } } else { /* Text only */ - int x, y; + int x, y; TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY, butPtr->textWidth + butPtr->indicatorSpace, @@ -629,46 +629,46 @@ DrawButtonImageAndText( */ if (mbPtr->useTkText) { - if ((butPtr->state == STATE_DISABLED) - && ((butPtr->disabledFg == NULL) || (butPtr->image != NULL))) { - if ((butPtr->flags & SELECTED) && !butPtr->indicatorOn - && (butPtr->selectBorder != NULL)) { - XSetForeground(butPtr->display, butPtr->stippleGC, - Tk_3DBorderColor(butPtr->selectBorder)->pixel); - } - /* - * Stipple the whole button if no disabledFg was specified, - * otherwise restrict stippling only to displayed image - */ - if (butPtr->disabledFg == NULL) { - XFillRectangle(butPtr->display, pixmap, butPtr->stippleGC, - 0, 0, (unsigned) Tk_Width(tkwin), - (unsigned) Tk_Height(tkwin)); - } else { - XFillRectangle(butPtr->display, pixmap, butPtr->stippleGC, - imageXOffset, imageYOffset, - (unsigned) imageWidth, (unsigned) imageHeight); - } - if ((butPtr->flags & SELECTED) && !butPtr->indicatorOn - && (butPtr->selectBorder != NULL) - ) { - XSetForeground(butPtr->display, butPtr->stippleGC, - Tk_3DBorderColor(butPtr->normalBorder)->pixel); - } - } - - /* - * Draw the border and traversal highlight last. This way, if the - * button's contents overflow they'll be covered up by the border. - */ - - if (dpPtr->relief != TK_RELIEF_FLAT) { + if ((butPtr->state == STATE_DISABLED) + && ((butPtr->disabledFg == NULL) || (butPtr->image != NULL))) { + if ((butPtr->flags & SELECTED) && !butPtr->indicatorOn + && (butPtr->selectBorder != NULL)) { + XSetForeground(butPtr->display, butPtr->stippleGC, + Tk_3DBorderColor(butPtr->selectBorder)->pixel); + } + /* + * Stipple the whole button if no disabledFg was specified, + * otherwise restrict stippling only to displayed image + */ + if (butPtr->disabledFg == NULL) { + XFillRectangle(butPtr->display, pixmap, butPtr->stippleGC, + 0, 0, (unsigned) Tk_Width(tkwin), + (unsigned) Tk_Height(tkwin)); + } else { + XFillRectangle(butPtr->display, pixmap, butPtr->stippleGC, + imageXOffset, imageYOffset, + (unsigned) imageWidth, (unsigned) imageHeight); + } + if ((butPtr->flags & SELECTED) && !butPtr->indicatorOn + && (butPtr->selectBorder != NULL) + ) { + XSetForeground(butPtr->display, butPtr->stippleGC, + Tk_3DBorderColor(butPtr->normalBorder)->pixel); + } + } + + /* + * Draw the border and traversal highlight last. This way, if the + * button's contents overflow they'll be covered up by the border. + */ + + if (dpPtr->relief != TK_RELIEF_FLAT) { int inset = butPtr->highlightWidth; Tk_Draw3DRectangle(tkwin, pixmap, dpPtr->border, inset, inset, Tk_Width(tkwin) - 2*inset, Tk_Height(tkwin) - 2*inset, butPtr->borderWidth, dpPtr->relief); - } + } } } @@ -695,7 +695,7 @@ TkpDestroyButton( MacButton *mbPtr = (MacButton *) butPtr; /* Mac button. */ if (mbPtr->defaultPulseHandler) { - Tcl_DeleteTimerHandler(mbPtr->defaultPulseHandler); + Tcl_DeleteTimerHandler(mbPtr->defaultPulseHandler); } } @@ -720,9 +720,9 @@ static void TkMacOSXDrawButton( MacButton *mbPtr, /* Mac button. */ TCL_UNUSED(GC), /* The GC we are drawing into - needed for - * the bevel button */ + * the bevel button */ Pixmap pixmap) /* The pixmap we are drawing into - needed - * for the bevel button */ + * for the bevel button */ { TkButton *butPtr = (TkButton *) mbPtr; TkWindow *winPtr = (TkWindow *) butPtr->tkwin; @@ -739,24 +739,24 @@ TkMacOSXDrawButton( cntrRect = CGRectInset(cntrRect, butPtr->inset, butPtr->inset); if (useNewerHITools == 1) { - HIRect contHIRec; - static HIThemeButtonDrawInfo hiinfo; + HIRect contHIRec; + static HIThemeButtonDrawInfo hiinfo; - ButtonBackgroundDrawCB(&cntrRect, mbPtr, 32, true); + ButtonBackgroundDrawCB(&cntrRect, mbPtr, 32, true); if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) { return; } - hiinfo.version = 0; - hiinfo.state = mbPtr->drawinfo.state; - hiinfo.kind = mbPtr->btnkind; - hiinfo.value = mbPtr->drawinfo.value; - hiinfo.adornment = mbPtr->drawinfo.adornment; - hiinfo.animation.time.current = CFAbsoluteTimeGetCurrent(); - if (hiinfo.animation.time.start == 0) { - hiinfo.animation.time.start = hiinfo.animation.time.current; - } + hiinfo.version = 0; + hiinfo.state = mbPtr->drawinfo.state; + hiinfo.kind = mbPtr->btnkind; + hiinfo.value = mbPtr->drawinfo.value; + hiinfo.adornment = mbPtr->drawinfo.adornment; + hiinfo.animation.time.current = CFAbsoluteTimeGetCurrent(); + if (hiinfo.animation.time.start == 0) { + hiinfo.animation.time.start = hiinfo.animation.time.current; + } /* * To avoid buttons with white text on a white background, we set the @@ -776,7 +776,7 @@ TkMacOSXDrawButton( kHIThemeOrientationNormal, &contHIRec); TkMacOSXRestoreDrawingContext(&dc); - ButtonContentDrawCB(&contHIRec, mbPtr->btnkind, &mbPtr->drawinfo, + ButtonContentDrawCB(&contHIRec, mbPtr->btnkind, &mbPtr->drawinfo, (MacButton *) mbPtr, 32, true); } else { if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, &dc)) { @@ -819,26 +819,26 @@ ButtonBackgroundDrawCB( int usehlborder = 0; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { - return; + return; } pixmap = (Pixmap) Tk_WindowId(tkwin); if (butPtr->type != TYPE_LABEL) { - switch (mbPtr->btnkind) { + switch (mbPtr->btnkind) { case kThemeSmallBevelButton: case kThemeBevelButton: case kThemeRoundedBevelButton: case kThemePushButton: usehlborder = 1; break; - } + } } if (usehlborder) { - Tk_Fill3DRectangle(tkwin, pixmap, butPtr->highlightBorder, 0, 0, - Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); + Tk_Fill3DRectangle(tkwin, pixmap, butPtr->highlightBorder, 0, 0, + Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); } else { - Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, 0, 0, - Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); + Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, 0, 0, + Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); } } @@ -870,7 +870,7 @@ ButtonContentDrawCB ( Tk_Window tkwin = butPtr->tkwin; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { - return; + return; } /* @@ -950,17 +950,17 @@ TkMacOSXComputeButtonParams( MacButton *mbPtr = (MacButton *) butPtr; if (butPtr->borderWidth <= 2) { - *btnkind = kThemeSmallBevelButton; + *btnkind = kThemeSmallBevelButton; } else if (butPtr->borderWidth == 3) { - *btnkind = kThemeBevelButton; + *btnkind = kThemeBevelButton; } else if (butPtr->borderWidth == 4) { - *btnkind = kThemeRoundedBevelButton; + *btnkind = kThemeRoundedBevelButton; } else { - *btnkind = kThemePushButton; + *btnkind = kThemePushButton; } if ((butPtr->image == NULL) && (butPtr->bitmap == None)) { - switch (butPtr->type) { + switch (butPtr->type) { case TYPE_BUTTON: *btnkind = kThemePushButton; break; @@ -982,7 +982,7 @@ TkMacOSXComputeButtonParams( } if (butPtr->indicatorOn) { - switch (butPtr->type) { + switch (butPtr->type) { case TYPE_RADIO_BUTTON: if (butPtr->borderWidth <= 1) { *btnkind = kThemeSmallRadioButton; @@ -997,22 +997,22 @@ TkMacOSXComputeButtonParams( *btnkind = kThemeCheckBox; } break; - } + } } else { - if (butPtr->type == TYPE_RADIO_BUTTON || + if (butPtr->type == TYPE_RADIO_BUTTON || butPtr->type == TYPE_CHECK_BUTTON) { if (*btnkind == kThemePushButton) { *btnkind = kThemeBevelButton; } - } + } } if (butPtr->flags & SELECTED) { - drawinfo->value = kThemeButtonOn; + drawinfo->value = kThemeButtonOn; } else if (butPtr->flags & TRISTATED) { - drawinfo->value = kThemeButtonMixed; + drawinfo->value = kThemeButtonMixed; } else { - drawinfo->value = kThemeButtonOff; + drawinfo->value = kThemeButtonOff; } if ((mbPtr->flags & FIRST_DRAW) != 0) { @@ -1024,17 +1024,17 @@ TkMacOSXComputeButtonParams( drawinfo->state = kThemeStateInactive; if ((mbPtr->flags & ACTIVE) == 0) { - if (butPtr->state == STATE_DISABLED) { - drawinfo->state = kThemeStateUnavailableInactive; - } else { - drawinfo->state = kThemeStateInactive; - } + if (butPtr->state == STATE_DISABLED) { + drawinfo->state = kThemeStateUnavailableInactive; + } else { + drawinfo->state = kThemeStateInactive; + } } else if (butPtr->state == STATE_DISABLED) { - drawinfo->state = kThemeStateUnavailable; + drawinfo->state = kThemeStateUnavailable; } else if (butPtr->state == STATE_ACTIVE) { - drawinfo->state = kThemeStatePressed; + drawinfo->state = kThemeStatePressed; } else { - drawinfo->state = kThemeStateActive; + drawinfo->state = kThemeStateActive; } drawinfo->adornment = kThemeAdornmentNone; @@ -1049,17 +1049,17 @@ TkMacOSXComputeButtonParams( * the button periodically. */ - if (!mbPtr->defaultPulseHandler && ([NSApp macOSVersion] <= 100900)) { - mbPtr->defaultPulseHandler = Tcl_CreateTimerHandler( - PULSE_TIMER_MSECS, PulseDefaultButtonProc, butPtr); - } + if (!mbPtr->defaultPulseHandler && ([NSApp macOSVersion] <= 100900)) { + mbPtr->defaultPulseHandler = Tcl_CreateTimerHandler( + PULSE_TIMER_MSECS, PulseDefaultButtonProc, butPtr); + } } else if (mbPtr->defaultPulseHandler) { - Tcl_DeleteTimerHandler(mbPtr->defaultPulseHandler); + Tcl_DeleteTimerHandler(mbPtr->defaultPulseHandler); } if (butPtr->highlightWidth >= 3) { - if ((butPtr->flags & GOT_FOCUS)) { - drawinfo->adornment |= kThemeAdornmentFocus; - } + if ((butPtr->flags & GOT_FOCUS)) { + drawinfo->adornment |= kThemeAdornmentFocus; + } } } @@ -1091,17 +1091,17 @@ TkMacOSXComputeButtonDrawParams( || (butPtr->bitmap != None)); if (butPtr->type != TYPE_LABEL) { - dpPtr->offset = 0; - if (dpPtr->hasImageOrBitmap) { - switch (mbPtr->btnkind) { + dpPtr->offset = 0; + if (dpPtr->hasImageOrBitmap) { + switch (mbPtr->btnkind) { case kThemeSmallBevelButton: case kThemeBevelButton: case kThemeRoundedBevelButton: case kThemePushButton: dpPtr->offset = 1; break; - } - } + } + } } dpPtr->border = butPtr->normalBorder; @@ -1187,7 +1187,7 @@ PulseDefaultButtonProc(void *clientData) */ Tcl_CancelIdleCall(TkpDisplayButton, clientData); mbPtr->defaultPulseHandler = Tcl_CreateTimerHandler( - PULSE_TIMER_MSECS, PulseDefaultButtonProc, clientData); + PULSE_TIMER_MSECS, PulseDefaultButtonProc, clientData); } /* diff --git a/tests/button.test b/tests/button.test index b30780d..fb1e5f3 100644 --- a/tests/button.test +++ b/tests/button.test @@ -3368,7 +3368,7 @@ test button-5.17 {ConfigureButton - -width option} -body { } -cleanup { destroy .b } -result {expected integer but got "1i" - (processing -width option) + (processing "-width" option) invoked from within ".b configure -width 1i"} test button-5.18 {ConfigureButton - -height option} -body { @@ -3384,7 +3384,7 @@ test button-5.19 {ConfigureButton - -height option} -body { } -cleanup { destroy .b } -result {expected integer but got "0.5c" - (processing -height option) + (processing "-height" option) invoked from within ".b configure -height 0.5c"} #ex 6.16 @@ -3401,7 +3401,7 @@ test button-5.21 {ConfigureButton - -width option} -body { } -cleanup { destroy .b } -result {expected screen distance but got "abc" - (processing -width option) + (processing "-width" option) invoked from within ".b configure -width abc"} test button-5.22 {ConfigureButton - -height option} -constraints { @@ -3428,7 +3428,7 @@ test button-5.23 {ConfigureButton - -height option} -constraints { destroy .b image delete image1 } -result {expected screen distance but got "0.5x" - (processing -height option) + (processing "-height" option) invoked from within ".b configure -height 0.5x"} #ex 6.18 diff --git a/tests/menubut.test b/tests/menubut.test index 21c0cf7..028341f 100644 --- a/tests/menubut.test +++ b/tests/menubut.test @@ -404,7 +404,7 @@ test menubutton-4.2 {ConfigureMenuButton procedure} -setup { } -cleanup { deleteWindows } -result {expected integer but got "1i" - (processing -width option) + (processing "-width" option) invoked from within ".mb1 configure -width 1i"} @@ -425,7 +425,7 @@ test menubutton-4.4 {ConfigureMenuButton procedure} -setup { } -cleanup { deleteWindows } -result {expected integer but got "0.5c" - (processing -height option) + (processing "-height" option) invoked from within ".mb1 configure -height 0.5c"} @@ -446,7 +446,7 @@ test menubutton-4.6 {ConfigureMenuButton procedure} -setup { } -cleanup { deleteWindows } -result {expected screen distance but got "abc" - (processing -width option) + (processing "-width" option) invoked from within ".mb1 configure -width abc"} @@ -477,7 +477,7 @@ test menubutton-4.8 {ConfigureMenuButton procedure} -constraints { deleteWindows imageCleanup } -result {expected screen distance but got "0.5x" - (processing -height option) + (processing "-height" option) invoked from within ".mb1 configure -height 0.5x"} diff --git a/win/tkWinButton.c b/win/tkWinButton.c index a60fec2..31789e1 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -623,7 +623,7 @@ TkpDisplayButton( if (butPtr->type == TYPE_LABEL) { defaultWidth = butPtr->highlightWidth; - offset = 0; + offset = 0; } else if (butPtr->type == TYPE_BUTTON) { defaultWidth = ((butPtr->defaultState == DEFAULT_ACTIVE) ? butPtr->highlightWidth : 0); @@ -929,14 +929,14 @@ TkpDisplayButton( butPtr->borderWidth, relief); } if (defaultWidth != 0) { - int highlightColor; + int highlightColor; dc = TkWinGetDrawableDC(butPtr->display, pixmap, &state); - if (butPtr->type == TYPE_LABEL) { - highlightColor = (int) Tk_3DBorderColor(butPtr->highlightBorder)->pixel; - } else { - highlightColor = (int) butPtr->highlightColorPtr->pixel; - } + if (butPtr->type == TYPE_LABEL) { + highlightColor = (int) Tk_3DBorderColor(butPtr->highlightBorder)->pixel; + } else { + highlightColor = (int) butPtr->highlightColorPtr->pixel; + } TkWinFillRect(dc, 0, 0, Tk_Width(tkwin), defaultWidth, highlightColor); TkWinFillRect(dc, 0, 0, defaultWidth, Tk_Height(tkwin), @@ -1449,7 +1449,7 @@ ButtonProc( * causes all buttons to fire once a second, so we need to make sure * that we are not dealing with the chromium life check. */ - if (wParam != 0 || lParam != 0) { + if (wParam != 0 || lParam != 0) { int code; Tcl_Interp *interp = butPtr->info.interp; |