diff options
author | nijtmans@users.sourceforge.net <jan.nijtmans> | 2012-08-09 14:59:12 (GMT) |
---|---|---|
committer | nijtmans@users.sourceforge.net <jan.nijtmans> | 2012-08-09 14:59:12 (GMT) |
commit | 8d7ac108d7cd591e1a0923757509c62cfeb1a2f3 (patch) | |
tree | 57746efe1742520b75333e90185f5f1680880270 /library | |
parent | 3a12127fdd022a3270c878b9db842f75d29e3f5c (diff) | |
download | tk-8d7ac108d7cd591e1a0923757509c62cfeb1a2f3.zip tk-8d7ac108d7cd591e1a0923757509c62cfeb1a2f3.tar.gz tk-8d7ac108d7cd591e1a0923757509c62cfeb1a2f3.tar.bz2 |
8 new virtual events (doc not updated yet)
Diffstat (limited to 'library')
-rw-r--r-- | library/demos/items.tcl | 2 | ||||
-rw-r--r-- | library/entry.tcl | 14 | ||||
-rw-r--r-- | library/iconlist.tcl | 4 | ||||
-rw-r--r-- | library/listbox.tcl | 8 | ||||
-rw-r--r-- | library/menu.tcl | 4 | ||||
-rw-r--r-- | library/scale.tcl | 8 | ||||
-rw-r--r-- | library/scrlbar.tcl | 8 | ||||
-rw-r--r-- | library/spinbox.tcl | 14 | ||||
-rw-r--r-- | library/text.tcl | 48 | ||||
-rw-r--r-- | library/tk.tcl | 28 | ||||
-rw-r--r-- | library/ttk/entry.tcl | 4 | ||||
-rw-r--r-- | library/ttk/scale.tcl | 8 |
12 files changed, 63 insertions, 87 deletions
diff --git a/library/demos/items.tcl b/library/demos/items.tcl index 31a1570..177e9a4 100644 --- a/library/demos/items.tcl +++ b/library/demos/items.tcl @@ -173,7 +173,7 @@ bind $c <2> "$c scan mark %x %y" bind $c <B2-Motion> "$c scan dragto %x %y" bind $c <3> "itemMark $c %x %y" bind $c <B3-Motion> "itemStroke $c %x %y" -bind $c <Control-f> "itemsUnderArea $c" +bind $c <<NextChar>> "itemsUnderArea $c" bind $c <1> "itemStartDrag $c %x %y" bind $c <B1-Motion> "itemDrag $c %x %y" diff --git a/library/entry.tcl b/library/entry.tcl index 5dbf063..026363c 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -214,8 +214,8 @@ if {[tk windowingsystem] eq "aqua"} { bind Entry <Command-KeyPress> {# nothing} } # Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] -bind Entry <Down> {# nothing} -bind Entry <Up> {# nothing} +bind Entry <<NextLine>> {# nothing} +bind Entry <<PrevLine>> {# nothing} # On Windows, paste is done using Shift-Insert. Shift-Insert already # generates the <<Paste>> event, so we don't need to do anything here. @@ -227,21 +227,11 @@ if {[tk windowingsystem] ne "win32"} { # Additional emacs-like bindings: -bind Entry <Control-b> { - if {!$tk_strictMotif} { - tk::EntrySetCursor %W [expr {[%W index insert] - 1}] - } -} bind Entry <Control-d> { if {!$tk_strictMotif} { %W delete insert } } -bind Entry <Control-f> { - if {!$tk_strictMotif} { - tk::EntrySetCursor %W [expr {[%W index insert] + 1}] - } -} bind Entry <Control-h> { if {!$tk_strictMotif} { tk::EntryBackspace %W diff --git a/library/iconlist.tcl b/library/iconlist.tcl index 15a4f53..ce1aae2 100644 --- a/library/iconlist.tcl +++ b/library/iconlist.tcl @@ -444,8 +444,8 @@ package require Tk 8.6 bind $canvas <Control-B1-Motion> {;} bind $canvas <Shift-B1-Motion> [namespace code {my ShiftMotion1 %x %y}] - bind $canvas <Up> [namespace code {my UpDown -1}] - bind $canvas <Down> [namespace code {my UpDown 1}] + bind $canvas <<PrevLine>> [namespace code {my UpDown -1}] + bind $canvas <<NextLine>> [namespace code {my UpDown 1}] bind $canvas <<PrevChar>> [namespace code {my LeftRight -1}] bind $canvas <<NextChar>> [namespace code {my LeftRight 1}] bind $canvas <Return> [namespace code {my ReturnKey}] diff --git a/library/listbox.tcl b/library/listbox.tcl index eae513a..2715385 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -69,16 +69,16 @@ bind Listbox <B1-Enter> { tk::CancelRepeat } -bind Listbox <Up> { +bind Listbox <<PrevLine>> { tk::ListboxUpDown %W -1 } -bind Listbox <Shift-Up> { +bind Listbox <<SelectPrevLine>> { tk::ListboxExtendUpDown %W -1 } -bind Listbox <Down> { +bind Listbox <<NextLine>> { tk::ListboxUpDown %W 1 } -bind Listbox <Shift-Down> { +bind Listbox <<SelectNextLine>> { tk::ListboxExtendUpDown %W 1 } bind Listbox <<PrevChar>> { diff --git a/library/menu.tcl b/library/menu.tcl index 8261e82..a51c96f 100644 --- a/library/menu.tcl +++ b/library/menu.tcl @@ -155,10 +155,10 @@ bind Menu <<PrevChar>> { bind Menu <<NextChar>> { tk::MenuRightArrow %W } -bind Menu <Up> { +bind Menu <<PrevLine>> { tk::MenuUpArrow %W } -bind Menu <Down> { +bind Menu <<NextLine>> { tk::MenuDownArrow %W } bind Menu <KeyPress> { diff --git a/library/scale.tcl b/library/scale.tcl index 72a254a..d9e7d27 100644 --- a/library/scale.tcl +++ b/library/scale.tcl @@ -71,10 +71,10 @@ if {[tk windowingsystem] eq "win32"} { bind Scale <Control-1> { tk::ScaleControlPress %W %x %y } -bind Scale <Up> { +bind Scale <<PrevLine>> { tk::ScaleIncrement %W up little noRepeat } -bind Scale <Down> { +bind Scale <<NextLine>> { tk::ScaleIncrement %W down little noRepeat } bind Scale <<PrevChar>> { @@ -83,10 +83,10 @@ bind Scale <<PrevChar>> { bind Scale <<NextChar>> { tk::ScaleIncrement %W down little noRepeat } -bind Scale <Control-Up> { +bind Scale <<PrevPara>> { tk::ScaleIncrement %W up big noRepeat } -bind Scale <Control-Down> { +bind Scale <<NextPara>> { tk::ScaleIncrement %W down big noRepeat } bind Scale <<PrevWord>> { diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl index 4a16f0b..1f8c7d2 100644 --- a/library/scrlbar.tcl +++ b/library/scrlbar.tcl @@ -91,16 +91,16 @@ bind Scrollbar <Control-2> { tk::ScrollTopBottom %W %x %y } -bind Scrollbar <Up> { +bind Scrollbar <<PrevLine>> { tk::ScrollByUnits %W v -1 } -bind Scrollbar <Down> { +bind Scrollbar <<NextLine>> { tk::ScrollByUnits %W v 1 } -bind Scrollbar <Control-Up> { +bind Scrollbar <<PrevPara>> { tk::ScrollByPages %W v -1 } -bind Scrollbar <Control-Down> { +bind Scrollbar <<NextPara>> { tk::ScrollByPages %W v 1 } bind Scrollbar <<PrevChar>> { diff --git a/library/spinbox.tcl b/library/spinbox.tcl index d5b4d79..54d8fe6 100644 --- a/library/spinbox.tcl +++ b/library/spinbox.tcl @@ -120,10 +120,10 @@ bind Spinbox <Control-1> { %W icursor @%x } -bind Spinbox <Up> { +bind Spinbox <<PrevLine>> { %W invoke buttonup } -bind Spinbox <Down> { +bind Spinbox <<NextLine>> { %W invoke buttondown } @@ -231,21 +231,11 @@ if {[tk windowingsystem] ne "win32"} { # Additional emacs-like bindings: -bind Spinbox <Control-b> { - if {!$tk_strictMotif} { - ::tk::EntrySetCursor %W [expr {[%W index insert] - 1}] - } -} bind Spinbox <Control-d> { if {!$tk_strictMotif} { %W delete insert } } -bind Spinbox <Control-f> { - if {!$tk_strictMotif} { - ::tk::EntrySetCursor %W [expr {[%W index insert] + 1}] - } -} bind Spinbox <Control-h> { if {!$tk_strictMotif} { ::tk::EntryBackspace %W diff --git a/library/text.tcl b/library/text.tcl index a71150a..94bb223 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -92,10 +92,10 @@ bind Text <<PrevChar>> { bind Text <<NextChar>> { tk::TextSetCursor %W insert+1displayindices } -bind Text <Up> { +bind Text <<PrevLine>> { tk::TextSetCursor %W [tk::TextUpDownLine %W -1] } -bind Text <Down> { +bind Text <<NextLine>> { tk::TextSetCursor %W [tk::TextUpDownLine %W 1] } bind Text <<SelectPrevChar>> { @@ -104,10 +104,10 @@ bind Text <<SelectPrevChar>> { bind Text <<SelectNextChar>> { tk::TextKeySelect %W [%W index {insert + 1displayindices}] } -bind Text <Shift-Up> { +bind Text <<SelectPrevLine>> { tk::TextKeySelect %W [tk::TextUpDownLine %W -1] } -bind Text <Shift-Down> { +bind Text <<SelectNextLine>> { tk::TextKeySelect %W [tk::TextUpDownLine %W 1] } bind Text <<PrevWord>> { @@ -116,10 +116,10 @@ bind Text <<PrevWord>> { bind Text <<NextWord>> { tk::TextSetCursor %W [tk::TextNextWord %W insert] } -bind Text <Control-Up> { +bind Text <<PrevPara>> { tk::TextSetCursor %W [tk::TextPrevPara %W insert] } -bind Text <Control-Down> { +bind Text <<NextPara>> { tk::TextSetCursor %W [tk::TextNextPara %W insert] } bind Text <<SelectPrevWord>> { @@ -128,10 +128,10 @@ bind Text <<SelectPrevWord>> { bind Text <<SelectNextWord>> { tk::TextKeySelect %W [tk::TextNextWord %W insert] } -bind Text <Shift-Control-Up> { +bind Text <<SelectPrevPara>> { tk::TextKeySelect %W [tk::TextPrevPara %W insert] } -bind Text <Shift-Control-Down> { +bind Text <<SelectNextPara>> { tk::TextKeySelect %W [tk::TextNextPara %W insert] } bind Text <Prior> { @@ -287,21 +287,11 @@ if {[tk windowingsystem] eq "aqua"} { # Additional emacs-like bindings: -bind Text <Control-b> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W insert-1displayindices - } -} bind Text <Control-d> { if {!$tk_strictMotif && [%W compare end != insert+1c]} { %W delete insert } } -bind Text <Control-f> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W insert+1displayindices - } -} bind Text <Control-k> { if {!$tk_strictMotif && [%W compare end != insert+1c]} { if {[%W compare insert == {insert lineend}]} { @@ -311,22 +301,12 @@ bind Text <Control-k> { } } } -bind Text <Control-n> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W [tk::TextUpDownLine %W 1] - } -} bind Text <Control-o> { if {!$tk_strictMotif} { %W insert insert \n %W mark set insert insert-1c } } -bind Text <Control-p> { - if {!$tk_strictMotif} { - tk::TextSetCursor %W [tk::TextUpDownLine %W -1] - } -} bind Text <Control-t> { if {!$tk_strictMotif} { tk::TextTranspose %W @@ -380,18 +360,6 @@ bind Text <Meta-Delete> { # Macintosh only bindings: if {[tk windowingsystem] eq "aqua"} { -bind Text <Option-Up> { - tk::TextSetCursor %W [tk::TextPrevPara %W insert] -} -bind Text <Option-Down> { - tk::TextSetCursor %W [tk::TextNextPara %W insert] -} -bind Text <Shift-Option-Up> { - tk::TextKeySelect %W [tk::TextPrevPara %W insert] -} -bind Text <Shift-Option-Down> { - tk::TextKeySelect %W [tk::TextNextPara %W insert] -} bind Text <<Paste>> { tk::TextScrollPages %W 1 } diff --git a/library/tk.tcl b/library/tk.tcl index 33671ed..b810dc6 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -311,6 +311,10 @@ proc ::tk::EventMotifBindings {n1 dummy dummy} { event $op <<Copy>> <Meta-Key-w> event $op <<Paste>> <Control-Key-y> event $op <<Undo>> <Control-underscore> + event $op <<PrevChar>> <Control-Key-b> + event $op <<NextChar>> <Control-Key-f> + event $op <<PrevLine>> <Control-Key-p> + event $op <<NextLine>> <Control-Key-n> } #---------------------------------------------------------------------- @@ -381,6 +385,14 @@ switch -exact -- [tk windowingsystem] { event add <<SelectLineStart>> <Shift-Home> event add <<LineEnd>> <End> <Control-Key-e> <Control-Lock-Key-E> event add <<SelectLineEnd>> <Shift-End> + event add <<PrevLine>> <Up> + event add <<NextLine>> <Down> + event add <<SelectPrevLine>> <Shift-Up> + event add <<SelectNextLine>> <Shift-Down> + event add <<PrevPara>> <Control-Up> + event add <<NextPara>> <Control-Down> + event add <<SelectPrevPara>> <Shift-Control-Up> + event add <<SelectPrevPara>> <Shift-Control-Down> # Some OS's define a goofy (as in, not <Shift-Tab>) keysym that is # returned when the user presses <Shift-Tab>. In order for tab @@ -422,6 +434,14 @@ switch -exact -- [tk windowingsystem] { event add <<SelectLineStart>> <Shift-Home> event add <<LineEnd>> <End> <Control-Key-e> <Control-Lock-Key-E> event add <<SelectLineEnd>> <Shift-End> + event add <<PrevLine>> <Up> + event add <<NextLine>> <Down> + event add <<SelectPrevLine>> <Shift-Up> + event add <<SelectNextLine>> <Shift-Down> + event add <<PrevPara>> <Control-Up> + event add <<NextPara>> <Control-Down> + event add <<SelectPrevPara>> <Shift-Control-Up> + event add <<SelectPrevPara>> <Shift-Control-Down> } "aqua" { event add <<Cut>> <Command-Key-x> <Key-F2> <Control-Lock-Key-X> @@ -449,6 +469,14 @@ switch -exact -- [tk windowingsystem] { # bindings present in MS Word on OSX. event add <<LineStart>> <Home> <Command-Left> <Command-Key-a> <Control-Lock-Key-A> event add <<LineEnd>> <End> <Command-Right> <Command-Key-e> <Control-Lock-Key-E> + event add <<PrevLine>> <Up> + event add <<NextLine>> <Down> + event add <<SelectPrevLine>> <Shift-Up> + event add <<SelectNextLine>> <Shift-Down> + event add <<PrevPara>> <Option-Up> + event add <<NextPara>> <Option-Down> + event add <<SelectPrevPara>> <Shift-Option-Up> + event add <<SelectPrevPara>> <Shift-Option-Down> } } diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl index 9e0d6e1..dc835e9 100644 --- a/library/ttk/entry.tcl +++ b/library/ttk/entry.tcl @@ -136,8 +136,8 @@ if {[tk windowingsystem] eq "aqua"} { bind TEntry <Command-KeyPress> {# nothing} } # Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] -bind TEntry <Down> {# nothing} -bind TEntry <Up> {# nothing} +bind TEntry <<PrevLine>> {# nothing} +bind TEntry <<NextLine>> {# nothing} ## Additional emacs-like bindings: # diff --git a/library/ttk/scale.tcl b/library/ttk/scale.tcl index f270697..69b9dd8 100644 --- a/library/ttk/scale.tcl +++ b/library/ttk/scale.tcl @@ -27,13 +27,13 @@ bind TScale <<LineStart>> { %W set [%W cget -from] } bind TScale <<LineEnd>> { %W set [%W cget -to] } bind TScale <<PrevChar>> { ttk::scale::Increment %W -1 } -bind TScale <Up> { ttk::scale::Increment %W -1 } +bind TScale <<PrevLine>> { ttk::scale::Increment %W -1 } bind TScale <<NextChar>> { ttk::scale::Increment %W 1 } -bind TScale <Down> { ttk::scale::Increment %W 1 } +bind TScale <<NextLine>> { ttk::scale::Increment %W 1 } bind TScale <<PrevWord>> { ttk::scale::Increment %W -10 } -bind TScale <Control-Up> { ttk::scale::Increment %W -10 } +bind TScale <<PrevPara>> { ttk::scale::Increment %W -10 } bind TScale <<NextWord>> { ttk::scale::Increment %W 10 } -bind TScale <Control-Down> { ttk::scale::Increment %W 10 } +bind TScale <<NextPara>> { ttk::scale::Increment %W 10 } proc ttk::scale::Press {w x y} { variable State |