Update to tk 8.5.19

This commit is contained in:
Zachary Ware
2017-11-24 17:53:51 -06:00
parent 27e7dfc7da
commit c67b328f06
325 changed files with 12511 additions and 12047 deletions

View File

@@ -373,12 +373,18 @@ proc ::tk::EntryMouseSelect {w x} {
}
}
word {
if {$cur < [$w index anchor]} {
if {$cur < $anchor} {
set before [tcl_wordBreakBefore [$w get] $cur]
set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]]
} else {
} elseif {$cur > $anchor} {
set before [tcl_wordBreakBefore [$w get] $anchor]
set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]]
} else {
if {[$w index @$Priv(pressX)] < $anchor} {
incr anchor -1
}
set before [tcl_wordBreakBefore [$w get] $anchor]
set after [tcl_wordBreakAfter [$w get] $anchor]
}
if {$before < 0} {
set before 0

View File

@@ -118,7 +118,7 @@ bind Listbox <Control-Home> {
%W see 0
%W selection clear 0 end
%W selection set 0
event generate %W <<ListboxSelect>>
tk::FireListboxSelectEvent %W
}
bind Listbox <Shift-Control-Home> {
tk::ListboxDataExtend %W 0
@@ -128,7 +128,7 @@ bind Listbox <Control-End> {
%W see end
%W selection clear 0 end
%W selection set end
event generate %W <<ListboxSelect>>
tk::FireListboxSelectEvent %W
}
bind Listbox <Shift-Control-End> {
tk::ListboxDataExtend %W [%W index end]
@@ -163,7 +163,7 @@ bind Listbox <Control-slash> {
bind Listbox <Control-backslash> {
if {[%W cget -selectmode] ne "browse"} {
%W selection clear 0 end
event generate %W <<ListboxSelect>>
tk::FireListboxSelectEvent %W
}
}
@@ -243,7 +243,7 @@ proc ::tk::ListboxBeginSelect {w el {focus 1}} {
set Priv(listboxSelection) {}
set Priv(listboxPrev) $el
}
event generate $w <<ListboxSelect>>
tk::FireListboxSelectEvent $w
# check existence as ListboxSelect may destroy us
if {$focus && [winfo exists $w] && [$w cget -state] eq "normal"} {
focus $w
@@ -271,7 +271,7 @@ proc ::tk::ListboxMotion {w el} {
$w selection clear 0 end
$w selection set $el
set Priv(listboxPrev) $el
event generate $w <<ListboxSelect>>
tk::FireListboxSelectEvent $w
}
extended {
set i $Priv(listboxPrev)
@@ -302,7 +302,7 @@ proc ::tk::ListboxMotion {w el} {
incr i -1
}
set Priv(listboxPrev) $el
event generate $w <<ListboxSelect>>
tk::FireListboxSelectEvent $w
}
}
}
@@ -353,7 +353,7 @@ proc ::tk::ListboxBeginToggle {w el} {
} else {
$w selection set $el
}
event generate $w <<ListboxSelect>>
tk::FireListboxSelectEvent $w
}
}
@@ -405,7 +405,7 @@ proc ::tk::ListboxUpDown {w amount} {
browse {
$w selection clear 0 end
$w selection set active
event generate $w <<ListboxSelect>>
tk::FireListboxSelectEvent $w
}
extended {
$w selection clear 0 end
@@ -413,7 +413,7 @@ proc ::tk::ListboxUpDown {w amount} {
$w selection anchor active
set Priv(listboxPrev) [$w index active]
set Priv(listboxSelection) {}
event generate $w <<ListboxSelect>>
tk::FireListboxSelectEvent $w
}
}
}
@@ -501,7 +501,7 @@ proc ::tk::ListboxCancel w {
}
incr first
}
event generate $w <<ListboxSelect>>
tk::FireListboxSelectEvent $w
}
# ::tk::ListboxSelectAll
@@ -521,5 +521,19 @@ proc ::tk::ListboxSelectAll w {
} else {
$w selection set 0 end
}
event generate $w <<ListboxSelect>>
tk::FireListboxSelectEvent $w
}
# ::tk::FireListboxSelectEvent
#
# Fire the <<ListboxSelect>> event if the listbox is not in disabled
# state.
#
# Arguments:
# w - The listbox widget.
proc ::tk::FireListboxSelectEvent w {
if {[$w cget -state] eq "normal"} {
event generate $w <<ListboxSelect>>
}
}

View File

