| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
|
|
| |
|
|
| bind Scale <Enter> { |
| if {$tk_strictMotif} { |
| set tk::Priv(activeBg) [%W cget -activebackground] |
| %W configure -activebackground [%W cget -background] |
| } |
| tk::ScaleActivate %W %x %y |
| } |
| bind Scale <Motion> { |
| tk::ScaleActivate %W %x %y |
| } |
| bind Scale <Leave> { |
| if {$tk_strictMotif} { |
| %W configure -activebackground $tk::Priv(activeBg) |
| } |
| if {[%W cget -state] eq "active"} { |
| %W configure -state normal |
| } |
| } |
| bind Scale <1> { |
| tk::ScaleButtonDown %W %x %y |
| } |
| bind Scale <B1-Motion> { |
| tk::ScaleDrag %W %x %y |
| } |
| bind Scale <B1-Leave> { } |
| bind Scale <B1-Enter> { } |
| bind Scale <ButtonRelease-1> { |
| tk::CancelRepeat |
| tk::ScaleEndDrag %W |
| tk::ScaleActivate %W %x %y |
| } |
| bind Scale <2> { |
| tk::ScaleButton2Down %W %x %y |
| } |
| bind Scale <B2-Motion> { |
| tk::ScaleDrag %W %x %y |
| } |
| bind Scale <B2-Leave> { } |
| bind Scale <B2-Enter> { } |
| bind Scale <ButtonRelease-2> { |
| tk::CancelRepeat |
| tk::ScaleEndDrag %W |
| tk::ScaleActivate %W %x %y |
| } |
| if {[tk windowingsystem] eq "win32"} { |
| |
| bind Scale <3> [bind Scale <2>] |
| bind Scale <B3-Motion> [bind Scale <B2-Motion>] |
| bind Scale <B3-Leave> [bind Scale <B2-Leave>] |
| bind Scale <B3-Enter> [bind Scale <B2-Enter>] |
| bind Scale <ButtonRelease-3> [bind Scale <ButtonRelease-2>] |
| } |
| bind Scale <Control-1> { |
| tk::ScaleControlPress %W %x %y |
| } |
| bind Scale <<PrevLine>> { |
| tk::ScaleIncrement %W up little noRepeat |
| } |
| bind Scale <<NextLine>> { |
| tk::ScaleIncrement %W down little noRepeat |
| } |
| bind Scale <<PrevChar>> { |
| tk::ScaleIncrement %W up little noRepeat |
| } |
| bind Scale <<NextChar>> { |
| tk::ScaleIncrement %W down little noRepeat |
| } |
| bind Scale <<PrevPara>> { |
| tk::ScaleIncrement %W up big noRepeat |
| } |
| bind Scale <<NextPara>> { |
| tk::ScaleIncrement %W down big noRepeat |
| } |
| bind Scale <<PrevWord>> { |
| tk::ScaleIncrement %W up big noRepeat |
| } |
| bind Scale <<NextWord>> { |
| tk::ScaleIncrement %W down big noRepeat |
| } |
| bind Scale <<LineStart>> { |
| %W set [%W cget -from] |
| } |
| bind Scale <<LineEnd>> { |
| %W set [%W cget -to] |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScaleActivate {w x y} { |
| if {[$w cget -state] eq "disabled"} { |
| return |
| } |
| if {[$w identify $x $y] eq "slider"} { |
| set state active |
| } else { |
| set state normal |
| } |
| if {[$w cget -state] ne $state} { |
| $w configure -state $state |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScaleButtonDown {w x y} { |
| variable ::tk::Priv |
| set Priv(dragging) 0 |
| set el [$w identify $x $y] |
|
|
| |
| set Priv($w,relief) [$w cget -sliderrelief] |
|
|
| if {$el eq "trough1"} { |
| ScaleIncrement $w up little initial |
| } elseif {$el eq "trough2"} { |
| ScaleIncrement $w down little initial |
| } elseif {$el eq "slider"} { |
| set Priv(dragging) 1 |
| set Priv(initValue) [$w get] |
| set coords [$w coords] |
| set Priv(deltaX) [expr {$x - [lindex $coords 0]}] |
| set Priv(deltaY) [expr {$y - [lindex $coords 1]}] |
| switch -exact -- $Priv($w,relief) { |
| "raised" { $w configure -sliderrelief sunken } |
| "ridge" { $w configure -sliderrelief groove } |
| } |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScaleDrag {w x y} { |
| variable ::tk::Priv |
| if {!$Priv(dragging)} { |
| return |
| } |
| $w set [$w get [expr {$x-$Priv(deltaX)}] [expr {$y-$Priv(deltaY)}]] |
| } |
|
|
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScaleEndDrag {w} { |
| variable ::tk::Priv |
| set Priv(dragging) 0 |
| if {[info exists Priv($w,relief)]} { |
| $w configure -sliderrelief $Priv($w,relief) |
| unset Priv($w,relief) |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScaleIncrement {w dir big repeat} { |
| variable ::tk::Priv |
| if {![winfo exists $w]} return |
| if {$big eq "big"} { |
| set inc [$w cget -bigincrement] |
| if {$inc == 0} { |
| set inc [expr {abs([$w cget -to] - [$w cget -from])/10.0}] |
| } |
| if {$inc < [$w cget -resolution]} { |
| set inc [$w cget -resolution] |
| } |
| } else { |
| set inc [$w cget -resolution] |
| } |
| if {([$w cget -from] > [$w cget -to]) ^ ($dir eq "up")} { |
| if {$inc > 0} { |
| set inc [expr {-$inc}] |
| } |
| } else { |
| if {$inc < 0} { |
| set inc [expr {-$inc}] |
| } |
| } |
| $w set [expr {[$w get] + $inc}] |
|
|
| if {$repeat eq "again"} { |
| set Priv(afterId) [after [$w cget -repeatinterval] \ |
| [list tk::ScaleIncrement $w $dir $big again]] |
| } elseif {$repeat eq "initial"} { |
| set delay [$w cget -repeatdelay] |
| if {$delay > 0} { |
| set Priv(afterId) [after $delay \ |
| [list tk::ScaleIncrement $w $dir $big again]] |
| } |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScaleControlPress {w x y} { |
| set el [$w identify $x $y] |
| if {$el eq "trough1"} { |
| $w set [$w cget -from] |
| } elseif {$el eq "trough2"} { |
| $w set [$w cget -to] |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| proc ::tk::ScaleButton2Down {w x y} { |
| variable ::tk::Priv |
|
|
| if {[$w cget -state] eq "disabled"} { |
| return |
| } |
|
|
| $w configure -state active |
| $w set [$w get $x $y] |
| set Priv(dragging) 1 |
| set Priv(initValue) [$w get] |
| set Priv($w,relief) [$w cget -sliderrelief] |
| set coords "$x $y" |
| set Priv(deltaX) 0 |
| set Priv(deltaY) 0 |
| } |
|
|