Import Tk 8.6.8

This commit is contained in:
Cheryl Sabella
2018-02-22 14:31:15 -05:00
parent b1c28856bb
commit 8e57feeeb9
193 changed files with 6172 additions and 4033 deletions

View File

@@ -286,6 +286,7 @@ proc ::tk::ConsoleHistory {cmd} {
}
.console delete promptEnd end
.console insert promptEnd $cmd {input stdin}
.console see end
}
next {
incr HistNum
@@ -302,6 +303,7 @@ proc ::tk::ConsoleHistory {cmd} {
}
.console delete promptEnd end
.console insert promptEnd $cmd {input stdin}
.console see end
}
reset {
set HistNum 1

View File

@@ -18,7 +18,7 @@
::msgcat::mcset en "Demo code: %s"
::msgcat::mcset en "About Widget Demo"
::msgcat::mcset en "Tk widget demonstration application"
::msgcat::mcset en "Copyright \u00a9 %s"
::msgcat::mcset en "Copyright © %s"
::msgcat::mcset en "
@@title
Tk Widget Demonstrations

View File

@@ -114,10 +114,12 @@ set m $w.menu.icon
$w.menu add cascade -label "Icons" -menu $m -underline 0
menu $m -tearoff 0
# Main widget program sets variable tk_demoDirectory
$m add command -bitmap @[file join $tk_demoDirectory images pattern.xbm] \
image create photo lilearth -file [file join $tk_demoDirectory \
images earthmenu.png]
$m add command -image lilearth \
-hidemargin 1 -command [list \
tk_dialog $w.pattern {Bitmap Menu Entry} \
"The menu entry you invoked displays a bitmap rather than\
"The menu entry you invoked displays a photoimage rather than\
a text string. Other than this, it is just like any other\
menu entry." {} 0 OK ]
foreach i {info questhead error} {

View File

@@ -18,9 +18,9 @@
::msgcat::mcset nl "Demo code: %s" "Code van Demo %s"
::msgcat::mcset nl "About Widget Demo" "Over deze demonstratie"
::msgcat::mcset nl "Tk widget demonstration" "Demonstratie van Tk widgets"
::msgcat::mcset nl "Copyright \u00a9 %s"
::msgcat::mcset nl "Copyright © %s"
::msgcat::mcset nl "Tk Widget Demonstrations" "Demostratie van Tk widgets"
::msgcat::mcset nl "Tk Widget Demonstrations" "Demonstratie van Tk widgets"
::msgcat::mcset nl "This application provides a front end for several short scripts" \
"Dit programma is een schil rond enkele korte scripts waarmee"
::msgcat::mcset nl "that demonstrate what you can do with Tk widgets. Each of the" \

View File

@@ -83,12 +83,12 @@ $t window create end \
-cursor top_left_arrow} -padx 3
$t insert end " widget. Notice how peer widgets can have different "
$t insert end "font settings, and by default contain all the images "
$t insert end "of the 'parent', but many of the embedded windows, "
$t insert end "such as buttons will not be there. The easiest way "
$t insert end "to ensure they are in all peers is to use '-create' "
$t insert end "embedded window creation scripts "
$t insert end "(the plot above and the 'Make A Peer' button are "
$t insert end "designed to show up in all peers). A good use of "
$t insert end "of the 'parent', but that the embedded windows, "
$t insert end "such as buttons may not appear in the peer. To ensure "
$t insert end "that embedded windows appear in all peers you can set the "
$t insert end "'-create' option to a script or a string containing %W. "
$t insert end "(The plot above and the 'Make A Peer' button are "
$t insert end "designed to show up in all peers.) A good use of "
$t insert end "peers is for "
$t window create end \
-create {button %W.split -text "Split Windows" -command "textSplitWindow %W" \
@@ -112,6 +112,7 @@ $t insert end "you can see how the text widget automatically "
$t insert end "changes the layout. Click on the button again "
$t insert end "to restore the short string.\n"
$t insert end "\nNOTE: these buttons will not appear in peers!\n" "peer_warning"
button $t.default -text Default -command "embDefBg $t" \
-cursor top_left_arrow
$t window create end -window $t.default -padx 3
@@ -164,7 +165,6 @@ $t insert end "\n\nFinally, images fit comfortably in text widgets too:"
$t image create end -image \
[image create photo -file [file join $tk_demoDirectory images ouster.png]]
proc textWindBigB w {
$w configure -borderwidth 15
}
@@ -302,6 +302,7 @@ proc textMakePeer {parent} {
frame $w.f -highlightthickness 1 -borderwidth 1 -relief sunken
set t [$parent peer create $w.f.text -yscrollcommand "$w.scroll set" \
-borderwidth 0 -highlightthickness 0]
$t tag configure peer_warning -font boldFont
pack $t -expand yes -fill both
ttk::scrollbar $w.scroll -command "$t yview"
pack $w.scroll -side right -fill y
@@ -317,6 +318,7 @@ proc textSplitWindow {textW} {
set w [winfo parent $parent]
set t [$textW peer create $w.peer \
-yscrollcommand "$w.scroll set"]
$t tag configure peer_warning -font boldFont
$w.pane add $t
}
} else {

View File

@@ -65,6 +65,9 @@ proc ::tk::fontchooser::Show {} {
wm transient $S(W) [winfo toplevel $S(-parent)]
tk::PlaceWindow $S(W) widget $S(-parent)
}
set S(fonts) [lsort -dictionary [font families]]
set S(fonts,lcase) {}
foreach font $S(fonts) { lappend S(fonts,lcase) [string tolower $font]}
wm deiconify $S(W)
}

View File

@@ -206,7 +206,7 @@ if {"x11" eq [tk windowingsystem]} {
# Support for mousewheels on Linux/Unix commonly comes through mapping
# the wheel to the extended buttons. If you have a mousewheel, find
# Linux configuration info at:
# http://www.inria.fr/koala/colas/mouse-wheel-scroll/
# http://linuxreviews.org/howtos/xfree/mouse/
bind Listbox <4> {
if {!$tk_strictMotif} {
%W yview scroll -5 units

View File

@@ -170,6 +170,7 @@ bind Menu <<NextLine>> {
}
bind Menu <KeyPress> {
tk::TraverseWithinMenu %W %A
break
}
# The following bindings apply to all windows, and are used to
@@ -607,6 +608,10 @@ proc ::tk::MenuButtonDown menu {
if {![winfo viewable $menu]} {
return
}
if {[$menu index active] eq "none"} {
set Priv(window) {}
return
}
$menu postcascade active
if {$Priv(postedMb) ne "" && [winfo viewable $Priv(postedMb)]} {
grab -global $Priv(postedMb)

View File

@@ -463,7 +463,7 @@ if {"x11" eq [tk windowingsystem]} {
# Support for mousewheels on Linux/Unix commonly comes through mapping
# the wheel to the extended buttons. If you have a mousewheel, find
# Linux configuration info at:
# http://www.inria.fr/koala/colas/mouse-wheel-scroll/
# http://linuxreviews.org/howtos/xfree/mouse/
bind Text <4> {
if {!$tk_strictMotif} {
%W yview scroll -50 pixels
@@ -768,6 +768,9 @@ proc ::tk::TextKeySelect {w new} {
}
$w mark set $anchorname insert
} else {
if {[catch {$w index $anchorname}]} {
$w mark set $anchorname insert
}
if {[$w compare $new < $anchorname]} {
set first $new
set last $anchorname

View File

@@ -11,7 +11,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
# Verify that we have Tk binary and script components from the same release
package require -exact Tk 8.6.6
package require -exact Tk 8.6.8
# Create a ::tk namespace
namespace eval ::tk {
@@ -600,8 +600,9 @@ proc ::tk::AmpWidget {class path args} {
# ::tk::AmpMenuArgs --
# Processes arguments for a menu entry, turning -label option into
# -label and -underline options, returned by ::tk::UnderlineAmpersand.
# The cmd argument is supposed to be either "add" or "entryconfigure"
#
proc ::tk::AmpMenuArgs {widget add type args} {
proc ::tk::AmpMenuArgs {widget cmd type args} {
set options {}
foreach {opt val} $args {
if {$opt eq "-label"} {
@@ -611,7 +612,7 @@ proc ::tk::AmpMenuArgs {widget add type args} {
lappend options $opt $val
}
}
$widget add $type {*}$options
$widget $cmd $type {*}$options
}
# ::tk::FindAltKeyTarget --

View File

@@ -310,6 +310,7 @@ proc ::tk::dialog::file::Config {dataName type argList} {
# 5. Parse the -filetypes option
#
set data(origfiletypes) $data(-filetypes)
set data(-filetypes) [::tk::FDGetFileTypes $data(-filetypes)]
if {![winfo exists $data(-parent)]} {
@@ -1119,7 +1120,9 @@ proc ::tk::dialog::file::Done {w {selectFilePath ""}} {
&& [info exists data(filterType)] && $data(filterType) ne ""
} then {
upvar #0 $data(-typevariable) typeVariable
set typeVariable [lindex $data(filterType) 0]
set typeVariable [lindex $data(origfiletypes) \
[lsearch -exact $data(-filetypes) $data(filterType)] 0]
}
}
bind $data(okBtn) <Destroy> {}

View File

@@ -14,6 +14,7 @@ namespace eval ttk::theme::alt {
-disabledfg "#a3a3a3"
-selectbg "#4a6984"
-selectfg "#ffffff"
-altindicator "#aaaaaa"
}
ttk::style theme settings alt {
@@ -46,9 +47,13 @@ namespace eval ttk::theme::alt {
ttk::style configure TCheckbutton -indicatorcolor "#ffffff" -padding 2
ttk::style configure TRadiobutton -indicatorcolor "#ffffff" -padding 2
ttk::style map TCheckbutton -indicatorcolor \
[list disabled $colors(-frame) pressed $colors(-frame)]
[list pressed $colors(-frame) \
alternate $colors(-altindicator) \
disabled $colors(-frame)]
ttk::style map TRadiobutton -indicatorcolor \
[list disabled $colors(-frame) pressed $colors(-frame)]
[list pressed $colors(-frame) \
alternate $colors(-altindicator) \
disabled $colors(-frame)]
ttk::style configure TMenubutton \
-width -11 -padding "3 3" -relief raised
@@ -58,7 +63,8 @@ namespace eval ttk::theme::alt {
[list readonly $colors(-frame) disabled $colors(-frame)]
ttk::style configure TCombobox -padding 1
ttk::style map TCombobox -fieldbackground \
[list readonly $colors(-frame) disabled $colors(-frame)]
[list readonly $colors(-frame) disabled $colors(-frame)] \
-arrowcolor [list disabled $colors(-disabledfg)]
ttk::style configure ComboboxPopdownFrame \
-relief solid -borderwidth 1

View File

@@ -7,16 +7,18 @@
namespace eval ttk::theme::clam {
variable colors
array set colors {
-disabledfg "#999999"
-frame "#dcdad5"
-window "#ffffff"
-dark "#cfcdc8"
-darker "#bab5ab"
-darkest "#9e9a91"
-lighter "#eeebe7"
-lightest "#ffffff"
-selectbg "#4a6984"
-selectfg "#ffffff"
-disabledfg "#999999"
-frame "#dcdad5"
-window "#ffffff"
-dark "#cfcdc8"
-darker "#bab5ab"
-darkest "#9e9a91"
-lighter "#eeebe7"
-lightest "#ffffff"
-selectbg "#4a6984"
-selectfg "#ffffff"
-altindicator "#5895bc"
-disabledaltindicator "#a0a0a0"
}
ttk::style theme settings clam {
@@ -80,9 +82,15 @@ namespace eval ttk::theme::clam {
-indicatormargin {1 1 4 1} \
-padding 2 ;
ttk::style map TCheckbutton -indicatorbackground \
[list disabled $colors(-frame) pressed $colors(-frame)]
[list pressed $colors(-frame) \
{!disabled alternate} $colors(-altindicator) \
{disabled alternate} $colors(-disabledaltindicator) \
disabled $colors(-frame)]
ttk::style map TRadiobutton -indicatorbackground \
[list disabled $colors(-frame) pressed $colors(-frame)]
[list pressed $colors(-frame) \
{!disabled alternate} $colors(-altindicator) \
{disabled alternate} $colors(-disabledaltindicator) \
disabled $colors(-frame)]
ttk::style configure TMenubutton \
-width -11 -padding 5 -relief raised
@@ -102,7 +110,7 @@ namespace eval ttk::theme::clam {
-fieldbackground [list {readonly focus} $colors(-selectbg) \
readonly $colors(-frame)] \
-foreground [list {readonly focus} $colors(-selectfg)] \
;
-arrowcolor [list disabled $colors(-disabledfg)]
ttk::style configure ComboboxPopdownFrame \
-relief solid -borderwidth 1

View File

@@ -15,6 +15,7 @@ namespace eval ttk::theme::classic {
-selectfg "#000000"
-disabledfg "#a3a3a3"
-indicator "#b03060"
-altindicator "#b05e5e"
}
ttk::style theme settings classic {
@@ -49,15 +50,19 @@ namespace eval ttk::theme::classic {
ttk::style configure TCheckbutton -indicatorrelief raised
ttk::style map TCheckbutton \
-indicatorcolor [list \
pressed $colors(-frame) selected $colors(-indicator)] \
-indicatorrelief {selected sunken pressed sunken} \
pressed $colors(-frame) \
alternate $colors(-altindicator) \
selected $colors(-indicator)] \
-indicatorrelief {alternate raised selected sunken pressed sunken} \
;
ttk::style configure TRadiobutton -indicatorrelief raised
ttk::style map TRadiobutton \
-indicatorcolor [list \
pressed $colors(-frame) selected $colors(-indicator)] \
-indicatorrelief {selected sunken pressed sunken} \
pressed $colors(-frame) \
alternate $colors(-altindicator) \
selected $colors(-indicator)] \
-indicatorrelief {alternate raised selected sunken pressed sunken} \
;
ttk::style configure TMenubutton -relief raised -padding "3m 1m"

View File

@@ -368,7 +368,8 @@ proc ttk::combobox::PlacePopdown {cb popdown} {
set y [winfo rooty $cb]
set w [winfo width $cb]
set h [winfo height $cb]
set postoffset [ttk::style lookup TCombobox -postoffset {} {0 0 0 0}]
set style [$cb cget -style]
set postoffset [ttk::style lookup $style -postoffset {} {0 0 0 0}]
foreach var {x y w h} delta $postoffset {
incr $var $delta
}

View File

@@ -5,16 +5,19 @@
namespace eval ttk::theme::default {
variable colors
array set colors {
-frame "#d9d9d9"
-foreground "#000000"
-window "#ffffff"
-text "#000000"
-activebg "#ececec"
-selectbg "#4a6984"
-selectfg "#ffffff"
-darker "#c3c3c3"
-disabledfg "#a3a3a3"
-indicator "#4a6984"
-frame "#d9d9d9"
-foreground "#000000"
-window "#ffffff"
-text "#000000"
-activebg "#ececec"
-selectbg "#4a6984"
-selectfg "#ffffff"
-darker "#c3c3c3"
-disabledfg "#a3a3a3"
-indicator "#4a6984"
-disabledindicator "#a3a3a3"
-altindicator "#9fbdd8"
-disabledaltindicator "#c0c0c0"
}
ttk::style theme settings default {
@@ -45,12 +48,24 @@ namespace eval ttk::theme::default {
ttk::style configure TCheckbutton \
-indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
ttk::style map TCheckbutton -indicatorcolor \
[list pressed $colors(-activebg) selected $colors(-indicator)]
[list pressed $colors(-activebg) \
{!disabled alternate} $colors(-altindicator) \
{disabled alternate} $colors(-disabledaltindicator) \
{!disabled selected} $colors(-indicator) \
{disabled selected} $colors(-disabledindicator)]
ttk::style map TCheckbutton -indicatorrelief \
[list alternate raised]
ttk::style configure TRadiobutton \
-indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
ttk::style map TRadiobutton -indicatorcolor \
[list pressed $colors(-activebg) selected $colors(-indicator)]
[list pressed $colors(-activebg) \
{!disabled alternate} $colors(-altindicator) \
{disabled alternate} $colors(-disabledaltindicator) \
{!disabled selected} $colors(-indicator) \
{disabled selected} $colors(-disabledindicator)]
ttk::style map TRadiobutton -indicatorrelief \
[list alternate raised]
ttk::style configure TMenubutton \
-relief raised -padding "10 3"
@@ -62,7 +77,8 @@ namespace eval ttk::theme::default {
ttk::style configure TCombobox -arrowsize 12 -padding 1
ttk::style map TCombobox -fieldbackground \
[list readonly $colors(-frame) disabled $colors(-frame)]
[list readonly $colors(-frame) disabled $colors(-frame)] \
-arrowcolor [list disabled $colors(-disabledfg)]
ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
ttk::style map TSpinbox -fieldbackground \

View File

@@ -133,7 +133,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 -sticky {}
Spinbox.textarea -expand 1
}
}
Spinbox.uparrow -side top -sticky ens

View File

@@ -156,7 +156,7 @@ proc ::tk::MotifFDialog_FileTypes {w} {
# The filetypes radiobuttons
# set data(fileType) $data(-defaulttype)
# Default type to first entry
set initialTypeName [lindex $data(-filetypes) 0 0]
set initialTypeName [lindex $data(origfiletypes) 0 0]
if {$data(-typevariable) ne ""} {
upvar #0 $data(-typevariable) typeVariable
if {[info exists typeVariable]} {
@@ -165,7 +165,7 @@ proc ::tk::MotifFDialog_FileTypes {w} {
}
set ix 0
set data(fileType) 0
foreach fltr $data(-filetypes) {
foreach fltr $data(origfiletypes) {
set fname [lindex $fltr 0]
if {[string first $initialTypeName $fname] == 0} {
set data(fileType) $ix
@@ -185,7 +185,7 @@ proc ::tk::MotifFDialog_FileTypes {w} {
set cnt 0
if {$data(-filetypes) ne {}} {
foreach type $data(-filetypes) {
set title [lindex [lindex $type 0] 0]
set title [lindex $type 0]
set filter [lindex $type 1]
radiobutton $f.b$cnt \
-text $title \
@@ -299,6 +299,7 @@ proc ::tk::MotifFDialog_Config {dataName type argList} {
# file dialog, but we check for validity of the value to make sure
# the application code also runs fine with the TK file dialog.
#
set data(origfiletypes) $data(-filetypes)
set data(-filetypes) [::tk::FDGetFileTypes $data(-filetypes)]
if {![info exists data(filter)]} {
@@ -870,7 +871,7 @@ proc ::tk::MotifFDialog_ActivateSEnt {w} {
if {[info exists data(-typevariable)] && $data(-typevariable) ne ""
&& [info exists data(-filetypes)] && $data(-filetypes) ne ""} {
upvar #0 $data(-typevariable) typeVariable
set typeVariable [lindex $data(-filetypes) $data(fileType) 0]
set typeVariable [lindex $data(origfiletypes) $data(fileType) 0]
}
if {$data(-multiple) != 0} {