summaryrefslogtreecommitdiffstats
path: root/library/ttk
diff options
context:
space:
mode:
Diffstat (limited to 'library/ttk')
-rw-r--r--library/ttk/button.tcl9
-rw-r--r--library/ttk/classicTheme.tcl3
-rw-r--r--library/ttk/combobox.tcl25
-rw-r--r--library/ttk/cursors.tcl5
-rw-r--r--library/ttk/entry.tcl35
-rw-r--r--library/ttk/fonts.tcl7
-rw-r--r--library/ttk/menubutton.tcl21
-rw-r--r--library/ttk/notebook.tcl17
-rw-r--r--library/ttk/panedwindow.tcl4
-rw-r--r--library/ttk/scale.tcl2
-rw-r--r--library/ttk/scrollbar.tcl3
-rw-r--r--library/ttk/sizegrip.tcl8
-rw-r--r--library/ttk/spinbox.tcl16
-rw-r--r--library/ttk/treeview.tcl38
-rw-r--r--library/ttk/ttk.tcl16
-rw-r--r--library/ttk/utils.tcl17
16 files changed, 130 insertions, 96 deletions
diff --git a/library/ttk/button.tcl b/library/ttk/button.tcl
index 9f2cec7..199d0fa 100644
--- a/library/ttk/button.tcl
+++ b/library/ttk/button.tcl
@@ -52,7 +52,8 @@ bind TRadiobutton <KeyPress-Down> { ttk::button::RadioTraverse %W +1 }
proc ttk::button::activate {w} {
$w instate disabled { return }
set oldState [$w state pressed]
- update idletasks; after 100 ;# block event loop to avoid reentrancy
+ update idletasks
+ after 100 ;# block event loop to avoid reentrancy
$w state $oldState
$w invoke
}
@@ -66,9 +67,9 @@ proc ttk::button::activate {w} {
proc ttk::button::RadioTraverse {w dir} {
set group [list]
foreach sibling [winfo children [winfo parent $w]] {
- if { [winfo class $sibling] eq "TRadiobutton"
- && [$sibling cget -variable] eq [$w cget -variable]
- && ![$sibling instate disabled]
+ if { ([winfo class $sibling] eq "TRadiobutton") &&
+ ([$sibling cget -variable] eq [$w cget -variable]) &&
+ (![$sibling instate disabled])
} {
lappend group $sibling
}
diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl
index 7e3eff5..01c577e 100644
--- a/library/ttk/classicTheme.tcl
+++ b/library/ttk/classicTheme.tcl
@@ -6,7 +6,8 @@
namespace eval ttk::theme::classic {
- variable colors; array set colors {
+ variable colors
+ array set colors {
-frame "#d9d9d9"
-window "#ffffff"
-activebg "#ececec"
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
index 03821a2..6c90ac8 100644
--- a/library/ttk/combobox.tcl
+++ b/library/ttk/combobox.tcl
@@ -76,6 +76,7 @@ switch -- [tk windowingsystem] {
# NB: *only* do this on Windows (see #1814778)
bind ComboboxListbox <FocusOut> { ttk::combobox::LBCancel %W }
}
+ default {}
}
### Combobox popdown window bindings.
@@ -101,6 +102,7 @@ switch -- [tk windowingsystem] {
aqua {
option add *TCombobox*Listbox.borderWidth 0
}
+ default {}
}
### Binding procedures.
@@ -149,8 +151,8 @@ proc ttk::combobox::Drag {w x} {
# Set cursor.
#
proc ttk::combobox::Motion {w x y} {
- if { [$w identify $x $y] eq "textarea"
- && [$w instate {!readonly !disabled}]
+ if { ([$w identify $x $y] eq "textarea") &&
+ [$w instate {!readonly !disabled}]
} {
ttk::setCursor $w text
} else {
@@ -185,7 +187,7 @@ proc ttk::combobox::Scroll {cb dir} {
set max [llength [$cb cget -values]]
set current [$cb current]
incr current $dir
- if {$max != 0 && $current == $current % $max} {
+ if {($max != 0) && ($current == ($current % $max))} {
SelectEntry $cb $current
}
}
@@ -216,6 +218,7 @@ proc ttk::combobox::LBTab {lb dir} {
switch -- $dir {
next { set newFocus [tk_focusNext $cb] }
prev { set newFocus [tk_focusPrev $cb] }
+ default {}
}
if {$newFocus ne ""} {
@@ -307,12 +310,6 @@ proc ttk::combobox::PopdownToplevel {w} {
toplevel $w -class ComboboxPopdown
wm withdraw $w
switch -- [tk windowingsystem] {
- default -
- x11 {
- $w configure -relief flat -borderwidth 0
- wm attributes $w -type combo
- wm overrideredirect $w true
- }
win32 {
$w configure -relief flat -borderwidth 0
wm overrideredirect $w true
@@ -324,6 +321,11 @@ proc ttk::combobox::PopdownToplevel {w} {
help {noActivates hideOnSuspend}
wm resizable $w 0 0
}
+ default {
+ $w configure -relief flat -borderwidth 0
+ wm attributes $w -type combo
+ wm overrideredirect $w true
+ }
}
return $w
}
@@ -370,11 +372,11 @@ proc ttk::combobox::PlacePopdown {cb popdown} {
set h [winfo height $cb]
set postoffset [ttk::style lookup TCombobox -postoffset {} {0 0 0 0}]
foreach var {x y w h} delta $postoffset {
- incr $var $delta
+ incr [set var] $delta
}
set H [winfo reqheight $popdown]
- if {$y + $h + $H > [winfo screenheight $popdown]} {
+ if {($y + $h + $H) > [winfo screenheight $popdown]} {
set Y [expr {$y - $H}]
} else {
set Y [expr {$y + $h}]
@@ -403,6 +405,7 @@ proc ttk::combobox::Post {cb} {
# See <<NOTE-WM-TRANSIENT>>
switch -- [tk windowingsystem] {
x11 - win32 { wm transient $popdown [winfo toplevel $cb] }
+ default {}
}
# Post the listbox:
diff --git a/library/ttk/cursors.tcl b/library/ttk/cursors.tcl
index 75f7791..be6aa1b 100644
--- a/library/ttk/cursors.tcl
+++ b/library/ttk/cursors.tcl
@@ -70,7 +70,7 @@ namespace eval ttk {
# Platform-specific overrides for Windows and OSX.
#
- switch [tk windowingsystem] {
+ switch -- [tk windowingsystem] {
"win32" {
array set Cursors {
none {}
@@ -118,6 +118,7 @@ namespace eval ttk {
}
}
}
+ default {}
}
}
@@ -176,7 +177,7 @@ proc ttk::CursorSampler {f} {
return $f
}
-if {[info exists argv0] && $argv0 eq [info script]} {
+if {[info exists argv0] && ($argv0 eq [info script])} {
wm title . "[array size ::ttk::Cursors] cursors"
pack [ttk::CursorSampler .f] -expand true -fill both
bind . <KeyPress-Escape> [list destroy .]
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index f5ba19e..783cda1 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -192,7 +192,8 @@ proc ttk::entry::Clear {w} {
## Cut -- Copy selection to clipboard then delete it.
#
proc ttk::entry::Cut {w} {
- Copy $w; Clear $w
+ Copy $w
+ Clear $w
}
### Navigation procedures.
@@ -204,7 +205,7 @@ proc ttk::entry::Cut {w} {
proc ttk::entry::ClosestGap {w x} {
set pos [$w index @$x]
set bbox [$w bbox $pos]
- if {$x - [lindex $bbox 0] > [lindex $bbox 2]/2} {
+ if {($x - [lindex $bbox 0]) > ([lindex $bbox 2] / 2)} {
incr pos
}
return $pos
@@ -216,7 +217,7 @@ proc ttk::entry::See {w {index insert}} {
update idletasks ;# ensure scroll data up-to-date
set c [$w index $index]
# @@@ OR: check [$w index left] / [$w index right]
- if {$c < [$w index @0] || $c >= [$w index @[winfo width $w]]} {
+ if {($c < [$w index @0]) || ($c >= [$w index @[winfo width $w]])} {
$w xview $c
}
}
@@ -232,7 +233,7 @@ set ::ttk::entry::State(startNext) \
proc ttk::entry::NextWord {w start} {
variable State
set pos [tcl_endOfWord [$w get] [$w index $start]]
- if {$pos >= 0 && $State(startNext)} {
+ if {($pos >= 0) && $State(startNext)} {
set pos [tcl_startOfNextWord [$w get] $pos]
}
if {$pos < 0} {
@@ -291,8 +292,8 @@ proc ttk::entry::Move {w where} {
#
# Returns: selection anchor.
#
-proc ttk::entry::ExtendTo {w index} {
- set index [$w index $index]
+proc ttk::entry::ExtendTo {w a_index} {
+ set index [$w index $a_index]
set insert [$w index insert]
# Figure out selection anchor:
@@ -302,8 +303,8 @@ proc ttk::entry::ExtendTo {w index} {
set selfirst [$w index sel.first]
set sellast [$w index sel.last]
- if { ($index < $selfirst)
- || ($insert == $selfirst && $index <= $sellast)
+ if { ($index < $selfirst) ||
+ (($insert == $selfirst) && ($index <= $sellast))
} {
set anchor $sellast
} else {
@@ -377,7 +378,10 @@ proc ttk::entry::Select {w x mode} {
switch -- $mode {
word { WordSelect $w $cur $cur }
line { LineSelect $w $cur $cur }
- char { # no-op }
+ char {
+ # no-op
+ }
+ default {}
}
set State(anchor) $cur
@@ -398,10 +402,11 @@ proc ttk::entry::DragTo {w x} {
variable State
set cur [ClosestGap $w $x]
- switch $State(selectMode) {
+ switch -- $State(selectMode) {
char { CharSelect $w $State(anchor) $cur }
word { WordSelect $w $State(anchor) $cur }
line { LineSelect $w $State(anchor) $cur }
+ default {}
}
}
@@ -491,10 +496,10 @@ proc ttk::entry::ScanDrag {w x} {
variable State
set dx [expr {$State(scanX) - $x}]
- if {abs($dx) > $State(deadband)} {
+ if { ( abs ($dx) ) > $State(deadband)} {
set State(scanMoved) 1
}
- set left [expr {$State(scanIndex) + ($dx*$State(scanNum))/$State(scanDen)}]
+ set left [expr {$State(scanIndex) + (($dx * $State(scanNum)) / $State(scanDen))}]
$w xview $left
if {$left != [set newLeft [$w index @0]]} {
@@ -564,10 +569,8 @@ proc ttk::entry::Backspace {w} {
$w delete $x
if {[$w index @0] >= [$w index insert]} {
- set range [$w xview]
- set left [lindex $range 0]
- set right [lindex $range 1]
- $w xview moveto [expr {$left - ($right - $left)/2.0}]
+ lassign [$w xview] left right
+ $w xview moveto [expr {$left - (($right - $left) / 2.0)}]
}
}
diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl
index 52298c5..44de6c3 100644
--- a/library/ttk/fonts.tcl
+++ b/library/ttk/fonts.tcl
@@ -82,7 +82,7 @@ switch -- [tk windowingsystem] {
set F(family) "MS Sans Serif"
}
} else {
- if {[lsearch -exact [font families] Tahoma] != -1} {
+ if {"Tahoma" in [font families]} {
set F(family) "Tahoma"
} else {
set F(family) "MS Sans Serif"
@@ -122,9 +122,8 @@ switch -- [tk windowingsystem] {
font configure TkMenuFont -family $F(family) -size $F(menusize)
font configure TkSmallCaptionFont -family $F(family) -size $F(labelsize)
}
- default -
- x11 {
- if {![catch {tk::pkgconfig get fontsystem} F(fs)] && $F(fs) eq "xft"} {
+ default {
+ if {(![catch {tk::pkgconfig get fontsystem} F(fs)]) && ($F(fs) eq "xft")} {
set F(family) "sans-serif"
set F(fixed) "monospace"
} else {
diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl
index 093bb02..16af971 100644
--- a/library/ttk/menubutton.tcl
+++ b/library/ttk/menubutton.tcl
@@ -81,10 +81,10 @@ proc ttk::menubutton::PostPosition {mb menu} {
set sh [expr {[winfo screenheight $menu] - $bh - $mh}]
switch -- $dir {
- above { if {$y >= $mh} { incr y -$mh } { incr y $bh } }
- below { if {$y <= $sh} { incr y $bh } { incr y -$mh } }
- left { if {$x >= $mw} { incr x -$mw } { incr x $bw } }
- right { if {$x <= $sw} { incr x $bw } { incr x -$mw } }
+ above { if {$y >= $mh} { incr y -$mh } else { incr y $bh } }
+ below { if {$y <= $sh} { incr y $bh } else { incr y -$mh } }
+ left { if {$x >= $mw} { incr x -$mw } else { incr x $bw } }
+ right { if {$x <= $sw} { incr x $bw } else { incr x -$mw } }
flush {
# post menu atop menubutton.
# If there's a menu entry whose label matches the
@@ -95,6 +95,7 @@ proc ttk::menubutton::PostPosition {mb menu} {
incr y -[$menu yposition $index]
}
}
+ default {}
}
return [list $x $y]
@@ -104,10 +105,10 @@ proc ttk::menubutton::PostPosition {mb menu} {
# Post the menu and set a grab on the menu.
#
proc ttk::menubutton::Popdown {mb} {
- if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} {
+ if {[$mb instate disabled] || ([set menu [$mb cget -menu]] eq "")} {
return
}
- foreach {x y} [PostPosition $mb $menu] { break }
+ lassign [PostPosition $mb $menu] x y
tk_popup $menu $x $y
}
@@ -118,10 +119,10 @@ proc ttk::menubutton::Popdown {mb} {
#
proc ttk::menubutton::Pulldown {mb} {
variable State
- if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} {
+ if {[$mb instate disabled] || ([set menu [$mb cget -menu]] eq "")} {
return
}
- foreach {x y} [PostPosition $mb $menu] { break }
+ lassign [PostPosition $mb $menu] x y
set State(pulldown) 1
set State(oldcursor) [$mb cget -cursor]
@@ -158,8 +159,8 @@ proc ttk::menubutton::FindMenuEntry {menu s} {
return ""
}
for {set i 0} {$i <= $last} {incr i} {
- if {![catch {$menu entrycget $i -label} label]
- && ($label eq $s)} {
+ if {(![catch {$menu entrycget $i -label} label]) &&
+ ($label eq $s)} {
return $i
}
}
diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl
index 72b85e6..6d2c88e 100644
--- a/library/ttk/notebook.tcl
+++ b/library/ttk/notebook.tcl
@@ -32,7 +32,10 @@ proc ttk::notebook::ActivateTab {w tab} {
set newtab [$w select] ;# NOTE: might not be $tab, if $tab is disabled
if {[focus] eq $w} { return }
- if {$newtab eq $oldtab} { focus $w ; return }
+ if {$newtab eq $oldtab} {
+ focus $w
+ return
+ }
update idletasks ;# needed so focus logic sees correct mapped states
if {[set f [ttk::focusFirst $newtab]] ne ""} {
@@ -60,7 +63,7 @@ proc ttk::notebook::CycleTab {w dir} {
if {[$w index end] != 0} {
set current [$w index current]
set select [expr {($current + $dir) % [$w index end]}]
- while {[$w tab $select -state] != "normal" && ($select != $current)} {
+ while {([$w tab $select -state] ne "normal") && ($select != $current)} {
set select [expr {($select + $dir) % [$w index end]}]
}
if {$select != $current} {
@@ -74,13 +77,13 @@ proc ttk::notebook::CycleTab {w dir} {
# specified mnemonic. If found, returns path name of tab;
# otherwise returns ""
#
-proc ttk::notebook::MnemonicTab {nb key} {
- set key [string toupper $key]
+proc ttk::notebook::MnemonicTab {nb a_key} {
+ set key [string toupper $a_key]
foreach tab [$nb tabs] {
set label [$nb tab $tab -text]
set underline [$nb tab $tab -underline]
set mnemonic [string toupper [string index $label $underline]]
- if {$mnemonic ne "" && $mnemonic eq $key} {
+ if {($mnemonic ne "") && ($mnemonic eq $key)} {
return $tab
}
}
@@ -160,8 +163,8 @@ proc ttk::notebook::EnclosingNotebook {w} {
set top [winfo toplevel $w]
if {![info exists TLNotebooks($top)]} { return }
- while {$w ne $top && $w ne ""} {
- if {[lsearch -exact $TLNotebooks($top) $w] >= 0} {
+ while {$w ni "$top {}"} {
+ if {$w in $TLNotebooks($top)} {
return $w
}
set w [winfo parent $w]
diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl
index a2e073b..67906c6 100644
--- a/library/ttk/panedwindow.tcl
+++ b/library/ttk/panedwindow.tcl
@@ -48,6 +48,7 @@ proc ttk::panedwindow::Drag {w x y} {
switch -- [$w cget -orient] {
horizontal { set delta [expr {$x - $State(pressX)}] }
vertical { set delta [expr {$y - $State(pressY)}] }
+ default {}
}
$w sashpos $State(sash) [expr {$State(sashPos) + $delta}]
}
@@ -63,7 +64,7 @@ proc ttk::panedwindow::Release {w x y} {
proc ttk::panedwindow::ResetCursor {w} {
variable State
if {!$State(pressed)} {
- ttk::setCursor $w {}
+ ttk::setCursor $w ""
}
}
@@ -74,6 +75,7 @@ proc ttk::panedwindow::SetCursor {w x y} {
switch -- [$w cget -orient] {
horizontal { set cursor hresize }
vertical { set cursor vresize }
+ default {}
}
}
ttk::setCursor $w $cursor
diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl
index 69b9dd8..0816d9e 100644
--- a/library/ttk/scale.tcl
+++ b/library/ttk/scale.tcl
@@ -49,6 +49,7 @@ proc ttk::scale::Press {w x y} {
set State(dragging) 1
set State(initial) [$w get]
}
+ default {}
}
}
@@ -69,6 +70,7 @@ proc ttk::scale::Jump {w x y} {
*slider {
Press $w $x $y
}
+ default {}
}
}
diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl
index 4bd5107..15cd805 100644
--- a/library/ttk/scrollbar.tcl
+++ b/library/ttk/scrollbar.tcl
@@ -11,7 +11,7 @@ if {[tk windowingsystem] eq "aqua"} {
proc ttk::scrollbar {w args} {
set constructor ::tk::scrollbar
foreach {option _} $args {
- if {$option eq "-class" || $option eq "-style"} {
+ if {$option in "-class -style"} {
set constructor ::ttk::_scrollbar
break
}
@@ -80,6 +80,7 @@ proc ttk::scrollbar::Press {w x y} {
set State(first) [lindex [$w get] 0]
}
}
+ default {}
}
}
diff --git a/library/ttk/sizegrip.tcl b/library/ttk/sizegrip.tcl
index 153e310..7b86640 100644
--- a/library/ttk/sizegrip.tcl
+++ b/library/ttk/sizegrip.tcl
@@ -14,6 +14,7 @@ switch -- [tk windowingsystem] {
aqua {
# Aqua sizegrips use default Arrow cursor.
}
+ default {}
}
namespace eval ttk::sizegrip {
@@ -83,14 +84,15 @@ proc ttk::sizegrip::Drag {W X Y} {
set w $State(width)
set h $State(height)
if {$State(resizeX)} {
- set w [expr {$w + ($X - $State(pressX))/$State(widthInc)}]
+ set w [expr {$w + (($X - $State(pressX)) / $State(widthInc))}]
}
if {$State(resizeY)} {
- set h [expr {$h + ($Y - $State(pressY))/$State(heightInc)}]
+ set h [expr {$h + (($Y - $State(pressY)) / $State(heightInc))}]
}
if {$w <= 0} { set w 1 }
if {$h <= 0} { set h 1 }
- set x $State(x) ; set y $State(y)
+ set x $State(x)
+ set y $State(y)
wm geometry $State(toplevel) ${w}x${h}+${x}+${y}
}
diff --git a/library/ttk/spinbox.tcl b/library/ttk/spinbox.tcl
index 1aa0ccb..20cae97 100644
--- a/library/ttk/spinbox.tcl
+++ b/library/ttk/spinbox.tcl
@@ -29,8 +29,8 @@ ttk::bindMouseWheel TSpinbox [list ttk::spinbox::MouseWheel %W]
# Sets cursor.
#
proc ttk::spinbox::Motion {w x y} {
- if { [$w identify $x $y] eq "textarea"
- && [$w instate {!readonly !disabled}]
+ if { ([$w identify $x $y] eq "textarea") &&
+ [$w instate {!readonly !disabled}]
} {
ttk::setCursor $w text
} else {
@@ -50,13 +50,14 @@ proc ttk::spinbox::Press {w x y} {
*leftarrow -
*downarrow { ttk::Repeatedly event generate $w <<Decrement>> }
*spinbutton {
- if {$y * 2 >= [winfo height $w]} {
+ if {($y * 2) >= [winfo height $w]} {
set event <<Decrement>>
} else {
set event <<Increment>>
}
ttk::Repeatedly event generate $w $event
}
+ default {}
}
}
@@ -69,6 +70,7 @@ proc ttk::spinbox::DoubleClick {w x y} {
switch -glob -- [$w identify $x $y] {
*textarea { SelectAll $w }
* { Press $w $x $y }
+ default {}
}
}
@@ -140,7 +142,7 @@ proc ttk::spinbox::Spin {w dir} {
$w set [lindex $values $index]
} else {
if {[catch {
- set v [expr {[scan [$w get] %f] + $dir * [$w cget -increment]}]
+ set v [expr {[scan [$w get] %f] + ($dir * [$w cget -increment])}]
}]} {
set v [$w cget -from]
}
@@ -157,11 +159,11 @@ proc ttk::spinbox::FormatValue {w val} {
set fmt [$w cget -format]
if {$fmt eq ""} {
# Try to guess a suitable -format based on -increment.
- set delta [expr {abs([$w cget -increment])}]
- if {0 < $delta && $delta < 1} {
+ set delta [expr { abs ([$w cget -increment])}]
+ 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)))}]
+ set nsd [expr { int ( ceil (- ( log10 ($delta))))}]
set fmt "%.${nsd}f"
} else {
set fmt "%.0f"
diff --git a/library/ttk/treeview.tcl b/library/ttk/treeview.tcl
index 8772587..41ab69f 100644
--- a/library/ttk/treeview.tcl
+++ b/library/ttk/treeview.tcl
@@ -7,8 +7,8 @@ namespace eval ttk::treeview {
# Enter/Leave/Motion
#
- set State(activeWidget) {}
- set State(activeHeading) {}
+ set State(activeWidget) ""
+ set State(activeHeading) ""
# Press/drag/release:
#
@@ -19,7 +19,7 @@ namespace eval ttk::treeview {
set State(resizeColumn) #0
# For pressmode == "heading"
- set State(heading) {}
+ set State(heading) ""
}
### Widget bindings.
@@ -75,7 +75,7 @@ proc ttk::treeview::Keynav {w dir} {
set focus [lindex [$w children $focus] 0]
} else {
set up $focus
- while {$up ne "" && [set down [$w next $up]] eq ""} {
+ while {($up ne "") && ([set down [$w next $up]] eq "")} {
set up [$w parent $up]
}
set focus $down
@@ -91,9 +91,10 @@ proc ttk::treeview::Keynav {w dir} {
right {
OpenItem $w $focus
}
+ default {}
}
- if {$focus != {}} {
+ if {$focus ne ""} {
SelectOp $w $focus choose
}
}
@@ -102,12 +103,13 @@ proc ttk::treeview::Keynav {w dir} {
# Sets cursor, active element ...
#
proc ttk::treeview::Motion {w x y} {
- set cursor {}
- set activeHeading {}
+ set cursor ""
+ set activeHeading ""
switch -- [$w identify region $x $y] {
separator { set cursor hresize }
heading { set activeHeading [$w identify column $x $y] }
+ default {}
}
ttk::setCursor $w $cursor
@@ -119,11 +121,11 @@ proc ttk::treeview::Motion {w x y} {
proc ttk::treeview::ActivateHeading {w heading} {
variable State
- if {$w != $State(activeWidget) || $heading != $State(activeHeading)} {
- if {$State(activeHeading) != {}} {
+ if {($w ne $State(activeWidget)) || ($heading ne $State(activeHeading))} {
+ if {$State(activeHeading) ne ""} {
$State(activeWidget) heading $State(activeHeading) state !active
}
- if {$heading != {}} {
+ if {$heading ne ""} {
$w heading $heading state active
}
set State(activeHeading) $heading
@@ -166,8 +168,10 @@ proc ttk::treeview::Press {w x y} {
switch -glob -- [$w identify element $x $y] {
*indicator -
*disclosure { Toggle $w $item }
+ default {}
}
}
+ default {}
}
}
@@ -175,17 +179,19 @@ proc ttk::treeview::Press {w x y} {
#
proc ttk::treeview::Drag {w x y} {
variable State
- switch $State(pressMode) {
+ switch -- $State(pressMode) {
resize { resize.drag $w $x }
heading { heading.drag $w $x $y }
+ default {}
}
}
proc ttk::treeview::Release {w x y} {
variable State
- switch $State(pressMode) {
+ switch -- $State(pressMode) {
resize { resize.release $w $x }
heading { heading.release $w }
+ default {}
}
set State(pressMode) none
Motion $w $x $y
@@ -221,8 +227,8 @@ proc ttk::treeview::heading.press {w x y} {
proc ttk::treeview::heading.drag {w x y} {
variable State
- if { [$w identify region $x $y] eq "heading"
- && [$w identify column $x $y] eq $State(heading)
+ if { ([$w identify region $x $y] eq "heading") &&
+ ([$w identify column $x $y] eq $State(heading))
} {
$w heading $State(heading) state pressed
} else {
@@ -232,7 +238,7 @@ proc ttk::treeview::heading.drag {w x y} {
proc ttk::treeview::heading.release {w} {
variable State
- if {[lsearch -exact [$w heading $State(heading) state] pressed] >= 0} {
+ if {"pressed" in [$w heading $State(heading) state]} {
after 0 [$w heading $State(heading) -command]
}
$w heading $State(heading) state !pressed
@@ -304,7 +310,7 @@ proc ttk::treeview::ScanBetween {tv item1 item2 item} {
variable between
variable selectingBetween
- if {$item eq $item1 || $item eq $item2} {
+ if {$item in "$item1 $item2"} {
lappend between $item
set selectingBetween [expr {!$selectingBetween}]
} elseif {$selectingBetween} {
diff --git a/library/ttk/ttk.tcl b/library/ttk/ttk.tcl
index 7bae211..1df95cf 100644
--- a/library/ttk/ttk.tcl
+++ b/library/ttk/ttk.tcl
@@ -21,7 +21,7 @@ source [file join $::ttk::library utils.tcl]
# $old and $new must be fully namespace-qualified.
#
proc ttk::deprecated {old new} {
- interp alias {} $old {} ttk::do'deprecate $old $new
+ interp alias "" $old "" ttk::do'deprecate $old $new
}
## do'deprecate --
# Implementation procedure for deprecated commands --
@@ -29,7 +29,7 @@ proc ttk::deprecated {old new} {
#
proc ttk::do'deprecate {old new args} {
deprecated'warning $old $new
- interp alias {} $old {} $new
+ interp alias "" $old "" $new
uplevel 1 [linsert $args 0 $new]
}
@@ -133,7 +133,7 @@ proc ttk::LoadThemes {} {
xpnative {xpTheme.tcl vistaTheme.tcl}
aqua aquaTheme.tcl
} {
- if {[lsearch -exact $builtinThemes $theme] >= 0} {
+ if {$theme in $builtinThemes} {
foreach script $scripts {
uplevel #0 [list source [file join $library $script]]
}
@@ -141,7 +141,8 @@ proc ttk::LoadThemes {} {
}
}
-ttk::LoadThemes; rename ::ttk::LoadThemes {}
+ttk::LoadThemes
+rename ::ttk::LoadThemes ""
### Select platform-specific default theme:
#
@@ -157,9 +158,9 @@ proc ttk::DefaultTheme {} {
set preferred [list aqua vista xpnative winnative]
set userTheme [option get . tkTheme TkTheme]
- if {$userTheme ne {} && ![catch {
+ if {($userTheme ne "") && (![catch {
uplevel #0 [list package require ttk::theme::$userTheme]
- }]} {
+ }])} {
return $userTheme
}
@@ -171,6 +172,7 @@ proc ttk::DefaultTheme {} {
return "default"
}
-ttk::setTheme [ttk::DefaultTheme] ; rename ttk::DefaultTheme {}
+ttk::setTheme [ttk::DefaultTheme]
+rename ttk::DefaultTheme ""
#*EOF*
diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl
index 7cc1bb7..27f92c0 100644
--- a/library/ttk/utils.tcl
+++ b/library/ttk/utils.tcl
@@ -30,14 +30,14 @@ proc ttk::takefocus {w} {
proc ttk::GuessTakeFocus {w} {
# Don't traverse to widgets with '-state disabled':
#
- if {![catch {$w cget -state} state] && $state eq "disabled"} {
+ if {(![catch {$w cget -state} state]) && ($state eq "disabled")} {
return 0
}
# Allow traversal to widgets with explicit key or focus bindings:
#
- if {[regexp {Key|Focus} [concat [bind $w] [bind [winfo class $w]]]]} {
- return 1;
+ if {[regexp "Key|Focus" [concat [bind $w] [bind [winfo class $w]]]]} {
+ return 1
}
# Default is nontraversable:
@@ -144,10 +144,13 @@ proc ttk::SaveGrab {w} {
set grabbed [grab current $w]
if {[winfo exists $grabbed]} {
- switch [grab status $grabbed] {
+ switch -- [grab status $grabbed] {
global { set restoreGrab [list grab -global $grabbed] }
local { set restoreGrab [list grab $grabbed] }
- none { ;# grab window is really in a different interp }
+ none {
+ # grab window is really in a different interp
+ }
+ default {}
}
}
@@ -306,11 +309,12 @@ proc ttk::bindMouseWheel {bindtag callback} {
bind $bindtag <ButtonPress-5> "$callback +1"
}
win32 {
- bind $bindtag <MouseWheel> [append callback { [expr {-(%D/120)}]}]
+ bind $bindtag <MouseWheel> [append callback { [expr {-(%D / 120)}]}]
}
aqua {
bind $bindtag <MouseWheel> [append callback { [expr {-(%D)}]} ]
}
+ default {}
}
}
@@ -345,6 +349,7 @@ switch -- [tk windowingsystem] {
bind TtkScrollable <Shift-Option-MouseWheel> \
{ %W xview scroll [expr {-10*(%D)}] units }
}
+ default {}
}
#*EOF*