summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--library/tkfbox.tcl42
2 files changed, 25 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 99297b9..d70f1fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
* library/tkfbox.tcl (IconList_Selection, IconList_Create):
(IconList_Arrange): Assorted tk_getOpenFile fixes. [part of Bug 600313]
+ (IconList_ShiftMotion1): Also fix shift-drag.
2005-01-12 Donal K. Fellows <donal.k.fellows@man.ac.uk>
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl
index 8bff977..5e5b630 100644
--- a/library/tkfbox.tcl
+++ b/library/tkfbox.tcl
@@ -11,7 +11,7 @@
# files by clicking on the file icons or by entering a filename
# in the "Filename:" entry.
#
-# RCS: @(#) $Id: tkfbox.tcl,v 1.49 2005/01/13 09:54:04 dkf Exp $
+# RCS: @(#) $Id: tkfbox.tcl,v 1.50 2005/01/13 10:16:14 dkf Exp $
#
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
#
@@ -38,9 +38,10 @@ proc ::tk::IconList {w args} {
}
proc ::tk::IconList_Index {w i} {
- upvar #0 ::tk::$w data
- upvar #0 ::tk::$w:itemList itemList
- if {![info exists data(list)]} {set data(list) {}}
+ upvar #0 ::tk::$w data ::tk::$w:itemList itemList
+ if {![info exists data(list)]} {
+ set data(list) {}
+ }
switch -regexp -- $i {
"^-?[0-9]+$" {
if { $i < 0 } {
@@ -64,7 +65,8 @@ proc ::tk::IconList_Index {w i} {
foreach {x y} [scan $i "@%d,%d"] {
break
}
- set item [$data(canvas) find closest $x $y]
+ set item [$data(canvas) find closest \
+ [$data(canvas) canvasx $x] [$data(canvas) canvasy $y]]
return [lindex [$data(canvas) itemcget $item -tags] 1]
}
}
@@ -261,6 +263,8 @@ proc ::tk::IconList_Create {w} {
[list tk::IconList_Double1 $w %x %y]
bind $data(canvas) <Control-B1-Motion> {;}
+ bind $data(canvas) <Shift-B1-Motion> \
+ [list tk::IconList_ShiftMotion1 $w %x %y]
bind $data(canvas) <Up> [list tk::IconList_UpDown $w -1]
bind $data(canvas) <Down> [list tk::IconList_UpDown $w 1]
@@ -540,9 +544,7 @@ proc ::tk::IconList_Btn1 {w x y} {
upvar ::tk::$w data
focus $data(canvas)
- set x [expr {int([$data(canvas) canvasx $x])}]
- set y [expr {int([$data(canvas) canvasy $y])}]
- set i [IconList_Index $w @${x},${y}]
+ set i [IconList_Index $w @$x,$y]
if {$i eq ""} return
IconList_Selection $w clear 0 end
IconList_Selection $w set $i
@@ -554,9 +556,7 @@ proc ::tk::IconList_CtrlBtn1 {w x y} {
if { $data(-multiple) } {
focus $data(canvas)
- set x [expr {int([$data(canvas) canvasx $x])}]
- set y [expr {int([$data(canvas) canvasy $y])}]
- set i [IconList_Index $w @${x},${y}]
+ set i [IconList_Index $w @$x,$y]
if {$i eq ""} return
if { [IconList_Selection $w includes $i] } {
IconList_Selection $w clear $i
@@ -572,9 +572,7 @@ proc ::tk::IconList_ShiftBtn1 {w x y} {
if { $data(-multiple) } {
focus $data(canvas)
- set x [expr {int([$data(canvas) canvasx $x])}]
- set y [expr {int([$data(canvas) canvasy $y])}]
- set i [IconList_Index $w @${x},${y}]
+ set i [IconList_Index $w @$x,$y]
if {$i eq ""} return
set a [IconList_Index $w anchor]
if { [string equal $a ""] } {
@@ -588,18 +586,26 @@ proc ::tk::IconList_ShiftBtn1 {w x y} {
# Gets called on button-1 motions
#
proc ::tk::IconList_Motion1 {w x y} {
- upvar ::tk::$w data
variable ::tk::Priv
set Priv(x) $x
set Priv(y) $y
- set x [expr {int([$data(canvas) canvasx $x])}]
- set y [expr {int([$data(canvas) canvasy $y])}]
- set i [IconList_Index $w @${x},${y}]
+ set i [IconList_Index $w @$x,$y]
if {$i eq ""} return
IconList_Selection $w clear 0 end
IconList_Selection $w set $i
}
+proc ::tk::IconList_ShiftMotion1 {w x y} {
+ upvar ::tk::$w data
+ variable ::tk::Priv
+ set Priv(x) $x
+ set Priv(y) $y
+ set i [IconList_Index $w @$x,$y]
+ if {$i eq ""} return
+ IconList_Selection $w clear 0 end
+ IconList_Selection $w set anchor $i
+}
+
proc ::tk::IconList_Double1 {w x y} {
upvar ::tk::$w data