diff options
Diffstat (limited to 'library/demos')
-rw-r--r-- | library/demos/cscroll.tcl | 20 | ||||
-rw-r--r-- | library/demos/ctext.tcl | 6 | ||||
-rw-r--r-- | library/demos/floor.tcl | 9 | ||||
-rw-r--r-- | library/demos/items.tcl | 17 |
4 files changed, 38 insertions, 14 deletions
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl index c0c30ee..f906c7d 100644 --- a/library/demos/cscroll.tcl +++ b/library/demos/cscroll.tcl @@ -56,9 +56,9 @@ for {set i 0} {$i < 20} {incr i} { $c bind all <Enter> "scrollEnter $c" $c bind all <Leave> "scrollLeave $c" $c bind all <Button-1> "scrollButton $c" -bind $c <Button-2> "$c scan mark %x %y" -bind $c <B2-Motion> "$c scan dragto %x %y" if {[tk windowingsystem] eq "aqua"} { + bind $c <Button-3> "$c scan mark %x %y" + bind $c <B3-Motion> "$c scan dragto %x %y" bind $c <MouseWheel> { %W yview scroll [expr {-(%D)}] units } @@ -72,6 +72,8 @@ if {[tk windowingsystem] eq "aqua"} { %W xview scroll [expr {-10 * (%D)}] units } } else { + bind $c <Button-2> "$c scan mark %x %y" + bind $c <B2-Motion> "$c scan dragto %x %y" # We must make sure that positive and negative movements are rounded # equally to integers, avoiding the problem that # (int)1/30 = 0, @@ -80,18 +82,24 @@ if {[tk windowingsystem] eq "aqua"} { # The following code ensure equal +/- behaviour. bind $c <MouseWheel> { if {%D >= 0} { - %W yview scroll [expr {-%D/30}] units + %W yview scroll [expr {%D/-30}] units } else { - %W yview scroll [expr {(29-%D)/30}] units + %W yview scroll [expr {(%D-29)/-30}] units } } + bind $c <Option-MouseWheel> { + %W yview scroll [expr {%D/-3}] units + } bind $c <Shift-MouseWheel> { if {%D >= 0} { - %W xview scroll [expr {-%D/30}] units + %W xview scroll [expr {%D/-30}] units } else { - %W xview scroll [expr {(29-%D)/30}] units + %W xview scroll [expr {(%D-29)/-30}] units } } + bind $c <Shift-Option-MouseWheel> { + %W xview scroll [expr {%D/-3}] units + } } if {[tk windowingsystem] eq "x11"} { diff --git a/library/demos/ctext.tcl b/library/demos/ctext.tcl index 502c9d0..5acc82f 100644 --- a/library/demos/ctext.tcl +++ b/library/demos/ctext.tcl @@ -50,7 +50,11 @@ $c bind text <Return> "textInsert $c \\n" $c bind text <Control-h> "textBs $c" $c bind text <BackSpace> "textBs $c" $c bind text <Delete> "textDel $c" -$c bind text <Button-2> "textPaste $c @%x,%y" +if {[tk windowingsystem] eq "aqua"} { + $c bind text <Button-3> "textPaste $c @%x,%y" +} else { + $c bind text <Button-2> "textPaste $c @%x,%y" +} # Next, create some items that allow the text's anchor position # to be edited. diff --git a/library/demos/floor.tcl b/library/demos/floor.tcl index b5d3c64..37e1b95 100644 --- a/library/demos/floor.tcl +++ b/library/demos/floor.tcl @@ -1359,8 +1359,13 @@ $c bind floor2 <Button-1> "floorDisplay $c 2" $c bind floor3 <Button-1> "floorDisplay $c 3" $c bind room <Enter> "newRoom $c" $c bind room <Leave> {set currentRoom ""} -bind $c <Button-2> "$c scan mark %x %y" -bind $c <B2-Motion> "$c scan dragto %x %y" +if {[tk windowingsystem] eq "aqua"} { + bind $c <Button-3> "$c scan mark %x %y" + bind $c <B3-Motion> "$c scan dragto %x %y" +} else { + bind $c <Button-2> "$c scan mark %x %y" + bind $c <B2-Motion> "$c scan dragto %x %y" +} bind $c <Destroy> "unset currentRoom" set currentRoom "" trace variable currentRoom w "roomChanged $c" diff --git a/library/demos/items.tcl b/library/demos/items.tcl index 30fda5c..545877c 100644 --- a/library/demos/items.tcl +++ b/library/demos/items.tcl @@ -17,7 +17,7 @@ wm iconname $w "Items" positionWindow $w set c $w.frame.c -label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Button-1 drag:\tmoves item under pointer.\n Button-2 drag:\trepositions view.\n Button-3 drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area." +label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Left-Button drag:\tmoves item under pointer.\n Middle-Button drag:\trepositions view.\n Right-Button drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area." pack $w.msg -side top ## See Code / Dismiss buttons @@ -173,10 +173,17 @@ $c create text 28.5c 17.4c -text Scale: -anchor s $c bind item <Enter> "itemEnter $c" $c bind item <Leave> "itemLeave $c" -bind $c <Button-2> "$c scan mark %x %y" -bind $c <B2-Motion> "$c scan dragto %x %y" -bind $c <Button-3> "itemMark $c %x %y" -bind $c <B3-Motion> "itemStroke $c %x %y" +if {[tk windowingsystem] eq "aqua"} { + bind $c <Button-2> "itemMark $c %x %y" + bind $c <B2-Motion> "itemStroke $c %x %y" + bind $c <Button-3> "$c scan mark %x %y" + bind $c <B3-Motion> "$c scan dragto %x %y" +} else { + bind $c <Button-2> "$c scan mark %x %y" + bind $c <B2-Motion> "$c scan dragto %x %y" + bind $c <Button-3> "itemMark $c %x %y" + bind $c <B3-Motion> "itemStroke $c %x %y" +} bind $c <<NextChar>> "itemsUnderArea $c" bind $c <Button-1> "itemStartDrag $c %x %y" bind $c <B1-Motion> "itemDrag $c %x %y" |