Tk Source Code

Changes On Branch bug-8bee4b2009
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch bug-8bee4b2009 Excluding Merge-Ins

This is equivalent to a diff from bf9a2216 to fba99d26

2023-01-02
16:27
Merge 8.6 check-in: befeafbf user: jan.nijtmans tags: trunk, main
2022-12-30
16:44
A workaround for [8bee4b2009]: the default font used for progressbars is of very small size. Test progressbar-3.3 now passes. Closed-Leaf check-in: fba99d26 user: fvogel tags: bug-8bee4b2009
16:41
Add (currently failing) test progressbar-3.3 demonstrating bug [8bee4b2009]. check-in: 79c6edba user: fvogel tags: bug-8bee4b2009
2022-12-29
22:56
Use some more point-expressions in stead of tk::ScaleNum check-in: bf9a2216 user: jan.nijtmans tags: trunk, main
2022-12-22
20:10
For completeness, added the automatic scaling to the winnative theme, too check-in: a1523223 user: csaba tags: trunk, main

Changes to doc/ttk_progressbar.n.

20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
\fIindeterminate\fR mode provides an animated display to let the user know
that something is happening.
.PP
If the value of \fB-orient\fR is \fBhorizontal\fR a text string can be
displayed inside the progressbar. This string can be configured using
the \fB-anchor\fR, \fB-font\fR, \fB-foreground\fR, \fB-justify\fR,
\fB-text\fR and \fB-wraplength\fR options. If the value of \fB-orient\fR
is \fBvertical\fR then these options are ignored.

.SO ttk_widget
\-anchor	\-class	\-cursor
\-font	\-foreground	\-justify	\-style
\-takefocus	\-text	\-wraplength
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-length length Length







|
>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
\fIindeterminate\fR mode provides an animated display to let the user know
that something is happening.
.PP
If the value of \fB-orient\fR is \fBhorizontal\fR a text string can be
displayed inside the progressbar. This string can be configured using
the \fB-anchor\fR, \fB-font\fR, \fB-foreground\fR, \fB-justify\fR,
\fB-text\fR and \fB-wraplength\fR options. If the value of \fB-orient\fR
is \fBvertical\fR then these options are ignored. When configuring
\fB-text\fR, \fB-font\fR should be configured as well.
.SO ttk_widget
\-anchor	\-class	\-cursor
\-font	\-foreground	\-justify	\-style
\-takefocus	\-text	\-wraplength
.SE
.SH "WIDGET-SPECIFIC OPTIONS"
.OP \-length length Length

Changes to generic/ttk/ttkProgress.c.

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

