From e5bb2baae8dd7b496cc9a06e0b0191510627e14e Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 8 Jul 2020 22:07:54 +0000 Subject: Fix [031dfcf1dd]: ttk::treeview -anchor does not work with column #0 --- generic/ttk/ttkTreeview.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 358e409..479820a 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -1779,7 +1779,7 @@ static void DrawItem( x+indent, y, colwidth-indent, rowHeight); if (item->textObj) { displayItem.textObj = item->textObj; } if (item->imageObj) { displayItem.imageObj = item->imageObj; } - /* ??? displayItem.anchorObj = 0; <> */ + displayItem.anchorObj = tv->tree.column0.anchorObj; DisplayLayout(tv->tree.itemLayout, &displayItem, state, parcel, d); x += colwidth; } @@ -3320,8 +3320,8 @@ TTK_LAYOUT("Item", TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH, TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT) TTK_NODE("Treeitem.image", TTK_PACK_LEFT) - TTK_GROUP("Treeitem.focus", TTK_PACK_LEFT, - TTK_NODE("Treeitem.text", TTK_PACK_LEFT)))) + TTK_GROUP("Treeitem.focus", TTK_FILL_BOTH, + TTK_NODE("Treeitem.text", TTK_FILL_BOTH)))) TTK_LAYOUT("Cell", TTK_GROUP("Treedata.padding", TTK_FILL_BOTH, -- cgit v0.12 From c73eda1243fcc00949b8a09a9ee2f2d6209c374f Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 17 Jul 2020 21:07:22 +0000 Subject: Better formatting for the ttk Geometry man page. --- doc/ttk_Geometry.3 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/ttk_Geometry.3 b/doc/ttk_Geometry.3 index 09d59e0..0118927 100644 --- a/doc/ttk_Geometry.3 +++ b/doc/ttk_Geometry.3 @@ -66,8 +66,9 @@ Extra padding (in pixels) to add uniformly to each side of a region. .AP short bottom in Extra padding (in pixels) to add to the bottom of a region. .AP Ttk_Box box in -.AP "Ttk_Box *" box_rtn out Specifies a rectangular region. +.AP "Ttk_Box *" box_rtn out +A rectangular region. .AP int height in The height in pixels of a region. .AP "Tcl_Interp *" interp in @@ -79,13 +80,14 @@ String value contains a symbolic name to be converted to an enumerated value or bitmask. Internal rep may be be modified to cache corresponding value. .AP Ttk_Padding padding in -.AP "Ttk_Padding *" padding_rtn out Extra padding to add on the inside of a region. +.AP "Ttk_Padding *" padding_rtn out +Padding present in the inside of a region. .AP Ttk_Box parcel in A rectangular region, allocated from a cavity. .AP int relief in One of the standard Tk relief options -(TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, etc.). +(\fBTK_RELIEF_RAISED\fR, \fBTK_RELIEF_SUNKEN\fR, etc.). See \fBTk_GetReliefFromObj\fR. .AP short right in Extra padding (in pixels) to add to the right side of a region. @@ -95,13 +97,13 @@ One of \fBTTK_SIDE_LEFT\fR, \fBTTK_SIDE_TOP\fR, .AP unsigned sticky in A bitmask containing one or more of the bits \fBTTK_STICK_W\fR (west, or left), -\fBTTK_STICK_E\fR (east, or right, +\fBTTK_STICK_E\fR (east, or right), \fBTTK_STICK_N\fR (north, or top), and \fBTTK_STICK_S\fR (south, or bottom). -\fBTTK_FILL_X\fR is defined as a synonym for (TTK_STICK_W|TTK_STICK_E), -\fBTTK_FILL_Y\fR is a synonym for (TTK_STICK_N|TTK_STICK_S), +\fBTTK_FILL_X\fR is defined as a synonym for (\fBTTK_STICK_W\fR|\fBTTK_STICK_E\fR), +\fBTTK_FILL_Y\fR is a synonym for (\fBTTK_STICK_N\fR|\fBTTK_STICK_S\fR), and \fBTTK_FILL_BOTH\fR and \fBTTK_STICK_ALL\fR -are synonyms for (TTK_FILL_X|TTK_FILL_Y). +are synonyms for (\fBTTK_FILL_X\fR|\fBTTK_FILL_Y\fR). See also: \fIgrid(n)\fR. .AP Tk_Window tkwin in Window whose screen geometry determines -- cgit v0.12 From 150c5622292b1daa23aaf8d7a43053f9345f9642 Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 17 Jul 2020 22:53:31 +0000 Subject: Document -expand for layouts, and order layout options alphabetically. --- doc/ttk_style.n | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/ttk_style.n b/doc/ttk_style.n index db80d95..a67cae6 100644 --- a/doc/ttk_style.n +++ b/doc/ttk_style.n @@ -100,17 +100,23 @@ geometry manager: given an initial cavity, each element is allocated a parcel. Valid options are: .TP +\fB\-children { \fIsublayout... \fB}\fR +Specifies a list of elements to place inside the element. +.TP +\fB\-expand\fR \fIboolean\fR +Specifies whether the allocated parcel is the entire cavity. +Defaults to 0. +.TP \fB\-side \fIside\fR Specifies which side of the cavity to place the element; one of \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR. -If omitted, the element occupies the entire cavity. +If omitted, the allocated parcel is the entire cavity (therefore the +same as \fB\-expand\fR 1). .TP \fB\-sticky\fR \fB[\fInswe\fB]\fR Specifies where the element is placed inside its allocated parcel. -.TP -\fB\-children { \fIsublayout... \fB}\fR -Specifies a list of elements to place inside the element. -.\" Also: -border, -unit, -expand: may go away. +Default is \fBnswe\fR. +.\" Also: -border, -unit: may go away. .PP For example: .CS -- cgit v0.12 From 5c61bcbe7c9f0de02a56e88fcd6253a2b2cfb482 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 18 Jul 2020 10:24:09 +0000 Subject: More detailed documentation of the simplified packing algorithm and options used by ttk for layouts. --- doc/ttk_style.n | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/doc/ttk_style.n b/doc/ttk_style.n index a67cae6..931e290 100644 --- a/doc/ttk_style.n +++ b/doc/ttk_style.n @@ -98,24 +98,31 @@ by one or more options specifying how to arrange the element. The layout mechanism uses a simplified version of the \fBpack\fR geometry manager: given an initial cavity, each element is allocated a parcel. +Then the parcel actually used by the element is adjusted within +the allocated parcel. Valid options are: .TP -\fB\-children { \fIsublayout... \fB}\fR +\fB\-children { \fIsublayout...\fB }\fR Specifies a list of elements to place inside the element. .TP \fB\-expand\fR \fIboolean\fR -Specifies whether the allocated parcel is the entire cavity. +Specifies whether the allocated parcel is the entire cavity. If so, +simultaneous specification of \fB\-side\fR is ignored. Defaults to 0. .TP \fB\-side \fIside\fR Specifies which side of the cavity to place the element; one of \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR. -If omitted, the allocated parcel is the entire cavity (therefore the -same as \fB\-expand\fR 1). +For instance, \fB\-side top\fR allocates the parcel along the top of +the cavity having width and height respectively the width of the cavity +and the height of the element. +If omitted, the allocated parcel is the entire cavity (same result +as \fB\-expand\fR 1). .TP \fB\-sticky\fR \fB[\fInswe\fB]\fR -Specifies where the element is placed inside its allocated parcel. -Default is \fBnswe\fR. +Specifies the actual parcel position and size inside the allocated parcel. +If specified as an empty string then the actual parcel is centered in +the allocated parcel. Default is \fBnswe\fR. .\" Also: -border, -unit: may go away. .PP For example: -- cgit v0.12 From 29dbbc2b98d03faa31105171d49ec5a219dab3a1 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 18 Jul 2020 12:05:24 +0000 Subject: In ttk layouts, when -expand 1 is specified, then -side is ignored. Ditto for respectively the TTK_EXPAND and TTK_PACK_* flags. Remove such specs that are anyway ignored. --- doc/ttk_intro.n | 2 +- generic/ttk/ttkButton.c | 2 +- generic/ttk/ttkClamTheme.c | 2 +- generic/ttk/ttkClassicTheme.c | 2 +- generic/ttk/ttkEntry.c | 2 +- generic/ttk/ttkScrollbar.c | 4 ++-- win/ttkWinTheme.c | 4 ++-- win/ttkWinXPTheme.c | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n index 581cb44..06db167 100644 --- a/doc/ttk_intro.n +++ b/doc/ttk_intro.n @@ -86,7 +86,7 @@ ttk::\fBstyle layout\fR Horizontal.TScrollbar { Scrollbar.trough \-children { Scrollbar.leftarrow \-side left \-sticky w Scrollbar.rightarrow \-side right \-sticky e - Scrollbar.thumb \-side left \-expand true \-sticky ew + Scrollbar.thumb \-expand true \-sticky ew } } .CE diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index 43fd95f..216b112 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -855,7 +855,7 @@ TTK_BEGIN_LAYOUT(MenubuttonLayout) TTK_GROUP("Menubutton.border", TTK_FILL_BOTH, TTK_GROUP("Menubutton.focus", TTK_FILL_BOTH, TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT) - TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X, + TTK_GROUP("Menubutton.padding", TTK_EXPAND|TTK_FILL_X, TTK_NODE("Menubutton.label", TTK_PACK_LEFT)))) TTK_END_LAYOUT diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index 299b568..20b4b86 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -959,7 +959,7 @@ TTK_BEGIN_LAYOUT_TABLE(LayoutTable) TTK_LAYOUT("TCombobox", TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Combobox.field", TTK_PACK_LEFT|TTK_FILL_BOTH|TTK_EXPAND, + TTK_GROUP("Combobox.field", TTK_FILL_BOTH|TTK_EXPAND, TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))) diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index 4b245c7..228d474 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -457,7 +457,7 @@ TTK_LAYOUT("TMenubutton", TTK_GROUP("Menubutton.highlight", TTK_FILL_BOTH, TTK_GROUP("Menubutton.border", TTK_FILL_BOTH, TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT) - TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X, + TTK_GROUP("Menubutton.padding", TTK_EXPAND|TTK_FILL_X, TTK_NODE("Menubutton.label", 0))))) /* "classic" entry, includes highlight border */ diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 770d8ff..17287cc 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -2072,7 +2072,7 @@ TTK_END_LAYOUT TTK_BEGIN_LAYOUT(ComboboxLayout) TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Combobox.padding", TTK_FILL_BOTH|TTK_PACK_LEFT|TTK_EXPAND, + TTK_GROUP("Combobox.padding", TTK_FILL_BOTH|TTK_EXPAND, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))) TTK_END_LAYOUT diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index 04430ee..08ad56e 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -318,7 +318,7 @@ TTK_BEGIN_LAYOUT(VerticalScrollbarLayout) TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_TOP) TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM) TTK_NODE( - "Vertical.Scrollbar.thumb", TTK_PACK_TOP|TTK_EXPAND|TTK_FILL_BOTH)) + "Vertical.Scrollbar.thumb", TTK_EXPAND|TTK_FILL_BOTH)) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalScrollbarLayout) @@ -326,7 +326,7 @@ TTK_BEGIN_LAYOUT(HorizontalScrollbarLayout) TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_LEFT) TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT) TTK_NODE( - "Horizontal.Scrollbar.thumb", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH)) + "Horizontal.Scrollbar.thumb", TTK_EXPAND|TTK_FILL_BOTH)) TTK_END_LAYOUT /*------------------------------------------------------------------------ diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index b0468fd..fac77aa 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -686,8 +686,8 @@ TTK_LAYOUT("TButton", TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Combobox.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Combobox.focus", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Combobox.padding", TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Combobox.focus", TTK_EXPAND|TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))) TTK_END_LAYOUT_TABLE diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 436fe00..90863b9 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -923,8 +923,8 @@ TTK_LAYOUT("TButton", TTK_LAYOUT("TMenubutton", TTK_NODE("Menubutton.dropdown", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Menubutton.button", TTK_PACK_RIGHT|TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Menubutton.padding", TTK_PACK_LEFT|TTK_EXPAND|TTK_FILL_X, + TTK_GROUP("Menubutton.button", TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Menubutton.padding", TTK_EXPAND|TTK_FILL_X, TTK_NODE("Menubutton.label", 0)))) TTK_LAYOUT("Horizontal.TScrollbar", -- cgit v0.12 From acc0ba4af690545c19ed138807c702d988839ce7 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 18 Jul 2020 12:10:38 +0000 Subject: Two occurrences leftover in previous commit. --- macosx/ttkMacOSXTheme.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index f1b7b8e..c181fcb 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -3087,15 +3087,13 @@ TTK_LAYOUT("Item", TTK_LAYOUT("Vertical.TScrollbar", TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y, - TTK_NODE("Vertical.Scrollbar.thumb", - TTK_PACK_TOP | TTK_EXPAND | TTK_FILL_BOTH) + TTK_NODE("Vertical.Scrollbar.thumb", TTK_EXPAND | TTK_FILL_BOTH) TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM) TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_BOTTOM))) TTK_LAYOUT("Horizontal.TScrollbar", TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X, - TTK_NODE("Horizontal.Scrollbar.thumb", - TTK_PACK_LEFT | TTK_EXPAND | TTK_FILL_BOTH) + TTK_NODE("Horizontal.Scrollbar.thumb", TTK_EXPAND | TTK_FILL_BOTH) TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT) TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_RIGHT))) -- cgit v0.12 From ac5b7e605129f0a9b06055347b1d1d0074ff1c95 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 18 Jul 2020 12:18:50 +0000 Subject: In ttk layouts, specifying -expand 1 (resp. TTK_EXPAND) is superfluous when -side (resp. TTK_PACK_*) is not given. Remove such superfluous specifications. --- doc/ttk_intro.n | 2 +- generic/ttk/ttkButton.c | 2 +- generic/ttk/ttkClamTheme.c | 2 +- generic/ttk/ttkClassicTheme.c | 2 +- generic/ttk/ttkEntry.c | 2 +- generic/ttk/ttkScrollbar.c | 6 ++---- library/ttk/vistaTheme.tcl | 14 +++++++------- macosx/ttkMacOSXTheme.c | 14 +++++++------- win/ttkWinTheme.c | 4 ++-- win/ttkWinXPTheme.c | 12 ++++++------ 10 files changed, 29 insertions(+), 31 deletions(-) diff --git a/doc/ttk_intro.n b/doc/ttk_intro.n index 06db167..f93cbe3 100644 --- a/doc/ttk_intro.n +++ b/doc/ttk_intro.n @@ -86,7 +86,7 @@ ttk::\fBstyle layout\fR Horizontal.TScrollbar { Scrollbar.trough \-children { Scrollbar.leftarrow \-side left \-sticky w Scrollbar.rightarrow \-side right \-sticky e - Scrollbar.thumb \-expand true \-sticky ew + Scrollbar.thumb \-sticky ew } } .CE diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index 216b112..43855b2 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -855,7 +855,7 @@ TTK_BEGIN_LAYOUT(MenubuttonLayout) TTK_GROUP("Menubutton.border", TTK_FILL_BOTH, TTK_GROUP("Menubutton.focus", TTK_FILL_BOTH, TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT) - TTK_GROUP("Menubutton.padding", TTK_EXPAND|TTK_FILL_X, + TTK_GROUP("Menubutton.padding", TTK_FILL_X, TTK_NODE("Menubutton.label", TTK_PACK_LEFT)))) TTK_END_LAYOUT diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c index 20b4b86..41a8f6d 100644 --- a/generic/ttk/ttkClamTheme.c +++ b/generic/ttk/ttkClamTheme.c @@ -959,7 +959,7 @@ TTK_BEGIN_LAYOUT_TABLE(LayoutTable) TTK_LAYOUT("TCombobox", TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Combobox.field", TTK_FILL_BOTH|TTK_EXPAND, + TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))) diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index 228d474..8436aec 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -457,7 +457,7 @@ TTK_LAYOUT("TMenubutton", TTK_GROUP("Menubutton.highlight", TTK_FILL_BOTH, TTK_GROUP("Menubutton.border", TTK_FILL_BOTH, TTK_NODE("Menubutton.indicator", TTK_PACK_RIGHT) - TTK_GROUP("Menubutton.padding", TTK_EXPAND|TTK_FILL_X, + TTK_GROUP("Menubutton.padding", TTK_FILL_X, TTK_NODE("Menubutton.label", 0))))) /* "classic" entry, includes highlight border */ diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 17287cc..bae4529 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -2072,7 +2072,7 @@ TTK_END_LAYOUT TTK_BEGIN_LAYOUT(ComboboxLayout) TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Combobox.padding", TTK_FILL_BOTH|TTK_EXPAND, + TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))) TTK_END_LAYOUT diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index 08ad56e..2c8d195 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -317,16 +317,14 @@ TTK_BEGIN_LAYOUT(VerticalScrollbarLayout) TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y, TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_TOP) TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM) - TTK_NODE( - "Vertical.Scrollbar.thumb", TTK_EXPAND|TTK_FILL_BOTH)) + TTK_NODE("Vertical.Scrollbar.thumb", TTK_FILL_BOTH)) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalScrollbarLayout) TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X, TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_LEFT) TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT) - TTK_NODE( - "Horizontal.Scrollbar.thumb", TTK_EXPAND|TTK_FILL_BOTH)) + TTK_NODE("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH)) TTK_END_LAYOUT /*------------------------------------------------------------------------ diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl index 094288c..06f9361 100644 --- a/library/ttk/vistaTheme.tcl +++ b/library/ttk/vistaTheme.tcl @@ -69,9 +69,9 @@ namespace eval ttk::theme::vista { ttk::style layout TCombobox { Combobox.border -sticky nswe -border 0 -children { Combobox.rightdownarrow -side right -sticky ns - Combobox.padding -expand 1 -sticky nswe -children { + Combobox.padding -sticky nswe -children { Combobox.background -sticky nswe -children { - Combobox.focus -expand 1 -sticky nswe -children { + Combobox.focus -sticky nswe -children { Combobox.textarea -sticky nswe } } @@ -138,7 +138,7 @@ namespace eval ttk::theme::vista { Spinbox.background -sticky news -children { Spinbox.padding -sticky news -children { Spinbox.innerbg -sticky news -children { - Spinbox.textarea -expand 1 + Spinbox.textarea } } Spinbox.uparrow -side top -sticky ens @@ -202,8 +202,8 @@ namespace eval ttk::theme::vista { TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \ -width 6 -height 12 ttk::style layout Horizontal.TScale { - Scale.focus -expand 1 -sticky nswe -children { - Horizontal.Scale.trough -expand 1 -sticky nswe -children { + Scale.focus -sticky nswe -children { + Horizontal.Scale.trough -sticky nswe -children { Horizontal.Scale.track -sticky we Horizontal.Scale.slider -side left -sticky {} } @@ -213,8 +213,8 @@ namespace eval ttk::theme::vista { TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \ -width 12 -height 6 ttk::style layout Vertical.TScale { - Scale.focus -expand 1 -sticky nswe -children { - Vertical.Scale.trough -expand 1 -sticky nswe -children { + Scale.focus -sticky nswe -children { + Vertical.Scale.trough -sticky nswe -children { Vertical.Scale.track -sticky ns Vertical.Scale.slider -side top -sticky {} } diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index c181fcb..cb2ead1 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -3049,20 +3049,20 @@ TTK_LAYOUT("TCombobox", /* Notebook tabs -- no focus ring */ TTK_LAYOUT("Tab", TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, - TTK_GROUP("Notebook.padding", TTK_EXPAND | TTK_FILL_BOTH, - TTK_NODE("Notebook.label", TTK_EXPAND | TTK_FILL_BOTH)))) + TTK_GROUP("Notebook.padding", TTK_FILL_BOTH, + TTK_NODE("Notebook.label", TTK_FILL_BOTH)))) /* Spinbox -- buttons 2px to the right of the field. */ TTK_LAYOUT("TSpinbox", TTK_GROUP("Spinbox.buttons", TTK_PACK_RIGHT, TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP | TTK_STICK_E) TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM | TTK_STICK_E)) - TTK_GROUP("Spinbox.field", TTK_EXPAND | TTK_FILL_X, - TTK_NODE("Spinbox.textarea", TTK_EXPAND | TTK_FILL_X))) + TTK_GROUP("Spinbox.field", TTK_FILL_X, + TTK_NODE("Spinbox.textarea", TTK_FILL_X))) /* Progress bars -- track only */ TTK_LAYOUT("TProgressbar", - TTK_NODE("Progressbar.track", TTK_EXPAND | TTK_FILL_BOTH)) + TTK_NODE("Progressbar.track", TTK_FILL_BOTH)) /* Treeview -- no border. */ TTK_LAYOUT("Treeview", @@ -3087,13 +3087,13 @@ TTK_LAYOUT("Item", TTK_LAYOUT("Vertical.TScrollbar", TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y, - TTK_NODE("Vertical.Scrollbar.thumb", TTK_EXPAND | TTK_FILL_BOTH) + TTK_NODE("Vertical.Scrollbar.thumb", TTK_FILL_BOTH) TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM) TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_BOTTOM))) TTK_LAYOUT("Horizontal.TScrollbar", TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X, - TTK_NODE("Horizontal.Scrollbar.thumb", TTK_EXPAND | TTK_FILL_BOTH) + TTK_NODE("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH) TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT) TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_RIGHT))) diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index fac77aa..bd066fc 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -686,8 +686,8 @@ TTK_LAYOUT("TButton", TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.field", TTK_FILL_BOTH, TTK_NODE("Combobox.downarrow", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Combobox.padding", TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Combobox.focus", TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, + TTK_GROUP("Combobox.focus", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))) TTK_END_LAYOUT_TABLE diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 90863b9..22b371c 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -923,8 +923,8 @@ TTK_LAYOUT("TButton", TTK_LAYOUT("TMenubutton", TTK_NODE("Menubutton.dropdown", TTK_PACK_RIGHT|TTK_FILL_Y) - TTK_GROUP("Menubutton.button", TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Menubutton.padding", TTK_EXPAND|TTK_FILL_X, + TTK_GROUP("Menubutton.button", TTK_FILL_BOTH, + TTK_GROUP("Menubutton.padding", TTK_FILL_X, TTK_NODE("Menubutton.label", 0)))) TTK_LAYOUT("Horizontal.TScrollbar", @@ -942,14 +942,14 @@ TTK_LAYOUT("Vertical.TScrollbar", TTK_NODE("Vertical.Scrollbar.grip", 0)))) TTK_LAYOUT("Horizontal.TScale", - TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Horizontal.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Scale.focus", TTK_FILL_BOTH, + TTK_GROUP("Horizontal.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Scale.track", TTK_FILL_X) TTK_NODE("Horizontal.Scale.slider", TTK_PACK_LEFT) ))) TTK_LAYOUT("Vertical.TScale", - TTK_GROUP("Scale.focus", TTK_EXPAND|TTK_FILL_BOTH, - TTK_GROUP("Vertical.Scale.trough", TTK_EXPAND|TTK_FILL_BOTH, + TTK_GROUP("Scale.focus", TTK_FILL_BOTH, + TTK_GROUP("Vertical.Scale.trough", TTK_FILL_BOTH, TTK_NODE("Vertical.Scale.track", TTK_FILL_Y) TTK_NODE("Vertical.Scale.slider", TTK_PACK_TOP) ))) -- cgit v0.12 From bc28be1c5f445a8cfa92f2d70643a7e99856f677 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 18 Jul 2020 12:38:02 +0000 Subject: Remove documentation of non-implemented TTK_STICK_ALL flag. --- doc/ttk_Geometry.3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ttk_Geometry.3 b/doc/ttk_Geometry.3 index 0118927..0f8a171 100644 --- a/doc/ttk_Geometry.3 +++ b/doc/ttk_Geometry.3 @@ -102,8 +102,8 @@ A bitmask containing one or more of the bits \fBTTK_STICK_S\fR (south, or bottom). \fBTTK_FILL_X\fR is defined as a synonym for (\fBTTK_STICK_W\fR|\fBTTK_STICK_E\fR), \fBTTK_FILL_Y\fR is a synonym for (\fBTTK_STICK_N\fR|\fBTTK_STICK_S\fR), -and \fBTTK_FILL_BOTH\fR and \fBTTK_STICK_ALL\fR -are synonyms for (\fBTTK_FILL_X\fR|\fBTTK_FILL_Y\fR). +and \fBTTK_FILL_BOTH\fR +is a synonym for (\fBTTK_FILL_X\fR|\fBTTK_FILL_Y\fR). See also: \fIgrid(n)\fR. .AP Tk_Window tkwin in Window whose screen geometry determines -- cgit v0.12 From 3da09c84b4332bce4d4481fdfdd66290d9149b0f Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 18 Jul 2020 13:07:51 +0000 Subject: Document -border and -unit options for ttk layouts. --- doc/ttk_style.n | 8 +++++++- generic/ttk/ttkLayout.c | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/ttk_style.n b/doc/ttk_style.n index 931e290..5c7aa63 100644 --- a/doc/ttk_style.n +++ b/doc/ttk_style.n @@ -102,6 +102,9 @@ Then the parcel actually used by the element is adjusted within the allocated parcel. Valid options are: .TP +\fB\-border\fR \fIboolean\fR +Specifies whether the element is drawn after its children. Defaults to 0. +.TP \fB\-children { \fIsublayout...\fB }\fR Specifies a list of elements to place inside the element. .TP @@ -123,7 +126,10 @@ as \fB\-expand\fR 1). Specifies the actual parcel position and size inside the allocated parcel. If specified as an empty string then the actual parcel is centered in the allocated parcel. Default is \fBnswe\fR. -.\" Also: -border, -unit: may go away. +.TP +\fB\-unit\fR \fIboolean\fR +Specifies whether the element propagates its state to its children. +Defaults to 0. .PP For example: .CS diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index 2512c4b..4588c01 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -810,7 +810,6 @@ Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_TemplateNode *node) APPENDSTR("-sticky"); APPENDOBJ(Ttk_NewStickyObj(flags & _TTK_MASK_STICK)); - /* @@@ Check again: are these necessary? */ if (flags & TTK_BORDER) { APPENDSTR("-border"); APPENDSTR("1"); } if (flags & TTK_UNIT) { APPENDSTR("-unit"); APPENDSTR("1"); } -- cgit v0.12 From d6c8d76f57d05b5e6a2e0216d19e3afd646607bc Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 18 Jul 2020 13:08:37 +0000 Subject: Remove the focus ring of selected items of ttk::treeview. --- generic/ttk/ttkTreeview.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 479820a..0a156a5 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -3320,8 +3320,7 @@ TTK_LAYOUT("Item", TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH, TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT) TTK_NODE("Treeitem.image", TTK_PACK_LEFT) - TTK_GROUP("Treeitem.focus", TTK_FILL_BOTH, - TTK_NODE("Treeitem.text", TTK_FILL_BOTH)))) + TTK_NODE("Treeitem.text", TTK_FILL_BOTH))) TTK_LAYOUT("Cell", TTK_GROUP("Treedata.padding", TTK_FILL_BOTH, -- cgit v0.12 From cb769c1f19e1347424a4f97d6ab4dd535c409e6f Mon Sep 17 00:00:00 2001 From: culler Date: Wed, 19 Aug 2020 13:56:47 +0000 Subject: Adapt systemSelectedTabTextColor to Big Sur. --- macosx/tkMacOSXColor.c | 19 ++++++++++++++++--- macosx/tkMacOSXColor.h | 8 ++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 671583b..e9dbfec 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -23,6 +23,7 @@ static Tcl_HashTable systemColors; static int numSystemColors; static int rgbColorIndex; static int controlAccentIndex; +static int selectedTabTextIndex; static Bool useFakeAccentColor = NO; static SystemColorDatum **systemColorIndex; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 @@ -66,7 +67,7 @@ void initColorTable() if (![NSColor respondsToSelector:colorSelector]) { if ([colorName isEqualToString:@"controlAccentColor"]) { useFakeAccentColor = YES; - } else { + } else if (![colorName isEqualToString:@"selectedTabTextColor"]) { /* Uncomment to print all unsupported colors: */ /* printf("Unsupported color %s\n", colorName.UTF8String); */ continue; @@ -143,6 +144,9 @@ void initColorTable() hPtr = Tcl_FindHashEntry(&systemColors, "ControlAccentColor"); entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); controlAccentIndex = entry->index; + hPtr = Tcl_FindHashEntry(&systemColors, "SelectedTabTextColor"); + entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr); + selectedTabTextIndex = entry->index; [pool drain]; } @@ -314,10 +318,19 @@ GetRGBA( #if MAC_OS_X_VERSION_MAX_ALLOWED < 101500 color = [[NSColor colorForControlTint: [NSColor currentControlTint]] colorUsingColorSpace:sRGB]; + [color getComponents: rgba]; #endif - } else { - color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB]; + break; + } + if (entry->index == selectedTabTextIndex) { + int OSVersion = [NSApp macOSVersion]; + if (OSVersion > 100600 && OSVersion < 110000) { + color = [NSColor whiteColor]; + [color getComponents: rgba]; + break; + } } + color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB]; [color getComponents: rgba]; break; case clearColor: diff --git a/macosx/tkMacOSXColor.h b/macosx/tkMacOSXColor.h index 0ff7aee..e27500d 100644 --- a/macosx/tkMacOSXColor.h +++ b/macosx/tkMacOSXColor.h @@ -241,12 +241,8 @@ static SystemColorDatum systemColorData[] = { {"WindowBackgroundColor7", ttkBackground, 7, NULL, 0, NULL }, /* Apple's SecondaryLabelColor is the same as their LabelColor so we roll our own. */ {"SecondaryLabelColor", ttkBackground, 14, NULL, 0, NULL }, -/* Color to use for notebook tab labels. */ -#if MAC_OS_X_VERSION_MAX_ALLOWED > 1060 -{"SelectedTabTextColor", semantic, 0, "whiteColor", 0, NULL }, -#else -{"SelectedTabTextColor", semantic, 0, "blackColor", 0, NULL }, -#endif +/* Color to use for notebook tab labels -- depends on OS version. */ +{"SelectedTabTextColor", semantic, 0, "textColor", 0, NULL }, /* Semantic colors that we simulate on older systems which don't supoort them. */ {"ControlAccentColor", semantic, 0, "controlAccentColor", 0, NULL }, {"LabelColor", semantic, 0, "blackColor", 0, NULL }, -- cgit v0.12 From 8a379f340b71d82c193842252a85172c788248a6 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 19 Aug 2020 20:19:26 +0000 Subject: Comment out documentation of -border and -unit as layout options. --- doc/ttk_style.n | 18 ++++++++++-------- generic/ttk/ttkLayout.c | 1 + 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/ttk_style.n b/doc/ttk_style.n index 5c7aa63..3c0f9ce 100644 --- a/doc/ttk_style.n +++ b/doc/ttk_style.n @@ -101,9 +101,10 @@ each element is allocated a parcel. Then the parcel actually used by the element is adjusted within the allocated parcel. Valid options are: -.TP -\fB\-border\fR \fIboolean\fR -Specifies whether the element is drawn after its children. Defaults to 0. +.\" -border should remain undocumented for now (dubious usefulness) +.\" .TP +.\" \fB\-border\fR \fIboolean\fR +.\" Specifies whether the element is drawn after its children. Defaults to 0. .TP \fB\-children { \fIsublayout...\fB }\fR Specifies a list of elements to place inside the element. @@ -119,17 +120,18 @@ one of \fBleft\fR, \fBright\fR, \fBtop\fR, or \fBbottom\fR. For instance, \fB\-side top\fR allocates the parcel along the top of the cavity having width and height respectively the width of the cavity and the height of the element. -If omitted, the allocated parcel is the entire cavity (same result +If omitted, the allocated parcel is the entire cavity (same effect as \fB\-expand\fR 1). .TP \fB\-sticky\fR \fB[\fInswe\fB]\fR Specifies the actual parcel position and size inside the allocated parcel. If specified as an empty string then the actual parcel is centered in the allocated parcel. Default is \fBnswe\fR. -.TP -\fB\-unit\fR \fIboolean\fR -Specifies whether the element propagates its state to its children. -Defaults to 0. +.\" -unit should remain undocumented for now (dubious usefulness) +.\" .TP +.\" \fB\-unit\fR \fIboolean\fR +.\" Specifies whether the element propagates its state to its children. +.\" Defaults to 0. .PP For example: .CS diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index 4588c01..fdbeacf 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -810,6 +810,7 @@ Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_TemplateNode *node) APPENDSTR("-sticky"); APPENDOBJ(Ttk_NewStickyObj(flags & _TTK_MASK_STICK)); + /* @@@ Check again: are these necessary? Can't see any effect! */ if (flags & TTK_BORDER) { APPENDSTR("-border"); APPENDSTR("1"); } if (flags & TTK_UNIT) { APPENDSTR("-unit"); APPENDSTR("1"); } -- cgit v0.12 From 06b5ea26625d50fb3cf48c115b4efa0115f20d9e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 20 Aug 2020 07:49:01 +0000 Subject: New macro TkNewIndexObj(), which handled indices >= 2147483648 correctly when compiled against Tcl 9.0 headers. --- generic/tkEntry.c | 4 ++-- generic/tkInt.h | 1 + generic/tkMenu.c | 5 ++--- generic/ttk/ttkEntry.c | 14 +++++++------- generic/ttk/ttkNotebook.c | 12 ++++++------ generic/ttk/ttkTreeview.c | 31 +++++++++++++------------------ 6 files changed, 31 insertions(+), 36 deletions(-) diff --git a/generic/tkEntry.c b/generic/tkEntry.c index f225420..f8db7e5 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -737,7 +737,7 @@ EntryWidgetObjCmd( &index) != TCL_OK) { goto error; } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); + Tcl_SetObjResult(interp, TkNewIndexObj(index)); break; } @@ -3995,7 +3995,7 @@ SpinboxWidgetObjCmd( &index) != TCL_OK) { goto error; } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj((int)index)); + Tcl_SetObjResult(interp, TkNewIndexObj(index)); break; } diff --git a/generic/tkInt.h b/generic/tkInt.h index 7174866..91277b7 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1365,6 +1365,7 @@ MODULE_SCOPE void TkRotatePoint(double originX, double originY, double *yPtr); MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, TkSizeT, int lastOK, TkSizeT*); +#define TkNewIndexObj(value) Tcl_NewWideIntObj((Tcl_WideInt)(value + 1) - 1) #ifdef _WIN32 #define TkParseColor XParseColor diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 60f9eac..6ba569e 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -845,9 +845,8 @@ MenuWidgetObjCmd( } if (index == TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1)); - } else { - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); - } + } else + Tcl_SetObjResult(interp, TkNewIndexObj(index)); break; } case MENU_INSERT: diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index add27c2..f82c701 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -600,9 +600,9 @@ EntryValidateChange( VMODE vmode = entryPtr->entry.validate; int code, change_ok; - if ( (entryPtr->entry.validateCmd == NULL) + if ((entryPtr->entry.validateCmd == NULL) || (entryPtr->core.flags & VALIDATING) - || !EntryNeedsValidation(vmode, reason) ) + || !EntryNeedsValidation(vmode, reason)) { return TCL_OK; } @@ -1393,7 +1393,7 @@ EntryIndex( const char *string; if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->entry.numChars - 1, 1, &idx)) { - if (idx + 1 > entryPtr->entry.numChars + 1) { + if ((idx != TCL_INDEX_NONE) && (idx > entryPtr->entry.numChars)) { idx = entryPtr->entry.numChars; } *indexPtr = idx; @@ -1577,7 +1577,7 @@ EntryIndexCommand( if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) { return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); + Tcl_SetObjResult(interp, TkNewIndexObj(index)); return TCL_OK; } @@ -1650,7 +1650,7 @@ static int EntrySelectionRangeCommand( Tcl_WrongNumArgs(interp, 3, objv, "start end"); return TCL_ERROR; } - if ( EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK + if (EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK || EntryIndex(interp, entryPtr, objv[4], &end) != TCL_OK) { return TCL_ERROR; } @@ -1849,7 +1849,7 @@ static int ComboboxCurrentCommand( if (objc == 2) { /* Check if currentIndex still valid: */ - if ( currentIndex == TCL_INDEX_NONE + if (currentIndex == TCL_INDEX_NONE || currentIndex >= (TkSizeT)nValues || strcmp(currentValue,Tcl_GetString(values[currentIndex])) ) @@ -1867,7 +1867,7 @@ static int ComboboxCurrentCommand( } } cbPtr->combobox.currentIndex = currentIndex; - Tcl_SetObjResult(interp, Tcl_NewWideIntObj((int)currentIndex)); + Tcl_SetObjResult(interp, TkNewIndexObj(currentIndex)); return TCL_OK; } else if (objc == 3) { TkSizeT idx; diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 7ad46a4..784a38e 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -1079,7 +1079,7 @@ static int NotebookIdentifyCommand( return TCL_ERROR; } - if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK + if (Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK || Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK || (objc == 5 && Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable, sizeof(char *), "option", 0, &what) != TCL_OK) @@ -1108,9 +1108,8 @@ static int NotebookIdentifyCommand( } break; case IDENTIFY_TAB: - if (tabIndex != TCL_INDEX_NONE) { - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(tabIndex)); - } + if (tabIndex != TCL_INDEX_NONE) + Tcl_SetObjResult(interp, TkNewIndexObj(tabIndex)); break; } return TCL_OK; @@ -1134,8 +1133,9 @@ static int NotebookIndexCommand( } status = FindTabIndex(interp, nb, objv[2], &index); - if (status == TCL_OK && index != TCL_INDEX_NONE) { - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); + if (status == TCL_OK) { + if (index != TCL_INDEX_NONE) + Tcl_SetObjResult(interp, TkNewIndexObj(index)); } return status; diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 76a9e6f..33c3466 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -792,9 +792,8 @@ static int PickupSlack(Treeview *tv, int extra) { int newSlack = tv->tree.slack + extra; - if ( (newSlack < 0 && 0 <= tv->tree.slack) - || (newSlack > 0 && 0 >= tv->tree.slack)) - { + if ((newSlack < 0 && 0 <= tv->tree.slack) + || (newSlack > 0 && 0 >= tv->tree.slack)) { tv->tree.slack = 0; return newSlack; } else { @@ -1101,10 +1100,9 @@ TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask) TtkScrollbarUpdateRequired(tv->tree.xscrollHandle); TtkScrollbarUpdateRequired(tv->tree.yscrollHandle); } - if ( (mask & SHOW_CHANGED) - && GetEnumSetFromObj( - interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK) - { + if ((mask & SHOW_CHANGED) + && GetEnumSetFromObj( + interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK) { return TCL_ERROR; } @@ -2109,7 +2107,7 @@ static int TreeviewIndexCommand( { Treeview *tv = (Treeview *)recordPtr; TreeItem *item; - int index = 0; + TkSizeT index = 0; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "item"); @@ -2125,7 +2123,7 @@ static int TreeviewIndexCommand( item = item->prev; } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); + Tcl_SetObjResult(interp, TkNewIndexObj(index)); return TCL_OK; } @@ -2201,9 +2199,8 @@ static int TreeviewHorribleIdentify( /* ASSERT: objc == 4 */ - if ( Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK - || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK - ) { + if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK + || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) { return TCL_ERROR; } @@ -2750,9 +2747,8 @@ static int TreeviewMoveCommand( Tcl_WrongNumArgs(interp, 2, objv, "item parent index"); return TCL_ERROR; } - if ( (item = FindItem(interp, tv, objv[2])) == 0 - || (parent = FindItem(interp, tv, objv[3])) == 0) - { + if ((item = FindItem(interp, tv, objv[2])) == 0 + || (parent = FindItem(interp, tv, objv[3])) == 0) { return TCL_ERROR; } @@ -2879,9 +2875,8 @@ static int TreeviewDragCommand( return TCL_ERROR; } - if ( (column = FindColumn(interp, tv, objv[2])) == 0 - || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK) - { + if ((column = FindColumn(interp, tv, objv[2])) == 0 + || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK) { return TCL_ERROR; } -- cgit v0.12