chiark / gitweb /
keyboard shortcuts for set match context
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 3 Jul 2009 16:42:25 +0000 (17:42 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 3 Jul 2009 16:42:25 +0000 (17:42 +0100)
pctb/TODO
pctb/dictionary-manager

index 17c14b1c0d5aea08194a657b9a1d751cdb4e1ee6..3324436e41a194a09f114571dfff3d80f85990e7 100644 (file)
--- a/pctb/TODO
+++ b/pctb/TODO
@@ -1,7 +1,6 @@
 add UI option to dictionary-manager to make user specify which dictionary
   to add multi-context entries to
         - need to test that it actually works
 add UI option to dictionary-manager to make user specify which dictionary
   to add multi-context entries to
         - need to test that it actually works
-        - add keyboard shortcuts for specifying context
 
 install/test dictionary upload/approval
 write real uploader
 
 install/test dictionary upload/approval
 write real uploader
index cfb4a690498314997cc6f8ca37bc349301c6c0a2..fe794422708eaa066fded89bc3089393d5822d73 100755 (executable)
@@ -739,11 +739,25 @@ proc recursor/0 {} { recursor//01 0 }
 proc recursor/1 {} { recursor//01 1 }
 proc recursor//01 {z1} {
     global mul rhsmost_max cols glyphsdone cur_0 cur_1
 proc recursor/1 {} { recursor//01 1 }
 proc recursor//01 {z1} {
     global mul rhsmost_max cols glyphsdone cur_0 cur_1
+    global all_contexts
     upvar #0 cur_$z1 cur
     .d.csr.csr.l configure -text {adjust}
     place .d.csr.csr -x [expr {$cur*$mul - 7}]
 
     upvar #0 cur_$z1 cur
     .d.csr.csr.l configure -text {adjust}
     place .d.csr.csr -x [expr {$cur*$mul - 7}]
 
-    char_exactly_selctxts [char_get_definition_contexts]
+    set okctxts [char_get_definition_contexts]
+    char_exactly_selctxts $okctxts
+
+    foreach ctx [lsort [array names all_contexts]] {
+       set key [string range $ctx 0 0]
+       if {[lsearch -exact $okctxts $ctx] >= 0} {
+           bind_key [string tolower $key] [list set new_context $ctx]
+       } else {
+           bind_key [string tolower $key] {}
+       }
+       lappend context_help $key
+    }
+    set context_help [list [join $context_help " "] \
+                         {Set match context for new glyph.}]
 
     bind_key space { othercursor }
     bind_leftright_q cur_$z1 0 [expr {$cols-1}]
 
     bind_key space { othercursor }
     bind_leftright_q cur_$z1 0 [expr {$cols-1}]
@@ -755,13 +769,14 @@ proc recursor//01 {z1} {
     bind_key Return {
        char_start_define_text
     }
     bind_key Return {
        char_start_define_text
     }
-    helptext {
-       {{<- ->}   {move cursor, adjusting area to define}}
-       {Space     {switch to moving other cursor}}
-       {Return    {confirm location, enter letter(s)}}
-       {Backspace {switch to correcting earlier ocr}}
-       {Q         {quit and abandon OCR run}}
-    }
+    helptext [list                                             \
+       {{<- ->}   {move cursor, adjusting area to define}}     \
+       {Space     {switch to moving other cursor}}             \
+       {Return    {confirm location, enter letter(s)}}         \
+       {Backspace {switch to correcting earlier ocr}}          \
+       {Q         {quit and abandon OCR run}}                  \
+        $context_help                                          \
+                 ]
 }
 proc othercursor {} {
     global cur_mode
 }
 proc othercursor {} {
     global cur_mode