Fix imported build of Tcl/Tk 8.6.11 (previous version was actually 8.6.10)

This commit is contained in:
Steve Dower
2021-11-04 00:36:00 +00:00
parent 8986c8988f
commit c5c7ca7f25
288 changed files with 20280 additions and 4662 deletions

View File

@@ -41,7 +41,7 @@ proc ::tk::dialog::error::Details {} {
set w .bgerrorDialog
set caption [option get $w.function text {}]
set command [option get $w.function command {}]
if { ($caption eq "") || ($command eq "") } {
if {($caption eq "") || ($command eq "")} {
grid forget $w.function
}
lappend command [$w.top.info.text get 1.0 end-1c]
@@ -50,7 +50,7 @@ proc ::tk::dialog::error::Details {} {
}
proc ::tk::dialog::error::SaveToLog {text} {
if { $::tcl_platform(platform) eq "windows" } {
if {$::tcl_platform(platform) eq "windows"} {
set allFiles *.*
} else {
set allFiles *
@@ -129,11 +129,11 @@ proc ::tk::dialog::error::bgerror {err {flag 1}} {
set lines 0
set maxLine 45
foreach line [split $err \n] {
if { [string length $line] > $maxLine } {
append displayedErr "[string range $line 0 [expr {$maxLine-3}]]..."
if {[string length $line] > $maxLine} {
append displayedErr "[string range $line 0 $maxLine-3]..."
break
}
if { $lines > 4 } {
if {$lines > 4} {
append displayedErr "..."
break
} else {
@@ -182,7 +182,7 @@ proc ::tk::dialog::error::bgerror {err {flag 1}} {
pack $W.text -side left -expand yes -fill both
$W.text insert 0.0 "$err\n$info"
$W.text mark set insert 0.0
bind $W.text <ButtonPress-1> { focus %W }
bind $W.text <Button-1> {focus %W}
$W.text configure -state disabled
# 2. Fill the top part with bitmap and message

View File

@@ -396,7 +396,7 @@ proc ::tk::dialog::color::DrawColorScale {w c {create 0}} {
# Draw the selection polygons
CreateSelector $w $sel $c
$sel bind $data($c,index) <ButtonPress-1> \
$sel bind $data($c,index) <Button-1> \
[list tk::dialog::color::StartMove $w $sel $c %x $data(selPad) 1]
$sel bind $data($c,index) <B1-Motion> \
[list tk::dialog::color::MoveSelector $w $sel $c %x $data(selPad)]
@@ -409,14 +409,14 @@ proc ::tk::dialog::color::DrawColorScale {w c {create 0}} {
set data($c,clickRegion) [$sel create rectangle 0 0 \
$data(canvasWidth) $height -fill {} -outline {}]
bind $col <ButtonPress-1> \
bind $col <Button-1> \
[list tk::dialog::color::StartMove $w $sel $c %x $data(colorPad)]
bind $col <B1-Motion> \
[list tk::dialog::color::MoveSelector $w $sel $c %x $data(colorPad)]
bind $col <ButtonRelease-1> \
[list tk::dialog::color::ReleaseMouse $w $sel $c %x $data(colorPad)]
$sel bind $data($c,clickRegion) <ButtonPress-1> \
$sel bind $data($c,clickRegion) <Button-1> \
[list tk::dialog::color::StartMove $w $sel $c %x $data(selPad)]
$sel bind $data($c,clickRegion) <B1-Motion> \
[list tk::dialog::color::MoveSelector $w $sel $c %x $data(selPad)]

View File

@@ -29,7 +29,8 @@
# {....}
# }
#
# flags = currently unused.
# flags = a list of flags. Currently supported flags are:
# DONTSETDEFAULTS = skip default values setting
#
# argList = The list of "-option value" pairs.
#
@@ -63,8 +64,10 @@ proc tclParseConfigSpec {w specs flags argList} {
# 2: set the default values
#
foreach cmdsw [array names cmd] {
set data($cmdsw) $def($cmdsw)
if {"DONTSETDEFAULTS" ni $flags} {
foreach cmdsw [array names cmd] {
set data($cmdsw) $def($cmdsw)
}
}
# 3: parse the argument list

View File

@@ -131,7 +131,7 @@ proc ::tk::ConsoleInit {} {
default { set preferred {} }
}
foreach {family size} $preferred {
if {[lsearch -exact $families $family] != -1} {
if {$family in $families} {
font configure TkConsoleFont -family $family -size $size
break
}
@@ -592,7 +592,7 @@ proc ::tk::ConsoleBind {w} {
}
bind Console <F9> {
eval destroy [winfo child .]
source [file join $tk_library console.tcl]
source -encoding utf-8 [file join $tk_library console.tcl]
}
if {[tk windowingsystem] eq "aqua"} {
bind Console <Command-q> {
@@ -740,9 +740,9 @@ proc ::tk::console::FontchooserToggle {} {
}
proc ::tk::console::FontchooserVisibility {index} {
if {[tk fontchooser configure -visible]} {
.menubar.edit entryconfigure $index -label [msgcat::mc "Hide Fonts"]
.menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Hide Fonts"]
} else {
.menubar.edit entryconfigure $index -label [msgcat::mc "Show Fonts"]
.menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Show Fonts"]
}
}
proc ::tk::console::FontchooserFocus {w isFocusIn} {

View File

@@ -154,11 +154,11 @@ $c bind box <Enter> "$c itemconfigure current $demo_arrowInfo(activeStyle)"
$c bind box <Leave> "$c itemconfigure current $demo_arrowInfo(boxStyle)"
$c bind box <B1-Enter> " "
$c bind box <B1-Leave> " "
$c bind box1 <1> {set demo_arrowInfo(motionProc) arrowMove1}
$c bind box2 <1> {set demo_arrowInfo(motionProc) arrowMove2}
$c bind box3 <1> {set demo_arrowInfo(motionProc) arrowMove3}
$c bind box1 <Button-1> {set demo_arrowInfo(motionProc) arrowMove1}
$c bind box2 <Button-1> {set demo_arrowInfo(motionProc) arrowMove2}
$c bind box3 <Button-1> {set demo_arrowInfo(motionProc) arrowMove3}
$c bind box <B1-Motion> "\$demo_arrowInfo(motionProc) $c %x %y"
bind $c <Any-ButtonRelease-1> "arrowSetup $c"
bind $c <ButtonRelease-1> "arrowSetup $c"
# arrowMove1 --
# This procedure is called for each mouse motion event on box1 (the

View File

@@ -63,16 +63,16 @@ $w.text insert end \
# Create bindings for tags.
foreach tag {d1 d2 d3 d4 d5 d6} {
$w.text tag bind $tag <Any-Enter> "$w.text tag configure $tag $bold"
$w.text tag bind $tag <Any-Leave> "$w.text tag configure $tag $normal"
$w.text tag bind $tag <Enter> "$w.text tag configure $tag $bold"
$w.text tag bind $tag <Leave> "$w.text tag configure $tag $normal"
}
# Main widget program sets variable tk_demoDirectory
$w.text tag bind d1 <1> {source [file join $tk_demoDirectory items.tcl]}
$w.text tag bind d2 <1> {source [file join $tk_demoDirectory plot.tcl]}
$w.text tag bind d3 <1> {source [file join $tk_demoDirectory ctext.tcl]}
$w.text tag bind d4 <1> {source [file join $tk_demoDirectory arrow.tcl]}
$w.text tag bind d5 <1> {source [file join $tk_demoDirectory ruler.tcl]}
$w.text tag bind d6 <1> {source [file join $tk_demoDirectory cscroll.tcl]}
$w.text tag bind d1 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory items.tcl]}
$w.text tag bind d2 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory plot.tcl]}
$w.text tag bind d3 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory ctext.tcl]}
$w.text tag bind d4 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory arrow.tcl]}
$w.text tag bind d5 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory ruler.tcl]}
$w.text tag bind d6 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory cscroll.tcl]}
$w.text mark set insert 0.0
$w.text configure -state disabled

View File

@@ -32,7 +32,7 @@ listbox $w.frame.list -yscroll "$w.frame.scroll set" \
-width 20 -height 16 -setgrid 1
pack $w.frame.list $w.frame.scroll -side left -fill y -expand 1
bind $w.frame.list <Double-1> {
bind $w.frame.list <Double-Button-1> {
tk_setPalette [selection get]
}
$w.frame.list insert 0 gray60 gray70 gray80 gray85 gray90 gray95 \

View File

@@ -53,54 +53,84 @@ for {set i 0} {$i < 20} {incr i} {
}
}
$c bind all <Any-Enter> "scrollEnter $c"
$c bind all <Any-Leave> "scrollLeave $c"
$c bind all <1> "scrollButton $c"
bind $c <2> "$c scan mark %x %y"
bind $c <B2-Motion> "$c scan dragto %x %y"
if {[tk windowingsystem] eq "aqua"} {
$c bind all <Enter> "scrollEnter $c"
$c bind all <Leave> "scrollLeave $c"
$c bind all <Button-1> "scrollButton $c"
if {([tk windowingsystem] eq "aqua") && ![package vsatisfies [package provide Tk] 8.7-]} {
bind $c <Button-3> "$c scan mark %x %y"
bind $c <B3-Motion> "$c scan dragto %x %y"
bind $c <MouseWheel> {
%W yview scroll [expr {-(%D)}] units
%W yview scroll [expr {-%D}] units
}
bind $c <Option-MouseWheel> {
%W yview scroll [expr {-10 * (%D)}] units
%W yview scroll [expr {-10*%D}] units
}
bind $c <Shift-MouseWheel> {
%W xview scroll [expr {-(%D)}] units
%W xview scroll [expr {-%D}] units
}
bind $c <Shift-Option-MouseWheel> {
%W xview scroll [expr {-10 * (%D)}] units
%W xview scroll [expr {-10*%D}] units
}
} else {
bind $c <Button-2> "$c scan mark %x %y"
bind $c <B2-Motion> "$c scan dragto %x %y"
# We must make sure that positive and negative movements are rounded
# equally to integers, avoiding the problem that
# (int)1/-30 = -1,
# but
# (int)-1/-30 = 0
# The following code ensure equal +/- behaviour.
bind $c <MouseWheel> {
%W yview scroll [expr {-(%D / 30)}] units
if {%D >= 0} {
%W yview scroll [expr {%D/-30}] units
} else {
%W yview scroll [expr {(%D-29)/-30}] units
}
}
bind $c <Option-MouseWheel> {
if {%D >= 0} {
%W yview scroll [expr {%D/-3}] units
} else {
%W yview scroll [expr {(%D-2)/-3}] units
}
}
bind $c <Shift-MouseWheel> {
%W xview scroll [expr {-(%D / 30)}] units
if {%D >= 0} {
%W xview scroll [expr {%D/-30}] units
} else {
%W xview scroll [expr {(%D-29)/-30}] units
}
}
bind $c <Shift-Option-MouseWheel> {
if {%D >= 0} {
%W xview scroll [expr {%D/-3}] units
} else {
%W xview scroll [expr {(%D-2)/-3}] units
}
}
}
if {[tk windowingsystem] eq "x11"} {
if {[tk windowingsystem] eq "x11" && ![package vsatisfies [package provide Tk] 8.7-]} {
# 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://linuxreviews.org/howtos/xfree/mouse/
bind $c <4> {
bind $c <Button-4> {
if {!$tk_strictMotif} {
%W yview scroll -5 units
}
}
bind $c <Shift-4> {
bind $c <Shift-Button-4> {
if {!$tk_strictMotif} {
%W xview scroll -5 units
}
}
bind $c <5> {
bind $c <Button-5> {
if {!$tk_strictMotif} {
%W yview scroll 5 units
}
}
bind $c <Shift-5> {
bind $c <Shift-Button-5> {
if {!$tk_strictMotif} {
%W xview scroll 5 units
}

View File

@@ -41,16 +41,20 @@ $c create rectangle 245 195 255 205 -outline black -fill red
# First, create the text item and give it bindings so it can be edited.
$c addtag text withtag [$c create text 250 200 -text "This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been defined to support editing (see above)." -width 440 -anchor n -font $textFont -justify left]
$c bind text <1> "textB1Press $c %x %y"
$c bind text <Button-1> "textB1Press $c %x %y"
$c bind text <B1-Motion> "textB1Move $c %x %y"
$c bind text <Shift-1> "$c select adjust current @%x,%y"
$c bind text <Shift-Button-1> "$c select adjust current @%x,%y"
$c bind text <Shift-B1-Motion> "textB1Move $c %x %y"
$c bind text <KeyPress> "textInsert $c %A"
$c bind text <Key> "textInsert $c %A"
$c bind text <Return> "textInsert $c \\n"
$c bind text <Control-h> "textBs $c"
$c bind text <BackSpace> "textBs $c"
$c bind text <Delete> "textDel $c"
$c bind text <2> "textPaste $c @%x,%y"
if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
$c bind text <Button-3> "textPaste $c @%x,%y"
} else {
$c bind text <Button-2> "textPaste $c @%x,%y"
}
# Next, create some items that allow the text's anchor position
# to be edited.
@@ -58,14 +62,14 @@ $c bind text <2> "textPaste $c @%x,%y"
proc mkTextConfigBox {w x y option value color} {
set item [$w create rect $x $y [expr {$x+30}] [expr {$y+30}] \
-outline black -fill $color -width 1]
$w bind $item <1> "$w itemconf text $option $value"
$w bind $item <Button-1> "$w itemconf text $option $value"
$w addtag config withtag $item
}
proc mkTextConfigPie {w x y a option value color} {
set item [$w create arc $x $y [expr {$x+90}] [expr {$y+90}] \
-start [expr {$a-15}] -extent 30 -outline black -fill $color \
-width 1]
$w bind $item <1> "$w itemconf text $option $value"
$w bind $item <Button-1> "$w itemconf text $option $value"
$w addtag config withtag $item
}
@@ -84,7 +88,7 @@ mkTextConfigBox $c [expr {$x+60}] [expr {$y+60}] -anchor nw $color
set item [$c create rect \
[expr {$x+40}] [expr {$y+40}] [expr {$x+50}] [expr {$y+50}] \
-outline black -fill red]
$c bind $item <1> "$c itemconf text -anchor center"
$c bind $item <Button-1> "$c itemconf text -anchor center"
$c create text [expr {$x+45}] [expr {$y-5}] \
-text {Text Position} -anchor s -font {Times 20} -fill brown

View File

@@ -2,16 +2,16 @@
#
# This demonstration script creates a dialog box with a local grab.
interp create slave
load {} Tk slave
slave eval {
wm title . slave
interp create child
load {} Tk child
child eval {
wm title . child
wm geometry . +700+30
pack [text .t -width 30 -height 10]
}
after idle {.dialog1.msg configure -wraplength 4i}
set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "slave" which was created by a slave interpreter.} \
set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "child" which was created by a child interpreter.} \
info 0 OK Cancel {Show Code}]
switch $i {
@@ -20,6 +20,6 @@ switch $i {
2 {showCode .dialog1}
}
if {[interp exists slave]} {
interp delete slave
if {[interp exists child]} {
interp delete child
}

View File

@@ -16,7 +16,7 @@ wm title $w "Entry Demonstration (no scrollbars)"
wm iconname $w "entry1"
positionWindow $w
label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse button2 pressed."
label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse the middle mouse button pressed."
pack $w.msg -side top
## See Code / Dismiss buttons

View File

@@ -16,7 +16,7 @@ wm title $w "Entry Demonstration (with scrollbars)"
wm iconname $w "entry2"
positionWindow $w
label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below, with a scrollbar for each entry. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries with the scrollbars, or by dragging with mouse button2 pressed."
label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below, with a scrollbar for each entry. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries with the scrollbars, or by dragging with the middle mouse button pressed."
pack $w.msg -side top
## See Code / Dismiss buttons

View File

@@ -102,7 +102,7 @@ foreach {chars digit} {abc 2 def 3 ghi 4 jkl 5 mno 6 pqrs 7 tuv 8 wxyz 9} {
proc validatePhoneChange {W vmode idx char} {
global phoneNumberMap entry3content
if {$idx == -1} {return 1}
if {$idx < 0} {return 1}
after idle [list $W configure -validate $vmode -invcmd bell]
if {
!($idx<3 || $idx==6 || $idx==7 || $idx==11 || $idx>15) &&

View File

@@ -1354,13 +1354,18 @@ floorDisplay $c 3
# Set up event bindings for canvas:
$c bind floor1 <1> "floorDisplay $c 1"
$c bind floor2 <1> "floorDisplay $c 2"
$c bind floor3 <1> "floorDisplay $c 3"
$c bind floor1 <Button-1> "floorDisplay $c 1"
$c bind floor2 <Button-1> "floorDisplay $c 2"
$c bind floor3 <Button-1> "floorDisplay $c 3"
$c bind room <Enter> "newRoom $c"
$c bind room <Leave> {set currentRoom ""}
bind $c <2> "$c scan mark %x %y"
bind $c <B2-Motion> "$c scan dragto %x %y"
if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
bind $c <Button-3> "$c scan mark %x %y"
bind $c <B3-Motion> "$c scan dragto %x %y"
} else {
bind $c <Button-2> "$c scan mark %x %y"
bind $c <B2-Motion> "$c scan dragto %x %y"
}
bind $c <Destroy> "unset currentRoom"
set currentRoom ""
trace variable currentRoom w "roomChanged $c"

View File

@@ -55,10 +55,6 @@ grid $f.msg $f.vs -sticky news
grid $f.font - -sticky e
grid columnconfigure $f 0 -weight 1
grid rowconfigure $f 0 -weight 1
bind $w <Visibility> {
bind %W <Visibility> {}
grid propagate %W.f 0
}
## See Code / Dismiss buttons
set btns [addSeeDismiss $w.buttons $w]
@@ -67,3 +63,5 @@ grid $f -sticky news
grid $btns -sticky ew
grid columnconfigure $w 0 -weight 1
grid rowconfigure $w 0 -weight 1
update idletasks
grid propagate $f 0

View File

@@ -105,7 +105,7 @@ proc DoDisplay {w} {
$w.c yview moveto .05
pack $w.c -in $w.screen -side top -fill both -expand 1
bind $w.c <3> [list $w.pause invoke]
bind $w.c <Button-3> [list $w.pause invoke]
bind $w.c <Destroy> {
after cancel $animationCallbacks(goldberg)
unset animationCallbacks(goldberg)
@@ -162,7 +162,7 @@ proc DoCtrlFrame {w} {
grid $w.speed -in $w.ctrl -row 99 -sticky ew -pady {0 5}
pack $w.speed.scale -fill both -expand 1
grid $w.about -in $w.ctrl -row 100 -sticky ew
bind $w.reset <3> {set S(mode) -1} ;# Debugging
bind $w.reset <Button-3> {set S(mode) -1} ;# Debugging
## See Code / Dismiss buttons hack!
set btns [addSeeDismiss $w.ctrl.buttons $w]
@@ -342,7 +342,7 @@ proc Draw0 {w} {
set xy {719 119 763 119}
$w.c create line $xy -tag I0 -fill $color -width 5 -arrow last \
-arrowshape {18 18 5}
$w.c bind I0 <1> Start
$w.c bind I0 <Button-1> Start
}
proc Move0 {w {step {}}} {
set step [GetStep 0 $step]
@@ -372,7 +372,7 @@ proc Draw1 {w} {
set xy [box 812 122 9]
$w.c create oval $xy -tag I1 -fill $color2 -outline {}
$w.c bind I1 <1> Start
$w.c bind I1 <Button-1> Start
}
proc Move1 {w {step {}}} {
set step [GetStep 1 $step]
@@ -1620,7 +1620,7 @@ proc Move26 {w {step {}}} {
$w.c delete I24 I26
$w.c create text 430 755 -anchor s -tag I26 \
-text "click to continue" -font {{Times Roman} 24 bold}
bind $w.c <1> [list Reset $w]
bind $w.c <Button-1> [list Reset $w]
return 4
}
@@ -1675,7 +1675,7 @@ proc RotateC {x y Ox Oy beta} {
proc Reset {w} {
global S
DrawAll $w
bind $w.c <1> {}
bind $w.c <Button-1> {}
set S(mode) $::MSTART
set S(active) 0
}

View File

@@ -95,7 +95,7 @@ listbox $w.f.list -width 20 -height 10 -yscrollcommand "$w.f.scroll set"
ttk::scrollbar $w.f.scroll -command "$w.f.list yview"
pack $w.f.list $w.f.scroll -side left -fill y -expand 1
$w.f.list insert 0 earth.gif earthris.gif teapot.ppm
bind $w.f.list <Double-1> "loadImage $w %x %y"
bind $w.f.list <Double-Button-1> "loadImage $w %x %y"
catch {image delete image2a}
image create photo image2a

View File

@@ -17,7 +17,7 @@ wm iconname $w "Items"
positionWindow $w
set c $w.frame.c
label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Button-1 drag:\tmoves item under pointer.\n Button-2 drag:\trepositions view.\n Button-3 drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Left-Button drag:\tmoves item under pointer.\n Middle-Button drag:\trepositions view.\n Right-Button drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
pack $w.msg -side top
## See Code / Dismiss buttons
@@ -171,14 +171,21 @@ $c create text 28.5c 17.4c -text Scale: -anchor s
# Set up event bindings for canvas:
$c bind item <Any-Enter> "itemEnter $c"
$c bind item <Any-Leave> "itemLeave $c"
bind $c <2> "$c scan mark %x %y"
bind $c <B2-Motion> "$c scan dragto %x %y"
bind $c <3> "itemMark $c %x %y"
bind $c <B3-Motion> "itemStroke $c %x %y"
$c bind item <Enter> "itemEnter $c"
$c bind item <Leave> "itemLeave $c"
if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
bind $c <Button-2> "itemMark $c %x %y"
bind $c <B2-Motion> "itemStroke $c %x %y"
bind $c <Button-3> "$c scan mark %x %y"
bind $c <B3-Motion> "$c scan dragto %x %y"
} else {
bind $c <Button-2> "$c scan mark %x %y"
bind $c <B2-Motion> "$c scan dragto %x %y"
bind $c <Button-3> "itemMark $c %x %y"
bind $c <B3-Motion> "itemStroke $c %x %y"
}
bind $c <<NextChar>> "itemsUnderArea $c"
bind $c <1> "itemStartDrag $c %x %y"
bind $c <Button-1> "itemStartDrag $c %x %y"
bind $c <B1-Motion> "itemDrag $c %x %y"
# Utility procedures for highlighting the item under the pointer:
@@ -250,14 +257,14 @@ proc itemsUnderArea {c} {
set area [$c find withtag area]
set items ""
foreach i [$c find enclosed $areaX1 $areaY1 $areaX2 $areaY2] {
if {[lsearch [$c gettags $i] item] != -1} {
if {[lsearch [$c gettags $i] item] >= 0} {
lappend items $i
}
}
puts stdout "Items enclosed by area: $items"
set items ""
foreach i [$c find overlapping $areaX1 $areaY1 $areaX2 $areaY2] {
if {[lsearch [$c gettags $i] item] != -1} {
if {[lsearch [$c gettags $i] item] >= 0} {
lappend items $i
}
}

View File

@@ -54,7 +54,7 @@ proc readsettings {} {
global screencyc ; set screencyc 600
set xfd [open "|xset q" r]
while {[gets $xfd line] > -1} {
while {[gets $xfd line] >= 0} {
switch -- [lindex $line 0] {
auto {
set rpt [lindex $line 1]
@@ -197,7 +197,7 @@ proc createwindows {} {
bind . <Return> {.buttons.ok flash; .buttons.ok invoke}
bind . <Escape> {.buttons.quit flash; .buttons.quit invoke}
bind . <1> {
bind . <Button-1> {
if {![string match .buttons* %W]} {
.buttons.apply configure -state normal
.buttons.cancel configure -state normal

View File

@@ -21,7 +21,7 @@
# If you let it repeat then it will choose random start positions
# for each new tour.
package require Tk 8.5
package require Tk
# Return a list of accessible squares from a given square
proc ValidMoves {square} {
@@ -29,7 +29,7 @@ proc ValidMoves {square} {
foreach pair {{-1 -2} {-2 -1} {-2 1} {-1 2} {1 2} {2 1} {2 -1} {1 -2}} {
set col [expr {($square % 8) + [lindex $pair 0]}]
set row [expr {($square / 8) + [lindex $pair 1]}]
if {$row > -1 && $row < 8 && $col > -1 && $col < 8} {
if {$row >= 0 && $row < 8 && $col >= 0 && $col < 8} {
lappend moves [expr {$row * 8 + $col}]
}
}
@@ -41,7 +41,7 @@ proc CheckSquare {square} {
variable visited
set moves 0
foreach test [ValidMoves $square] {
if {[lsearch -exact -integer $visited $test] == -1} {
if {[lsearch -exact -integer $visited $test] < 0} {
incr moves
}
}
@@ -55,7 +55,7 @@ proc Next {square} {
set minimum 9
set nextSquare -1
foreach testSquare [ValidMoves $square] {
if {[lsearch -exact -integer $visited $testSquare] == -1} {
if {[lsearch -exact -integer $visited $testSquare] < 0} {
set count [CheckSquare $testSquare]
if {$count < $minimum} {
set minimum $count
@@ -190,7 +190,7 @@ proc CreateGUI {} {
ttk::button $dlg.tf.b1 -text Start -command [list Tour $dlg]
ttk::button $dlg.tf.b2 -text Exit -command [list Exit $dlg]
set square 0
for {set row 7} {$row != -1} {incr row -1} {
for {set row 7} {$row >= 0} {incr row -1} {
for {set col 0} {$col < 8} {incr col} {
if {(($col & 1) ^ ($row & 1))} {
set fill tan3 ; set dfill tan4
@@ -218,7 +218,7 @@ proc CreateGUI {} {
-fill black -activefill "#600000"
}
$c moveto knight {*}[lrange [$c coords [expr {1 + int(rand() * 64)}]] 0 1]
$c bind knight <ButtonPress-1> [namespace code [list DragStart %W %x %y]]
$c bind knight <Button-1> [namespace code [list DragStart %W %x %y]]
$c bind knight <Motion> [namespace code [list DragMotion %W %x %y]]
$c bind knight <ButtonRelease-1> [namespace code [list DragEnd %W %x %y]]

View File

@@ -63,7 +63,7 @@ if {[tk windowingsystem] eq "aqua"} {
}
foreach i {A B C D E F} {
$m add command -label "Print letter \"$i\"" -underline 14 \
-accelerator Meta+$i -command "puts $i" -accelerator $modifier+$i
-accelerator $modifier+$i -command "puts $i"
bind $w <$modifier-[string tolower $i]> "puts $i"
}
@@ -144,9 +144,24 @@ $m entryconfigure "Does almost nothing" -bitmap questhead -compound left \
set m $w.menu.colors
$w.menu add cascade -label "Colors" -menu $m -underline 1
menu $m -tearoff 1
foreach i {red orange yellow green blue} {
$m add command -label $i -background $i -command [list \
puts "You invoked \"$i\"" ]
if {[tk windowingsystem] eq "aqua"} {
# Aqua ignores the -background and -foreground options, but a compound
# button can be used for selecting colors.
foreach i {red orange yellow green blue} {
image create photo image_$i -height 16 -width 16
image_$i put black -to 0 0 16 1
image_$i put black -to 0 1 1 16
image_$i put black -to 0 15 16 16
image_$i put black -to 15 1 16 16
image_$i put $i -to 1 1 15 15
$m add command -label $i -image image_$i -compound left -command [list \
puts "You invoked \"$i\"" ]
}
} else {
foreach i {red orange yellow green blue} {
$m add command -label $i -background $i -command [list \
puts "You invoked \"$i\"" ]
}
}
$w configure -menu $w.menu

View File

@@ -113,7 +113,7 @@ bind $w.c <Destroy> {
after cancel $animationCallbacks(pendulum)
unset animationCallbacks(pendulum)
}
bind $w.c <1> {
bind $w.c <Button-1> {
after cancel $animationCallbacks(pendulum)
showPendulum %W at %x %y
}

View File

@@ -55,9 +55,9 @@ foreach point {
$c addtag point withtag $item
}
$c bind point <Any-Enter> "$c itemconfig current -fill red"
$c bind point <Any-Leave> "$c itemconfig current -fill SkyBlue2"
$c bind point <1> "plotDown $c %x %y"
$c bind point <Enter> "$c itemconfig current -fill red"
$c bind point <Leave> "$c itemconfig current -fill SkyBlue2"
$c bind point <Button-1> "plotDown $c %x %y"
$c bind point <ButtonRelease-1> "$c dtag selected"
bind $c <B1-Motion> "plotMove $c %x %y"

View File

@@ -77,10 +77,10 @@ $c addtag well withtag [$c create rect 13.2c 1c 13.8c 0.5c \
$c addtag well withtag [rulerMkTab $c [winfo pixels $c 13.5c] \
[winfo pixels $c .65c]]
$c bind well <1> "rulerNewTab $c %x %y"
$c bind tab <1> "rulerSelectTab $c %x %y"
$c bind well <Button-1> "rulerNewTab $c %x %y"
$c bind tab <Button-1> "rulerSelectTab $c %x %y"
bind $c <B1-Motion> "rulerMoveTab $c %x %y"
bind $c <Any-ButtonRelease-1> "rulerReleaseTab $c"
bind $c <ButtonRelease-1> "rulerReleaseTab $c"
# rulerNewTab --
# Does all the work of creating a tab stop, including creating the

View File

@@ -18,7 +18,7 @@ square .s
pack .s -expand yes -fill both
wm minsize . 1 1
bind .s <1> {center %x %y}
bind .s <Button-1> {center %x %y}
bind .s <B1-Motion> {center %x %y}
bind .s a animate
focus .s

View File

@@ -6,62 +6,62 @@
# element name is the name of a command and the value is
# a script that loads the command.
set auto_index(arrowSetup) [list source [file join $dir arrow.tcl]]
set auto_index(arrowMove1) [list source [file join $dir arrow.tcl]]
set auto_index(arrowMove2) [list source [file join $dir arrow.tcl]]
set auto_index(arrowMove3) [list source [file join $dir arrow.tcl]]
set auto_index(textLoadFile) [list source [file join $dir search.tcl]]
set auto_index(textSearch) [list source [file join $dir search.tcl]]
set auto_index(textToggle) [list source [file join $dir search.tcl]]
set auto_index(itemEnter) [list source [file join $dir items.tcl]]
set auto_index(itemLeave) [list source [file join $dir items.tcl]]
set auto_index(itemMark) [list source [file join $dir items.tcl]]
set auto_index(itemStroke) [list source [file join $dir items.tcl]]
set auto_index(itemsUnderArea) [list source [file join $dir items.tcl]]
set auto_index(itemStartDrag) [list source [file join $dir items.tcl]]
set auto_index(itemDrag) [list source [file join $dir items.tcl]]
set auto_index(butPress) [list source [file join $dir items.tcl]]
set auto_index(loadDir) [list source [file join $dir image2.tcl]]
set auto_index(loadImage) [list source [file join $dir image2.tcl]]
set auto_index(rulerMkTab) [list source [file join $dir ruler.tcl]]
set auto_index(rulerNewTab) [list source [file join $dir ruler.tcl]]
set auto_index(rulerSelectTab) [list source [file join $dir ruler.tcl]]
set auto_index(rulerMoveTab) [list source [file join $dir ruler.tcl]]
set auto_index(rulerReleaseTab) [list source [file join $dir ruler.tcl]]
set auto_index(mkTextConfig) [list source [file join $dir ctext.tcl]]
set auto_index(textEnter) [list source [file join $dir ctext.tcl]]
set auto_index(textInsert) [list source [file join $dir ctext.tcl]]
set auto_index(textPaste) [list source [file join $dir ctext.tcl]]
set auto_index(textB1Press) [list source [file join $dir ctext.tcl]]
set auto_index(textB1Move) [list source [file join $dir ctext.tcl]]
set auto_index(textBs) [list source [file join $dir ctext.tcl]]
set auto_index(textDel) [list source [file join $dir ctext.tcl]]
set auto_index(bitmapRow) [list source [file join $dir bitmap.tcl]]
set auto_index(scrollEnter) [list source [file join $dir cscroll.tcl]]
set auto_index(scrollLeave) [list source [file join $dir cscroll.tcl]]
set auto_index(scrollButton) [list source [file join $dir cscroll.tcl]]
set auto_index(textWindOn) [list source [file join $dir twind.tcl]]
set auto_index(textWindOff) [list source [file join $dir twind.tcl]]
set auto_index(textWindPlot) [list source [file join $dir twind.tcl]]
set auto_index(embPlotDown) [list source [file join $dir twind.tcl]]
set auto_index(embPlotMove) [list source [file join $dir twind.tcl]]
set auto_index(textWindDel) [list source [file join $dir twind.tcl]]
set auto_index(embDefBg) [list source [file join $dir twind.tcl]]
set auto_index(floorDisplay) [list source [file join $dir floor.tcl]]
set auto_index(newRoom) [list source [file join $dir floor.tcl]]
set auto_index(roomChanged) [list source [file join $dir floor.tcl]]
set auto_index(bg1) [list source [file join $dir floor.tcl]]
set auto_index(bg2) [list source [file join $dir floor.tcl]]
set auto_index(bg3) [list source [file join $dir floor.tcl]]
set auto_index(fg1) [list source [file join $dir floor.tcl]]
set auto_index(fg2) [list source [file join $dir floor.tcl]]
set auto_index(fg3) [list source [file join $dir floor.tcl]]
set auto_index(setWidth) [list source [file join $dir hscale.tcl]]
set auto_index(plotDown) [list source [file join $dir plot.tcl]]
set auto_index(plotMove) [list source [file join $dir plot.tcl]]
set auto_index(puzzleSwitch) [list source [file join $dir puzzle.tcl]]
set auto_index(setHeight) [list source [file join $dir vscale.tcl]]
set auto_index(showMessageBox) [list source [file join $dir msgbox.tcl]]
set auto_index(setColor) [list source [file join $dir clrpick.tcl]]
set auto_index(setColor_helper) [list source [file join $dir clrpick.tcl]]
set auto_index(fileDialog) [list source [file join $dir filebox.tcl]]
set auto_index(arrowSetup) [list source -encoding utf-8 [file join $dir arrow.tcl]]
set auto_index(arrowMove1) [list source -encoding utf-8 [file join $dir arrow.tcl]]
set auto_index(arrowMove2) [list source -encoding utf-8 [file join $dir arrow.tcl]]
set auto_index(arrowMove3) [list source -encoding utf-8 [file join $dir arrow.tcl]]
set auto_index(textLoadFile) [list source -encoding utf-8 [file join $dir search.tcl]]
set auto_index(textSearch) [list source -encoding utf-8 [file join $dir search.tcl]]
set auto_index(textToggle) [list source -encoding utf-8 [file join $dir search.tcl]]
set auto_index(itemEnter) [list source -encoding utf-8 [file join $dir items.tcl]]
set auto_index(itemLeave) [list source -encoding utf-8 [file join $dir items.tcl]]
set auto_index(itemMark) [list source -encoding utf-8 [file join $dir items.tcl]]
set auto_index(itemStroke) [list source -encoding utf-8 [file join $dir items.tcl]]
set auto_index(itemsUnderArea) [list source -encoding utf-8 [file join $dir items.tcl]]
set auto_index(itemStartDrag) [list source -encoding utf-8 [file join $dir items.tcl]]
set auto_index(itemDrag) [list source -encoding utf-8 [file join $dir items.tcl]]
set auto_index(butPress) [list source -encoding utf-8 [file join $dir items.tcl]]
set auto_index(loadDir) [list source -encoding utf-8 [file join $dir image2.tcl]]
set auto_index(loadImage) [list source -encoding utf-8 [file join $dir image2.tcl]]
set auto_index(rulerMkTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
set auto_index(rulerNewTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
set auto_index(rulerSelectTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
set auto_index(rulerMoveTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
set auto_index(rulerReleaseTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
set auto_index(mkTextConfig) [list source -encoding utf-8 [file join $dir ctext.tcl]]
set auto_index(textEnter) [list source -encoding utf-8 [file join $dir ctext.tcl]]
set auto_index(textInsert) [list source -encoding utf-8 [file join $dir ctext.tcl]]
set auto_index(textPaste) [list source -encoding utf-8 [file join $dir ctext.tcl]]
set auto_index(textB1Press) [list source -encoding utf-8 [file join $dir ctext.tcl]]
set auto_index(textB1Move) [list source -encoding utf-8 [file join $dir ctext.tcl]]
set auto_index(textBs) [list source -encoding utf-8 [file join $dir ctext.tcl]]
set auto_index(textDel) [list source -encoding utf-8 [file join $dir ctext.tcl]]
set auto_index(bitmapRow) [list source -encoding utf-8 [file join $dir bitmap.tcl]]
set auto_index(scrollEnter) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
set auto_index(scrollLeave) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
set auto_index(scrollButton) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
set auto_index(textWindOn) [list source -encoding utf-8 [file join $dir twind.tcl]]
set auto_index(textWindOff) [list source -encoding utf-8 [file join $dir twind.tcl]]
set auto_index(textWindPlot) [list source -encoding utf-8 [file join $dir twind.tcl]]
set auto_index(embPlotDown) [list source -encoding utf-8 [file join $dir twind.tcl]]
set auto_index(embPlotMove) [list source -encoding utf-8 [file join $dir twind.tcl]]
set auto_index(textWindDel) [list source -encoding utf-8 [file join $dir twind.tcl]]
set auto_index(embDefBg) [list source -encoding utf-8 [file join $dir twind.tcl]]
set auto_index(floorDisplay) [list source -encoding utf-8 [file join $dir floor.tcl]]
set auto_index(newRoom) [list source -encoding utf-8 [file join $dir floor.tcl]]
set auto_index(roomChanged) [list source -encoding utf-8 [file join $dir floor.tcl]]
set auto_index(bg1) [list source -encoding utf-8 [file join $dir floor.tcl]]
set auto_index(bg2) [list source -encoding utf-8 [file join $dir floor.tcl]]
set auto_index(bg3) [list source -encoding utf-8 [file join $dir floor.tcl]]
set auto_index(fg1) [list source -encoding utf-8 [file join $dir floor.tcl]]
set auto_index(fg2) [list source -encoding utf-8 [file join $dir floor.tcl]]
set auto_index(fg3) [list source -encoding utf-8 [file join $dir floor.tcl]]
set auto_index(setWidth) [list source -encoding utf-8 [file join $dir hscale.tcl]]
set auto_index(plotDown) [list source -encoding utf-8 [file join $dir plot.tcl]]
set auto_index(plotMove) [list source -encoding utf-8 [file join $dir plot.tcl]]
set auto_index(puzzleSwitch) [list source -encoding utf-8 [file join $dir puzzle.tcl]]
set auto_index(setHeight) [list source -encoding utf-8 [file join $dir vscale.tcl]]
set auto_index(showMessageBox) [list source -encoding utf-8 [file join $dir msgbox.tcl]]
set auto_index(setColor) [list source -encoding utf-8 [file join $dir clrpick.tcl]]
set auto_index(setColor_helper) [list source -encoding utf-8 [file join $dir clrpick.tcl]]
set auto_index(fileDialog) [list source -encoding utf-8 [file join $dir filebox.tcl]]

View File

@@ -7,7 +7,7 @@ exec wish "$0" ${1+"$@"}
# create colors using either the RGB, HSB, or CYM color spaces
# and apply the color to existing applications.
package require Tk 8.4
package require Tk
wm title . "Color Editor"
# Global variables that control the program:
@@ -90,7 +90,7 @@ foreach i {
grid columnconfigure . 0 -weight 1
listbox .names.lb -width 20 -height 12 -yscrollcommand ".names.s set" \
-exportselection false
bind .names.lb <Double-1> {
bind .names.lb <Double-Button-1> {
tc_loadNamedColor [.names.lb get [.names.lb curselection]]
}
scrollbar .names.s -orient vertical -command ".names.lb yview"

View File

@@ -57,8 +57,9 @@ can do to a text widget:
1. Scrolling. Use the scrollbar to adjust the view in the text window.
2. Scanning. Press mouse button 2 in the text window and drag up or down.
This will drag the text at high speed to allow you to scan its contents.
2. Scanning. Press the middle mouse button in the text window and drag up
or down. This will drag the text at high speed to allow you to scan its
contents.
3. Insert text. Press mouse button 1 to set the insertion cursor, then
type text. What you type will be added to the widget.
@@ -77,7 +78,8 @@ text, in which case it will replace the selected text.
6. Copy the selection. To copy the selection into this window, select
what you want to copy (either here or in another application), then
click button 2 to copy the selection to the point of the mouse cursor.
click the middle mouse button to copy the selection to the point of the
mouse cursor.
7. Edit. Text widgets support the standard Motif editing characters
plus many Emacs editing characters. Backspace and Control-h erase the

View File

@@ -39,6 +39,7 @@ proc populateTree {tree node} {
set path [$tree set $node fullpath]
$tree delete [$tree children $node]
foreach f [lsort -dictionary [glob -nocomplain -dir $path *]] {
set f [file normalize $f]
set type [file type $f]
set id [$tree insert $node end -text [file tail $f] \
-values [list $f $type]]

View File

@@ -265,9 +265,9 @@ proc createPlot {t} {
$c addtag point withtag $item
}
$c bind point <Any-Enter> "$c itemconfig current -fill red"
$c bind point <Any-Leave> "$c itemconfig current -fill SkyBlue2"
$c bind point <1> "embPlotDown $c %x %y"
$c bind point <Enter> "$c itemconfig current -fill red"
$c bind point <Leave> "$c itemconfig current -fill SkyBlue2"
$c bind point <Button-1> "embPlotDown $c %x %y"
$c bind point <ButtonRelease-1> "$c dtag selected"
bind $c <B1-Motion> "embPlotMove $c %x %y"
return $c

View File

@@ -109,10 +109,10 @@ if {[usePresentationFormsFor Arabic]} {
}
addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57"
addSample $w "Simpl. Chinese" "\u6C49\u8BED"
addSample $w French "Langue fran\u00E7aise"
addSample $w French "Langue fran\xE7aise"
addSample $w Greek \
"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \
"\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1"
"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \
"\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1"
if {[usePresentationFormsFor Hebrew]} {
# Visual order (pre-layouted)
addSample $w Hebrew \
@@ -123,17 +123,21 @@ if {[usePresentationFormsFor Hebrew]} {
"\u05DB\u05EA\u05D1 \u05E2\u05D1\u05E8\u05D9\u05EA"
}
addSample $w Hindi \
"\u0939\u093f\u0928\u094d\u0926\u0940 \u092d\u093e\u0937\u093e"
addSample $w Icelandic "\u00CDslenska"
"\u0939\u093F\u0928\u094D\u0926\u0940 \u092D\u093E\u0937\u093E"
addSample $w Icelandic "\xCDslenska"
addSample $w Japanese \
"\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \
"\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA"
"\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \
"\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA"
addSample $w Korean "\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00"
addSample $w Russian \
"\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A"
if {[tk windowingsystem] ne "x11"} {
addSample $w Emoji \
"\uD83D\uDE00\uD83D\uDCA9\uD83D\uDC4D\uD83C\uDDF3\uD83C\uDDF1"
if {([tk windowingsystem] ne "x11") || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))} {
if {[package vsatisfies [package provide Tcl] 8.7-]} {
addSample $w Emoji "😀💩👍🇳🇱"
} else {
addSample $w Emoji \
"\uD83D\uDE00\uD83D\uDCA9\uD83D\uDC4D\uD83C\uDDF3\uD83C\uDDF1"
}
}
## We're done processing, so change things back to normal running...

View File

@@ -83,12 +83,20 @@ image create photo ::img::print -format GIF -data {
# Note that this is run through the message catalog! This is because this is
# actually an image of a word.
image create photo ::img::new -format GIF -data [mc {
R0lGODlhHgAOALMPALMAANyIiOu7u8dEROaqqvru7sxVVeGZmbgREfXd3b0iItZ3
d8IzM9FmZvDMzP///yH5BAEAAA8ALAAAAAAeAA4AAASa8MlJq7046827WVOCHEkw
nANhUgJlEBIABJIwL3K+4IcUALCHjfbItYZDSgJgkBiYPmBMAUAkkLPKs/BAyLgM
wAQwOAAY2ByCaw4QAFQSoDEePJ6DmU1xInYZTw5nOEFFdgVUelkVDTIMd3AKFGQ1
MgI2AwEmQW8APZ0gdRONAks5nhIFVVxdAAkUAS2pAVwFl7ITB4UqHb0XEQA7
image create photo ::img::new -format PNG -data [mc {
iVBORw0KGgoAAAANSUhEUgAAAB4AAAAOCAYAAAA45qw5AAACMElEQVR4AeVTAwxd
QRCc2tZHGtQ2w9q2bdsOa9u2bUW1bdt2Z372JZe6DapJLqtb3h7+T8yKi5j4CsYD
EUQXxETclT7kWOlH2VV+tFkdQHPSwksSISF+BauCqL0qgOcMWgGfgEkaMsHxqUBk
3plE/sOnh/qDPAPJH/CKFBivGHWzFwBRnHhlqbu1Mh6CoFNnC/JshQ9p4YC2lrKt
DCAV+THiVejyhMjAbrNSrroiEfKR9g7ZfCgOog8QfnUQV62wAk68ndQ9ZbyoWO1H
Y6eDY1LCQL6a9ApOp9Hi1T0+gQq2JKMlky/oTKQliKWxEZvyG575kpW4pl1aZnQK
CLOVt45Lkp8uXp2SL8KO6uitNTZLdpK6s+I/eZbhpmsmWeOGOVQNKYLITzpKPAO3
tY7LSNZ7ccSLxX9y3uuOxRkg3dKESMoCHvL+GRVCutXsB3guLgDCeXOv4iWWkvwG
BaS+PmlpK6SI9ApI2oC2UtrwZQEkhkH+NtolVlQXJl1I+QltuU3XEc721bIRFpa8
IA5iqTo6vNNWmkNBLQbPeXwF2g17Q94nTQAfY3YzeY+WSu8MDzQ2kpELUhSGJUHE
0zeR3rY1L+Xl5G/re+jbiK6KhThwwInsts1fbMUUcpZszKeVtggZEiGdZDe5AtHh
7vL4CGiRvvKPS8FAvq9Nr4ZkFadR2y6kggu1z4vlyIbBp6BugQ8JLEg4bTkD9eMZ
QZ8hpJ3VvTtuvbWrY/ElvP/9R+Aj3603+iE3fkEAAAAASUVORK5CYII=
}]
#----------------------------------------------------------------
@@ -186,6 +194,10 @@ if {[winfo depth .] == 1} {
-foreground blue -underline 1
.t tag configure visited -lmargin1 1c -lmargin2 1c \
-foreground #303080 -underline 1
if {[tk windowingsystem] eq "aqua"} {
.t tag configure demo -foreground systemLinkColor
.t tag configure visited -foreground purple
}
.t tag configure hot -foreground red -underline 1
}
.t tag bind demo <ButtonRelease-1> {
@@ -504,7 +516,7 @@ proc invoke index {
.t configure -cursor [::ttk::cursor busy]
update
set demo [string range [lindex $tags $i] 5 end]
uplevel 1 [list source [file join $tk_demoDirectory $demo.tcl]]
uplevel 1 [list source -encoding utf-8 [file join $tk_demoDirectory $demo.tcl]]
update
.t configure -cursor $cursor
@@ -612,6 +624,7 @@ proc showCode w {
wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]]
wm iconname $top $file
set id [open [file join $tk_demoDirectory $file]]
fconfigure $id -encoding utf-8 -eofchar \032
$top.f.text delete 1.0 end
$top.f.text insert 1.0 [read $id]
$top.f.text mark set insert 1.0
@@ -710,10 +723,10 @@ proc PrintTextWin32 {filename} {
proc tkAboutDialog {} {
tk_messageBox -icon info -type ok -title [mc "About Widget Demo"] \
-message [mc "Tk widget demonstration application"] -detail \
"[mc "Copyright \u00a9 %s" {1996-1997 Sun Microsystems, Inc.}]
[mc "Copyright \u00a9 %s" {1997-2000 Ajuba Solutions, Inc.}]
[mc "Copyright \u00a9 %s" {2001-2009 Donal K. Fellows}]
[mc "Copyright \u00a9 %s" {2002-2007 Daniel A. Steffen}]"
"[mc "Copyright \xA9 %s" {1996-1997 Sun Microsystems, Inc.}]
[mc "Copyright \xA9 %s" {1997-2000 Ajuba Solutions, Inc.}]
[mc "Copyright \xA9 %s" {2001-2009 Donal K. Fellows}]
[mc "Copyright \xA9 %s" {2002-2007 Daniel A. Steffen}]"
}
# Local Variables:

View File

@@ -58,7 +58,7 @@ bind Entry <<Paste>> {
}
bind Entry <<Clear>> {
# ignore if there is no selection
catch { %W delete sel.first sel.last }
catch {%W delete sel.first sel.last}
}
bind Entry <<PasteSelection>> {
if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)]
@@ -74,7 +74,7 @@ bind Entry <<TraverseIn>> {
# Standard Motif bindings:
bind Entry <1> {
bind Entry <Button-1> {
tk::EntryButton1 %W %x
%W selection clear
}
@@ -82,25 +82,25 @@ bind Entry <B1-Motion> {
set tk::Priv(x) %x
tk::EntryMouseSelect %W %x
}
bind Entry <Double-1> {
bind Entry <Double-Button-1> {
set tk::Priv(selectMode) word
tk::EntryMouseSelect %W %x
catch {%W icursor sel.last}
}
bind Entry <Triple-1> {
bind Entry <Triple-Button-1> {
set tk::Priv(selectMode) line
tk::EntryMouseSelect %W %x
catch {%W icursor sel.last}
}
bind Entry <Shift-1> {
bind Entry <Shift-Button-1> {
set tk::Priv(selectMode) char
%W selection adjust @%x
}
bind Entry <Double-Shift-1> {
bind Entry <Double-Shift-Button-1> {
set tk::Priv(selectMode) word
tk::EntryMouseSelect %W %x
}
bind Entry <Triple-Shift-1> {
bind Entry <Triple-Shift-Button-1> {
set tk::Priv(selectMode) line
tk::EntryMouseSelect %W %x
}
@@ -114,22 +114,22 @@ bind Entry <B1-Enter> {
bind Entry <ButtonRelease-1> {
tk::CancelRepeat
}
bind Entry <Control-1> {
bind Entry <Control-Button-1> {
%W icursor @%x
}
bind Entry <<PrevChar>> {
tk::EntrySetCursor %W [expr {[%W index insert] - 1}]
tk::EntrySetCursor %W [expr {[%W index insert]-1}]
}
bind Entry <<NextChar>> {
tk::EntrySetCursor %W [expr {[%W index insert] + 1}]
tk::EntrySetCursor %W [expr {[%W index insert]+1}]
}
bind Entry <<SelectPrevChar>> {
tk::EntryKeySelect %W [expr {[%W index insert] - 1}]
tk::EntryKeySelect %W [expr {[%W index insert]-1}]
tk::EntrySeeInsert %W
}
bind Entry <<SelectNextChar>> {
tk::EntryKeySelect %W [expr {[%W index insert] + 1}]
tk::EntryKeySelect %W [expr {[%W index insert]+1}]
tk::EntrySeeInsert %W
}
bind Entry <<PrevWord>> {
@@ -190,19 +190,19 @@ bind Entry <<SelectAll>> {
bind Entry <<SelectNone>> {
%W selection clear
}
bind Entry <KeyPress> {
bind Entry <Key> {
tk::CancelRepeat
tk::EntryInsert %W %A
}
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
# Otherwise, if a widget binding for one of these is defined, the
# <KeyPress> class binding will also fire and insert the character,
# <Key> class binding will also fire and insert the character,
# which is wrong. Ditto for Escape, Return, and Tab.
bind Entry <Alt-KeyPress> {# nothing}
bind Entry <Meta-KeyPress> {# nothing}
bind Entry <Control-KeyPress> {# nothing}
bind Entry <Alt-Key> {# nothing}
bind Entry <Meta-Key> {# nothing}
bind Entry <Control-Key> {# nothing}
bind Entry <Escape> {# nothing}
bind Entry <Return> {# nothing}
bind Entry <KP_Enter> {# nothing}
@@ -210,7 +210,7 @@ bind Entry <Tab> {# nothing}
bind Entry <Prior> {# nothing}
bind Entry <Next> {# nothing}
if {[tk windowingsystem] eq "aqua"} {
bind Entry <Command-KeyPress> {# nothing}
bind Entry <Command-Key> {# nothing}
}
# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
bind Entry <<NextLine>> {# nothing}
@@ -278,7 +278,7 @@ bind Entry <<TkStartIMEMarkedText>> {
dict set ::tk::Priv(IMETextMark) "%W" [%W index insert]
}
bind Entry <<TkEndIMEMarkedText>> {
if { [catch {dict get $::tk::Priv(IMETextMark) "%W"} mark] } {
if {[catch {dict get $::tk::Priv(IMETextMark) "%W"} mark]} {
bell
} else {
%W selection range $mark insert
@@ -293,14 +293,27 @@ bind Entry <<TkAccentBackspace>> {
# A few additional bindings of my own.
bind Entry <2> {
if {!$tk_strictMotif} {
::tk::EntryScanMark %W %x
if {[tk windowingsystem] ne "aqua"} {
bind Entry <Button-2> {
if {!$tk_strictMotif} {
::tk::EntryScanMark %W %x
}
}
}
bind Entry <B2-Motion> {
if {!$tk_strictMotif} {
::tk::EntryScanDrag %W %x
bind Entry <B2-Motion> {
if {!$tk_strictMotif} {
::tk::EntryScanDrag %W %x
}
}
} else {
bind Entry <Button-3> {
if {!$tk_strictMotif} {
::tk::EntryScanMark %W %x
}
}
bind Entry <B3-Motion> {
if {!$tk_strictMotif} {
::tk::EntryScanDrag %W %x
}
}
}
@@ -378,10 +391,10 @@ proc ::tk::EntryMouseSelect {w x} {
word {
if {$cur < $anchor} {
set before [tcl_wordBreakBefore [$w get] $cur]
set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]]
set after [tcl_wordBreakAfter [$w get] $anchor-1]
} elseif {$cur > $anchor} {
set before [tcl_wordBreakBefore [$w get] $anchor]
set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]]
set after [tcl_wordBreakAfter [$w get] $cur-1]
} else {
if {[$w index @$Priv(pressX)] < $anchor} {
incr anchor -1
@@ -505,9 +518,9 @@ proc ::tk::EntryBackspace w {
if {[$w selection present]} {
$w delete sel.first sel.last
} else {
set x [expr {[$w index insert] - 1}]
if {$x >= 0} {
$w delete $x
set x [$w index insert]
if {$x > 0} {
$w delete [expr {$x-1}]
}
if {[$w index @0] >= [$w index insert]} {
set range [$w xview]
@@ -562,12 +575,12 @@ proc ::tk::EntryTranspose w {
if {$i < [$w index end]} {
incr i
}
set first [expr {$i-2}]
if {$first < 0} {
if {$i < 2} {
return
}
set first [expr {$i-2}]
set data [$w get]
set new [string index $data [expr {$i-1}]][string index $data $first]
set new [string index $data $i-1][string index $data $first]
$w delete $first $i
$w insert insert $new
EntrySeeInsert $w
@@ -647,7 +660,7 @@ proc ::tk::EntryScanMark {w x} {
proc ::tk::EntryScanDrag {w x} {
# Make sure these exist, as some weird situations can trigger the
# motion binding without the initial press. [Bug #220269]
if {![info exists ::tk::Priv(x)]} { set ::tk::Priv(x) $x }
if {![info exists ::tk::Priv(x)]} {set ::tk::Priv(x) $x}
# allow for a delta
if {abs($x-$::tk::Priv(x)) > 2} {
set ::tk::Priv(mouseMoved) 1
@@ -664,19 +677,10 @@ proc ::tk::EntryScanDrag {w x} {
proc ::tk::EntryGetSelection {w} {
set entryString [string range [$w get] [$w index sel.first] \
[expr {[$w index sel.last] - 1}]]
[$w index sel.last]-1]
if {[$w cget -show] ne ""} {
return [string repeat [string index [$w cget -show] 0] \
[string length $entryString]]
}
return $entryString
}

View File

@@ -14,11 +14,11 @@ namespace eval ::tk::fontchooser {
set S(W) .__tk__fontchooser
set S(fonts) [lsort -dictionary [font families]]
set S(styles) [list \
[::msgcat::mc "Regular"] \
[::msgcat::mc "Italic"] \
[::msgcat::mc "Bold"] \
[::msgcat::mc "Bold Italic"] \
]
[::msgcat::mc "Regular"] \
[::msgcat::mc "Italic"] \
[::msgcat::mc "Bold"] \
[::msgcat::mc "Bold Italic"] \
]
set S(sizes) {8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72}
set S(strike) 0
@@ -36,9 +36,9 @@ proc ::tk::fontchooser::Setup {} {
# Canonical versions of font families, styles, etc. for easier searching
set S(fonts,lcase) {}
foreach font $S(fonts) { lappend S(fonts,lcase) [string tolower $font]}
foreach font $S(fonts) {lappend S(fonts,lcase) [string tolower $font]}
set S(styles,lcase) {}
foreach style $S(styles) { lappend S(styles,lcase) [string tolower $style]}
foreach style $S(styles) {lappend S(styles,lcase) [string tolower $style]}
set S(sizes,lcase) $S(sizes)
::ttk::style layout FontchooserFrame {
@@ -111,7 +111,7 @@ proc ::tk::fontchooser::Configure {args} {
set cache [dict create -parent $S(-parent) -title $S(-title) \
-font $S(-font) -command $S(-command)]
set r [tclParseConfigSpec [namespace which -variable S] $specs "" $args]
set r [tclParseConfigSpec [namespace which -variable S] $specs DONTSETDEFAULTS $args]
if {![winfo exists $S(-parent)]} {
set code [list TK LOOKUP WINDOW $S(-parent)]
set err "bad window path name \"$S(-parent)\""
@@ -121,7 +121,7 @@ proc ::tk::fontchooser::Configure {args} {
if {[string trim $S(-title)] eq ""} {
set S(-title) [::msgcat::mc "Font"]
}
if {[winfo exists $S(W)] && [lsearch $args -font] != -1} {
if {[winfo exists $S(W)] && ("-font" in $args)} {
Init $S(-font)
event generate $S(-parent) <<TkFontchooserFontChanged>>
}
@@ -145,10 +145,13 @@ proc ::tk::fontchooser::Create {} {
wm title $S(W) $S(-title)
wm transient $S(W) [winfo toplevel $S(-parent)]
set scaling [tk scaling]
set sizeWidth [expr {int([string length [::msgcat::mc "&Size:"]] * $scaling)}]
set outer [::ttk::frame $S(W).outer -padding {10 10}]
::tk::AmpWidget ::ttk::label $S(W).font -text [::msgcat::mc "&Font:"]
::tk::AmpWidget ::ttk::label $S(W).style -text [::msgcat::mc "Font st&yle:"]
::tk::AmpWidget ::ttk::label $S(W).size -text [::msgcat::mc "&Size:"]
::tk::AmpWidget ::ttk::label $S(W).size -text [::msgcat::mc "&Size:"] -width $sizeWidth
ttk::entry $S(W).efont -width 18 \
-textvariable [namespace which -variable S](font)
ttk::entry $S(W).estyle -width 10 \
@@ -199,7 +202,7 @@ proc ::tk::fontchooser::Create {} {
set minsize(sizes) \
[expr {[font measure TkDefaultFont "-99"] + $scroll_width}]
set min [expr {$minsize(gap) * 4}]
foreach {what width} [array get minsize] { incr min $width }
foreach {what width} [array get minsize] {incr min $width}
wm minsize $S(W) $min 260
bind $S(W) <Return> [namespace code [list Done 1]]
@@ -277,7 +280,7 @@ proc ::tk::fontchooser::Create {} {
# Arguments:
# ok true if user pressed OK
#
proc ::tk::::fontchooser::Done {ok} {
proc ::tk::fontchooser::Done {ok} {
variable S
if {! $ok} {
@@ -327,13 +330,13 @@ proc ::tk::fontchooser::Init {{defaultFont ""}} {
set S(size) $F(-size)
set S(strike) $F(-overstrike)
set S(under) $F(-underline)
set S(style) "Regular"
set S(style) [::msgcat::mc "Regular"]
if {$F(-weight) eq "bold" && $F(-slant) eq "italic"} {
set S(style) "Bold Italic"
set S(style) [::msgcat::mc "Bold Italic"]
} elseif {$F(-weight) eq "bold"} {
set S(style) "Bold"
set S(style) [::msgcat::mc "Bold"]
} elseif {$F(-slant) eq "italic"} {
set S(style) "Italic"
set S(style) [::msgcat::mc "Italic"]
}
set S(first) 0
@@ -381,7 +384,7 @@ proc ::tk::fontchooser::Tracer {var1 var2 op} {
$S(W).l${var}s selection clear 0 end
set n [lsearch -exact $S(${var}s,lcase) $value]
$S(W).l${var}s selection set $n
if {$n != -1} {
if {$n >= 0} {
set S($var) [lindex $S(${var}s) $n]
$S(W).e$var icursor end
$S(W).e$var selection clear
@@ -396,7 +399,7 @@ proc ::tk::fontchooser::Tracer {var1 var2 op} {
}
$S(W).l${var}s see $n
}
if {!$bad} { Update }
if {!$bad} {Update}
$S(W).ok configure -state $nstate
}
@@ -408,11 +411,11 @@ proc ::tk::fontchooser::Update {} {
variable S
set S(result) [list $S(font) $S(size)]
if {$S(style) eq "Bold"} { lappend S(result) bold }
if {$S(style) eq "Italic"} { lappend S(result) italic }
if {$S(style) eq "Bold Italic"} { lappend S(result) bold italic}
if {$S(strike)} { lappend S(result) overstrike}
if {$S(under)} { lappend S(result) underline}
if {$S(style) eq [::msgcat::mc "Bold"]} {lappend S(result) bold}
if {$S(style) eq [::msgcat::mc "Italic"]} {lappend S(result) italic}
if {$S(style) eq [::msgcat::mc "Bold Italic"]} {lappend S(result) bold italic}
if {$S(strike)} {lappend S(result) overstrike}
if {$S(under)} {lappend S(result) underline}
$S(sample) configure -font $S(result)
}

View File

@@ -26,7 +26,7 @@
# <path> selection includes <item>
# <path> selection set <first> ?<last>?
package require Tk 8.6
package require Tk
::tk::Megawidget create ::tk::IconList ::tk::FocusableWidget {
variable w canvas sbar accel accelCB fill font index \
@@ -697,7 +697,7 @@ package require Tk 8.6
}
}
if {$theIndex > -1} {
if {$theIndex >= 0} {
$w selection clear 0 end
$w selection set $theIndex
$w selection anchor $theIndex

View File

@@ -311,13 +311,13 @@ proc ::tk::ListboxMotion {w el} {
set Priv(listboxSelection) [$w curselection]
}
while {($i < $el) && ($i < $anchor)} {
if {[lsearch $Priv(listboxSelection) $i] >= 0} {
if {$i in $Priv(listboxSelection)} {
$w selection set $i
}
incr i
}
while {($i > $el) && ($i > $anchor)} {
if {[lsearch $Priv(listboxSelection) $i] >= 0} {
if {$i in $Priv(listboxSelection)} {
$w selection set $i
}
incr i -1
@@ -517,7 +517,7 @@ proc ::tk::ListboxCancel w {
}
$w selection clear $first $last
while {$first <= $last} {
if {[lsearch $Priv(listboxSelection) $first] >= 0} {
if {$first in $Priv(listboxSelection)} {
$w selection set $first
}
incr first

View File

@@ -10,7 +10,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
package require Tk 8.6
package require Tk
::oo::class create ::tk::Megawidget {
superclass ::oo::class

View File

@@ -138,7 +138,7 @@ bind Menu <Leave> {
bind Menu <Motion> {
tk::MenuMotion %W %x %y %s
}
bind Menu <ButtonPress> {
bind Menu <Button> {
tk::MenuButtonDown %W
}
bind Menu <ButtonRelease> {

View File

@@ -1,7 +1,7 @@
if {[catch {package present Tcl 8.6.0}]} { return }
if {($::tcl_platform(platform) eq "unix") && ([info exists ::env(DISPLAY)]
|| ([info exists ::argv] && ("-display" in $::argv)))} {
package ifneeded Tk 8.6.10 [list load [file join $dir .. .. bin libtk8.6.dll] Tk]
package ifneeded Tk 8.6.11 [list load [file join $dir .. .. bin libtk8.6.dll] Tk]
} else {
package ifneeded Tk 8.6.10 [list load [file join $dir .. .. bin tk86t.dll] Tk]
package ifneeded Tk 8.6.11 [list load [file join $dir .. .. bin tk86t.dll] Tk]
}

View File

@@ -14,9 +14,9 @@
# Note: It is now ok to let untrusted code being executed
# between the creation of the interp and the actual loading
# of Tk in that interp because the C side Tk_Init will
# now look up the master interp and ask its safe::TkInit
# now look up the parent interp and ask its safe::TkInit
# for the actual parameters to use for it's initialization (if allowed),
# not relying on the slave state.
# not relying on the child state.
#
# We use opt (optional arguments parsing)
@@ -29,31 +29,31 @@ namespace eval ::safe {
}
#
# tkInterpInit : prepare the slave interpreter for tk loading
# tkInterpInit : prepare the child interpreter for tk loading
# most of the real job is done by loadTk
# returns the slave name (tkInterpInit does)
# returns the child name (tkInterpInit does)
#
proc ::safe::tkInterpInit {slave argv} {
proc ::safe::tkInterpInit {child argv} {
global env tk_library
# We have to make sure that the tk_library variable is normalized.
set tk_library [file normalize $tk_library]
# Clear Tk's access for that interp (path).
allowTk $slave $argv
allowTk $child $argv
# Ensure tk_library and subdirs (eg, ttk) are on the access path
::interp eval $slave [list set tk_library [::safe::interpAddToAccessPath $slave $tk_library]]
::interp eval $child [list set tk_library [::safe::interpAddToAccessPath $child $tk_library]]
foreach subdir [::safe::AddSubDirs [list $tk_library]] {
::safe::interpAddToAccessPath $slave $subdir
::safe::interpAddToAccessPath $child $subdir
}
return $slave
return $child
}
# tkInterpLoadTk:
# Do additional configuration as needed (calling tkInterpInit)
# and actually load Tk into the slave.
# and actually load Tk into the child.
#
# Either contained in the specified windowId (-use) or
# creating a decorated toplevel for it.
@@ -62,37 +62,37 @@ proc ::safe::tkInterpInit {slave argv} {
proc ::safe::loadTk {} {}
::tcl::OptProc ::safe::loadTk {
{slave -interp "name of the slave interpreter"}
{child -interp "name of the child interpreter"}
{-use -windowId {} "window Id to use (new toplevel otherwise)"}
{-display -displayName {} "display name to use (current one otherwise)"}
} {
set displayGiven [::tcl::OptProcArgGiven "-display"]
if {!$displayGiven} {
# Try to get the current display from "."
# (which might not exist if the master is tk-less)
# (which might not exist if the parent is tk-less)
if {[catch {set display [winfo screen .]}]} {
if {[info exists ::env(DISPLAY)]} {
set display $::env(DISPLAY)
} else {
Log $slave "no winfo screen . nor env(DISPLAY)" WARNING
Log $child "no winfo screen . nor env(DISPLAY)" WARNING
set display ":0.0"
}
}
}
# Get state for access to the cleanupHook.
namespace upvar ::safe S$slave state
namespace upvar ::safe S$child state
if {![::tcl::OptProcArgGiven "-use"]} {
# create a decorated toplevel
lassign [tkTopLevel $slave $display] w use
lassign [tkTopLevel $child $display] w use
# set our delete hook (slave arg is added by interpDelete)
# to clean up both window related code and tkInit(slave)
# set our delete hook (child arg is added by interpDelete)
# to clean up both window related code and tkInit(child)
set state(cleanupHook) [list tkDelete {} $w]
} else {
# set our delete hook (slave arg is added by interpDelete)
# to clean up tkInit(slave)
# set our delete hook (child arg is added by interpDelete)
# to clean up tkInit(child)
set state(cleanupHook) [list disallowTk]
# Let's be nice and also accept tk window names instead of ids
@@ -122,12 +122,12 @@ proc ::safe::loadTk {} {}
}
}
# Prepares the slave for tk with those parameters
tkInterpInit $slave [list "-use" $use "-display" $display]
# Prepares the child for tk with those parameters
tkInterpInit $child [list "-use" $use "-display" $display]
load {} Tk $slave
load {} Tk $child
return $slave
return $child
}
proc ::safe::TkInit {interpPath} {
@@ -149,7 +149,7 @@ proc ::safe::TkInit {interpPath} {
# safe::TkInit.
#
# Arguments:
# interpPath slave interpreter handle
# interpPath child interpreter handle
# argv arguments passed to safe::TkInterpInit
#
# Results:
@@ -168,7 +168,7 @@ proc ::safe::allowTk {interpPath argv} {
# in safe::TkInit.
#
# Arguments:
# interpPath slave interpreter handle
# interpPath child interpreter handle
#
# Results:
# none.
@@ -188,43 +188,43 @@ proc ::safe::disallowTk {interpPath} {
# Clean up the window associated with the interp being deleted.
#
# Arguments:
# interpPath slave interpreter handle
# interpPath child interpreter handle
#
# Results:
# none.
proc ::safe::tkDelete {W window slave} {
proc ::safe::tkDelete {W window child} {
# we are going to be called for each widget... skip untill it's
# top level
Log $slave "Called tkDelete $W $window" NOTICE
if {[::interp exists $slave]} {
if {[catch {::safe::interpDelete $slave} msg]} {
Log $slave "Deletion error : $msg"
Log $child "Called tkDelete $W $window" NOTICE
if {[::interp exists $child]} {
if {[catch {::safe::interpDelete $child} msg]} {
Log $child "Deletion error : $msg"
}
}
if {[winfo exists $window]} {
Log $slave "Destroy toplevel $window" NOTICE
Log $child "Destroy toplevel $window" NOTICE
destroy $window
}
# clean up tkInit(slave)
disallowTk $slave
# clean up tkInit(child)
disallowTk $child
return
}
proc ::safe::tkTopLevel {slave display} {
proc ::safe::tkTopLevel {child display} {
variable tkSafeId
incr tkSafeId
set w ".safe$tkSafeId"
if {[catch {toplevel $w -screen $display -class SafeTk} msg]} {
return -code error -errorcode {TK TOPLEVEL SAFE} \
"Unable to create toplevel for safe slave \"$slave\" ($msg)"
"Unable to create toplevel for \"$child\" ($msg)"
}
Log $slave "New toplevel $w" NOTICE
Log $child "New toplevel $w" NOTICE
set msg "Untrusted Tcl applet ($slave)"
set msg "Untrusted Tcl applet ($child)"
wm title $w $msg
# Control frame (we must create a style for it)
@@ -236,7 +236,7 @@ proc ::safe::tkTopLevel {slave display} {
# We will destroy the interp when the window is destroyed
bindtags $wc [concat Safe$wc [bindtags $wc]]
bind Safe$wc <Destroy> [list ::safe::tkDelete %W $w $slave]
bind Safe$wc <Destroy> [list ::safe::tkDelete %W $w $child]
ttk::label $wc.l -text $msg -anchor w
@@ -247,7 +247,7 @@ proc ::safe::tkTopLevel {slave display} {
# but still have the default background instead of red one from the parent
ttk::frame $wc.fb -borderwidth 0
ttk::button $wc.fb.b -text "Delete" \
-command [list ::safe::tkDelete $w $w $slave]
-command [list ::safe::tkDelete $w $w $child]
pack $wc.fb.b -side right -fill both
pack $wc.fb -side right -fill both -expand 1
pack $wc.l -side left -fill both -expand 1 -ipady 2

View File

@@ -280,14 +280,27 @@ bind Spinbox <Meta-Delete> {
# A few additional bindings of my own.
bind Spinbox <2> {
if {!$tk_strictMotif} {
::tk::EntryScanMark %W %x
if {[tk windowingsystem] ne "aqua"} {
bind Spinbox <2> {
if {!$tk_strictMotif} {
::tk::EntryScanMark %W %x
}
}
}
bind Spinbox <B2-Motion> {
if {!$tk_strictMotif} {
::tk::EntryScanDrag %W %x
bind Spinbox <B2-Motion> {
if {!$tk_strictMotif} {
::tk::EntryScanDrag %W %x
}
}
} else {
bind Spinbox <3> {
if {!$tk_strictMotif} {
::tk::EntryScanMark %W %x
}
}
bind Spinbox <B3-Motion> {
if {!$tk_strictMotif} {
::tk::EntryScanDrag %W %x
}
}
}
@@ -470,10 +483,10 @@ proc ::tk::spinbox::MouseSelect {w x {cursor {}}} {
word {
if {$cur < [$w index anchor]} {
set before [tcl_wordBreakBefore [$w get] $cur]
set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]]
set after [tcl_wordBreakAfter [$w get] $anchor-1]
} else {
set before [tcl_wordBreakBefore [$w get] $anchor]
set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]]
set after [tcl_wordBreakAfter [$w get] $cur-1]
}
if {$before < 0} {
set before 0

View File

@@ -39,7 +39,7 @@ proc ::tk::TearOffMenu {w {x 0} {y 0}} {
# Shift by height of tearoff entry minus height of window titlebar
catch {incr y [expr {[$w yposition 1] - 16}]}
# Avoid the native menu bar which sits on top of everything.
if {$y < 22} { set y 22 }
if {$y < 22} {set y 22}
}
}
@@ -153,9 +153,11 @@ proc ::tk::MenuDup {src dst type} {
# Copy tags to x, replacing each substring of src with dst.
while {[set index [string first $src $tags]] != -1} {
append x [string range $tags 0 [expr {$index - 1}]]$dst
set tags [string range $tags [expr {$index + $srcLen}] end]
while {[set index [string first $src $tags]] >= 0} {
if {$index > 0} {
append x [string range $tags 0 $index-1]$dst
}
set tags [string range $tags $index+$srcLen end]
}
append x $tags
@@ -168,10 +170,12 @@ proc ::tk::MenuDup {src dst type} {
# Copy script to x, replacing each substring of event with dst.
while {[set index [string first $event $script]] != -1} {
append x [string range $script 0 [expr {$index - 1}]]
while {[set index [string first $event $script]] >= 0} {
if {$index > 0} {
append x [string range $script 0 $index-1]
}
append x $dst
set script [string range $script [expr {$index + $eventLen}] end]
set script [string range $script $index+$eventLen end]
}
append x $script

View File

@@ -429,14 +429,27 @@ bind Text <Control-h> {
%W see insert
}
}
bind Text <2> {
if {!$tk_strictMotif} {
tk::TextScanMark %W %x %y
if {[tk windowingsystem] ne "aqua"} {
bind Text <2> {
if {!$tk_strictMotif} {
tk::TextScanMark %W %x %y
}
}
}
bind Text <B2-Motion> {
if {!$tk_strictMotif} {
tk::TextScanDrag %W %x %y
bind Text <B2-Motion> {
if {!$tk_strictMotif} {
tk::TextScanDrag %W %x %y
}
}
} else {
bind Text <3> {
if {!$tk_strictMotif} {
tk::TextScanMark %W %x %y
}
}
bind Text <B3-Motion> {
if {!$tk_strictMotif} {
tk::TextScanDrag %W %x %y
}
}
}
set ::tk::Priv(prevPos) {}
@@ -558,12 +571,7 @@ proc ::tk::TextButton1 {w x y} {
} else {
$w mark gravity $anchorname left
}
# Allow focus in any case on Windows, because that will let the
# selection be displayed even for state disabled text widgets.
if {[tk windowingsystem] eq "win32" \
|| [$w cget -state] eq "normal"} {
focus $w
}
focus $w
if {[$w cget -autoseparators]} {
$w edit separator
}

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.10
package require -exact Tk 8.6.11
# Create a ::tk namespace
namespace eval ::tk {
@@ -400,7 +400,7 @@ switch -exact -- [tk windowingsystem] {
event add <<NextPara>> <Control-Down>
event add <<SelectPrevPara>> <Control-Shift-Up>
event add <<SelectNextPara>> <Control-Shift-Down>
event add <<ToggleSelection>> <Control-ButtonPress-1>
event add <<ToggleSelection>> <Control-Button-1>
# Some OS's define a goofy (as in, not <Shift-Tab>) keysym that is
# returned when the user presses <Shift-Tab>. In order for tab
@@ -449,7 +449,7 @@ switch -exact -- [tk windowingsystem] {
event add <<NextPara>> <Control-Down>
event add <<SelectPrevPara>> <Control-Shift-Up>
event add <<SelectNextPara>> <Control-Shift-Down>
event add <<ToggleSelection>> <Control-ButtonPress-1>
event add <<ToggleSelection>> <Control-Button-1>
}
"aqua" {
event add <<Cut>> <Command-Key-x> <Key-F2> <Command-Lock-Key-X>
@@ -462,8 +462,6 @@ switch -exact -- [tk windowingsystem] {
# Official bindings
# See http://support.apple.com/kb/HT1343
event add <<SelectAll>> <Command-Key-a>
#Attach function keys not otherwise assigned to this event so they no-op - workaround for bug 0e6930dfe7
event add <<SelectNone>> <Option-Command-Key-a> <Key-F5> <Key-F1> <Key-F5> <Key-F6> <Key-F7> <Key-F8> <Key-F9> <Key-F10> <Key-F11> <Key-F12>
event add <<Undo>> <Command-Key-z> <Command-Lock-Key-Z>
event add <<Redo>> <Shift-Command-Key-z> <Shift-Command-Lock-Key-z>
event add <<NextChar>> <Right> <Control-Key-f> <Control-Lock-Key-F>
@@ -488,7 +486,7 @@ switch -exact -- [tk windowingsystem] {
event add <<NextPara>> <Option-Down>
event add <<SelectPrevPara>> <Shift-Option-Up>
event add <<SelectNextPara>> <Shift-Option-Down>
event add <<ToggleSelection>> <Command-ButtonPress-1>
event add <<ToggleSelection>> <Command-Button-1>
}
}
@@ -498,7 +496,7 @@ switch -exact -- [tk windowingsystem] {
if {$::tk_library ne ""} {
proc ::tk::SourceLibFile {file} {
namespace eval :: [list source [file join $::tk_library $file.tcl]]
namespace eval :: [list source -encoding utf-8 [file join $::tk_library $file.tcl]]
}
namespace eval ::tk {
SourceLibFile icons
@@ -689,9 +687,11 @@ if {[tk windowingsystem] eq "aqua"} {
if {[tk windowingsystem] eq "aqua"} {
#stub procedures to respond to "do script" Apple Events
proc ::tk::mac::DoScriptFile {file} {
source $file
uplevel #0 $file
source -encoding utf-8 $file
}
proc ::tk::mac::DoScriptText {script} {
uplevel #0 $script
eval $script
}
}
@@ -703,7 +703,7 @@ set ::tk::Priv(IMETextMark) [dict create]
# Run the Ttk themed widget set initialization
if {$::ttk::library ne ""} {
uplevel \#0 [list source $::ttk::library/ttk.tcl]
uplevel \#0 [list source -encoding utf-8 $::ttk::library/ttk.tcl]
}
# Local Variables:

View File

@@ -15,7 +15,7 @@ namespace eval ttk::theme::aqua {
-insertwidth 1
ttk::style map . \
-foreground {
-foreground {
disabled systemDisabledControlTextColor
background systemLabelColor} \
-selectbackground {
@@ -35,21 +35,38 @@ namespace eval ttk::theme::aqua {
ttk::style configure TMenubutton -anchor center -padding {2 0 0 2}
ttk::style configure Toolbutton -anchor center
# For Entry, Combobox and Spinbox widgets the selected text background
# is the "Highlight color" selected in preferences when the widget
# has focus. It is a gray color when the widget does not have focus or
# the window does not have focus. (The background state implies !focus
# so we only need to specify !focus.)
# Entry
ttk::style configure TEntry \
-foreground systemTextColor \
-background systemTextBackgroundColor
ttk::style map TEntry \
-foreground {
disabled systemDisabledControlTextColor
} \
-selectforeground {
background systemTextColor
-selectbackground {
!focus systemUnemphasizedSelectedTextBackgroundColor
}
# Combobox:
ttk::style map TCombobox \
-foreground {
disabled systemDisabledControlTextColor
} \
-selectbackground {
background systemTextBackgroundColor
!focus systemUnemphasizedSelectedTextBackgroundColor
}
# Spinbox
ttk::style map TSpinbox \
-foreground {
disabled systemDisabledControlTextColor
} \
-selectbackground {
!focus systemUnemphasizedSelectedTextBackgroundColor
}
# Workaround for #1100117:
# Actually, on Aqua we probably shouldn't stipple images in
@@ -67,40 +84,6 @@ namespace eval ttk::theme::aqua {
disabled systemDisabledControlTextColor
selected systemSelectedTabTextColor}
# Combobox:
ttk::style configure TCombobox \
-foreground systemTextColor \
-background systemTransparent
ttk::style map TCombobox \
-foreground {
disabled systemDisabledControlTextColor
} \
-selectforeground {
background systemTextColor
} \
-selectbackground {
background systemTransparent
}
# Spinbox
ttk::style configure TSpinbox \
-foreground systemTextColor \
-background systemTextBackgroundColor \
-selectforeground systemSelectedTextColor \
-selectbackground systemSelectedTextBackgroundColor
ttk::style map TSpinbox \
-foreground {
disabled systemDisabledControlTextColor
} \
-selectforeground {
!active systemTextColor
} \
-selectbackground {
!active systemTextBackgroundColor
!focus systemTextBackgroundColor
focus systemSelectedTextBackgroundColor
}
# Treeview:
ttk::style configure Heading \
-font TkHeadingFont \
@@ -116,7 +99,7 @@ namespace eval ttk::theme::aqua {
}
# Enable animation for ttk::progressbar widget:
ttk::style configure TProgressbar -period 100 -maxphase 255
ttk::style configure TProgressbar -period 100 -maxphase 120
# For Aqua, labelframe labels should appear outside the border,
# with a 14 pixel inset and 4 pixels spacing between border and label

View File

@@ -8,8 +8,8 @@
# (If the button is released off the widget, the grab deactivates and
# we get a <Leave> event then, which turns off the "active" state)
#
# Normally, <ButtonRelease> and <ButtonN-Enter/Leave> events are
# delivered to the widget which received the initial <ButtonPress>
# Normally, <ButtonRelease> and <ButtonN-Enter/Leave> events are
# delivered to the widget which received the initial <Button>
# event. However, Tk [grab]s (#1223103) and menu interactions
# (#1222605) can interfere with this. To guard against spurious
# <Button1-Enter> events, the <Button1-Enter> binding only sets
@@ -20,10 +20,10 @@ namespace eval ttk::button {}
bind TButton <Enter> { %W instate !disabled {%W state active} }
bind TButton <Leave> { %W state !active }
bind TButton <Key-space> { ttk::button::activate %W }
bind TButton <space> { ttk::button::activate %W }
bind TButton <<Invoke>> { ttk::button::activate %W }
bind TButton <ButtonPress-1> \
bind TButton <Button-1> \
{ %W instate !disabled { ttk::clickToFocus %W; %W state pressed } }
bind TButton <ButtonRelease-1> \
{ %W instate pressed { %W state !pressed; %W instate !disabled { %W invoke } } }
@@ -39,11 +39,11 @@ ttk::copyBindings TButton TRadiobutton
# ...plus a few more:
bind TRadiobutton <KeyPress-Up> { ttk::button::RadioTraverse %W -1 }
bind TRadiobutton <KeyPress-Down> { ttk::button::RadioTraverse %W +1 }
bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 }
bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 }
# bind TCheckbutton <KeyPress-plus> { %W select }
# bind TCheckbutton <KeyPress-minus> { %W deselect }
# bind TCheckbutton <plus> { %W select }
# bind TCheckbutton <minus> { %W deselect }
# activate --
# Simulate a button press: temporarily set the state to 'pressed',

View File

@@ -5,7 +5,7 @@
#
namespace eval ttk::theme::clam {
variable colors
variable colors
array set colors {
-disabledfg "#999999"
-frame "#dcdad5"

View File

@@ -45,13 +45,13 @@ namespace eval ttk::combobox {
ttk::copyBindings TEntry TCombobox
bind TCombobox <KeyPress-Down> { ttk::combobox::Post %W }
bind TCombobox <KeyPress-Escape> { ttk::combobox::Unpost %W }
bind TCombobox <Down> { ttk::combobox::Post %W }
bind TCombobox <Escape> { ttk::combobox::Unpost %W }
bind TCombobox <ButtonPress-1> { ttk::combobox::Press "" %W %x %y }
bind TCombobox <Shift-ButtonPress-1> { ttk::combobox::Press "s" %W %x %y }
bind TCombobox <Double-ButtonPress-1> { ttk::combobox::Press "2" %W %x %y }
bind TCombobox <Triple-ButtonPress-1> { ttk::combobox::Press "3" %W %x %y }
bind TCombobox <Button-1> { ttk::combobox::Press "" %W %x %y }
bind TCombobox <Shift-Button-1> { ttk::combobox::Press "s" %W %x %y }
bind TCombobox <Double-Button-1> { ttk::combobox::Press "2" %W %x %y }
bind TCombobox <Triple-Button-1> { ttk::combobox::Press "3" %W %x %y }
bind TCombobox <B1-Motion> { ttk::combobox::Drag %W %x }
bind TCombobox <Motion> { ttk::combobox::Motion %W %x %y }
@@ -62,9 +62,9 @@ bind TCombobox <<TraverseIn>> { ttk::combobox::TraverseIn %W }
### Combobox listbox bindings.
#
bind ComboboxListbox <ButtonRelease-1> { ttk::combobox::LBSelected %W }
bind ComboboxListbox <KeyPress-Return> { ttk::combobox::LBSelected %W }
bind ComboboxListbox <KeyPress-Escape> { ttk::combobox::LBCancel %W }
bind ComboboxListbox <KeyPress-Tab> { ttk::combobox::LBTab %W next }
bind ComboboxListbox <Return> { ttk::combobox::LBSelected %W }
bind ComboboxListbox <Escape> { ttk::combobox::LBCancel %W }
bind ComboboxListbox <Tab> { ttk::combobox::LBTab %W next }
bind ComboboxListbox <<PrevWindow>> { ttk::combobox::LBTab %W prev }
bind ComboboxListbox <Destroy> { ttk::combobox::LBCleanup %W }
bind ComboboxListbox <Motion> { ttk::combobox::LBHover %W %x %y }
@@ -82,7 +82,7 @@ switch -- [tk windowingsystem] {
#
bind ComboboxPopdown <Map> { ttk::combobox::MapPopdown %W }
bind ComboboxPopdown <Unmap> { ttk::combobox::UnmapPopdown %W }
bind ComboboxPopdown <ButtonPress> \
bind ComboboxPopdown <Button> \
{ ttk::combobox::Unpost [winfo parent %W] }
### Option database settings.
@@ -106,7 +106,7 @@ switch -- [tk windowingsystem] {
### Binding procedures.
#
## Press $mode $x $y -- ButtonPress binding for comboboxes.
## Press $mode $x $y -- Button binding for comboboxes.
# Either post/unpost the listbox, or perform Entry widget binding,
# depending on widget state and location of button press.
#
@@ -135,7 +135,7 @@ proc ttk::combobox::Press {mode w x y} {
}
## Drag -- B1-Motion binding for comboboxes.
# If the initial ButtonPress event was handled by Entry binding,
# If the initial Button event was handled by Entry binding,
# perform Entry widget drag binding; otherwise nothing.
#
proc ttk::combobox::Drag {w x} {
@@ -149,12 +149,14 @@ proc ttk::combobox::Drag {w x} {
# Set cursor.
#
proc ttk::combobox::Motion {w x y} {
variable State
ttk::saveCursor $w State(userConfCursor) [ttk::cursor text]
if { [$w identify $x $y] eq "textarea"
&& [$w instate {!readonly !disabled}]
} {
ttk::setCursor $w text
} else {
ttk::setCursor $w ""
ttk::setCursor $w $State(userConfCursor)
}
}
@@ -355,6 +357,9 @@ proc ttk::combobox::PlacePopdown {cb popdown} {
set w [winfo width $cb]
set h [winfo height $cb]
set style [$cb cget -style]
if { $style eq {} } {
set style TCombobox
}
set postoffset [ttk::style lookup $style -postoffset {} {0 0 0 0}]
foreach var {x y w h} delta $postoffset {
incr $var $delta

View File

@@ -140,8 +140,30 @@ proc ttk::cursor {name} {
proc ttk::setCursor {w name} {
variable Cursors
if {[$w cget -cursor] ne $Cursors($name)} {
$w configure -cursor $Cursors($name)
if {[info exists Cursors($name)]} {
set cursorname $Cursors($name)
} else {
set cursorname $name
}
if {[$w cget -cursor] ne $cursorname} {
$w configure -cursor $cursorname
}
}
## ttk::saveCursor $w $saveVar $excludeList --
# Set variable $saveVar to the -cursor value from widget $w,
# if either:
# a. $saveVar does not yet exist
# b. the currently user-specified cursor for $w is not in
# $excludeList
proc ttk::saveCursor {w saveVar excludeList} {
upvar $saveVar sv
if {![info exists sv]} {
set sv [$w cget -cursor]
}
if {[$w cget -cursor] ni $excludeList} {
set sv [$w cget -cursor]
}
}

View File

@@ -43,7 +43,7 @@ namespace eval ttk::theme::default {
ttk::style configure TButton \
-anchor center -padding "3 3" -width -9 \
-relief raised -shiftrelief 1
ttk::style map TButton -relief [list {!disabled pressed} sunken]
ttk::style map TButton -relief [list {!disabled pressed} sunken]
ttk::style configure TCheckbutton \
-indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1

View File

@@ -40,20 +40,20 @@ option add *TEntry.cursor [ttk::cursor text] widgetDefault
#
# Removed the following standard Tk bindings:
#
# <Control-Key-space>, <Control-Shift-Key-space>,
# <Key-Select>, <Shift-Key-Select>:
# <Control-space>, <Control-Shift-space>,
# <Select>, <Shift-Select>:
# Ttk entry widget doesn't use selection anchor.
# <Key-Insert>:
# <Insert>:
# Inserts PRIMARY selection (on non-Windows platforms).
# This is inconsistent with typical platform bindings.
# <Double-Shift-ButtonPress-1>, <Triple-Shift-ButtonPress-1>:
# <Double-Shift-Button-1>, <Triple-Shift-Button-1>:
# These don't do the right thing to start with.
# <Meta-Key-b>, <Meta-Key-d>, <Meta-Key-f>,
# <Meta-Key-BackSpace>, <Meta-Key-Delete>:
# <Meta-b>, <Meta-d>, <Meta-f>,
# <Meta-BackSpace>, <Meta-Delete>:
# Judgment call. If <Meta> happens to be assigned to the Alt key,
# these could conflict with application accelerators.
# (Plus, who has a Meta key these days?)
# <Control-Key-t>:
# <Control-t>:
# Another judgment call. If anyone misses this, let me know
# and I'll put it back.
#
@@ -68,27 +68,34 @@ bind TEntry <<Clear>> { ttk::entry::Clear %W }
## Button1 bindings:
# Used for selection and navigation.
#
bind TEntry <ButtonPress-1> { ttk::entry::Press %W %x }
bind TEntry <Shift-ButtonPress-1> { ttk::entry::Shift-Press %W %x }
bind TEntry <Double-ButtonPress-1> { ttk::entry::Select %W %x word }
bind TEntry <Triple-ButtonPress-1> { ttk::entry::Select %W %x line }
bind TEntry <Button-1> { ttk::entry::Press %W %x }
bind TEntry <Shift-Button-1> { ttk::entry::Shift-Press %W %x }
bind TEntry <Double-Button-1> { ttk::entry::Select %W %x word }
bind TEntry <Triple-Button-1> { ttk::entry::Select %W %x line }
bind TEntry <B1-Motion> { ttk::entry::Drag %W %x }
bind TEntry <B1-Leave> { ttk::entry::DragOut %W %m }
bind TEntry <B1-Enter> { ttk::entry::DragIn %W }
bind TEntry <ButtonRelease-1> { ttk::entry::Release %W }
bind TEntry <B1-Leave> { ttk::entry::DragOut %W %m }
bind TEntry <B1-Enter> { ttk::entry::DragIn %W }
bind TEntry <ButtonRelease-1> { ttk::entry::Release %W }
bind TEntry <<ToggleSelection>> {
%W instate {!readonly !disabled} { %W icursor @%x ; focus %W }
}
## Button2 bindings:
## Button2 (Button3 on Aqua) bindings:
# Used for scanning and primary transfer.
# Note: ButtonRelease-2 is mapped to <<PasteSelection>> in tk.tcl.
# Note: ButtonRelease-2 (ButtonRelease-3 on Aqua)
# is mapped to <<PasteSelection>> in tk.tcl.
#
bind TEntry <ButtonPress-2> { ttk::entry::ScanMark %W %x }
bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
if {[tk windowingsystem] ne "aqua"} {
bind TEntry <Button-2> { ttk::entry::ScanMark %W %x }
bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
} else {
bind TEntry <Button-3> { ttk::entry::ScanMark %W %x }
bind TEntry <B3-Motion> { ttk::entry::ScanDrag %W %x }
bind TEntry <ButtonRelease-3> { ttk::entry::ScanRelease %W %x }
}
bind TEntry <<PasteSelection>> { ttk::entry::ScanRelease %W %x }
## Keyboard navigation bindings:
@@ -114,26 +121,26 @@ bind TEntry <<TraverseIn>> { %W selection range 0 end; %W icursor end }
## Edit bindings:
#
bind TEntry <KeyPress> { ttk::entry::Insert %W %A }
bind TEntry <Key-Delete> { ttk::entry::Delete %W }
bind TEntry <Key-BackSpace> { ttk::entry::Backspace %W }
bind TEntry <Key> { ttk::entry::Insert %W %A }
bind TEntry <Delete> { ttk::entry::Delete %W }
bind TEntry <BackSpace> { ttk::entry::Backspace %W }
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
# Otherwise, the <KeyPress> class binding will fire and insert the character.
# Otherwise, the <Key> class binding will fire and insert the character.
# Ditto for Escape, Return, and Tab.
#
bind TEntry <Alt-KeyPress> {# nothing}
bind TEntry <Meta-KeyPress> {# nothing}
bind TEntry <Control-KeyPress> {# nothing}
bind TEntry <Key-Escape> {# nothing}
bind TEntry <Key-Return> {# nothing}
bind TEntry <Key-KP_Enter> {# nothing}
bind TEntry <Key-Tab> {# nothing}
bind TEntry <Alt-Key> {# nothing}
bind TEntry <Meta-Key> {# nothing}
bind TEntry <Control-Key> {# nothing}
bind TEntry <Escape> {# nothing}
bind TEntry <Return> {# nothing}
bind TEntry <KP_Enter> {# nothing}
bind TEntry <Tab> {# nothing}
# Argh. Apparently on Windows, the NumLock modifier is interpreted
# as a Command modifier.
if {[tk windowingsystem] eq "aqua"} {
bind TEntry <Command-KeyPress> {# nothing}
bind TEntry <Command-Key> {# nothing}
}
# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
bind TEntry <<PrevLine>> {# nothing}
@@ -141,9 +148,9 @@ bind TEntry <<NextLine>> {# nothing}
## Additional emacs-like bindings:
#
bind TEntry <Control-Key-d> { ttk::entry::Delete %W }
bind TEntry <Control-Key-h> { ttk::entry::Backspace %W }
bind TEntry <Control-Key-k> { %W delete insert end }
bind TEntry <Control-d> { ttk::entry::Delete %W }
bind TEntry <Control-h> { ttk::entry::Backspace %W }
bind TEntry <Control-k> { %W delete insert end }
# Bindings for IME text input.
@@ -351,7 +358,7 @@ proc ttk::entry::Extend {w where} {
# Triple-clicking enters "line-select" mode.
#
## Press -- ButtonPress-1 binding.
## Press -- Button-1 binding.
# Set the insertion cursor, claim the input focus, set up for
# future drag operations.
#
@@ -368,7 +375,7 @@ proc ttk::entry::Press {w x} {
set State(anchor) [$w index insert]
}
## Shift-Press -- Shift-ButtonPress-1 binding.
## Shift-Press -- Shift-Button-1 binding.
# Extends the selection, sets anchor for future drag operations.
#
proc ttk::entry::Shift-Press {w x} {
@@ -517,7 +524,7 @@ proc ttk::entry::LineSelect {w _ _} {
### Button 2 binding procedures.
#
## ScanMark -- ButtonPress-2 binding.
## ScanMark -- Button-2 binding.
# Marks the start of a scan or primary transfer operation.
#
proc ttk::entry::ScanMark {w x} {

View File

@@ -82,7 +82,7 @@ switch -- [tk windowingsystem] {
set F(family) "MS Sans Serif"
}
} else {
if {[lsearch -exact [font families] Tahoma] != -1} {
if {[lsearch -exact [font families] Tahoma] >= 0} {
set F(family) "Tahoma"
} else {
set F(family) "MS Sans Serif"

View File

@@ -5,12 +5,12 @@
#
# Pulldown: Press menubutton, drag over menu, release to activate menu entry
# Popdown: Click menubutton to post menu
# Keyboard: <Key-space> or accelerator key to post menu
# Keyboard: <space> or accelerator key to post menu
#
# (In addition, when menu system is active, "dropdown" -- menu posts
# on mouse-over. Ttk menubuttons don't implement this).
#
# For keyboard and popdown mode, we hand off to tk_popup and let
# For keyboard and popdown mode, we hand off to tk_popup and let
# the built-in Tk bindings handle the rest of the interaction.
#
# ON X11:
@@ -19,16 +19,16 @@
# This won't work for Ttk menubuttons in pulldown mode,
# since we need to process the final <ButtonRelease> event,
# and this might be delivered to the menu. So instead we
# rely on the passive grab that occurs on <ButtonPress> events,
# rely on the passive grab that occurs on <Button> events,
# and transition to popdown mode when the mouse is released
# or dragged outside the menubutton.
#
#
# ON WINDOWS:
#
# I'm not sure what the hell is going on here. [$menu post] apparently
# I'm not sure what the hell is going on here. [$menu post] apparently
# sets up some kind of internal grab for native menus.
# On this platform, just use [tk_popup] for all menu actions.
#
#
# ON MACOS:
#
# Same probably applies here.
@@ -46,15 +46,15 @@ namespace eval ttk {
bind TMenubutton <Enter> { %W instate !disabled {%W state active } }
bind TMenubutton <Leave> { %W state !active }
bind TMenubutton <Key-space> { ttk::menubutton::Popdown %W }
bind TMenubutton <space> { ttk::menubutton::Popdown %W }
bind TMenubutton <<Invoke>> { ttk::menubutton::Popdown %W }
if {[tk windowingsystem] eq "x11"} {
bind TMenubutton <ButtonPress-1> { ttk::menubutton::Pulldown %W }
bind TMenubutton <Button-1> { ttk::menubutton::Pulldown %W }
bind TMenubutton <ButtonRelease-1> { ttk::menubutton::TransferGrab %W }
bind TMenubutton <B1-Leave> { ttk::menubutton::TransferGrab %W }
} else {
bind TMenubutton <ButtonPress-1> \
bind TMenubutton <Button-1> \
{ %W state pressed ; ttk::menubutton::Popdown %W }
bind TMenubutton <ButtonRelease-1> \
{ if {[winfo exists %W]} { %W state !pressed } }
@@ -97,7 +97,7 @@ if {[tk windowingsystem] eq "aqua"} {
}
below {
set entry ""
incr y $bh
incr y $bh
}
left {
incr y $menuPad
@@ -105,7 +105,7 @@ if {[tk windowingsystem] eq "aqua"} {
}
right {
incr y $menuPad
incr x $bw
incr x $bw
}
default {
incr y $bbh
@@ -182,7 +182,7 @@ proc ttk::menubutton::Popdown {mb} {
# Pulldown (X11 only) --
# Called when Button1 is pressed on a menubutton.
# Posts the menu; a subsequent ButtonRelease
# Posts the menu; a subsequent ButtonRelease
# or Leave event will set a grab on the menu.
#
proc ttk::menubutton::Pulldown {mb} {
@@ -224,11 +224,11 @@ proc ttk::menubutton::TransferGrab {mb} {
# FindMenuEntry --
# Hack to support tk_optionMenus.
# Returns the index of the menu entry with a matching -label,
# -1 if not found.
# "" if not found.
#
proc ttk::menubutton::FindMenuEntry {menu s} {
set last [$menu index last]
if {$last eq "none"} {
if {$last eq "none" || $last eq ""} {
return ""
}
for {set i 0} {$i <= $last} {incr i} {

View File

@@ -6,11 +6,11 @@ namespace eval ttk::notebook {
variable TLNotebooks ;# See enableTraversal
}
bind TNotebook <ButtonPress-1> { ttk::notebook::Press %W %x %y }
bind TNotebook <Key-Right> { ttk::notebook::CycleTab %W 1; break }
bind TNotebook <Key-Left> { ttk::notebook::CycleTab %W -1; break }
bind TNotebook <Control-Key-Tab> { ttk::notebook::CycleTab %W 1; break }
bind TNotebook <Control-Shift-Key-Tab> { ttk::notebook::CycleTab %W -1; break }
bind TNotebook <Button-1> { ttk::notebook::Press %W %x %y }
bind TNotebook <Right> { ttk::notebook::CycleTab %W 1; break }
bind TNotebook <Left> { ttk::notebook::CycleTab %W -1; break }
bind TNotebook <Control-Tab> { ttk::notebook::CycleTab %W 1; break }
bind TNotebook <Control-Shift-Tab> { ttk::notebook::CycleTab %W -1; break }
catch {
bind TNotebook <Control-ISO_Left_Tab> { ttk::notebook::CycleTab %W -1; break }
}
@@ -43,7 +43,7 @@ proc ttk::notebook::ActivateTab {w tab} {
}
# Press $nb $x $y --
# ButtonPress-1 binding for notebook widgets.
# Button-1 binding for notebook widgets.
# Activate the tab under the mouse cursor, if any.
#
proc ttk::notebook::Press {w x y} {
@@ -70,7 +70,7 @@ proc ttk::notebook::CycleTab {w dir} {
}
# MnemonicTab $nb $key --
# Scan all tabs in the specified notebook for one with the
# Scan all tabs in the specified notebook for one with the
# specified mnemonic. If found, returns path name of tab;
# otherwise returns ""
#
@@ -94,8 +94,8 @@ proc ttk::notebook::MnemonicTab {nb key} {
# Enable keyboard traversal for a notebook widget
# by adding bindings to the containing toplevel window.
#
# TLNotebooks($top) keeps track of the list of all traversal-enabled
# notebooks contained in the toplevel
# TLNotebooks($top) keeps track of the list of all traversal-enabled
# notebooks contained in the toplevel
#
proc ttk::notebook::enableTraversal {nb} {
variable TLNotebooks
@@ -105,18 +105,18 @@ proc ttk::notebook::enableTraversal {nb} {
if {![info exists TLNotebooks($top)]} {
# Augment $top bindings:
#
bind $top <Control-Key-Next> {+ttk::notebook::TLCycleTab %W 1}
bind $top <Control-Key-Prior> {+ttk::notebook::TLCycleTab %W -1}
bind $top <Control-Key-Tab> {+ttk::notebook::TLCycleTab %W 1}
bind $top <Control-Shift-Key-Tab> {+ttk::notebook::TLCycleTab %W -1}
bind $top <Control-Next> {+ttk::notebook::TLCycleTab %W 1}
bind $top <Control-Prior> {+ttk::notebook::TLCycleTab %W -1}
bind $top <Control-Tab> {+ttk::notebook::TLCycleTab %W 1}
bind $top <Control-Shift-Tab> {+ttk::notebook::TLCycleTab %W -1}
catch {
bind $top <Control-Key-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1}
bind $top <Control-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1}
}
if {[tk windowingsystem] eq "aqua"} {
bind $top <Option-KeyPress> \
bind $top <Option-Key> \
+[list ttk::notebook::MnemonicActivation $top %K]
} else {
bind $top <Alt-KeyPress> \
bind $top <Alt-Key> \
+[list ttk::notebook::MnemonicActivation $top %K]
}
bind $top <Destroy> {+ttk::notebook::TLCleanup %W}
@@ -145,7 +145,7 @@ proc ttk::notebook::Cleanup {nb} {
}
}
# EnclosingNotebook $w --
# EnclosingNotebook $w --
# Return the nearest traversal-enabled notebook widget
# that contains $w.
#
@@ -171,7 +171,7 @@ proc ttk::notebook::EnclosingNotebook {w} {
# TLCycleTab --
# toplevel binding procedure for Control-Tab / Control-Shift-Tab
# Select the next/previous tab in the nearest ancestor notebook.
# Select the next/previous tab in the nearest ancestor notebook.
#
proc ttk::notebook::TLCycleTab {w dir} {
set nb [EnclosingNotebook $w]
@@ -182,7 +182,7 @@ proc ttk::notebook::TLCycleTab {w dir} {
}
# MnemonicActivation $nb $key --
# Alt-KeyPress binding procedure for mnemonic activation.
# Alt-Key binding procedure for mnemonic activation.
# Scan all notebooks in specified toplevel for a tab with the
# the specified mnemonic. If found, activate it and return TCL_BREAK.
#

View File

@@ -15,7 +15,7 @@ namespace eval ttk::panedwindow {
## Bindings:
#
bind TPanedwindow <ButtonPress-1> { ttk::panedwindow::Press %W %x %y }
bind TPanedwindow <Button-1> { ttk::panedwindow::Press %W %x %y }
bind TPanedwindow <B1-Motion> { ttk::panedwindow::Drag %W %x %y }
bind TPanedwindow <ButtonRelease-1> { ttk::panedwindow::Release %W %x %y }
@@ -62,13 +62,22 @@ proc ttk::panedwindow::Release {w x y} {
#
proc ttk::panedwindow::ResetCursor {w} {
variable State
ttk::saveCursor $w State(userConfCursor) \
[list [ttk::cursor hresize] [ttk::cursor vresize]]
if {!$State(pressed)} {
ttk::setCursor $w {}
ttk::setCursor $w $State(userConfCursor)
}
}
proc ttk::panedwindow::SetCursor {w x y} {
set cursor ""
variable State
ttk::saveCursor $w State(userConfCursor) \
[list [ttk::cursor hresize] [ttk::cursor vresize]]
set cursor $State(userConfCursor)
if {[llength [$w identify $x $y]]} {
# Assume we're over a sash.
switch -- [$w cget -orient] {

View File

@@ -9,15 +9,15 @@ namespace eval ttk::scale {
}
}
bind TScale <ButtonPress-1> { ttk::scale::Press %W %x %y }
bind TScale <Button-1> { ttk::scale::Press %W %x %y }
bind TScale <B1-Motion> { ttk::scale::Drag %W %x %y }
bind TScale <ButtonRelease-1> { ttk::scale::Release %W %x %y }
bind TScale <ButtonPress-2> { ttk::scale::Jump %W %x %y }
bind TScale <Button-2> { ttk::scale::Jump %W %x %y }
bind TScale <B2-Motion> { ttk::scale::Drag %W %x %y }
bind TScale <ButtonRelease-2> { ttk::scale::Release %W %x %y }
bind TScale <ButtonPress-3> { ttk::scale::Jump %W %x %y }
bind TScale <Button-3> { ttk::scale::Jump %W %x %y }
bind TScale <B3-Motion> { ttk::scale::Drag %W %x %y }
bind TScale <ButtonRelease-3> { ttk::scale::Release %W %x %y }
@@ -52,7 +52,7 @@ proc ttk::scale::Press {w x y} {
}
}
# scale::Jump -- ButtonPress-2/3 binding for scale acts like
# scale::Jump -- Button-2/3 binding for scale acts like
# Press except that clicking in the trough jumps to the
# clicked position.
proc ttk::scale::Jump {w x y} {

View File

@@ -9,14 +9,35 @@ namespace eval ttk::scrollbar {
# State(first) -- value of -first at start of drag.
}
bind TScrollbar <ButtonPress-1> { ttk::scrollbar::Press %W %x %y }
bind TScrollbar <Button-1> { ttk::scrollbar::Press %W %x %y }
bind TScrollbar <B1-Motion> { ttk::scrollbar::Drag %W %x %y }
bind TScrollbar <ButtonRelease-1> { ttk::scrollbar::Release %W %x %y }
bind TScrollbar <ButtonPress-2> { ttk::scrollbar::Jump %W %x %y }
bind TScrollbar <Button-2> { ttk::scrollbar::Jump %W %x %y }
bind TScrollbar <B2-Motion> { ttk::scrollbar::Drag %W %x %y }
bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y }
# Redirect scrollwheel bindings to the scrollbar widget
#
# The shift-bindings scroll left/right (not up/down)
# if a widget has both possibilities
set eventList [list <MouseWheel> <Shift-MouseWheel>]
switch [tk windowingsystem] {
aqua {
lappend eventList <Option-MouseWheel> <Shift-Option-MouseWheel>
}
x11 {
lappend eventList <Button-4> <Button-5> \
<Shift-Button-4> <Shift-Button-5>
# For tk 8.7, the event list will be extended by
# <Button-6> <Button-7>
}
}
foreach event $eventList {
bind TScrollbar $event [bind Scrollbar $event]
}
unset eventList event
proc ttk::scrollbar::Scroll {w n units} {
set cmd [$w cget -command]
if {$cmd ne ""} {
@@ -38,7 +59,7 @@ proc ttk::scrollbar::Press {w x y} {
set State(yPress) $y
switch -glob -- [$w identify $x $y] {
*uparrow -
*uparrow -
*leftarrow {
ttk::Repeatedly Scroll $w -1 units
}
@@ -46,6 +67,7 @@ proc ttk::scrollbar::Press {w x y} {
*rightarrow {
ttk::Repeatedly Scroll $w 1 units
}
*grip -
*thumb {
set State(first) [lindex [$w get] 0]
}
@@ -68,7 +90,7 @@ proc ttk::scrollbar::Press {w x y} {
proc ttk::scrollbar::Drag {w x y} {
variable State
if {![info exists State(first)]} {
# Initial buttonpress was not on the thumb,
# Initial buttonpress was not on the thumb,
# or something screwy has happened. In either case, ignore:
return;
}
@@ -83,7 +105,7 @@ proc ttk::scrollbar::Release {w x y} {
ttk::CancelRepeat
}
# scrollbar::Jump -- ButtonPress-2 binding for scrollbars.
# scrollbar::Jump -- Button-2 binding for scrollbars.
# Behaves exactly like scrollbar::Press, except that
# clicking in the trough jumps to the the selected position.
#
@@ -91,6 +113,7 @@ proc ttk::scrollbar::Jump {w x y} {
variable State
switch -glob -- [$w identify $x $y] {
*grip -
*thumb -
*trough {
set State(first) [$w fraction $x $y]

View File

@@ -32,7 +32,7 @@ namespace eval ttk::sizegrip {
}
}
bind TSizegrip <ButtonPress-1> { ttk::sizegrip::Press %W %X %Y }
bind TSizegrip <Button-1> { ttk::sizegrip::Press %W %X %Y }
bind TSizegrip <B1-Motion> { ttk::sizegrip::Drag %W %X %Y }
bind TSizegrip <ButtonRelease-1> { ttk::sizegrip::Release %W %X %Y }

View File

@@ -12,13 +12,13 @@ namespace eval ttk::spinbox { }
ttk::copyBindings TEntry TSpinbox
bind TSpinbox <Motion> { ttk::spinbox::Motion %W %x %y }
bind TSpinbox <ButtonPress-1> { ttk::spinbox::Press %W %x %y }
bind TSpinbox <Button-1> { ttk::spinbox::Press %W %x %y }
bind TSpinbox <ButtonRelease-1> { ttk::spinbox::Release %W }
bind TSpinbox <Double-Button-1> { ttk::spinbox::DoubleClick %W %x %y }
bind TSpinbox <Triple-Button-1> {} ;# disable TEntry triple-click
bind TSpinbox <KeyPress-Up> { event generate %W <<Increment>> }
bind TSpinbox <KeyPress-Down> { event generate %W <<Decrement>> }
bind TSpinbox <Up> { event generate %W <<Increment>> }
bind TSpinbox <Down> { event generate %W <<Decrement>> }
bind TSpinbox <<Increment>> { ttk::spinbox::Spin %W +1 }
bind TSpinbox <<Decrement>> { ttk::spinbox::Spin %W -1 }
@@ -29,12 +29,14 @@ ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W]
# Sets cursor.
#
proc ttk::spinbox::Motion {w x y} {
variable State
ttk::saveCursor $w State(userConfCursor) [ttk::cursor text]
if { [$w identify $x $y] eq "textarea"
&& [$w instate {!readonly !disabled}]
&& [$w instate {!readonly !disabled}]
} {
ttk::setCursor $w text
} else {
ttk::setCursor $w ""
ttk::setCursor $w $State(userConfCursor)
}
}
@@ -44,16 +46,16 @@ proc ttk::spinbox::Press {w x y} {
if {[$w instate disabled]} { return }
focus $w
switch -glob -- [$w identify $x $y] {
*textarea { ttk::entry::Press $w $x }
*textarea { ttk::entry::Press $w $x }
*rightarrow -
*uparrow { ttk::Repeatedly event generate $w <<Increment>> }
*uparrow { ttk::Repeatedly event generate $w <<Increment>> }
*leftarrow -
*downarrow { ttk::Repeatedly event generate $w <<Decrement>> }
*downarrow { ttk::Repeatedly event generate $w <<Decrement>> }
*spinbutton {
if {$y * 2 >= [winfo height $w]} {
set event <<Decrement>>
set event <<Decrement>>
} else {
set event <<Increment>>
set event <<Increment>>
}
ttk::Repeatedly event generate $w $event
}
@@ -67,7 +69,7 @@ proc ttk::spinbox::DoubleClick {w x y} {
if {[$w instate disabled]} { return }
switch -glob -- [$w identify $x $y] {
*textarea { SelectAll $w }
*textarea { SelectAll $w }
* { Press $w $x $y }
}
}
@@ -133,16 +135,31 @@ proc ttk::spinbox::Adjust {w v min max} {
# -from, -to, and -increment.
#
proc ttk::spinbox::Spin {w dir} {
variable State
if {[$w instate disabled]} { return }
set nvalues [llength [set values [$w cget -values]]]
set value [$w get]
if {$nvalues} {
set current [lsearch -exact $values $value]
set index [Adjust $w [expr {$current + $dir}] 0 [expr {$nvalues - 1}]]
$w set [lindex $values $index]
if {![info exists State($w,values.length)]} {
set State($w,values.index) -1
set State($w,values.last) {}
}
set State($w,values) [$w cget -values]
set State($w,values.length) [llength $State($w,values)]
if {$State($w,values.length) > 0} {
set value [$w get]
set current $State($w,values.index)
if {$value ne $State($w,values.last)} {
set current [lsearch -exact $State($w,values) $value]
if {$current < 0} {set current -1}
}
set State($w,values.index) [Adjust $w [expr {$current + $dir}] 0 \
[expr {$State($w,values.length) - 1}]]
set State($w,values.last) [lindex $State($w,values) $State($w,values.index)]
$w set $State($w,values.last)
} else {
if {[catch {
set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}]
if {[catch {
set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}]
}]} {
set v [$w cget -from]
}
@@ -160,7 +177,7 @@ proc ttk::spinbox::FormatValue {w val} {
if {$fmt eq ""} {
# Try to guess a suitable -format based on -increment.
set delta [expr {abs([$w cget -increment])}]
if {0 < $delta && $delta < 1} {
if {0 < $delta && $delta < 1} {
# NB: This guesses wrong if -increment has more than 1
# significant digit itself, e.g., -increment 0.25
set nsd [expr {int(ceil(-log10($delta)))}]

View File

@@ -28,25 +28,25 @@ namespace eval ttk::treeview {
bind Treeview <Motion> { ttk::treeview::Motion %W %x %y }
bind Treeview <B1-Leave> { #nothing }
bind Treeview <Leave> { ttk::treeview::ActivateHeading {} {}}
bind Treeview <ButtonPress-1> { ttk::treeview::Press %W %x %y }
bind Treeview <Double-ButtonPress-1> { ttk::treeview::DoubleClick %W %x %y }
bind Treeview <Button-1> { ttk::treeview::Press %W %x %y }
bind Treeview <Double-Button-1> { ttk::treeview::DoubleClick %W %x %y }
bind Treeview <ButtonRelease-1> { ttk::treeview::Release %W %x %y }
bind Treeview <B1-Motion> { ttk::treeview::Drag %W %x %y }
bind Treeview <KeyPress-Up> { ttk::treeview::Keynav %W up }
bind Treeview <KeyPress-Down> { ttk::treeview::Keynav %W down }
bind Treeview <KeyPress-Right> { ttk::treeview::Keynav %W right }
bind Treeview <KeyPress-Left> { ttk::treeview::Keynav %W left }
bind Treeview <KeyPress-Prior> { %W yview scroll -1 pages }
bind Treeview <KeyPress-Next> { %W yview scroll 1 pages }
bind Treeview <KeyPress-Return> { ttk::treeview::ToggleFocus %W }
bind Treeview <KeyPress-space> { ttk::treeview::ToggleFocus %W }
bind Treeview <Up> { ttk::treeview::Keynav %W up }
bind Treeview <Down> { ttk::treeview::Keynav %W down }
bind Treeview <Right> { ttk::treeview::Keynav %W right }
bind Treeview <Left> { ttk::treeview::Keynav %W left }
bind Treeview <Prior> { %W yview scroll -1 pages }
bind Treeview <Next> { %W yview scroll 1 pages }
bind Treeview <Return> { ttk::treeview::ToggleFocus %W }
bind Treeview <space> { ttk::treeview::ToggleFocus %W }
bind Treeview <Shift-ButtonPress-1> \
bind Treeview <Shift-Button-1> \
{ ttk::treeview::Select %W %x %y extend }
bind Treeview <<ToggleSelection>> \
{ ttk::treeview::Select %W %x %y toggle }
ttk::copyBindings TtkScrollable Treeview
ttk::copyBindings TtkScrollable Treeview
### Binding procedures.
#
@@ -102,7 +102,11 @@ proc ttk::treeview::Keynav {w dir} {
# Sets cursor, active element ...
#
proc ttk::treeview::Motion {w x y} {
set cursor {}
variable State
ttk::saveCursor $w State(userConfCursor) [ttk::cursor hresize]
set cursor $State(userConfCursor)
set activeHeading {}
switch -- [$w identify region $x $y] {
@@ -127,7 +131,7 @@ proc ttk::treeview::ActivateHeading {w heading} {
# triggers a <Leave> event. A proc checking if the display column
# $State(activeHeading) is really still present or not could be
# written but it would need to check several special cases:
# a. -displaycolumns "#all" or being an explicit columns list
# a. -displaycolumns "#all" or being an explicit columns list
# b. column #0 display is not governed by the -displaycolumn
# list but by the value of the -show option
# --> Let's rather catch the following line.
@@ -151,7 +155,7 @@ proc ttk::treeview::Select {w x y op} {
}
}
## DoubleClick -- Double-ButtonPress-1 binding.
## DoubleClick -- Double-Button-1 binding.
#
proc ttk::treeview::DoubleClick {w x y} {
if {[set row [$w identify row $x $y]] ne ""} {
@@ -161,7 +165,7 @@ proc ttk::treeview::DoubleClick {w x y} {
}
}
## Press -- ButtonPress binding.
## Press -- Button binding.
#
proc ttk::treeview::Press {w x y} {
focus $w
@@ -261,9 +265,9 @@ proc ttk::treeview::SelectOp {w item op} {
## -selectmode none:
#
proc ttk::treeview::select.choose.none {w item} { $w focus $item }
proc ttk::treeview::select.toggle.none {w item} { $w focus $item }
proc ttk::treeview::select.extend.none {w item} { $w focus $item }
proc ttk::treeview::select.choose.none {w item} { $w focus $item; $w see $item }
proc ttk::treeview::select.toggle.none {w item} { $w focus $item; $w see $item }
proc ttk::treeview::select.extend.none {w item} { $w focus $item; $w see $item }
## -selectmode browse:
#

View File

@@ -12,9 +12,9 @@ namespace eval ::ttk {
}
}
source [file join $::ttk::library fonts.tcl]
source [file join $::ttk::library cursors.tcl]
source [file join $::ttk::library utils.tcl]
source -encoding utf-8 [file join $::ttk::library fonts.tcl]
source -encoding utf-8 [file join $::ttk::library cursors.tcl]
source -encoding utf-8 [file join $::ttk::library utils.tcl]
## ttk::deprecated $old $new --
# Define $old command as a deprecated alias for $new command
@@ -97,18 +97,18 @@ proc ::ttk::setTheme {theme} {
### Load widget bindings.
#
source [file join $::ttk::library button.tcl]
source [file join $::ttk::library menubutton.tcl]
source [file join $::ttk::library scrollbar.tcl]
source [file join $::ttk::library scale.tcl]
source [file join $::ttk::library progress.tcl]
source [file join $::ttk::library notebook.tcl]
source [file join $::ttk::library panedwindow.tcl]
source [file join $::ttk::library entry.tcl]
source [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl
source [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl
source [file join $::ttk::library treeview.tcl]
source [file join $::ttk::library sizegrip.tcl]
source -encoding utf-8 [file join $::ttk::library button.tcl]
source -encoding utf-8 [file join $::ttk::library menubutton.tcl]
source -encoding utf-8 [file join $::ttk::library scrollbar.tcl]
source -encoding utf-8 [file join $::ttk::library scale.tcl]
source -encoding utf-8 [file join $::ttk::library progress.tcl]
source -encoding utf-8 [file join $::ttk::library notebook.tcl]
source -encoding utf-8 [file join $::ttk::library panedwindow.tcl]
source -encoding utf-8 [file join $::ttk::library entry.tcl]
source -encoding utf-8 [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl
source -encoding utf-8 [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl
source -encoding utf-8 [file join $::ttk::library treeview.tcl]
source -encoding utf-8 [file join $::ttk::library sizegrip.tcl]
## Label and Labelframe bindings:
# (not enough to justify their own file...)
@@ -122,7 +122,7 @@ proc ttk::LoadThemes {} {
variable library
# "default" always present:
uplevel #0 [list source [file join $library defaults.tcl]]
uplevel #0 [list source -encoding utf-8 [file join $library defaults.tcl]]
set builtinThemes [style theme names]
foreach {theme scripts} {
@@ -135,7 +135,7 @@ proc ttk::LoadThemes {} {
} {
if {[lsearch -exact $builtinThemes $theme] >= 0} {
foreach script $scripts {
uplevel #0 [list source [file join $library $script]]
uplevel #0 [list source -encoding utf-8 [file join $library $script]]
}
}
}

View File

@@ -58,7 +58,7 @@ proc ttk::traverseTo {w} {
}
## ttk::clickToFocus $w --
# Utility routine, used in <ButtonPress-1> bindings --
# Utility routine, used in <Button-1> bindings --
# Assign keyboard focus to the specified widget if -takefocus is enabled.
#
proc ttk::clickToFocus {w} {
@@ -278,9 +278,6 @@ proc ttk::copyBindings {from to} {
# On OSX, Tk generates sensible values for the %D field in <MouseWheel> events.
#
# On Windows, %D must be scaled by a factor of 120.
# In addition, Tk redirects mousewheel events to the window with
# keyboard focus instead of sending them to the window under the pointer.
# We do not attempt to fix that here, see also TIP#171.
#
# OSX conventionally uses Shift+MouseWheel for horizontal scrolling,
# and Option+MouseWheel for accelerated scrolling.
@@ -301,14 +298,14 @@ proc ttk::copyBindings {from to} {
proc ttk::bindMouseWheel {bindtag callback} {
if {[tk windowingsystem] eq "x11"} {
bind $bindtag <ButtonPress-4> "$callback -1"
bind $bindtag <ButtonPress-5> "$callback +1"
bind $bindtag <Button-4> "$callback -1"
bind $bindtag <Button-5> "$callback +1"
}
if {[tk windowingsystem] eq "aqua"} {
bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ]
bind $bindtag <Option-MouseWheel> [append callback { [expr {-10 *(%D)}]} ]
bind $bindtag <MouseWheel> "$callback \[expr {-%D}\]"
bind $bindtag <Option-MouseWheel> "$callback \[expr {-10*%D}\]"
} else {
bind $bindtag <MouseWheel> [append callback { [expr {-(%D / 120)}]}]
bind $bindtag <MouseWheel> "$callback \[expr {-%D/120}\]"
}
}
@@ -321,10 +318,10 @@ proc ttk::bindMouseWheel {bindtag callback} {
#
if {[tk windowingsystem] eq "x11"} {
bind TtkScrollable <ButtonPress-4> { %W yview scroll -5 units }
bind TtkScrollable <ButtonPress-5> { %W yview scroll 5 units }
bind TtkScrollable <Shift-ButtonPress-4> { %W xview scroll -5 units }
bind TtkScrollable <Shift-ButtonPress-5> { %W xview scroll 5 units }
bind TtkScrollable <Button-4> { %W yview scroll -5 units }
bind TtkScrollable <Button-5> { %W yview scroll 5 units }
bind TtkScrollable <Shift-Button-4> { %W xview scroll -5 units }
bind TtkScrollable <Shift-Button-5> { %W xview scroll 5 units }
}
if {[tk windowingsystem] eq "aqua"} {
bind TtkScrollable <MouseWheel> \

View File

@@ -3,7 +3,7 @@
#
# The Vista theme can only be defined on Windows Vista and above. The theme
# is created in C due to the need to assign a theme-enabled function for
# is created in C due to the need to assign a theme-enabled function for
# detecting when themeing is disabled. On systems that cannot support the
# Vista theme, there will be no such theme created and we must not
# evaluate this script.
@@ -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
@@ -151,7 +151,7 @@ namespace eval ttk::theme::vista {
-selectforeground [list !focus SystemWindowText] \
;
# SCROLLBAR elements (Vista includes a state for 'hover')
ttk::style element create Vertical.Scrollbar.uparrow vsapi \
SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1} \
@@ -196,14 +196,14 @@ namespace eval ttk::theme::vista {
Vertical.Progressbar.pbar -side bottom -sticky we
}
}
# Scale
ttk::style element create Horizontal.Scale.slider vsapi \
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,17 +213,17 @@ 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 {}
}
}
}
# Treeview
ttk::style configure Item -padding {4 0 0 0}
package provide ttk::theme::vista 1.0
}
}

View File

@@ -28,13 +28,6 @@ namespace eval ttk::theme::xpnative {
ttk::style map TNotebook.Tab \
-expand [list selected {2 2 2 2}]
# Treeview:
ttk::style configure Heading -font TkHeadingFont
ttk::style configure Treeview -background SystemWindow
ttk::style map Treeview \
-background [list selected SystemHighlight] \
-foreground [list selected SystemHighlightText] ;
ttk::style configure TLabelframe.Label -foreground "#0046d5"
# OR: -padding {3 3 3 6}, which some apps seem to use.