From 4f3bd35cc8a055ecc94507243800f219fc477cac Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 19 May 2024 12:09:25 +0000 Subject: Fix [527cb3cd5d]. Moves special internal flags outside the user1-user6 range --- generic/ttk/ttkClamTheme.c | 10 +++++----- generic/ttk/ttkDefaultTheme.c | 3 --- generic/ttk/ttkNotebook.c | 4 ++-- generic/ttk/ttkThemeInt.h | 9 +++++++++ generic/ttk/ttkTreeview.c | 3 --- macosx/ttkMacOSXTheme.c | 34 ++++++++++++++++------------------ macosx/ttkMacOSXTheme.h | 2 -- win/ttkWinXPTheme.c | 3 --- 8 files changed, 32 insertions(+), 36 deletions(-) diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index dceec38..d13462d 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -5,7 +5,7 @@ */ #include "tkInt.h" -#include "ttkTheme.h" +#include "ttkThemeInt.h" /* * Under windows, the Tk-provided XDrawLine and XDrawArc have an @@ -1035,7 +1035,7 @@ static void TabElementDraw( switch (nbTabsStickBit) { default: case TTK_STICK_S: - if (state & TTK_STATE_USER2) { /* rightmost tab */ + if (state & TTK_STATE_LAST) { /* rightmost tab */ --b.width; } @@ -1057,7 +1057,7 @@ static void TabElementDraw( break; case TTK_STICK_N: - if (state & TTK_STATE_USER2) { /* rightmost tab */ + if (state & TTK_STATE_LAST) { /* rightmost tab */ --b.width; } @@ -1079,7 +1079,7 @@ static void TabElementDraw( break; case TTK_STICK_E: - if (state & TTK_STATE_USER2) { /* bottommost tab */ + if (state & TTK_STATE_LAST) { /* bottommost tab */ --b.height; } @@ -1101,7 +1101,7 @@ static void TabElementDraw( break; case TTK_STICK_W: - if (state & TTK_STATE_USER2) { /* bottommost tab */ + if (state & TTK_STATE_LAST) { /* bottommost tab */ --b.height; } diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c index ce1aebf..8182c27 100644 --- a/generic/ttk/ttkDefaultTheme.c +++ b/generic/ttk/ttkDefaultTheme.c @@ -1208,9 +1208,6 @@ static const Ttk_ElementSpec SliderElementSpec = { * +++ Tree indicator element. */ -#define TTK_STATE_OPEN TTK_STATE_USER1 /* XREF: treeview.c */ -#define TTK_STATE_LEAF TTK_STATE_USER2 - typedef struct { Tcl_Obj *colorObj; Tcl_Obj *marginObj; diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 96f7997..11a5046 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -317,7 +317,7 @@ static Ttk_State TabState(Notebook *nb, Tcl_Size index) continue; } if (index == i) { - state |= TTK_STATE_USER1; + state |= TTK_STATE_FIRST; } break; } @@ -327,7 +327,7 @@ static Ttk_State TabState(Notebook *nb, Tcl_Size index) continue; } if (index == i) { - state |= TTK_STATE_USER2; + state |= TTK_STATE_LAST; } break; } diff --git a/generic/ttk/ttkThemeInt.h b/generic/ttk/ttkThemeInt.h index 0b5e48f..37e9c83 100644 --- a/generic/ttk/ttkThemeInt.h +++ b/generic/ttk/ttkThemeInt.h @@ -9,6 +9,15 @@ #include "ttkTheme.h" +/*------------------------------------------------------------------------ + * +++ Widget states (internal). + */ + +#define TTK_STATE_OPEN (1<<16) +#define TTK_STATE_LEAF (1<<17) +#define TTK_STATE_FIRST (1<<18) +#define TTK_STATE_LAST (1<<19) + typedef struct Ttk_TemplateNode_ Ttk_TemplateNode, *Ttk_LayoutTemplate; MODULE_SCOPE Ttk_ElementClass *Ttk_GetElement(Ttk_Theme, const char *name); diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 84667c5..5acf9c3 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -23,9 +23,6 @@ static const Tk_Anchor DEFAULT_IMAGEANCHOR = TK_ANCHOR_W; static const int DEFAULT_INDENT = 20; static const int HALO = 4; /* heading separator */ -#define TTK_STATE_OPEN TTK_STATE_USER1 -#define TTK_STATE_LEAF TTK_STATE_USER2 - #define STATE_CHANGED (0x100) /* item state option changed */ #define MAX(a,b) (((a) > (b)) ? (a) : (b)) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index efcb271..7a89fa7 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -30,7 +30,7 @@ */ #include "tkMacOSXPrivate.h" -#include "ttk/ttkTheme.h" +#include "ttk/ttkThemeInt.h" #include "ttkMacOSXTheme.h" #include "tkColor.h" #include @@ -1488,11 +1488,11 @@ DrawTab( CGContextClipToRect(context, bounds); if (OSVersion < 110000 || !(state & TTK_STATE_SELECTED)) { - if (!(state & TTK_STATE_FIRST_TAB)) { + if (!(state & TTK_STATE_FIRST)) { bounds.origin.x -= 10; bounds.size.width += 10; } - if (!(state & TTK_STATE_LAST_TAB)) { + if (!(state & TTK_STATE_LAST)) { bounds.size.width += 10; } } @@ -1510,7 +1510,7 @@ DrawTab( * not first. */ - if (!(state & TTK_STATE_FIRST_TAB)) { + if (!(state & TTK_STATE_FIRST)) { CGContextSaveGState(context); strokeColor = CGColorFromGray(darkTabSeparator); CGContextSetStrokeColorWithColor(context, strokeColor); @@ -1530,7 +1530,7 @@ DrawTab( * (The selected tab is always drawn last.) */ - if ((state & TTK_STATE_FIRST_TAB) && !(state & TTK_STATE_LAST_TAB)) { + if ((state & TTK_STATE_FIRST) && !(state & TTK_STATE_LAST)) { bounds.size.width += 1; } if (!(state & TTK_STATE_BACKGROUND)) { @@ -1559,12 +1559,12 @@ DrawTab11( * rounded rectangle behind the entire tab bar. */ - if (!(state & TTK_STATE_FIRST_TAB)) { + if (!(state & TTK_STATE_FIRST)) { clipRect.origin.x -= 5; bounds.origin.x -= 5; bounds.size.width += 5; } - if (!(state & TTK_STATE_LAST_TAB)) { + if (!(state & TTK_STATE_LAST)) { clipRect.size.width += 5; bounds.size.width += 5; } @@ -1874,15 +1874,15 @@ static const Ttk_StateTable TabStyleTable[] = { {kThemeTabNonFront, 0, 0} }; static const Ttk_StateTable TabAdornmentTable[] = { - {kHIThemeTabAdornmentNone, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB, 0}, - {kHIThemeTabAdornmentTrailingSeparator, TTK_STATE_FIRST_TAB, 0}, - {kHIThemeTabAdornmentNone, TTK_STATE_LAST_TAB, 0}, + {kHIThemeTabAdornmentNone, TTK_STATE_FIRST | TTK_STATE_LAST, 0}, + {kHIThemeTabAdornmentTrailingSeparator, TTK_STATE_FIRST, 0}, + {kHIThemeTabAdornmentNone, TTK_STATE_LAST, 0}, {kHIThemeTabAdornmentTrailingSeparator, 0, 0}, }; static const Ttk_StateTable TabPositionTable[] = { - {kHIThemeTabPositionOnly, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB, 0}, - {kHIThemeTabPositionFirst, TTK_STATE_FIRST_TAB, 0}, - {kHIThemeTabPositionLast, TTK_STATE_LAST_TAB, 0}, + {kHIThemeTabPositionOnly, TTK_STATE_FIRST | TTK_STATE_LAST, 0}, + {kHIThemeTabPositionFirst, TTK_STATE_FIRST, 0}, + {kHIThemeTabPositionLast, TTK_STATE_LAST, 0}, {kHIThemeTabPositionMiddle, 0, 0}, }; @@ -3321,10 +3321,8 @@ static Ttk_ElementSpec TreeHeaderElementSpec = { * +++ Disclosure triangles -- */ -#define TTK_TREEVIEW_STATE_OPEN TTK_STATE_USER1 -#define TTK_TREEVIEW_STATE_LEAF TTK_STATE_USER2 static const Ttk_StateTable DisclosureValueTable[] = { - {kThemeDisclosureDown, TTK_TREEVIEW_STATE_OPEN, 0}, + {kThemeDisclosureDown, TTK_STATE_OPEN, 0}, {kThemeDisclosureRight, 0, 0}, }; static void DisclosureElementSize( @@ -3351,7 +3349,7 @@ static void DisclosureElementDraw( Ttk_Box b, Ttk_State state) { - if (!(state & TTK_TREEVIEW_STATE_LEAF)) { + if (!(state & TTK_STATE_LEAF)) { int triangleState = TkMacOSXInDarkMode(tkwin) ? kThemeStateInactive : kThemeStateActive; CGRect bounds = BoxToRect(d, b); @@ -3370,7 +3368,7 @@ static void DisclosureElementDraw( NSColor *stroke = [[NSColor textColor] colorUsingColorSpace: deviceRGB]; [stroke getComponents: rgba]; - if (state & TTK_TREEVIEW_STATE_OPEN) { + if (state & TTK_STATE_OPEN) { DrawOpenDisclosure(dc.context, bounds, 2, 8, rgba); } else { DrawClosedDisclosure(dc.context, bounds, 2, 12, rgba); diff --git a/macosx/ttkMacOSXTheme.h b/macosx/ttkMacOSXTheme.h index 994cb10..1e2b7ae 100644 --- a/macosx/ttkMacOSXTheme.h +++ b/macosx/ttkMacOSXTheme.h @@ -38,8 +38,6 @@ * Meanings of Ttk states represented by User1 and User2. */ -#define TTK_STATE_FIRST_TAB TTK_STATE_USER1 -#define TTK_STATE_LAST_TAB TTK_STATE_USER2 #define TTK_STATE_IS_ACCENTED TTK_STATE_USER2 #define TTK_TREEVIEW_STATE_SORTARROW TTK_STATE_USER1 diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 51790e4..7e13151 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -866,9 +866,6 @@ static const Ttk_ElementSpec TabElementSpec = * Generic element, but don't display at all if TTK_STATE_LEAF (=USER2) set */ -#define TTK_STATE_OPEN TTK_STATE_USER1 -#define TTK_STATE_LEAF TTK_STATE_USER2 - static const Ttk_StateTable header_statemap[] = { { HIS_PRESSED, TTK_STATE_PRESSED, 0 }, -- cgit v0.12