summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkScrollbar.c13
-rw-r--r--generic/tkScrollbar.h6
-rw-r--r--tests/scrollbar.test4
3 files changed, 17 insertions, 6 deletions
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index 5017d30..9c1ceb8 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.c
@@ -179,10 +179,12 @@ Tk_ScrollbarObjCmd(
scrollPtr->sliderLast = 0;
scrollPtr->activeField = 0;
scrollPtr->activeRelief = TK_RELIEF_RAISED;
+#ifndef TK_NO_DEPRECATED
scrollPtr->totalUnits = 0;
scrollPtr->windowUnits = 0;
scrollPtr->firstUnit = 0;
scrollPtr->lastUnit = 0;
+#endif /* TK_NO_DEPRECATED */
scrollPtr->firstFraction = 0.0;
scrollPtr->lastFraction = 0.0;
scrollPtr->cursor = None;
@@ -377,10 +379,13 @@ ScrollbarWidgetObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "get");
goto error;
}
+#ifndef TK_NO_DEPRECATED
if (scrollPtr->flags & NEW_STYLE_COMMANDS) {
+#endif /* TK_NO_DEPRECATED */
resObjs[0] = Tcl_NewDoubleObj(scrollPtr->firstFraction);
resObjs[1] = Tcl_NewDoubleObj(scrollPtr->lastFraction);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, resObjs));
+#ifndef TK_NO_DEPRECATED
} else {
resObjs[0] = Tcl_NewIntObj(scrollPtr->totalUnits);
resObjs[1] = Tcl_NewIntObj(scrollPtr->windowUnits);
@@ -388,6 +393,7 @@ ScrollbarWidgetObjCmd(
resObjs[3] = Tcl_NewIntObj(scrollPtr->lastUnit);
Tcl_SetObjResult(interp, Tcl_NewListObj(4, resObjs));
}
+#endif /* TK_NO_DEPRECATED */
break;
}
case COMMAND_IDENTIFY: {
@@ -413,8 +419,6 @@ ScrollbarWidgetObjCmd(
break;
}
case COMMAND_SET: {
- int totalUnits, windowUnits, firstUnit, lastUnit;
-
if (objc == 4) {
double first, last;
@@ -438,8 +442,10 @@ ScrollbarWidgetObjCmd(
} else {
scrollPtr->lastFraction = last;
}
+#ifndef TK_NO_DEPRECATED
scrollPtr->flags |= NEW_STYLE_COMMANDS;
} else if (objc == 6) {
+ int totalUnits, windowUnits, firstUnit, lastUnit;
if (Tcl_GetIntFromObj(interp, objv[2], &totalUnits) != TCL_OK) {
goto error;
}
@@ -477,10 +483,9 @@ ScrollbarWidgetObjCmd(
scrollPtr->lastFraction = ((double) (lastUnit+1))/totalUnits;
}
scrollPtr->flags &= ~NEW_STYLE_COMMANDS;
+#endif /* !TK_NO_DEPRECATED */
} else {
Tcl_WrongNumArgs(interp, 1, objv, "set firstFraction lastFraction");
- Tcl_AppendResult(interp, " or \"", Tcl_GetString(objv[0]),
- " set totalUnits windowUnits firstUnit lastUnit\"", NULL);
goto error;
}
TkpComputeScrollbarGeometry(scrollPtr);
diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h
index b0cd085..66b12b8 100644
--- a/generic/tkScrollbar.h
+++ b/generic/tkScrollbar.h
@@ -96,6 +96,7 @@ typedef struct TkScrollbar {
* the NEW_STYLE_COMMANDS flag is 0.
*/
+#ifndef TK_NO_DEPRECATED
int totalUnits; /* Total dimension of application, in units.
* Valid only if the NEW_STYLE_COMMANDS flag
* isn't set. */
@@ -108,6 +109,9 @@ typedef struct TkScrollbar {
int lastUnit; /* Index of last unit visible in window.
* Valid only if the NEW_STYLE_COMMANDS flag
* isn't set. */
+#else
+ int dummy1,dummy2,dummy3,dummy4; /* sizeof(TkScrollbar) should not depend on TK_NO_DEPRECATED */
+#endif /* TK_NO_DEPRECATED */
double firstFraction; /* Position of first visible thing in window,
* specified as a fraction between 0 and
* 1.0. */
@@ -153,7 +157,9 @@ typedef struct TkScrollbar {
*/
#define REDRAW_PENDING 1
+#ifndef TK_NO_DEPRECATED
#define NEW_STYLE_COMMANDS 2
+#endif /* TK_NO_DEPRECATED */
#define GOT_FOCUS 4
/*
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index 6d811dc..b7cdbc0 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -396,10 +396,10 @@ test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} {
} {100 50 30 30}
test scrollbar-3.71 {ScrollbarWidgetCmd procedure, "set" option} {
list [catch {.s set 1 2 3} msg] $msg
-} {1 {wrong # args: should be ".s set firstFraction lastFraction" or ".s set totalUnits windowUnits firstUnit lastUnit"}}
+} {1 {wrong # args: should be ".s set firstFraction lastFraction"}}
test scrollbar-3.72 {ScrollbarWidgetCmd procedure, "set" option} {
list [catch {.s set 1 2 3 4 5} msg] $msg
-} {1 {wrong # args: should be ".s set firstFraction lastFraction" or ".s set totalUnits windowUnits firstUnit lastUnit"}}
+} {1 {wrong # args: should be ".s set firstFraction lastFraction"}}
test scrollbar-3.73 {ScrollbarWidgetCmd procedure} {
list [catch {.s bogus} msg] $msg
} {1 {bad option "bogus": must be activate, cget, configure, delta, fraction, get, identify, or set}}