diff options
-rw-r--r-- | .travis.yml | 14 | ||||
-rw-r--r-- | generic/tk.h | 3 | ||||
-rw-r--r-- | generic/tkButton.c | 8 | ||||
-rw-r--r-- | generic/tkConfig.c | 38 | ||||
-rw-r--r-- | generic/tkMenubutton.c | 2 | ||||
-rw-r--r-- | generic/ttk/ttkButton.c | 7 | ||||
-rw-r--r-- | generic/ttk/ttkFrame.c | 5 | ||||
-rw-r--r-- | generic/ttk/ttkLabel.c | 16 | ||||
-rw-r--r-- | generic/ttk/ttkNotebook.c | 3 | ||||
-rw-r--r-- | macosx/tkMacOSXDefault.h | 8 | ||||
-rw-r--r-- | tests/button.test | 8 | ||||
-rw-r--r-- | tests/canvText.test | 2 | ||||
-rw-r--r-- | tests/entry.test | 6 | ||||
-rw-r--r-- | tests/listbox.test | 32 | ||||
-rw-r--r-- | tests/menubut.test | 2 | ||||
-rw-r--r-- | tests/spinbox.test | 6 | ||||
-rw-r--r-- | unix/tkUnixDefault.h | 8 | ||||
-rw-r--r-- | win/tkWinDefault.h | 8 |
18 files changed, 123 insertions, 53 deletions
diff --git a/.travis.yml b/.travis.yml index 0a8ab68..fb252e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,13 @@ matrix: compiler: gcc env: - BUILD_DIR=unix + - name: "Linux/GCC/Shared: NO_DEPRECATED" + os: linux + dist: bionic + compiler: gcc + env: + - BUILD_DIR=unix + - CFGOPT="CFLAGS=-DTK_NO_DEPRECATED=1" - name: "Linux/GCC/Shared/no-xft" os: linux dist: bionic @@ -113,6 +120,13 @@ matrix: compiler: clang env: - BUILD_DIR=unix + - name: "Linux/Clang/Shared: NO_DEPRECATED" + os: linux + dist: bionic + compiler: clang + env: + - BUILD_DIR=unix + - CFGOPT="CFLAGS=-DTK_NO_DEPRECATED=1" - name: "Linux/Clang/Shared/no-xft" os: linux dist: bionic diff --git a/generic/tk.h b/generic/tk.h index cec87b3..8875eea 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -170,7 +170,8 @@ typedef enum { TK_OPTION_WINDOW, TK_OPTION_END, TK_OPTION_CUSTOM, - TK_OPTION_STYLE + TK_OPTION_STYLE, + TK_OPTION_INDEX } Tk_OptionType; /* diff --git a/generic/tkButton.c b/generic/tkButton.c index 8056f31..211fdac 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -143,7 +143,7 @@ static const Tk_OptionSpec labelOptionSpecs[] = { {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_INT, "-underline", "underline", "Underline", + {TK_OPTION_INDEX, "-underline", "underline", "Underline", DEF_BUTTON_UNDERLINE, TCL_INDEX_NONE, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0}, @@ -244,7 +244,7 @@ static const Tk_OptionSpec buttonOptionSpecs[] = { {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_INT, "-underline", "underline", "Underline", + {TK_OPTION_INDEX, "-underline", "underline", "Underline", DEF_BUTTON_UNDERLINE, TCL_INDEX_NONE, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), TCL_INDEX_NONE, 0, 0, 0}, @@ -354,7 +354,7 @@ static const Tk_OptionSpec checkbuttonOptionSpecs[] = { TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue", DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), TCL_INDEX_NONE, 0, 0, 0}, - {TK_OPTION_INT, "-underline", "underline", "Underline", + {TK_OPTION_INDEX, "-underline", "underline", "Underline", DEF_BUTTON_UNDERLINE, TCL_INDEX_NONE, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", DEF_CHECKBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), TCL_INDEX_NONE, @@ -464,7 +464,7 @@ static const Tk_OptionSpec radiobuttonOptionSpecs[] = { TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue", DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), TCL_INDEX_NONE, 0, 0, 0}, - {TK_OPTION_INT, "-underline", "underline", "Underline", + {TK_OPTION_INDEX, "-underline", "underline", "Underline", DEF_BUTTON_UNDERLINE, TCL_INDEX_NONE, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-value", "value", "Value", DEF_BUTTON_VALUE, offsetof(TkButton, onValuePtr), TCL_INDEX_NONE, 0, 0, 0}, diff --git a/generic/tkConfig.c b/generic/tkConfig.c index d4ffa7c..fad4f94 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -635,6 +635,30 @@ DoObjConfig( } break; } + case TK_OPTION_INDEX: { + TkSizeT newIndex; + + /* TODO: don't bother handling "end" yet */ + if (TkGetIntForIndex(valuePtr, INT_MAX - 1, 0, &newIndex) != TCL_OK) { + if (interp) { + Tcl_AppendResult(interp, "bad index \"", Tcl_GetString(valuePtr), + "\": must be integer?[+-]integer?, end?[+-]integer? or none", NULL); + } + return TCL_ERROR; + } + if (valuePtr->internalRep.wideValue < INT_MIN) { + newIndex = (TkSizeT)INT_MIN; + } else if (valuePtr->internalRep.wideValue > INT_MAX) { + newIndex = (TkSizeT)INT_MAX; + } else if (valuePtr->internalRep.wideValue < 0) { + newIndex = (TkSizeT)valuePtr->internalRep.wideValue; + } + if (internalPtr != NULL) { + *((int *) oldInternalPtr) = *((int *) internalPtr); + *((int *) internalPtr) = (int)newIndex; + } + break; + } case TK_OPTION_DOUBLE: { double newDbl; @@ -1410,6 +1434,9 @@ Tk_RestoreSavedOptions( case TK_OPTION_INT: *((int *) internalPtr) = *((int *) ptr); break; + case TK_OPTION_INDEX: + *((int *) internalPtr) = *((int *) ptr); + break; case TK_OPTION_DOUBLE: *((double *) internalPtr) = *((double *) ptr); break; @@ -1883,6 +1910,17 @@ GetObjectForOption( case TK_OPTION_INT: objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); break; + case TK_OPTION_INDEX: + if (*((int *) internalPtr) >= 0 && *((int *) internalPtr) < INT_MAX) { + objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); + } else { +#if TCL_MAJOR_VERSION > 8 || defined(TK_NO_DEPRECATED) + objPtr = Tcl_NewStringObj("none", -1); +#else + objPtr = Tcl_NewWideIntObj(-1); +#endif + } + break; case TK_OPTION_DOUBLE: objPtr = Tcl_NewDoubleObj(*((double *) internalPtr)); break; diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 4b7a492..7d6086f 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -145,7 +145,7 @@ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_MENUBUTTON_TEXT_VARIABLE, TCL_INDEX_NONE, offsetof(TkMenuButton, textVarName), TK_OPTION_NULL_OK, 0, 0}, - {TK_OPTION_INT, "-underline", "underline", "Underline", + {TK_OPTION_INDEX, "-underline", "underline", "Underline", DEF_MENUBUTTON_UNDERLINE, TCL_INDEX_NONE, offsetof(TkMenuButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index 9712c66..efb53b7 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -7,6 +7,7 @@ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" +#include "default.h" /* Bit fields for OptionSpec mask field: */ @@ -24,7 +25,7 @@ typedef struct Tcl_Obj *textObj; Tcl_Obj *justifyObj; Tcl_Obj *textVariableObj; - Tcl_Obj *underlineObj; + Tcl_Obj *underlineObj1; Tcl_Obj *widthObj; Ttk_TraceHandle *textVariableTrace; @@ -65,8 +66,8 @@ static const Tk_OptionSpec BaseOptionSpecs[] = {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", "", offsetof(Base,base.textVariableObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, - {TK_OPTION_INT, "-underline", "underline", "Underline", - "-1", offsetof(Base,base.underlineObj), TCL_INDEX_NONE, + {TK_OPTION_INDEX, "-underline", "underline", "Underline", + DEF_BUTTON_UNDERLINE, offsetof(Base,base.underlineObj1), TCL_INDEX_NONE, 0,0,0 }, /* SB: OPTION_INT, see <<NOTE-NULLOPTIONS>> */ {TK_OPTION_STRING, "-width", "width", "Width", diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index 7c43bce..6fea538 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -8,6 +8,7 @@ #include "ttkTheme.h" #include "ttkWidget.h" #include "ttkManager.h" +#include "default.h" /* ====================================================================== * +++ Frame widget: @@ -257,8 +258,8 @@ static const Tk_OptionSpec LabelframeOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(Labelframe,label.textObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, - {TK_OPTION_INT, "-underline", "underline", "Underline", - "-1", offsetof(Labelframe,label.underlineObj), TCL_INDEX_NONE, + {TK_OPTION_INDEX, "-underline", "underline", "Underline", + DEF_BUTTON_UNDERLINE, offsetof(Labelframe,label.underlineObj), TCL_INDEX_NONE, 0,0,0 }, {TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", NULL, TCL_INDEX_NONE, offsetof(Labelframe,label.labelWidget), diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index a4dbf96..c83c222 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -8,6 +8,7 @@ #include "tkInt.h" #include "ttkTheme.h" +#include "default.h" /*---------------------------------------------------------------------- * +++ Text element. @@ -53,8 +54,8 @@ static const Ttk_ElementOptionSpec TextElementOptions[] = { offsetof(TextElement,fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, offsetof(TextElement,foregroundObj), "black" }, - { "-underline", TK_OPTION_INT, - offsetof(TextElement,underlineObj), "-1"}, + { "-underline", TK_OPTION_INDEX, + offsetof(TextElement,underlineObj), DEF_BUTTON_UNDERLINE}, { "-width", TK_OPTION_INT, offsetof(TextElement,widthObj), "-1"}, { "-anchor", TK_OPTION_ANCHOR, @@ -126,7 +127,7 @@ static void TextCleanup(TextElement *text) static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) { XColor *color = Tk_GetColorFromObj(tkwin, text->foregroundObj); - int underline = -1; + TkSizeT underline = TCL_INDEX_NONE; XGCValues gcValues; GC gc1, gc2; Tk_Anchor anchor = TK_ANCHOR_CENTER; @@ -170,8 +171,9 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) Tk_DrawTextLayout(Tk_Display(tkwin), d, gc1, text->textLayout, b.x, b.y, 0/*firstChar*/, -1/*lastChar*/); - Tcl_GetIntFromObj(NULL, text->underlineObj, &underline); - if (underline >= 0) { + /* TODO: Handle end+/- syntax */ + TkGetIntForIndex(text->underlineObj, INT_MAX - 1, TCL_INDEX_ERROR, &underline); + if ((underline != TCL_INDEX_NONE) && (underline < (TkSizeT)INT_MAX)) { if (text->embossed) { Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc2, text->textLayout, b.x+1, b.y+1, underline); @@ -463,8 +465,8 @@ static const Ttk_ElementOptionSpec LabelElementOptions[] = { offsetof(LabelElement,text.fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, offsetof(LabelElement,text.foregroundObj), "black" }, - { "-underline", TK_OPTION_INT, - offsetof(LabelElement,text.underlineObj), "-1"}, + { "-underline", TK_OPTION_INDEX, + offsetof(LabelElement,text.underlineObj), DEF_BUTTON_UNDERLINE}, { "-width", TK_OPTION_INT, offsetof(LabelElement,text.widthObj), ""}, { "-anchor", TK_OPTION_ANCHOR, diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 7ad46a4..6b185c1 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -6,6 +6,7 @@ #include "ttkTheme.h" #include "ttkWidget.h" #include "ttkManager.h" +#include "default.h" #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MAX(a,b) ((a) > (b) ? (a) : (b)) @@ -67,7 +68,7 @@ static const Tk_OptionSpec TabOptionSpecs[] = {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", NULL, offsetof(Tab,compoundObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,(void *)ttkCompoundStrings,GEOMETRY_CHANGED }, - {TK_OPTION_INT, "-underline", "underline", "Underline", "-1", + {TK_OPTION_INDEX, "-underline", "underline", "Underline", DEF_BUTTON_UNDERLINE, offsetof(Tab,underlineObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 } }; diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index efaaa91..b20454b 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -114,7 +114,11 @@ #define DEF_BUTTON_TAKE_FOCUS NULL #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" -#define DEF_BUTTON_UNDERLINE "-1" +#if TCL_MAJOR_VERSION < 9 && !defined(TK_NO_DEPRECATED) +# define DEF_BUTTON_UNDERLINE "-1" +#else +# define DEF_BUTTON_UNDERLINE "none" +#endif #define DEF_BUTTON_VALUE "" #define DEF_BUTTON_WIDTH "0" #define DEF_BUTTON_WRAP_LENGTH "0" @@ -370,7 +374,7 @@ #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" -#define DEF_MENUBUTTON_UNDERLINE "-1" +#define DEF_MENUBUTTON_UNDERLINE DEF_BUTTON_UNDERLINE #define DEF_MENUBUTTON_WIDTH "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" diff --git a/tests/button.test b/tests/button.test index 9a69b1b..04d4aa0 100644 --- a/tests/button.test +++ b/tests/button.test @@ -2414,7 +2414,7 @@ test button-1.244 {configuration option: "underline" for label} -setup { .l configure -underline 3p } -cleanup { destroy .l -} -returnCodes {error} -result {expected integer but got "3p"} +} -returnCodes {error} -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer? or none} test button-1.245 {configuration option: "underline" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b @@ -2433,7 +2433,7 @@ test button-1.246 {configuration option: "underline" for button} -setup { .b configure -underline 3p } -cleanup { destroy .b -} -returnCodes {error} -result {expected integer but got "3p"} +} -returnCodes {error} -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer? or none} test button-1.247 {configuration option: "underline" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c @@ -2452,7 +2452,7 @@ test button-1.248 {configuration option: "underline" for checkbutton} -setup { .c configure -underline 3p } -cleanup { destroy .c -} -returnCodes {error} -result {expected integer but got "3p"} +} -returnCodes {error} -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer? or none} test button-1.249 {configuration option: "underline" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r @@ -2471,7 +2471,7 @@ test button-1.250 {configuration option: "underline" for radiobutton} -setup { .r configure -underline 3p } -cleanup { destroy .r -} -returnCodes {error} -result {expected integer but got "3p"} +} -returnCodes {error} -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer? or none} test button-1.251 {configuration option: "tristatevalue" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} diff --git a/tests/canvText.test b/tests/canvText.test index da60ea4..8037040 100644 --- a/tests/canvText.test +++ b/tests/canvText.test @@ -753,7 +753,7 @@ test canvText-14.1 {GetTextIndex procedure} -setup { list [.c index test end] [.c index test insert] \ [.c index test sel.first] [.c index test sel.last] \ [.c index test @0,0] \ - [.c index test -1] [.c index test 10] [.c index test 100] + [.c index test none] [.c index test 10] [.c index test 100] } -cleanup { .c delete test } -result {15 12 5 8 0 0 10 15} diff --git a/tests/entry.test b/tests/entry.test index 967546f..e139ae3 100644 --- a/tests/entry.test +++ b/tests/entry.test @@ -1533,7 +1533,7 @@ test entry-3.79 {EntryWidgetCmd procedure, "xview" widget command} -setup { .e insert end "runs off the end of the window quite a bit." .e xview 0 update - .e xview -1 + .e xview none .e index @0 } -cleanup { destroy .e @@ -2101,7 +2101,7 @@ test entry-8.2 {DeleteChars procedure} -setup { } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde - .e delete -1 2 + .e delete 0 2 set timeout [after 500 {set $scrollInfo "timeout"}] vwait scrollInfo list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] @@ -2833,7 +2833,7 @@ test entry-13.23 {GetEntryIndex procedure} -body { .e insert 0 012345678901234567890 .e xview 4 update - .e index -1 + .e index none } -cleanup { destroy .e } -result 0 diff --git a/tests/listbox.test b/tests/listbox.test index c4c178f..c03b881 100644 --- a/tests/listbox.test +++ b/tests/listbox.test @@ -374,7 +374,7 @@ test listbox-3.5 {ListboxWidgetCmd procedure, "activate" option} -body { .l index active } -result 3 test listbox-3.6 {ListboxWidgetCmd procedure, "activate" option} -body { - .l activate -1 + .l activate none .l index active } -result 0 test listbox-3.7 {ListboxWidgetCmd procedure, "activate" option} -body { @@ -426,7 +426,7 @@ test listbox-3.15 {ListboxWidgetCmd procedure, "bbox" option} -constraints { } -body { .l yview 0 update - list [.l bbox -1] [.l bbox 0] + list [.l bbox none] [.l bbox 0] } -result {{} {7 7 17 14}} test listbox-3.16 {ListboxWidgetCmd procedure, "bbox" option} -constraints { fonts @@ -587,7 +587,7 @@ test listbox-3.36 {ListboxWidgetCmd procedure, "delete" option} -setup { } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 - .l2 delete -1 2 + .l2 delete 0 2 .l2 get 0 end } -cleanup { destroy .l2 @@ -597,7 +597,7 @@ test listbox-3.37 {ListboxWidgetCmd procedure, "delete" option} -setup { } -body { listbox .l2 .l2 insert 0 el0 el1 el2 el3 el4 el5 el6 el7 - .l2 delete -1 -1 + .l2 delete 0 none .l2 get 0 end } -cleanup { destroy .l2 @@ -681,13 +681,13 @@ test listbox-3.48 {ListboxWidgetCmd procedure, "get" option} -setup { destroy .l2 } -result {{two words} el4 el5 el6 el7} test listbox-3.49 {ListboxWidgetCmd procedure, "get" option} -body { - .l get -1 + .l get none } -result {} test listbox-3.50 {ListboxWidgetCmd procedure, "get" option} -body { - .l get -1 -1 + .l get none none } -result {} test listbox-3.51 {ListboxWidgetCmd procedure, "get" option} -body { - .l get -1 3 + .l get none 3 } -result {el0 el1 el2 el3} test listbox-3.52 {ListboxWidgetCmd procedure, "get" option} -body { .l get 12 end @@ -717,7 +717,7 @@ test listbox-3.60 {ListboxWidgetCmd procedure, "index" option} -body { .l index 2 } -result 2 test listbox-3.61 {ListboxWidgetCmd procedure, "index" option} -body { - .l index -1 + .l index none } -result {-1} test listbox-3.62 {ListboxWidgetCmd procedure, "index" option} -body { .l index end @@ -746,7 +746,7 @@ test listbox-3.67 {ListboxWidgetCmd procedure, "insert" option} -setup { } -body { listbox .l2 .l2 insert end a b c - .l2 insert -1 x + .l2 insert 0 x .l2 get 0 end } -cleanup { destroy .l2 @@ -858,7 +858,7 @@ test listbox-3.88 {ListboxWidgetCmd procedure, "see" option} -body { } -result 11 test listbox-3.89 {ListboxWidgetCmd procedure, "see" option} -body { .l yview 7 - .l see -1 + .l see none .l index @0,0 } -result 0 test listbox-3.90 {ListboxWidgetCmd procedure, "see" option} -body { @@ -896,7 +896,7 @@ test listbox-3.98 {ListboxWidgetCmd procedure, "selection" option} -body { [.l selection anchor 0; .l index anchor] } -result {5 0} test listbox-3.99 {ListboxWidgetCmd procedure, "selection" option} -body { - .l selection anchor -1 + .l selection anchor none .l index anchor } -result 0 test listbox-3.100 {ListboxWidgetCmd procedure, "selection" option} -body { @@ -925,7 +925,7 @@ test listbox-3.104 {ListboxWidgetCmd procedure, "selection" option} -body { } -result {1 0 1} test listbox-3.105 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection set 0 end - .l selection includes -1 + .l selection includes none } -result 0 test listbox-3.106 {ListboxWidgetCmd procedure, "selection" option} -body { .l selection clear 0 end @@ -2129,7 +2129,7 @@ test listbox-10.19 {GetListboxIndex procedure} -setup { pack [listbox .l] .l insert 0 el0 el1 el2 el3 el4 el5 el6 el7 el8 el9 el10 el11 update - .l index -1 + .l index none } -cleanup { destroy .l } -result -1 @@ -2155,7 +2155,7 @@ test listbox-11.1 {ChangeListboxView procedure, boundary conditions for index} - .l yview 3 update set x [.l index @0,0] - .l yview -1 + .l yview none update lappend x [.l index @0,0] } -cleanup { @@ -2378,14 +2378,14 @@ test listbox-15.4 {ListboxSelect procedure, boundary conditions for indices} -bo .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end - .l select set -1 -1 + .l select set none none .l curselection } -result {} test listbox-15.5 {ListboxSelect procedure, boundary conditions for indices} -body { .l delete 0 end .l insert 0 a b c d e f .l select clear 0 end - .l select set -1 3 + .l select set none 3 .l curselection } -result {0 1 2 3} test listbox-15.6 {ListboxSelect procedure, boundary conditions for indices} -body { diff --git a/tests/menubut.test b/tests/menubut.test index b8a52a9..fa4d89d 100644 --- a/tests/menubut.test +++ b/tests/menubut.test @@ -294,7 +294,7 @@ test menubutton-1.54 {configuration options} -body { } -result 5 test menubutton-1.55 {configuration options} -body { .mb configure -underline 3p -} -returnCodes error -result {expected integer but got "3p"} +} -returnCodes error -result {bad index "3p": must be integer?[+-]integer?, end?[+-]integer? or none} test menubutton-1.56 {configuration options} -body { .mb configure -width 402 .mb cget -width diff --git a/tests/spinbox.test b/tests/spinbox.test index f59104f..f5c6540 100644 --- a/tests/spinbox.test +++ b/tests/spinbox.test @@ -1871,7 +1871,7 @@ test spinbox-3.79 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { .e insert end "runs off the end of the window quite a bit." .e xview 0 update - .e xview -1 + .e xview none .e index @0 } -cleanup { destroy .e @@ -2386,7 +2386,7 @@ test spinbox-8.2 {DeleteChars procedure} -setup { } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde - .e delete -1 2 + .e delete 0 2 set timeout [after 500 {set $scrollInfo "timeout"}] vwait scrollInfo list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] @@ -3115,7 +3115,7 @@ test spinbox-13.23 {GetSpinboxIndex procedure} -body { .e insert 0 012345678901234567890 .e xview 4 update - .e index -1 + .e index none } -cleanup { destroy .e } -result 0 diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h index fa1f120..231a48b 100644 --- a/unix/tkUnixDefault.h +++ b/unix/tkUnixDefault.h @@ -86,7 +86,11 @@ #define DEF_BUTTON_TAKE_FOCUS NULL #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" -#define DEF_BUTTON_UNDERLINE "-1" +#if TCL_MAJOR_VERSION < 9 && !defined(TK_NO_DEPRECATED) +# define DEF_BUTTON_UNDERLINE "-1" +#else +# define DEF_BUTTON_UNDERLINE "none" +#endif #define DEF_BUTTON_VALUE "" #define DEF_BUTTON_WIDTH "0" #define DEF_BUTTON_WRAP_LENGTH "0" @@ -331,7 +335,7 @@ #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" -#define DEF_MENUBUTTON_UNDERLINE "-1" +#define DEF_MENUBUTTON_UNDERLINE DEF_BUTTON_UNDERLINE #define DEF_MENUBUTTON_WIDTH "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h index 33756f8..906887d 100644 --- a/win/tkWinDefault.h +++ b/win/tkWinDefault.h @@ -91,7 +91,11 @@ #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" #define DEF_BUTTON_TRISTATE_VALUE "" -#define DEF_BUTTON_UNDERLINE "-1" +#if TCL_MAJOR_VERSION < 9 && !defined(TK_NO_DEPRECATED) +# define DEF_BUTTON_UNDERLINE "-1" +#else +# define DEF_BUTTON_UNDERLINE "none" +#endif #define DEF_BUTTON_VALUE "" #define DEF_BUTTON_WIDTH "0" #define DEF_BUTTON_WRAP_LENGTH "0" @@ -335,7 +339,7 @@ #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" -#define DEF_MENUBUTTON_UNDERLINE "-1" +#define DEF_MENUBUTTON_UNDERLINE DEF_BUTTON_UNDERLINE #define DEF_MENUBUTTON_WIDTH "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" |