summaryrefslogtreecommitdiffstats
path: root/library/panedwindow.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/panedwindow.tcl')
-rw-r--r--library/panedwindow.tcl71
1 files changed, 40 insertions, 31 deletions
diff --git a/library/panedwindow.tcl b/library/panedwindow.tcl
index 58b0bae..d3dfabc 100644
--- a/library/panedwindow.tcl
+++ b/library/panedwindow.tcl
@@ -32,16 +32,21 @@ namespace eval ::tk::panedwindow {}
# None
#
proc ::tk::panedwindow::MarkSash {w x y proxy} {
- if {[$w cget -opaqueresize]} { set proxy 0 }
+ variable ::tk::Priv
+ if {[$w cget -opaqueresize]} {
+ set proxy 0
+ }
set what [$w identify $x $y]
if { [llength $what] == 2 } {
- foreach {index which} $what break
- if { !$::tk_strictMotif || $which eq "handle" } {
- if {!$proxy} { $w sash mark $index $x $y }
- set ::tk::Priv(sash) $index
- foreach {sx sy} [$w sash coord $index] break
- set ::tk::Priv(dx) [expr {$sx-$x}]
- set ::tk::Priv(dy) [expr {$sy-$y}]
+ lassign $what index which
+ if {!$::tk_strictMotif || $which eq "handle"} {
+ if {!$proxy} {
+ $w sash mark $index $x $y
+ }
+ set Priv(sash) $index
+ lassign [$w sash coord $index] sx sy
+ set Priv(dx) [expr {$sx-$x}]
+ set Priv(dy) [expr {$sy-$y}]
# Do this to init the proxy location
DragSash $w $x $y $proxy
}
@@ -61,14 +66,16 @@ proc ::tk::panedwindow::MarkSash {w x y proxy} {
# Moves sash
#
proc ::tk::panedwindow::DragSash {w x y proxy} {
- if {[$w cget -opaqueresize]} { set proxy 0 }
- if { [info exists ::tk::Priv(sash)] } {
+ variable ::tk::Priv
+ if {[$w cget -opaqueresize]} {
+ set proxy 0
+ }
+ if {[info exists Priv(sash)]} {
if {$proxy} {
- $w proxy place \
- [expr {$x+$::tk::Priv(dx)}] [expr {$y+$::tk::Priv(dy)}]
+ $w proxy place [expr {$x+$Priv(dx)}] [expr {$y+$Priv(dy)}]
} else {
- $w sash place $::tk::Priv(sash) \
- [expr {$x+$::tk::Priv(dx)}] [expr {$y+$::tk::Priv(dy)}]
+ $w sash place $Priv(sash) \
+ [expr {$x+$Priv(dx)}] [expr {$y+$Priv(dy)}]
}
}
}
@@ -84,14 +91,17 @@ proc ::tk::panedwindow::DragSash {w x y proxy} {
# Returns ...
#
proc ::tk::panedwindow::ReleaseSash {w proxy} {
- if {[$w cget -opaqueresize]} { set proxy 0 }
- if { [info exists ::tk::Priv(sash)] } {
+ variable ::tk::Priv
+ if {[$w cget -opaqueresize]} {
+ set proxy 0
+ }
+ if {[info exists Priv(sash)]} {
if {$proxy} {
- foreach {x y} [$w proxy coord] break
- $w sash place $::tk::Priv(sash) $x $y
+ lassign [$w proxy coord] x y
+ $w sash place $Priv(sash) $x $y
$w proxy forget
}
- unset ::tk::Priv(sash) ::tk::Priv(dx) ::tk::Priv(dy)
+ unset Priv(sash) Priv(dx) Priv(dy)
}
}
@@ -113,16 +123,14 @@ proc ::tk::panedwindow::Motion {w x y} {
set id [$w identify $x $y]
if {([llength $id] == 2) && \
(!$::tk_strictMotif || [lindex $id 1] eq "handle")} {
- if { ![info exists Priv($w,panecursor)] } {
+ if {![info exists Priv($w,panecursor)]} {
set Priv($w,panecursor) [$w cget -cursor]
- if { [$w cget -sashcursor] eq "" } {
- if { [$w cget -orient] eq "horizontal" } {
- $w configure -cursor sb_h_double_arrow
- } else {
- $w configure -cursor sb_v_double_arrow
- }
- } else {
+ if {[$w cget -sashcursor] ne ""} {
$w configure -cursor [$w cget -sashcursor]
+ } elseif {[$w cget -orient] eq "horizontal"} {
+ $w configure -cursor sb_h_double_arrow
+ } else {
+ $w configure -cursor sb_v_double_arrow
}
if {[info exists Priv($w,pwAfterId)]} {
after cancel $Priv($w,pwAfterId)
@@ -132,7 +140,7 @@ proc ::tk::panedwindow::Motion {w x y} {
}
return
}
- if { [info exists Priv($w,panecursor)] } {
+ if {[info exists Priv($w,panecursor)]} {
$w configure -cursor $Priv($w,panecursor)
unset Priv($w,panecursor)
}
@@ -178,8 +186,9 @@ proc ::tk::panedwindow::Cursor {w} {
# Restores the default cursor
#
proc ::tk::panedwindow::Leave {w} {
- if {[info exists ::tk::Priv($w,panecursor)]} {
- $w configure -cursor $::tk::Priv($w,panecursor)
- unset ::tk::Priv($w,panecursor)
+ variable ::tk::Priv
+ if {[info exists Priv($w,panecursor)]} {
+ $w configure -cursor $Priv($w,panecursor)
+ unset Priv($w,panecursor)
}
}