static const Tk_OptionSpec ProgressbarOptionSpecs[] =
{
    {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
	"w", offsetof(Progressbar,progress.anchorObj), TCL_INDEX_NONE,
	TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED},
    {TK_OPTION_FONT, "-font", "font", "Font",
	DEFAULT_FONT, offsetof(Progressbar,progress.fontObj), TCL_INDEX_NONE,
	TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
    {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor",
	"black", offsetof(Progressbar,progress.foregroundObj), TCL_INDEX_NONE,
	TK_OPTION_NULL_OK,0,0 },
    {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
	"left", offsetof(Progressbar,progress.justifyObj), TCL_INDEX_NONE,
	TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },







|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

static const Tk_OptionSpec ProgressbarOptionSpecs[] =
{
    {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor",
	"w", offsetof(Progressbar,progress.anchorObj), TCL_INDEX_NONE,
	TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED},
    {TK_OPTION_FONT, "-font", "font", "Font",
	"TkDefaultFont_progressbar", offsetof(Progressbar,progress.fontObj), TCL_INDEX_NONE,
	TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
    {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor",
	"black", offsetof(Progressbar,progress.foregroundObj), TCL_INDEX_NONE,
	TK_OPTION_NULL_OK,0,0 },
    {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify",
	"left", offsetof(Progressbar,progress.justifyObj), TCL_INDEX_NONE,
	TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },

Changes to library/ttk/progress.tcl.

1
2
3
4
5

6










7
8
9
10
11
12
13
#
# Ttk widget set: progress bar utilities.
#

namespace eval ttk::progressbar {

    variable Timers	;# Map: widget name -> after ID










}

# Autoincrement --
#	Periodic callback procedure for autoincrement mode
#
proc ttk::progressbar::Autoincrement {pb steptime stepsize} {
    variable Timers





>

>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#
# Ttk widget set: progress bar utilities.
#

namespace eval ttk::progressbar {

    variable Timers	;# Map: widget name -> after ID

    # Default font for -text option in progressbars:
    # The size of a progressbar takes the font height into account so that when
    # some -text is to be displayed it does not get cropped. The default font
    # size must be very small in order to not increase the progresbar height
    # to the font height when no text is displayed (which is the default).
    # When some -text must be displayed then the user has to set an adequate
    # font size. For more details, see ticket [8bee4b2009].
    font create TkDefaultFont_progressbar {*}[font actual TkDefaultFont]
    font configure TkDefaultFont_progressbar -size -1
}

# Autoincrement --
#	Periodic callback procedure for autoincrement mode
#
proc ttk::progressbar::Autoincrement {pb steptime stepsize} {
    variable Timers

Added tests/ttk/pb_image.svg.

























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="30"
   height="14"
   viewBox="0 0 30 14"
   version="1.1"
   id="svg8"
   sodipodi:docname="slider-hn.svg"
   inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
   style="shape-rendering:crispEdges">
  <defs
     id="defs2" />
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="24.766586"
     inkscape:cx="15.000049"
     inkscape:cy="7.0000477"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="false"
     inkscape:window-width="1315"
     inkscape:window-height="617"
     inkscape:window-x="155"
     inkscape:window-y="185"
     inkscape:window-maximized="0"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0"
     units="px"
     showguides="false"
     showborder="false"
     inkscape:pagecheckerboard="true" />
  <metadata
     id="metadata5">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(-97.353746,-141.48839)">
    <rect
       style="opacity:1;fill:#0044ff;fill-opacity:1;stroke:#222222;stroke-width:0.7;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="rect815"
       width="13.3"
       height="29.3"
       x="141.98839"
       y="-126.85384"
       ry="0"
       transform="rotate(90)" />
  </g>
</svg>

Changes to tests/ttk/progressbar.test.

117
118
119
120
121
122
123
















124
125
126
127
128
129
130
        lappend res [list $option [.p cget $option]]
    }
    set res
} -cleanup {
    unset res thefont
    destroy .p
} -result {{-anchor e} {-foreground green} {-justify center} {-text {Cannot be seen}} {-wraplength 250}}

















test progressbar-4.1 "style command" -body {
    ttk::progressbar .wh  ; # default is  -orient horizontal
    ttk::progressbar .wv -orient vertical
    list [.wh cget -style] [.wh style] [winfo class .wh]\
         [.wv cget -style] [.wv style] [winfo class .wv]
} -cleanup {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
        lappend res [list $option [.p cget $option]]
    }
    set res
} -cleanup {
    unset res thefont
    destroy .p
} -result {{-anchor e} {-foreground green} {-justify center} {-text {Cannot be seen}} {-wraplength 250}}

test progressbar-3.3 {horizontal progressbar height with no -text (TIP #442) specified - Bug [8bee4b2009]} -setup {
    set oldTheme [ttk::style theme use]
} -body {
    ttk::style theme use default
    set imga [image create photo -file [file join [file dirname [info script]] pb_image.svg] -format {svg -scale 0.8}]
    ::ttk::style element create Horizontal.Progressbar.pbar image $imga
    pack [ttk::progressbar .p -orient horizontal]
    .p step 25
    update
    expr {[winfo reqheight .p] == [image height $imga] + 2}
} -cleanup {
    destroy .p
    ttk::style theme use $oldTheme
    # there's no way I know to undo  '::ttk::style element create...'
} -result {1}

test progressbar-4.1 "style command" -body {
    ttk::progressbar .wh  ; # default is  -orient horizontal
    ttk::progressbar .wv -orient vertical
    list [.wh cget -style] [.wh style] [winfo class .wh]\
         [.wv cget -style] [.wv style] [winfo class .wv]
} -cleanup {