diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-11-16 08:28:42 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-11-16 08:28:42 (GMT) |
commit | b571874acdb6907f92b4bc630a8c5db172a771a8 (patch) | |
tree | a773a940e17f0b93315d92d74b5b2ca783e2aa71 | |
parent | 0b8e693f8fee267c596ede0aa80c2b947925c606 (diff) | |
download | tk-b571874acdb6907f92b4bc630a8c5db172a771a8.zip tk-b571874acdb6907f92b4bc630a8c5db172a771a8.tar.gz tk-b571874acdb6907f92b4bc630a8c5db172a771a8.tar.bz2 |
Give Ttk_GetOrientFromObj the signature it always should have had.
-rw-r--r-- | generic/ttk/ttk.decls | 9 | ||||
-rw-r--r-- | generic/ttk/ttkClamTheme.c | 4 | ||||
-rw-r--r-- | generic/ttk/ttkClassicTheme.c | 4 | ||||
-rw-r--r-- | generic/ttk/ttkDecls.h | 26 | ||||
-rw-r--r-- | generic/ttk/ttkDefaultTheme.c | 4 | ||||
-rw-r--r-- | generic/ttk/ttkElements.c | 10 | ||||
-rw-r--r-- | generic/ttk/ttkInit.c | 2 | ||||
-rw-r--r-- | generic/ttk/ttkLabel.c | 8 | ||||
-rw-r--r-- | generic/ttk/ttkNotebook.c | 14 | ||||
-rw-r--r-- | generic/ttk/ttkProgress.c | 4 | ||||
-rw-r--r-- | generic/ttk/ttkStubInit.c | 5 | ||||
-rw-r--r-- | generic/ttk/ttkTheme.h | 3 | ||||
-rw-r--r-- | generic/ttk/ttkThemeInt.h | 6 | ||||
-rw-r--r-- | generic/ttk/ttkWidget.c | 2 | ||||
-rw-r--r-- | macosx/ttkMacOSXTheme.c | 12 | ||||
-rw-r--r-- | win/ttkWinTheme.c | 4 |
16 files changed, 64 insertions, 53 deletions
diff --git a/generic/ttk/ttk.decls b/generic/ttk/ttk.decls index e3a788e..7826c99 100644 --- a/generic/ttk/ttk.decls +++ b/generic/ttk/ttk.decls @@ -139,3 +139,12 @@ declare 34 { declare 35 { Tcl_Obj *Ttk_NewBoxObj(Ttk_Box box) } + +# +# Utilities. +# +declare 40 { + int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *orient) +} + + diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index e17ee82..08d2df9 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -717,7 +717,7 @@ static void ThumbElementDraw( /* * Draw grip: */ - TtkGetOrientFromObj(NULL, sb->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, sb->gripSizeObj, &gripSize); lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d); darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d); @@ -763,7 +763,7 @@ static void SliderElementSize( (void)paddingPtr; length = thickness = SCROLLBAR_THICKNESS; - TtkGetOrientFromObj(NULL, sb->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, sb->arrowSizeObj, &thickness); Tk_GetPixelsFromObj(NULL, tkwin, sb->sliderlengthObj, &length); if (orient == TTK_ORIENT_VERTICAL) { diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index a9d07ee..e102e7f 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -564,7 +564,7 @@ static void SliderElementSize( (void)dummy; (void)paddingPtr; - TtkGetOrientFromObj(NULL, slider->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->lengthObj, &length); Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness); @@ -593,7 +593,7 @@ static void SliderElementDraw( (void)state; border = Tk_Get3DBorderFromObj(tkwin, slider->borderObj); - TtkGetOrientFromObj(NULL, slider->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); Tk_GetReliefFromObj(NULL, slider->reliefObj, &relief); diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h index 33274aa..9c40904 100644 --- a/generic/ttk/ttkDecls.h +++ b/generic/ttk/ttkDecls.h @@ -13,11 +13,7 @@ extern const char *TtkInitializeStubs( interp, TTK_VERSION, TTK_STUBS_EPOCH, TTK_STUBS_REVISION) #else -#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 -# define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "Ttk", TTK_VERSION, 0, NULL) -#else -# define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "ttk", TTK_VERSION, 0, NULL) -#endif +#define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "ttk", TTK_VERSION, 0, NULL) #endif @@ -34,7 +30,7 @@ extern const char *TtkInitializeStubs( /* !BEGIN!: Do not edit below this line. */ #define TTK_STUBS_EPOCH 0 -#define TTK_STUBS_REVISION 30 +#define TTK_STUBS_REVISION 31 #ifdef __cplusplus extern "C" { @@ -138,6 +134,13 @@ TTKAPI Ttk_Box Ttk_PlaceBox(Ttk_Box *cavity, int w, int h, Ttk_Side side, Ttk_Sticky sticky); /* 35 */ TTKAPI Tcl_Obj * Ttk_NewBoxObj(Ttk_Box box); +/* Slot 36 is reserved */ +/* Slot 37 is reserved */ +/* Slot 38 is reserved */ +/* Slot 39 is reserved */ +/* 40 */ +TTKAPI int Ttk_GetOrientFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr, Ttk_Orient *orient); typedef struct TtkStubs { int magic; @@ -181,6 +184,11 @@ typedef struct TtkStubs { Ttk_Box (*ttk_ExpandBox) (Ttk_Box b, Ttk_Padding p); /* 33 */ Ttk_Box (*ttk_PlaceBox) (Ttk_Box *cavity, int w, int h, Ttk_Side side, Ttk_Sticky sticky); /* 34 */ Tcl_Obj * (*ttk_NewBoxObj) (Ttk_Box box); /* 35 */ + void (*reserved36)(void); + void (*reserved37)(void); + void (*reserved38)(void); + void (*reserved39)(void); + int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *orient); /* 40 */ } TtkStubs; extern const TtkStubs *ttkStubsPtr; @@ -261,6 +269,12 @@ extern const TtkStubs *ttkStubsPtr; (ttkStubsPtr->ttk_PlaceBox) /* 34 */ #define Ttk_NewBoxObj \ (ttkStubsPtr->ttk_NewBoxObj) /* 35 */ +/* Slot 36 is reserved */ +/* Slot 37 is reserved */ +/* Slot 38 is reserved */ +/* Slot 39 is reserved */ +#define Ttk_GetOrientFromObj \ + (ttkStubsPtr->ttk_GetOrientFromObj) /* 40 */ #endif /* defined(USE_TTK_STUBS) */ diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index 431a5af..d15f1c9 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -1056,7 +1056,7 @@ static void ThumbElementSize( (void)paddingPtr; Tk_GetPixelsFromObj(NULL, tkwin, thumb->sizeObj, &size); - TtkGetOrientFromObj(NULL, thumb->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient); if (orient == TTK_ORIENT_VERTICAL) { *widthPtr = size; @@ -1147,7 +1147,7 @@ static void SliderElementSize( (void)dummy; (void)paddingPtr; - TtkGetOrientFromObj(NULL, slider->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, slider->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, slider->thicknessObj, &thickness); diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 16296b2..cee050f 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -497,7 +497,7 @@ static void GeneralSeparatorElementDraw( SeparatorElement *separator = (SeparatorElement *)elementRecord; Ttk_Orient orient; - TtkGetOrientFromObj(NULL, separator->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, separator->orientObj, &orient); switch (orient) { case TTK_ORIENT_HORIZONTAL: HorizontalSeparatorElementDraw( @@ -1199,7 +1199,7 @@ static void TroughElementDraw( Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->borderWidthObj, &borderWidth); Tk_GetPixelsFromObj(NULL, tkwin, troughPtr->grooveWidthObj, &grooveWidth); Tk_GetReliefFromObj(NULL, troughPtr->reliefObj, &relief); - TtkGetOrientFromObj(NULL, troughPtr->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, troughPtr->orientObj, &orient); if (grooveWidth > 0 && grooveWidth < b.height && grooveWidth < b.width) { if (orient == TTK_ORIENT_HORIZONTAL) { @@ -1268,7 +1268,7 @@ static void ThumbElementSize( (void)paddingPtr; Tk_GetPixelsFromObj(NULL, tkwin, thumb->thicknessObj, &thickness); - TtkGetOrientFromObj(NULL, thumb->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, thumb->orientObj, &orient); if (orient == TTK_ORIENT_VERTICAL) { *widthPtr = thickness; @@ -1399,7 +1399,7 @@ static void SliderElementDraw( * Fill the thin trough area preceding the * slider's center with the inner color */ - TtkGetOrientFromObj(NULL, slider->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); switch (orient) { case TTK_ORIENT_HORIZONTAL: XFillRectangle(disp, d, gc, troughInnerBox.x, troughInnerBox.y, @@ -1535,7 +1535,7 @@ static void PbarElementSize( (void)dummy; (void)paddingPtr; - TtkGetOrientFromObj(NULL, pbar->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orient); Tk_GetPixelsFromObj(NULL, tkwin, pbar->thicknessObj, &thickness); Tk_GetPixelsFromObj(NULL, tkwin, pbar->lengthObj, &length); Tk_GetPixelsFromObj(NULL, tkwin, pbar->borderWidthObj, &borderWidth); diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index 7ab55d6..fcc069b 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -55,7 +55,7 @@ const char *const ttkOrientStrings[] = { "horizontal", "vertical", NULL }; -int TtkGetOrientFromObj( +int Ttk_GetOrientFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *resultPtr) { int orient = (int)TTK_ORIENT_HORIZONTAL; diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index d94cb23..7210c26 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -54,11 +54,7 @@ static const Ttk_ElementOptionSpec TextElementOptions[] = { { "-foreground", TK_OPTION_COLOR, offsetof(TextElement,foregroundObj), "black" }, { "-underline", TK_OPTION_INDEX, -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) - offsetof(TextElement,underlineObj), "-1"}, -#else offsetof(TextElement,underlineObj), NULL}, -#endif { "-width", TK_OPTION_INT, offsetof(TextElement,widthObj), "-1"}, { "-anchor", TK_OPTION_ANCHOR, @@ -518,11 +514,7 @@ static const Ttk_ElementOptionSpec LabelElementOptions[] = { { "-foreground", TK_OPTION_COLOR, offsetof(LabelElement,text.foregroundObj), "black" }, { "-underline", TK_OPTION_INDEX, -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) offsetof(LabelElement,text.underlineObj), "-1"}, -#else - offsetof(LabelElement,text.underlineObj), NULL}, -#endif { "-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 17ccd3a..d365c99 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -1123,10 +1123,9 @@ static int NotebookIdentifyCommand( } break; case IDENTIFY_TAB: -#if !defined TK_NO_DEPRECATED && (TCL_MAJOR_VERSION < 9) - if (tabIndex >= 0) -#endif - Tcl_SetObjResult(interp, TkNewIndexObj(tabIndex)); + if (tabIndex >= 0) { + Tcl_SetObjResult(interp, TkNewIndexObj(tabIndex)); + } break; } return TCL_OK; @@ -1151,10 +1150,9 @@ static int NotebookIndexCommand( status = FindTabIndex(interp, nb, objv[2], &index); if (status == TCL_OK) { -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) - if (index >= 0) -#endif - Tcl_SetObjResult(interp, TkNewIndexObj(index)); + if (index >= 0) { + Tcl_SetObjResult(interp, TkNewIndexObj(index)); + } } return status; diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index b23c698..2b551b6 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -303,7 +303,7 @@ static int ProgressbarSize(void *recordPtr, int *widthPtr, int *heightPtr) /* Override requested width (height) based on -length and -orient */ Tk_GetPixelsFromObj(NULL, pb->core.tkwin, pb->progress.lengthObj, &length); - TtkGetOrientFromObj(NULL, pb->progress.orientObj, &orient); + Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = length; @@ -376,7 +376,7 @@ static void ProgressbarDoLayout(void *recordPtr) Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value); Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum); - TtkGetOrientFromObj(NULL, pb->progress.orientObj, &orient); + Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient); if (pbar) { double fraction = value / maximum; diff --git a/generic/ttk/ttkStubInit.c b/generic/ttk/ttkStubInit.c index f123ec5..9d7d4fc 100644 --- a/generic/ttk/ttkStubInit.c +++ b/generic/ttk/ttkStubInit.c @@ -59,6 +59,11 @@ const TtkStubs ttkStubs = { Ttk_ExpandBox, /* 33 */ Ttk_PlaceBox, /* 34 */ Ttk_NewBoxObj, /* 35 */ + 0, /* 36 */ + 0, /* 37 */ + 0, /* 38 */ + 0, /* 39 */ + Ttk_GetOrientFromObj, /* 40 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h index a00dbc5..b6d7626 100644 --- a/generic/ttk/ttkTheme.h +++ b/generic/ttk/ttkTheme.h @@ -369,9 +369,6 @@ typedef enum { /* -orient option values */ TTK_ORIENT_VERTICAL } Ttk_Orient; -MODULE_SCOPE int TtkGetOrientFromObj(Tcl_Interp *interp, - Tcl_Obj *objPtr, Ttk_Orient *orient); - /*------------------------------------------------------------------------ * +++ Utilities. */ diff --git a/generic/ttk/ttkThemeInt.h b/generic/ttk/ttkThemeInt.h index 23bbcd6..8758f85 100644 --- a/generic/ttk/ttkThemeInt.h +++ b/generic/ttk/ttkThemeInt.h @@ -43,10 +43,6 @@ MODULE_SCOPE void TtkSetBlinkCursorTimes(Tcl_Interp* interp); MODULE_SCOPE int TtkBoxEqual(Ttk_Box, Ttk_Box); -#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) -# define TTK_OPTION_UNDERLINE_DEF(type, field) "-1", offsetof(type, field), TCL_INDEX_NONE, 0, NULL -#else -# define TTK_OPTION_UNDERLINE_DEF(type, field) NULL, offsetof(type, field), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL -#endif +#define TTK_OPTION_UNDERLINE_DEF(type, field) NULL, offsetof(type, field), TCL_INDEX_NONE, TK_OPTION_NULL_OK, NULL #endif /* _TTKTHEMEINT */ diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index d819af7..f967b7e 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -480,7 +480,7 @@ Ttk_Layout TtkWidgetGetOrientedLayout( /* Prefix: */ - TtkGetOrientFromObj(NULL, orientObj, &orient); + Ttk_GetOrientFromObj(NULL, orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) Tcl_DStringAppend(&styleName, "Horizontal.", -1); else diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 504446b..7495741 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -2480,7 +2480,7 @@ static void TrackElementDraw( double from = 0, to = 100, value = 0, fraction, max; CGRect bounds = BoxToRect(d, b); - TtkGetOrientFromObj(NULL, elem->orientObj, &orientation); + Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from); Tcl_GetDoubleFromObj(NULL, elem->toObj, &to); Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value); @@ -2622,7 +2622,7 @@ static void PbarElementDraw( int isIndeterminate = !strcmp("indeterminate", Tcl_GetString(pbar->modeObj)); - TtkGetOrientFromObj(NULL, pbar->orientObj, &orientation); + Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum); Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase); @@ -2697,7 +2697,7 @@ static void TroughElementSize( Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; SInt32 thickness = 15; - TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); + Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &thickness); if (orientation == TTK_ORIENT_HORIZONTAL) { *minHeight = thickness; @@ -2725,7 +2725,7 @@ static void TroughElementDraw( CGRect bounds = BoxToRect(d, b); GrayColor bgGray; - TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); + Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); if (orientation == TTK_ORIENT_HORIZONTAL) { bounds = CGRectInset(bounds, 0, 1); } else { @@ -2761,7 +2761,7 @@ static void ThumbElementSize( ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; - TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); + Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); if (orientation == TTK_ORIENT_VERTICAL) { *minHeight = 18; *minWidth = 8; @@ -2782,7 +2782,7 @@ static void ThumbElementDraw( ScrollbarElement *scrollbar = (ScrollbarElement *)elementRecord; Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; - TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); + Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); /* * In order to make ttk scrollbars work correctly it is necessary to be diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index 640573e..3c7bf1d 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -621,7 +621,7 @@ static void ThumbElementSize( ThumbElement *thumbPtr = (ThumbElement *)elementRecord; Ttk_Orient orient; - TtkGetOrientFromObj(NULL, thumbPtr->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, thumbPtr->orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = GetSystemMetrics(SM_CXHTHUMB); *heightPtr = GetSystemMetrics(SM_CYHSCROLL); @@ -686,7 +686,7 @@ static void SliderElementSize( SliderElement *slider = (SliderElement *)elementRecord; Ttk_Orient orient; - TtkGetOrientFromObj(NULL, slider->orientObj, &orient); + Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = (GetSystemMetrics(SM_CXHTHUMB) / 2) | 1; *heightPtr = GetSystemMetrics(SM_CYHSCROLL); |