From b7a61d63d4aabbd30586eea219f7402f3da61ac6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 10 Aug 2012 10:20:50 +0000 Subject: define two more virtual bindings, and correct various Mac bindings according to Apple OSX documentation. Doc updated as well --- ChangeLog | 2 ++ doc/event.n | 48 ++++++++++++++++++++++++++++++++ library/entry.tcl | 4 +-- library/listbox.tcl | 4 +-- library/spinbox.tcl | 4 +-- library/text.tcl | 4 +-- library/tk.tcl | 77 ++++++++++++++++++++++++++------------------------- library/ttk/entry.tcl | 4 +-- 8 files changed, 100 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3b3e1aa..92088bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2012-08-?? Jan Nijtmans * 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 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<>\fR +. +Move to the next line in the current widget while deselecting any selected +contents. +.TP +\fB<>\fR +. +Move to the next paragraph in the current widget while deselecting any +selected contents. +.TP \fB<>\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<>\fR +. +Move to the previous line in the current widget while deselecting any selected +contents. +.TP +\fB<>\fR +. +Move to the previous paragraph in the current widget while deselecting any +selected contents. +.TP \fB<>\fR Traverse to the previous window. .TP @@ -402,6 +422,10 @@ while deselecting any selected contents. \fB<>\fR Redo one undone action. .TP +\fB<>\fR +. +Set the range of selected contents to the complete widget. +.TP \fB<>\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<>\fR +. +Move to the next line in the current widget while extending the range of +selected contents. +.TP +\fB<>\fR +. +Move to the next paragraph in the current widget while extending the range +of selected contents. +.TP \fB<>\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<>\fR +. +Reset the range of selected contents to be empty. +.TP \fB<>\fR . Move to the previous item (i.e., visible character) in the current widget while extending the range of selected contents. .TP +\fB<>\fR +. +Move to the previous line in the current widget while extending the range of +selected contents. +.TP +\fB<>\fR +. +Move to the previous paragraph in the current widget while extending the +range of selected contents. +.TP \fB<>\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 { bind Entry { %W selection adjust insert } -bind Entry { +bind Entry <> { %W selection range 0 end } -bind Entry { +bind Entry <> { %W selection clear } bind Entry { 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 { bind Listbox { tk::ListboxCancel %W } -bind Listbox { +bind Listbox <> { tk::ListboxSelectAll %W } -bind Listbox { +bind Listbox <> { if {[%W cget -selectmode] ne "browse"} { %W selection clear 0 end event generate %W <> 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 { bind Spinbox { %W selection adjust insert } -bind Spinbox { +bind Spinbox <> { %W selection range 0 end } -bind Spinbox { +bind Spinbox <> { %W selection clear } bind Spinbox { 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 { set tk::Priv(selectMode) char tk::TextKeyExtend %W insert } -bind Text { +bind Text <> { %W tag add sel 1.0 end } -bind Text { +bind Text <> { %W tag remove sel 1.0 end } bind Text <> { 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 <> - event add <> - event add <> - event add <> - event add <> - event add <> - event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> if {[info exists tcl_platform(os)] && $tcl_platform(os) eq "Darwin"} { - event add <> + event add <> } + event add <> + event add <> event add <> event add <> event add <> @@ -411,17 +413,16 @@ switch -exact -- [tk windowingsystem] { set ::tk::AlwaysShowSelection 1 } "win32" { - event add <> \ - - event add <> \ - - event add <> \ - - event add <> - event add <> - event add <> - event add <> - + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + + event add <> + event add <> event add <> event add <> event add <> @@ -444,35 +445,37 @@ switch -exact -- [tk windowingsystem] { event add <> } "aqua" { - event add <> - event add <> - event add <> - event add <> - event add <> - event add <> - event add <> - event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> # Official bindings # See http://support.apple.com/kb/HT1343 - event add <> + event add <> + event add <> + event add <> + event add <> + event add <> event add <> - event add <> + event add <> event add <> event add <> event add <> event add <> event add <> - event add <> - event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> + event add <> # Not official, but logical extensions of above. Also derived from # bindings present in MS Word on OSX. - event add <> - event add <> - event add <> - event add <> - event add <> - event add <> event add <> event add <> event add <> 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 <> { ttk::entry::Extend %W nextword } bind TEntry <> { ttk::entry::Extend %W home } bind TEntry <> { ttk::entry::Extend %W end } -bind TEntry { %W selection range 0 end } -bind TEntry { %W selection clear } +bind TEntry <> { %W selection range 0 end } +bind TEntry <> { %W selection clear } bind TEntry <> { %W selection range 0 end; %W icursor end } -- cgit v0.12