diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | doc/event.n | 48 | ||||
-rw-r--r-- | library/entry.tcl | 4 | ||||
-rw-r--r-- | library/listbox.tcl | 4 | ||||
-rw-r--r-- | library/spinbox.tcl | 4 | ||||
-rw-r--r-- | library/text.tcl | 4 | ||||
-rw-r--r-- | library/tk.tcl | 77 | ||||
-rw-r--r-- | library/ttk/entry.tcl | 4 |
8 files changed, 100 insertions, 47 deletions
@@ -1,6 +1,8 @@ 2012-08-?? Jan Nijtmans <nijtmans@users.sf.net> * library/*.tcl: [Bug 3555644]: Better use of virtual events. + Pre-define 10 new Virtual events, and correct various + bindings according to the Mac OSX documentation. 2012-07-31 Donal K. Fellows <dkf@users.sf.net> diff --git a/doc/event.n b/doc/event.n index 214e6b7..f45a13f 100644 --- a/doc/event.n +++ b/doc/event.n @@ -373,6 +373,16 @@ selected contents. Move to the next item (i.e., visible character) in the current widget while deselecting any selected contents. .TP +\fB<<NextLine>>\fR +. +Move to the next line in the current widget while deselecting any selected +contents. +.TP +\fB<<NextPara>>\fR +. +Move to the next paragraph in the current widget while deselecting any +selected contents. +.TP \fB<<NextWord>>\fR . Move to the next group of items (i.e., visible word) in the current widget @@ -391,6 +401,16 @@ event has meaningful \fB%x\fR and \fB%y\fR substitutions). Move to the previous item (i.e., visible character) in the current widget while deselecting any selected contents. .TP +\fB<<PrevLine>>\fR +. +Move to the previous line in the current widget while deselecting any selected +contents. +.TP +\fB<<PrevPara>>\fR +. +Move to the previous paragraph in the current widget while deselecting any +selected contents. +.TP \fB<<PrevWindow>>\fR Traverse to the previous window. .TP @@ -402,6 +422,10 @@ while deselecting any selected contents. \fB<<Redo>>\fR Redo one undone action. .TP +\fB<<SelectAll>>\fR +. +Set the range of selected contents to the complete widget. +.TP \fB<<SelectLineEnd>>\fR . Move to the end of the line in the current widget while extending the range @@ -417,16 +441,40 @@ of selected contents. Move to the next item (i.e., visible character) in the current widget while extending the range of selected contents. .TP +\fB<<SelectNextLine>>\fR +. +Move to the next line in the current widget while extending the range of +selected contents. +.TP +\fB<<SelectNextPara>>\fR +. +Move to the next paragraph in the current widget while extending the range +of selected contents. +.TP \fB<<SelectNextWord>>\fR . Move to the next group of items (i.e., visible word) in the current widget while extending the range of selected contents. .TP +\fB<<SelectNone>>\fR +. +Reset the range of selected contents to be empty. +.TP \fB<<SelectPrevChar>>\fR . Move to the previous item (i.e., visible character) in the current widget while extending the range of selected contents. .TP +\fB<<SelectPrevLine>>\fR +. +Move to the previous line in the current widget while extending the range of +selected contents. +.TP +\fB<<SelectPrevPara>>\fR +. +Move to the previous paragraph in the current widget while extending the +range of selected contents. +.TP \fB<<SelectPrevWord>>\fR . Move to the previous group of items (i.e., visible word) in the current widget diff --git a/library/entry.tcl b/library/entry.tcl index 026363c..f28547e 100644 --- a/library/entry.tcl +++ b/library/entry.tcl @@ -185,10 +185,10 @@ bind Entry <Control-Shift-space> { bind Entry <Shift-Select> { %W selection adjust insert } -bind Entry <Control-slash> { +bind Entry <<SelectAll>> { %W selection range 0 end } -bind Entry <Control-backslash> { +bind Entry <<SelectNone>> { %W selection clear } bind Entry <KeyPress> { diff --git a/library/listbox.tcl b/library/listbox.tcl index 2715385..31d0fbb 100644 --- a/library/listbox.tcl +++ b/library/listbox.tcl @@ -154,10 +154,10 @@ bind Listbox <Shift-Select> { bind Listbox <Escape> { tk::ListboxCancel %W } -bind Listbox <Control-slash> { +bind Listbox <<SelectAll>> { tk::ListboxSelectAll %W } -bind Listbox <Control-backslash> { +bind Listbox <<SelectNone>> { if {[%W cget -selectmode] ne "browse"} { %W selection clear 0 end event generate %W <<ListboxSelect>> diff --git a/library/spinbox.tcl b/library/spinbox.tcl index 54d8fe6..06c002c 100644 --- a/library/spinbox.tcl +++ b/library/spinbox.tcl @@ -193,10 +193,10 @@ bind Spinbox <Control-Shift-space> { bind Spinbox <Shift-Select> { %W selection adjust insert } -bind Spinbox <Control-slash> { +bind Spinbox <<SelectAll>> { %W selection range 0 end } -bind Spinbox <Control-backslash> { +bind Spinbox <<SelectNone>> { %W selection clear } bind Spinbox <KeyPress> { diff --git a/library/text.tcl b/library/text.tcl index 94bb223..e59a86e 100644 --- a/library/text.tcl +++ b/library/text.tcl @@ -240,10 +240,10 @@ bind Text <Shift-Select> { set tk::Priv(selectMode) char tk::TextKeyExtend %W insert } -bind Text <Control-slash> { +bind Text <<SelectAll>> { %W tag add sel 1.0 end } -bind Text <Control-backslash> { +bind Text <<SelectNone>> { %W tag remove sel 1.0 end } bind Text <<Cut>> { diff --git a/library/tk.tcl b/library/tk.tcl index b810dc6..8a0e3ff 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -362,17 +362,19 @@ if {![llength [info command tk_chooseDirectory]]} { switch -exact -- [tk windowingsystem] { "x11" { - event add <<Cut>> <Control-Key-x> <Key-F20> <Control-Lock-Key-X> - event add <<Copy>> <Control-Key-c> <Key-F16> <Control-Lock-Key-C> - event add <<Paste>> <Control-Key-v> <Key-F18> <Control-Lock-Key-V> - event add <<PasteSelection>> <ButtonRelease-2> - event add <<Undo>> <Control-Key-z> <Control-Lock-Key-Z> - event add <<Redo>> <Control-Key-Z> <Control-Lock-Key-z> - event add <<ContextMenu>> <Button-3> + event add <<Cut>> <Control-Key-x> <Key-F20> <Control-Lock-Key-X> + event add <<Copy>> <Control-Key-c> <Key-F16> <Control-Lock-Key-C> + event add <<Paste>> <Control-Key-v> <Key-F18> <Control-Lock-Key-V> + event add <<PasteSelection>> <ButtonRelease-2> + event add <<Undo>> <Control-Key-z> <Control-Lock-Key-Z> + event add <<Redo>> <Control-Key-Z> <Control-Lock-Key-z> + event add <<ContextMenu>> <Button-3> if {[info exists tcl_platform(os)] && $tcl_platform(os) eq "Darwin"} { - event add <<ContextMenu>> <Button-2> + event add <<ContextMenu>> <Button-2> } + event add <<SelectAll>> <Control-Key-slash> + event add <<SelectNone>> <Control-Key-backslash> event add <<NextChar>> <Right> event add <<SelectNextChar>> <Shift-Right> event add <<PrevChar>> <Left> @@ -411,17 +413,16 @@ switch -exact -- [tk windowingsystem] { set ::tk::AlwaysShowSelection 1 } "win32" { - event add <<Cut>> <Control-Key-x> <Shift-Key-Delete> \ - <Control-Lock-Key-X> - event add <<Copy>> <Control-Key-c> <Control-Key-Insert> \ - <Control-Lock-Key-C> - event add <<Paste>> <Control-Key-v> <Shift-Key-Insert> \ - <Control-Lock-Key-V> - event add <<PasteSelection>> <ButtonRelease-2> - event add <<Undo>> <Control-Key-z> <Control-Lock-Key-Z> - event add <<Redo>> <Control-Key-y> <Control-Lock-Key-Y> - event add <<ContextMenu>> <Button-3> - + event add <<Cut>> <Control-Key-x> <Shift-Key-Delete> <Control-Lock-Key-X> + event add <<Copy>> <Control-Key-c> <Control-Key-Insert> <Control-Lock-Key-C> + event add <<Paste>> <Control-Key-v> <Shift-Key-Insert> <Control-Lock-Key-V> + event add <<PasteSelection>> <ButtonRelease-2> + event add <<Undo>> <Control-Key-z> <Control-Lock-Key-Z> + event add <<Redo>> <Control-Key-y> <Control-Lock-Key-Y> + event add <<ContextMenu>> <Button-3> + + event add <<SelectAll>> <Control-Key-slash> + event add <<SelectNone>> <Control-Key-backslash> event add <<NextChar>> <Right> event add <<SelectNextChar>> <Shift-Right> event add <<PrevChar>> <Left> @@ -444,35 +445,37 @@ switch -exact -- [tk windowingsystem] { event add <<SelectPrevPara>> <Shift-Control-Down> } "aqua" { - event add <<Cut>> <Command-Key-x> <Key-F2> <Control-Lock-Key-X> - event add <<Copy>> <Command-Key-c> <Key-F3> <Control-Lock-Key-C> - event add <<Paste>> <Command-Key-v> <Key-F4> <Control-Lock-Key-V> - event add <<PasteSelection>> <ButtonRelease-2> - event add <<Clear>> <Clear> - event add <<Undo>> <Command-Key-z> <Control-Lock-Key-Z> - event add <<Redo>> <Command-Key-y> <Control-Lock-Key-Y> - event add <<ContextMenu>> <Button-2> + event add <<Cut>> <Command-Key-x> <Key-F2> <Control-Lock-Key-X> + event add <<Copy>> <Command-Key-c> <Key-F3> <Control-Lock-Key-C> + event add <<Paste>> <Command-Key-v> <Key-F4> <Control-Lock-Key-V> + event add <<PasteSelection>> <ButtonRelease-2> + event add <<Clear>> <Clear> + event add <<ContextMenu>> <Button-2> # Official bindings # See http://support.apple.com/kb/HT1343 - event add <<NextChar>> <Right> + event add <<SelectAll>> <Command-Key-a> + event add <<SelectNone>> <Option-Command-Key-a> + event add <<Undo>> <Command-Key-z> <Control-Lock-Key-Z> + event add <<Redo>> <Command-Key-Z> <Control-Lock-Key-z> + event add <<NextChar>> <Right> <Control-Key-f> <Control-Lock-Key-F> event add <<SelectNextChar>> <Shift-Right> - event add <<PrevChar>> <Left> + event add <<PrevChar>> <Left> <Control-Key-b> <Control-Lock-Key-B> event add <<SelectPrevChar>> <Shift-Left> event add <<NextWord>> <Option-Right> event add <<SelectNextWord>> <Shift-Option-Right> event add <<PrevWord>> <Option-Left> event add <<SelectPrevWord>> <Shift-Option-Left> - event add <<SelectLineStart>> <Shift-Home> <Shift-Command-Left> - event add <<SelectLineEnd>> <Shift-End> <Shift-Command-Right> + event add <<LineStart>> <Home> <Command-Left> <Control-Key-a> <Control-Lock-Key-A> + event add <<SelectLineStart>> <Shift-Home> <Shift-Command-Left> <Control-Key-A> <Control-Lock-Key-a> + event add <<LineEnd>> <End> <Command-Right> <Control-Key-e> <Control-Lock-Key-E> + event add <<SelectLineEnd>> <Shift-End> <Shift-Command-Right> <Control-Key-E> <Control-Lock-Key-e> + event add <<PrevLine>> <Up> <Control-Key-p> <Control-Lock-Key-P> + event add <<SelectPrevLine>> <Shift-Up> <Control-Key-P> <Control-Lock-Key-p> + event add <<NextLine>> <Down> <Control-Key-n> <Control-Lock-Key-N> + event add <<SelectNextLine>> <Shift-Down> <Control-Key-N> <Control-Lock-Key-n> # Not official, but logical extensions of above. Also derived from # 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> diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl index dc835e9..22c4115 100644 --- a/library/ttk/entry.tcl +++ b/library/ttk/entry.tcl @@ -107,8 +107,8 @@ bind TEntry <<SelectNextWord>> { ttk::entry::Extend %W nextword } bind TEntry <<SelectLineStart>> { ttk::entry::Extend %W home } bind TEntry <<SelectLineEnd>> { ttk::entry::Extend %W end } -bind TEntry <Control-Key-slash> { %W selection range 0 end } -bind TEntry <Control-Key-backslash> { %W selection clear } +bind TEntry <<SelectAll>> { %W selection range 0 end } +bind TEntry <<SelectNone>> { %W selection clear } bind TEntry <<TraverseIn>> { %W selection range 0 end; %W icursor end } |