From 624dbd57c279976ac04e288cf6d64f632e9f410c Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Tue, 28 Oct 2014 14:42:40 +0000 Subject: Fix for different ttk notebook tab metrics on OS X/Yosemite --- macosx/ttkMacOSXTheme.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 5752fb1..64b96cb 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -294,14 +294,21 @@ static Ttk_StateTable TabPositionTable[] = { * TP30000359-TPXREF116> */ -static const int TAB_HEIGHT = 10; -static const int TAB_OVERLAP = 10; +int TAB_HEIGHT = 0; +int TAB_OVERLAP = 0; static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - *heightPtr = TAB_HEIGHT + TAB_OVERLAP - 1; + TAB_HEIGHT = 10; + TAB_OVERLAP = 10; + /*Different metrics on 10.10/Yosemite.*/ + if (MAC_OS_X_VERSION_MIN_REQUIRED > 100000) { + TAB_OVERLAP = 5; + } + *heightPtr = TAB_HEIGHT + TAB_OVERLAP - 1; + } static void TabElementDraw( -- cgit v0.12 From 245ebed1ef100bd1d20092163894e30648d3f967 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 29 Oct 2014 23:05:22 +0000 Subject: Fixed bug [3417012fff] --- generic/tkScale.c | 11 ++++++++--- tests/scale.test | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/generic/tkScale.c b/generic/tkScale.c index 28e5b16..258a1fa 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -632,7 +632,12 @@ ConfigureScale( scalePtr->tickInterval = -scalePtr->tickInterval; } - ComputeFormat(scalePtr); + if (scalePtr->digits > TCL_MAX_PREC) { + Tcl_AppendResult(interp, "too large -digits value", NULL); + continue; + } else { + ComputeFormat(scalePtr); + } scalePtr->labelLength = scalePtr->label ? (int)strlen(scalePtr->label) : 0; @@ -888,7 +893,7 @@ static void ComputeScaleGeometry( register TkScale *scalePtr) /* Information about widget. */ { - char valueString[PRINT_CHARS]; + char valueString[TCL_DOUBLE_SPACE]; int tmp, valuePixels, x, y, extraSpace; Tk_FontMetrics fm; @@ -1304,7 +1309,7 @@ ScaleSetVariable( register TkScale *scalePtr) /* Info about widget. */ { if (scalePtr->varNamePtr != NULL) { - char string[PRINT_CHARS]; + char string[TCL_DOUBLE_SPACE]; sprintf(string, scalePtr->format, scalePtr->value); scalePtr->flags |= SETTING_VAR; diff --git a/tests/scale.test b/tests/scale.test index 657f668..527b319 100644 --- a/tests/scale.test +++ b/tests/scale.test @@ -35,6 +35,7 @@ foreach test { {-command "set x" {set x} {} {}} {-cursor arrow arrow badValue {bad cursor spec "badValue"}} {-digits 5 5 badValue {expected integer but got "badValue"}} + {-digits 17 17 18 {too large -digits value}} {-fg #00ff00 #00ff00 badValue {unknown color name "badValue"}} {-font fixed fixed {} {font "" doesn't exist}} {-foreground green green badValue {unknown color name "badValue"}} -- cgit v0.12 From 08e0eb04285780cdb42d7f3b7d6833c1adbc79ce Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 30 Oct 2014 15:07:28 +0000 Subject: Pushing the fix out to more files. --- generic/tkScale.c | 10 ++++------ generic/tkScale.h | 6 ------ macosx/tkMacOSXScale.c | 2 +- tests/scale.test | 1 - unix/tkUnixScale.c | 8 ++++---- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/generic/tkScale.c b/generic/tkScale.c index 258a1fa..69a7d91 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -632,12 +632,7 @@ ConfigureScale( scalePtr->tickInterval = -scalePtr->tickInterval; } - if (scalePtr->digits > TCL_MAX_PREC) { - Tcl_AppendResult(interp, "too large -digits value", NULL); - continue; - } else { - ComputeFormat(scalePtr); - } + ComputeFormat(scalePtr); scalePtr->labelLength = scalePtr->label ? (int)strlen(scalePtr->label) : 0; @@ -813,6 +808,9 @@ ComputeFormat( */ numDigits = scalePtr->digits; + if (numDigits > TCL_MAX_PREC) { + numDigits = 0; + } if (numDigits <= 0) { if (scalePtr->resolution > 0) { /* diff --git a/generic/tkScale.h b/generic/tkScale.h index f406bf6..a2c5f2b 100644 --- a/generic/tkScale.h +++ b/generic/tkScale.h @@ -220,12 +220,6 @@ typedef struct TkScale { #define SPACING 2 /* - * How many characters of space to provide when formatting the scale's value: - */ - -#define PRINT_CHARS 150 - -/* * Declaration of procedures used in the implementation of the scale widget. */ diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c index e94763d..a37029c 100644 --- a/macosx/tkMacOSXScale.c +++ b/macosx/tkMacOSXScale.c @@ -145,7 +145,7 @@ TkpDisplayScale( Tk_Window tkwin = scalePtr->tkwin; Tcl_Interp *interp = scalePtr->interp; int result; - char string[PRINT_CHARS]; + char string[TCL_DOUBLE_SPACE]; MacScale *macScalePtr = (MacScale *) clientData; Rect r; WindowRef windowRef; diff --git a/tests/scale.test b/tests/scale.test index 527b319..657f668 100644 --- a/tests/scale.test +++ b/tests/scale.test @@ -35,7 +35,6 @@ foreach test { {-command "set x" {set x} {} {}} {-cursor arrow arrow badValue {bad cursor spec "badValue"}} {-digits 5 5 badValue {expected integer but got "badValue"}} - {-digits 17 17 18 {too large -digits value}} {-fg #00ff00 #00ff00 badValue {unknown color name "badValue"}} {-font fixed fixed {} {font "" doesn't exist}} {-foreground green green badValue {unknown color name "badValue"}} diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c index e158549..71f9ea8 100644 --- a/unix/tkUnixScale.c +++ b/unix/tkUnixScale.c @@ -262,7 +262,7 @@ DisplayVerticalValue( { register Tk_Window tkwin = scalePtr->tkwin; int y, width, length; - char valueString[PRINT_CHARS]; + char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; Tk_GetFontMetrics(scalePtr->tkfont, &fm); @@ -341,7 +341,7 @@ DisplayHorizontalScale( */ if (tickInterval != 0) { - char valueString[PRINT_CHARS]; + char valueString[TCL_DOUBLE_SPACE]; double ticks, maxTicks; /* @@ -478,7 +478,7 @@ DisplayHorizontalValue( { register Tk_Window tkwin = scalePtr->tkwin; int x, y, length, width; - char valueString[PRINT_CHARS]; + char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; x = TkScaleValueToPixel(scalePtr, value); @@ -535,7 +535,7 @@ TkpDisplayScale( Tcl_Interp *interp = scalePtr->interp; Pixmap pixmap; int result; - char string[PRINT_CHARS]; + char string[TCL_DOUBLE_SPACE]; XRectangle drawnArea; scalePtr->flags &= ~REDRAW_PENDING; -- cgit v0.12 From 62f95363c9ba45b862bc5ed40e933acc38925edf Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 30 Oct 2014 15:13:10 +0000 Subject: Test for 3417012 --- tests/scale.test | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/scale.test b/tests/scale.test index 657f668..d7ded7f 100644 --- a/tests/scale.test +++ b/tests/scale.test @@ -387,6 +387,11 @@ test scale-6.20 {ComputeFormat procedure} { .s set 1001.23456789 .s get } {1001.235} +test scale-6.21 {ComputeFormat procedure} { + .s configure -length 200 -from 1000 -to 1001.8 -resolution 0 -digits 200 + .s set 1001.23456789 + .s get +} {1001.235} test scale-7.1 {ComputeScaleGeometry procedure} {nonPortable fonts} { catch {destroy .s} -- cgit v0.12