diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-24 14:00:22 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-24 14:00:22 (GMT) |
commit | b744234ad43b7dc3544f0184e2b76d9f28137551 (patch) | |
tree | 00c1f2568bb436b660acd8ed3b863b86b96cf086 /generic/ttk | |
parent | c8bf7eaf6e7d5dbcf3c5ee48102077d9579e1de2 (diff) | |
parent | bbbc32416a291c8abda4072bafa9579418034907 (diff) | |
download | tk-b744234ad43b7dc3544f0184e2b76d9f28137551.zip tk-b744234ad43b7dc3544f0184e2b76d9f28137551.tar.gz tk-b744234ad43b7dc3544f0184e2b76d9f28137551.tar.bz2 |
Merge core-8-5-branch
Various Tcl_GetIndexFromObj -> Tcl_GetIndexFromObjStruct changes.
Diffstat (limited to 'generic/ttk')
-rw-r--r-- | generic/ttk/ttkDefaultTheme.c | 4 | ||||
-rw-r--r-- | generic/ttk/ttkImage.c | 6 | ||||
-rw-r--r-- | generic/ttk/ttkInit.c | 25 | ||||
-rw-r--r-- | generic/ttk/ttkLayout.c | 8 | ||||
-rw-r--r-- | generic/ttk/ttkNotebook.c | 5 | ||||
-rw-r--r-- | generic/ttk/ttkPanedwindow.c | 5 | ||||
-rw-r--r-- | generic/ttk/ttkScroll.c | 20 | ||||
-rw-r--r-- | generic/ttk/ttkTheme.c | 6 | ||||
-rw-r--r-- | generic/ttk/ttkTreeview.c | 12 | ||||
-rw-r--r-- | generic/ttk/ttkWidget.c | 4 |
10 files changed, 50 insertions, 45 deletions
diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index d2deee8..0c55651 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -722,8 +722,8 @@ static void MenubuttonArrowElementDraw( int width = 0, height = 0; Tk_GetPixelsFromObj(NULL, tkwin, arrow->sizeObj, &size); - Tcl_GetIndexFromObj(NULL, arrow->directionObj, directionStrings, - ""/*message*/, 0/*flags*/, &postDirection); + Tcl_GetIndexFromObjStruct(NULL, arrow->directionObj, directionStrings, + sizeof(char *), ""/*message*/, 0/*flags*/, &postDirection); /* ... this might not be such a great idea ... */ switch (postDirection) { diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index 1d455d9..a5a3a52 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -36,7 +36,7 @@ static void NullImageChanged(ClientData clientData, /* TtkGetImageSpec -- * Constructs a Ttk_ImageSpec * from a Tcl_Obj *. - * Result must be released using TtkFreeImageSpec. + * Result must be released using TtkFreeImageSpec. * * TODO: Need a variant of this that takes a user-specified ImageChanged proc */ @@ -364,8 +364,8 @@ Ttk_CreateImageElement( } #endif - if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, - "option", 0, &option) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[i], optionStrings, + sizeof(char *), "option", 0, &option) != TCL_OK) { goto error; } diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index 78676c6..dc6e994 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -21,8 +21,8 @@ int Ttk_GetButtonDefaultStateFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, int *statePtr) { *statePtr = TTK_BUTTON_DEFAULT_DISABLED; - return Tcl_GetIndexFromObj(interp, objPtr, - ttkDefaultStrings, "default state", 0, statePtr); + return Tcl_GetIndexFromObjStruct(interp, objPtr, ttkDefaultStrings, + sizeof(char *), "default state", 0, statePtr); } /* @@ -38,8 +38,8 @@ int Ttk_GetCompoundFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, int *statePtr) { *statePtr = TTK_COMPOUND_NONE; - return Tcl_GetIndexFromObj(interp, objPtr, - ttkCompoundStrings, "compound layout", 0, statePtr); + return Tcl_GetIndexFromObjStruct(interp, objPtr, ttkCompoundStrings, + sizeof(char *), "compound layout", 0, statePtr); } /* @@ -54,8 +54,8 @@ int Ttk_GetOrientFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr) { *resultPtr = TTK_ORIENT_HORIZONTAL; - return Tcl_GetIndexFromObj(interp, objPtr, - ttkOrientStrings, "orientation", 0, resultPtr); + return Tcl_GetIndexFromObjStruct(interp, objPtr, ttkOrientStrings, + sizeof(char *), "orientation", 0, resultPtr); } /* @@ -65,18 +65,18 @@ int Ttk_GetOrientFromObj( static const char *ttkStateStrings[] = { "normal", "readonly", "disabled", "active", NULL }; -enum { +enum { TTK_COMPAT_STATE_NORMAL, TTK_COMPAT_STATE_READONLY, TTK_COMPAT_STATE_DISABLED, TTK_COMPAT_STATE_ACTIVE }; -/* TtkCheckStateOption -- +/* TtkCheckStateOption -- * Handle -state compatibility option. * - * NOTE: setting -state disabled / -state enabled affects the - * widget state, but the internal widget state does *not* affect + * NOTE: setting -state disabled / -state enabled affects the + * widget state, but the internal widget state does *not* affect * the value of the -state option. * This option is present for compatibility only. */ @@ -86,7 +86,8 @@ void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr) unsigned all = TTK_STATE_DISABLED|TTK_STATE_READONLY|TTK_STATE_ACTIVE; # define SETFLAGS(f) TtkWidgetChangeState(corePtr, f, all^f) - (void)Tcl_GetIndexFromObj(NULL,objPtr,ttkStateStrings,"",0,&stateOption); + (void)Tcl_GetIndexFromObjStruct(NULL, objPtr, ttkStateStrings, + sizeof(char *), "", 0, &stateOption); switch (stateOption) { case TTK_COMPAT_STATE_NORMAL: default: @@ -174,7 +175,7 @@ int TtkGetOptionValue( * type name dbName dbClass default objOffset intOffset flags clientData mask */ -/* public */ +/* public */ Tk_OptionSpec ttkCoreOptionSpecs[] = { {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", NULL, diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index de9d795..ba24589 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -636,8 +636,8 @@ Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *interp, Tcl_Obj *objPtr) if (optName[0] != '-') break; - if (Tcl_GetIndexFromObj( - interp, objv[i], optStrings, "option", 0, &option) + if (Tcl_GetIndexFromObjStruct(interp, objv[i], optStrings, + sizeof(char *), "option", 0, &option) != TCL_OK) { goto error; @@ -653,8 +653,8 @@ Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *interp, Tcl_Obj *objPtr) switch (option) { case OP_SIDE: /* <<NOTE-PACKSIDE>> */ - if (Tcl_GetIndexFromObj(interp, objv[i], packSideStrings, - "side", 0, &value) != TCL_OK) + if (Tcl_GetIndexFromObjStruct(interp, objv[i], packSideStrings, + sizeof(char *), "side", 0, &value) != TCL_OK) { goto error; } diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 6849135..16a8bfe 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -1058,9 +1058,8 @@ static int NotebookIdentifyCommand( if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK - || (objc == 5 && - Tcl_GetIndexFromObj(interp, objv[2], whatTable, "option", 0, &what) - != TCL_OK) + || (objc == 5 && Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable, + sizeof(char *), "option", 0, &what) != TCL_OK) ) { return TCL_ERROR; } diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index f4b14c9..adc2aef 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -731,9 +731,8 @@ static int PanedIdentifyCommand( if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK - || (objc == 5 && - Tcl_GetIndexFromObj(interp, objv[2], whatTable, "option", 0, &what) - != TCL_OK) + || (objc == 5 && Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable, + sizeof(char *), "option", 0, &what) != TCL_OK) ) { return TCL_ERROR; } diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c index f596bb4..7ac4f14 100644 --- a/generic/ttk/ttkScroll.c +++ b/generic/ttk/ttkScroll.c @@ -7,7 +7,7 @@ * * Scrollable interface: * - * + 'first' is controlled by [xy]view widget command + * + 'first' is controlled by [xy]view widget command * and other scrolling commands like 'see'; * + 'total' depends on widget contents; * + 'last' depends on first, total, and widget size. @@ -16,15 +16,15 @@ * * 1. User adjusts scrollbar, scrollbar widget calls its -command * 2. Scrollbar -command invokes the scrollee [xy]view widget method - * 3. TtkScrollviewCommand calls TtkScrollTo(), which updates + * 3. TtkScrollviewCommand calls TtkScrollTo(), which updates * 'first' and schedules a redisplay. - * 4. Once the scrollee knows 'total' and 'last' (typically in - * the LayoutProc), call TtkScrolled(h,first,last,total) to + * 4. Once the scrollee knows 'total' and 'last' (typically in + * the LayoutProc), call TtkScrolled(h,first,last,total) to * synchronize the scrollbar. * 5. The scrollee -[xy]scrollcommand is called (in an idle callback) * 6. Which calls the scrollbar 'set' method and redisplays the scrollbar. * - * If the scrollee has internal scrolling (e.g., a 'see' method), + * If the scrollee has internal scrolling (e.g., a 'see' method), * it should TtkScrollTo() directly (step 2). * * If the widget value changes, it should call TtkScrolled() (step 4). @@ -78,6 +78,7 @@ static int UpdateScrollbar(Tcl_Interp *interp, ScrollHandle h) char arg1[TCL_DOUBLE_SPACE + 2]; char arg2[TCL_DOUBLE_SPACE + 2]; int code; + Tcl_DString buf; h->flags &= ~SCROLL_UPDATE_REQUIRED; @@ -88,9 +89,14 @@ static int UpdateScrollbar(Tcl_Interp *interp, ScrollHandle h) arg1[0] = arg2[0] = ' '; Tcl_PrintDouble(interp, (double)s->first / s->total, arg1+1); Tcl_PrintDouble(interp, (double)s->last / s->total, arg2+1); + Tcl_DStringInit(&buf); + Tcl_DStringAppend(&buf, s->scrollCmd, -1); + Tcl_DStringAppend(&buf, arg1, -1); + Tcl_DStringAppend(&buf, arg2, -1); Tcl_Preserve(corePtr); - code = Tcl_VarEval(interp, s->scrollCmd, arg1, arg2, NULL); + code = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL); + Tcl_DStringFree(&buf); if (WidgetDestroyed(corePtr)) { Tcl_Release(corePtr); return TCL_ERROR; @@ -135,7 +141,7 @@ static void UpdateScrollbarBG(ClientData clientData) void TtkScrolled(ScrollHandle h, int first, int last, int total) { Scrollable *s = h->scrollPtr; - + /* Sanity-check inputs: */ if (total <= 0) { diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index d102be2..2f95962 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -1394,8 +1394,8 @@ static int StyleThemeCreateCmd( for (i=4; i < objc; i +=2) { int option; - if (Tcl_GetIndexFromObj( - interp, objv[i], optStrings, "option", 0, &option) != TCL_OK) + if (Tcl_GetIndexFromObjStruct(interp, objv[i], optStrings, + sizeof(char *), "option", 0, &option) != TCL_OK) { return TCL_ERROR; } @@ -1674,7 +1674,7 @@ StyleObjCmd( return Ttk_InvokeEnsemble(StyleEnsemble, 1, clientData,interp,objc,objv); } -MODULE_SCOPE +MODULE_SCOPE int Ttk_InvokeEnsemble( /* Run an ensemble command */ const Ttk_Ensemble *ensemble, int cmdIndex, void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index dc0206c..c1ecf38 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -340,8 +340,8 @@ static int GetEnumSetFromObj( for (i = 0; i < objc; ++i) { int index; - if (TCL_OK != Tcl_GetIndexFromObj( - interp, objv[i], table, "value", TCL_EXACT, &index)) + if (TCL_OK != Tcl_GetIndexFromObjStruct(interp, objv[i], table, + sizeof(char *), "value", TCL_EXACT, &index)) { return TCL_ERROR; } @@ -2287,8 +2287,8 @@ static int TreeviewIdentifyCommand( return TCL_ERROR; } - if ( Tcl_GetIndexFromObj(interp, objv[2], - submethodStrings, "command", TCL_EXACT, &submethod) != TCL_OK + if (Tcl_GetIndexFromObjStruct(interp, objv[2], submethodStrings, + sizeof(char *), "command", TCL_EXACT, &submethod) != TCL_OK || Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK ) { @@ -2955,8 +2955,8 @@ static int TreeviewSelectionCommand( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[2], selopStrings, - "selection operation", 0, &selop) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[2], selopStrings, + sizeof(char *), "selection operation", 0, &selop) != TCL_OK) { return TCL_ERROR; } diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index 016653d..464be78 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -766,8 +766,8 @@ int TtkWidgetIdentifyCommand( } if (objc == 5) { /* $w identify element $x $y */ - if (Tcl_GetIndexFromObj(interp,objv[2],whatTable,"option",0,&what) - != TCL_OK) + if (Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable, + sizeof(char *), "option", 0, &what) != TCL_OK) { return TCL_ERROR; } |