summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2020-08-20 18:17:03 (GMT)
committerfvogel <fvogelnew1@free.fr>2020-08-20 18:17:03 (GMT)
commitf9b9aac725a0a123d6e988f9e6bb557b86ba49af (patch)
treea999b14f231dae7b36f8f2983ccad57806a60989 /library
parente9c4f388b5b315e47cb30f70d0fc1b93afe2742e (diff)
parent22a9bc4bd75e5479537768884f7ead683e5e51d9 (diff)
downloadtk-f9b9aac725a0a123d6e988f9e6bb557b86ba49af.zip
tk-f9b9aac725a0a123d6e988f9e6bb557b86ba49af.tar.gz
tk-f9b9aac725a0a123d6e988f9e6bb557b86ba49af.tar.bz2
merge trunk
Diffstat (limited to 'library')
-rw-r--r--library/bgerror.tcl12
-rw-r--r--library/console.tcl4
-rw-r--r--library/demos/dialog1.tcl14
-rw-r--r--library/demos/fontchoose.tcl6
-rw-r--r--library/entry.tcl41
-rw-r--r--library/fontchooser.tcl43
-rw-r--r--library/safetk.tcl80
-rw-r--r--library/spinbox.tcl6
-rw-r--r--library/tearoff.tcl10
-rw-r--r--library/ttk/combobox.tcl3
-rw-r--r--library/ttk/entry.tcl2
-rw-r--r--library/ttk/spinbox.tcl26
-rw-r--r--library/ttk/utils.tcl3
-rw-r--r--library/ttk/vistaTheme.tcl14
14 files changed, 135 insertions, 129 deletions
diff --git a/library/bgerror.tcl b/library/bgerror.tcl
index d4d9b21..fe8dfe0 100644
--- a/library/bgerror.tcl
+++ b/library/bgerror.tcl
@@ -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 <Button-1> { focus %W }
+ bind $W.text <Button-1> {focus %W}
$W.text configure -state disabled
# 2. Fill the top part with bitmap and message
diff --git a/library/console.tcl b/library/console.tcl
index eb8990a..b98689f 100644
--- a/library/console.tcl
+++ b/library/console.tcl
@@ -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} {
diff --git a/library/demos/dialog1.tcl b/library/demos/dialog1.tcl
index 976e955..66d8c9a 100644
--- a/library/demos/dialog1.tcl
+++ b/library/demos/dialog1.tcl
@@ -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
}
diff --git a/library/demos/fontchoose.tcl b/library/demos/fontchoose.tcl
index 8b34377..446ed34 100644
--- a/library/demos/fontchoose.tcl
+++ b/library/demos/fontchoose.tcl
@@ -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
diff --git a/library/entry.tcl b/library/entry.tcl
index 02384da..6539af7 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -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)]
@@ -119,17 +119,17 @@ bind Entry <Control-Button-1> {
}
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>> {
@@ -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
@@ -391,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
@@ -518,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]
@@ -575,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
@@ -660,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
@@ -677,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
}
-
-
-
-
-
-
-
-
-
diff --git a/library/fontchooser.tcl b/library/fontchooser.tcl
index 5395acb..3e2b6df 100644
--- a/library/fontchooser.tcl
+++ b/library/fontchooser.tcl
@@ -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 {
@@ -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
@@ -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)
}
diff --git a/library/safetk.tcl b/library/safetk.tcl
index 9f8e25d..841a0b6 100644
--- a/library/safetk.tcl
+++ b/library/safetk.tcl
@@ -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 safe child \"$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
diff --git a/library/spinbox.tcl b/library/spinbox.tcl
index 909405e..6ba7842 100644
--- a/library/spinbox.tcl
+++ b/library/spinbox.tcl
@@ -483,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
@@ -589,5 +589,5 @@ proc ::tk::spinbox::AutoScan {w} {
proc ::tk::spinbox::GetSelection {w} {
return [string range [$w get] [$w index sel.first] \
- [expr {[$w index sel.last] - 1}]]
+ [$w index sel.last]-1]
}
diff --git a/library/tearoff.tcl b/library/tearoff.tcl
index c2d2d6b..4c8b404 100644
--- a/library/tearoff.tcl
+++ b/library/tearoff.tcl
@@ -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}
}
}
@@ -155,9 +155,9 @@ proc ::tk::MenuDup {src dst type} {
while {[set index [string first $src $tags]] != -1} {
if {$index > 0} {
- append x [string range $tags 0 [expr {$index - 1}]]$dst
+ append x [string range $tags 0 $index-1]$dst
}
- set tags [string range $tags [expr {$index + $srcLen}] end]
+ set tags [string range $tags $index+$srcLen end]
}
append x $tags
@@ -172,10 +172,10 @@ proc ::tk::MenuDup {src dst type} {
while {[set index [string first $event $script]] != -1} {
if {$index > 0} {
- append x [string range $script 0 [expr {$index - 1}]]
+ 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
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
index 9af8c59..e339f97 100644
--- a/library/ttk/combobox.tcl
+++ b/library/ttk/combobox.tcl
@@ -357,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
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index 4cdb5ac..2f3c1a6 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -179,7 +179,7 @@ bind TEntry <<TkAccentBackspace>> {
#
proc ttk::entry::EntrySelection {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]]
diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl
index 5db1d03..33936d9 100644
--- a/library/ttk/spinbox.tcl
+++ b/library/ttk/spinbox.tcl
@@ -135,13 +135,27 @@ 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]
+ }
+ 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]}]
diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl
index e0ab45b..79e6ce2 100644
--- a/library/ttk/utils.tcl
+++ b/library/ttk/utils.tcl
@@ -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.
diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl
index 4085f75..ccd7012 100644
--- a/library/ttk/vistaTheme.tcl
+++ b/library/ttk/vistaTheme.tcl
@@ -72,9 +72,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
}
}
@@ -141,7 +141,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
@@ -206,8 +206,8 @@ namespace eval ttk::theme::vista {
TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
-width 6 -height 12
ttk::style layout Horizontal.TScale {
- Scale.focus -expand 1 -sticky nswe -children {
- Horizontal.Scale.trough -expand 1 -sticky nswe -children {
+ Scale.focus -sticky nswe -children {
+ Horizontal.Scale.trough -sticky nswe -children {
Horizontal.Scale.track -sticky we
Horizontal.Scale.slider -side left -sticky {}
}
@@ -217,8 +217,8 @@ namespace eval ttk::theme::vista {
TRACKBAR 6 {disabled 5 focus 4 pressed 3 active 2 {} 1} \
-width 12 -height 6
ttk::style layout Vertical.TScale {
- Scale.focus -expand 1 -sticky nswe -children {
- Vertical.Scale.trough -expand 1 -sticky nswe -children {
+ Scale.focus -sticky nswe -children {
+ Vertical.Scale.trough -sticky nswe -children {
Vertical.Scale.track -sticky ns
Vertical.Scale.slider -side top -sticky {}
}