chiark / gitweb /
Permit Return instead of clicking on pixmap selection
[ypp-sc-tools.web-live.git] / pctb / dictionary-manager
index d9de00cb99da21296c1142952e15a2eb4961e23c..ad05c6b1760b343571a1bb3b052b57f17c2b8f82 100755 (executable)
@@ -145,6 +145,7 @@ static unsigned char csr_bits[] = {
 
     button .pe.ok -text OK
     pack .pe.grid .pe.ok -side left
+    bind .pe.ok <Key-Return> { .pe.ok invoke }
 
     pack .d.mi .d.ctx -side top -anchor w
     pack .d -fill x -padx 2 -pady 2
@@ -366,7 +367,9 @@ proc pixmap_select {ncol} {
        if {$col==$ncol} continue
        .pe.grid.l$col selection clear 0 end
     }
-    pixmap_maybe_ok
+    if {[pixmap_maybe_ok]} {
+       focus .pe.ok
+    }
 }
 proc pixmap_maybe_ok {} {
     global alloptions pixmap_selcol pixmap_selrow
@@ -382,8 +385,10 @@ proc pixmap_maybe_ok {} {
     if {$nsel==1} {
        debug "MAYBE_OK YES col=$pixmap_selcol row=$pixmap_selrow."
        .pe.ok configure -state normal -command pixmap_ok
+       return 1
     } else {
        .pe.ok configure -state disabled -command {}
+       return 0
     }
 }
 proc pixmap_ok {} {
@@ -452,7 +457,7 @@ proc required/pixmap {} {
     pixmap_maybe_ok
     
     helptext {
-       {{Indicate the meaning of this image, and click OK.}}
+       {{Indicate the meaning of this image; then click OK or hit Return.}}
     }
 }
 
@@ -731,7 +736,7 @@ proc startup_cursor {} {
     global glyphsdone unk_l unk_r
     
     set cur_already [expr {[llength $glyphsdone]/5-1}]
-    set cur_mode 1 ;# one of:   0 1 already text
+    set cur_mode 0 ;# one of:   0 1 already text
 
     set cur_0 $unk_l
     set cur_1 [expr {$unk_r+1}]
@@ -772,7 +777,7 @@ proc recursor//01 {z1} {
        if {[lsearch -exact $okctxts $ctx] >= 0} {
            bind_key [string tolower $key] "
                [list set new_context $ctx]
-                recursor
+               char_start_define_text
             "
        } else {
            bind_key [string tolower $key] {}
@@ -780,7 +785,7 @@ proc recursor//01 {z1} {
        lappend context_help $key
     }
     set context_help [list [join $context_help " "] \
-                         {Set match context for new glyph.}]
+      {Set match context for new glyph, confirm location, and start entry.}]
 
     bind_key space { othercursor }
     bind_leftright_q cur_$z1 0 [expr {$cols-1}]
@@ -1154,7 +1159,7 @@ proc approve_decompose_data {specdata} {
     uplevel 1 chop_counted key
     uplevel 1 chop_counted val
 
-    return [uplevel 1 {list $dict $def $image}]
+    return [uplevel 1 {list $dict $ctx $def $image}]
 }
 
 proc approve_compare {fd1 fd2} {
@@ -1249,6 +1254,8 @@ proc approve_check_server {} {
 
 proc approve_confirm {} {
     global approve_ixes approve_entryhow
+    .ok configure -state disabled
+    update idletasks
     approve_check_server
     foreach ix $approve_ixes {
        set how $approve_entryhow($ix)
@@ -1283,6 +1290,7 @@ proc approve_fetch_list {} {
 
     set approve_list [lsort -command approve_compare $approve_list]
     approve_show_page 0
+    .ok configure -state normal
 }
 
 proc main/approve {} {