@@ -312,6 +312,9 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
set x [expr {[winfo rootx $w] - [winfo reqwidth $menu]}]
set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}]
set entry [MenuFindName $menu [$w cget -text]]
if {$entry eq ""} {
set entry 0
}
if {[$w cget -indicatoron]} {
if {$entry == [$menu index last]} {
incr y [expr {-([$menu yposition $entry] \
@@ -332,6 +335,9 @@ proc ::tk::MbPost {w {x {}} {y {}}} {
set x [expr {[winfo rootx $w] + [winfo width $w]}]
set y [expr {(2 * [winfo rooty $w] + [winfo height $w]) / 2}]
set entry [MenuFindName $menu [$w cget -text]]
if {$entry eq ""} {
set entry 0
}
if {[$w cget -indicatoron]} {
if {$entry == [$menu index last]} {
incr y [expr {-([$menu yposition $entry] \
@@ -1031,7 +1037,7 @@ proc ::tk::MenuFind {w char} {
proc ::tk::TraverseToMenu {w char} {
variable ::tk::Priv
if {$char eq ""} {
if {![winfo exists $w] || $char eq ""} {
return
}
while {[winfo class $w] eq "Menu"} {
@@ -1344,6 +1350,7 @@ proc ::tk_popup {menu x y {entry {}}} {
tk::SaveGrabInfo $menu
grab -global $menu
set Priv(popup) $menu
set Priv(window) $menu
set Priv(menuActivated) 1
tk_menuSetFocus $menu
}

View File

@@ -223,7 +223,13 @@ proc ::tk::ScaleIncrement {w dir big repeat} {
set inc [$w cget -resolution]
}
if {([$w cget -from] > [$w cget -to]) ^ ($dir eq "up")} {
set inc [expr {-$inc}]
if {$inc > 0} {
set inc [expr {-$inc}]
}
} else {
if {$inc < 0} {
set inc [expr {-$inc}]
}
}
$w set [expr {[$w get] + $inc}]

View File

@@ -15,7 +15,7 @@
#-------------------------------------------------------------------------
# Standard Motif bindings:
if {[tk windowingsystem] eq "x11"} {
if {[tk windowingsystem] eq "x11" || [tk windowingsystem] eq "aqua"} {
bind Scrollbar <Enter> {
if {$tk_strictMotif} {
@@ -141,6 +141,13 @@ if {[tk windowingsystem] eq "aqua"} {
bind Scrollbar <Shift-Option-MouseWheel> {
tk::ScrollByUnits %W h [expr {-10 * (%D)}]
}
} else {
bind Scrollbar <MouseWheel> {
tk::ScrollByUnits %W v [expr {- (%D /120 ) * 4}]
}
bind Scrollbar <Shift-MouseWheel> {
tk::ScrollByUnits %W h [expr {- (%D /120 ) * 4}]
}
}
# tk::ScrollButtonDown --
# This procedure is invoked when a button is pressed in a scrollbar.

View File

@@ -85,7 +85,16 @@ bind Text <ButtonRelease-1> {
}
bind Text <Control-1> {
%W mark set insert @%x,%y
# An operation that moves the insert mark without making it
# one end of the selection must insert an autoseparator
if {[%W cget -autoseparators]} {
%W edit separator
}
}
# stop an accidental double click triggering <Double-Button-1>
bind Text <Double-Control-1> { # nothing }
# stop an accidental movement triggering <B1-Motion>
bind Text <Control-B1-Motion> { # nothing }
bind Text <Left> {
tk::TextSetCursor %W insert-1displayindices
}
@@ -241,6 +250,11 @@ bind Text <Control-slash> {
}
bind Text <Control-backslash> {
%W tag remove sel 1.0 end
# An operation that clears the selection must insert an autoseparator,
# because the selection operation may have moved the insert mark
if {[%W cget -autoseparators]} {
%W edit separator
}
}
bind Text <<Cut>> {
tk_textCut %W
@@ -252,7 +266,15 @@ bind Text <<Paste>> {
tk_textPaste %W
}
bind Text <<Clear>> {
# Make <<Clear>> an atomic operation on the Undo stack,
# i.e. separate it from other delete operations on either side
if {[%W cget -autoseparators]} {
%W edit separator
}
catch {%W delete sel.first sel.last}
if {[%W cget -autoseparators]} {
%W edit separator
}
}
bind Text <<PasteSelection>> {
if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)]
@@ -340,7 +362,16 @@ bind Text <Control-t> {
}
bind Text <<Undo>> {
# An Undo operation may remove the separator at the top of the Undo stack.
# Then the item at the top of the stack gets merged with the subsequent changes.
# Place separators before and after Undo to prevent this.
if {[%W cget -autoseparators]} {
%W edit separator
}
catch { %W edit undo }
if {[%W cget -autoseparators]} {
%W edit separator
}
}
bind Text <<Redo>> {
@@ -1054,9 +1085,18 @@ proc ::tk_textCopy w {
proc ::tk_textCut w {
if {![catch {set data [$w get sel.first sel.last]}]} {
# make <<Cut>> an atomic operation on the Undo stack,
# i.e. separate it from other delete operations on either side
set oldSeparator [$w cget -autoseparators]
if {$oldSeparator} {
$w edit separator
}
clipboard clear -displayof $w
clipboard append -displayof $w $data
$w delete sel.first sel.last
if {$oldSeparator} {
$w edit separator
}
}
}

View File

@@ -15,7 +15,7 @@ package require Tcl 8.5 ;# Guard against [source] in an 8.4- interp before
# Insist on running with compatible version of Tcl
package require Tcl 8.5.0
# Verify that we have Tk binary and script components from the same release
package require -exact Tk 8.5.15
package require -exact Tk 8.5.19
# Create a ::tk namespace
namespace eval ::tk {
@@ -308,7 +308,6 @@ proc ::tk::EventMotifBindings {n1 dummy dummy} {
event $op <<Cut>> <Control-Key-w>
event $op <<Copy>> <Meta-Key-w>
event $op <<Paste>> <Control-Key-y>
event $op <<Undo>> <Control-underscore>
}
#----------------------------------------------------------------------

View File

@@ -1896,6 +1896,10 @@ proc ::tk::dialog::file::GlobFiltered {dir type {overrideFilter 0}} {
if {$f eq "." || $f eq ".."} {
continue
}
# See ticket [1641721], $f might be a link pointing to a dir
if {$type != "d" && [file isdir [file join $dir $f]]} {
continue
}
lappend result $f
}
}

View File

@@ -14,7 +14,7 @@ namespace eval ttk {
variable State
set State(x) 0
set State(selectMode) char
set State(selectMode) none
set State(anchor) 0
set State(scanX) 0
set State(scanIndex) 0
@@ -74,9 +74,9 @@ bind TEntry <Double-ButtonPress-1> { ttk::entry::Select %W %x word }
bind TEntry <Triple-ButtonPress-1> { ttk::entry::Select %W %x line }
bind TEntry <B1-Motion> { ttk::entry::Drag %W %x }
bind TEntry <B1-Leave> { ttk::Repeatedly ttk::entry::AutoScroll %W }
bind TEntry <B1-Enter> { ttk::CancelRepeat }
bind TEntry <ButtonRelease-1> { ttk::CancelRepeat }
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 <Control-ButtonPress-1> {
%W instate {!readonly !disabled} { %W icursor @%x ; focus %W }
@@ -404,14 +404,40 @@ proc ttk::entry::DragTo {w x} {
char { CharSelect $w $State(anchor) $cur }
word { WordSelect $w $State(anchor) $cur }
line { LineSelect $w $State(anchor) $cur }
none { # no-op }
}
}
## <B1-Leave> binding:
# Begin autoscroll.
#
proc ttk::entry::DragOut {w mode} {
variable State
if {$State(selectMode) ne "none" && $mode eq "NotifyNormal"} {
ttk::Repeatedly ttk::entry::AutoScroll $w
}
}
## <B1-Enter> binding
# Suspend autoscroll.
#
proc ttk::entry::DragIn {w} {
ttk::CancelRepeat
}
## <ButtonRelease-1> binding
#
proc ttk::entry::Release {w} {
variable State
set State(selectMode) none
ttk::CancelRepeat ;# suspend autoscroll
}
## AutoScroll
# Called repeatedly when the mouse is outside an entry window
# with Button 1 down. Scroll the window left or right,
# depending on where the mouse is, and extend the selection
# according to the current selection mode.
# depending on where the mouse left the window, and extend
# the selection according to the current selection mode.
#
# TODO: AutoScroll should repeat faster (50ms) than normal autorepeat.
# TODO: Need a way for Repeat scripts to cancel themselves.

View File

@@ -60,7 +60,7 @@
namespace eval ttk {
set tip145 [catch {font create TkDefaultFont}]
variable tip145 [catch {font create TkDefaultFont}]
catch {font create TkTextFont}
catch {font create TkHeadingFont}
catch {font create TkCaptionFont}