Revision: 7354
Author:   deton.kih
Date:     Mon Oct 31 04:10:32 2011
Log:      * scm/tutcode.scm
  - (tutcode-set-candidate-index-handler):
    Change to treat button click on virtual keyboard as key press.

http://code.google.com/p/uim/source/detail?r=7354

Modified:
 /trunk/scm/tutcode.scm

=======================================
--- /trunk/scm/tutcode.scm      Mon Oct 31 04:08:08 2011
+++ /trunk/scm/tutcode.scm      Mon Oct 31 04:10:32 2011
@@ -4817,7 +4817,18 @@
 ;;; ¥Ú¡¼¥¸°ÜưÁàºî¤¬¹Ô¤ï¤ì¤¿)¾ì¹ç¡¢ÆâÉô¤ÎÁªÂò¸õÊäÈÖ¹æ¤ò¹¹¿·¤¹¤ë¤À¤±¡£
 (define (tutcode-set-candidate-index-handler c idx)
   (let* ((pc (tutcode-find-descendant-context c))
-         (candwin (tutcode-context-candidate-window pc)))
+         (candwin (tutcode-context-candidate-window pc))
+         ;; ²¾ÁÛ¸°È×¾å¤Î¥¯¥ê¥Ã¥¯¤ò¥­¡¼ÆþÎϤȤ·¤Æ½èÍý(¥½¥Õ¥È¥­¡¼¥Ü¡¼¥É)
+         (label-to-key-press
+          (lambda (label)
+            (let ((key (string->ichar label)))
+              (if key
+                (tutcode-key-press-handler c key 0)))))
+         (candlist-to-key-press
+          (lambda (candlist)
+            (let* ((candlabel (list-ref candlist idx))
+                   (label (cadr candlabel)))
+              (label-to-key-press label)))))
     (cond
       ((and (memq candwin '(tutcode-candidate-window-converting
                             tutcode-candidate-window-kigou
@@ -4860,20 +4871,38 @@
            (prev-page (quotient prev page-limit))
            (new-page (quotient idx page-limit)))
           (tutcode-context-set-prediction-index! pc idx)
-          (if (and (= new-page prev-page)
-                   (< idx-in-page nr-in-page))
-            (let*
-              ((nr-predictions (tutcode-lib-get-nr-predictions pc))
-               (p-idx (+ idx-in-page (* new-page nr-in-page)))
-               (i (remainder p-idx nr-predictions))
-               (mode (tutcode-context-predicting pc)))
-              (if (eq? candwin 'tutcode-candidate-window-interactive-bushu)
-                (tutcode-do-commit-prediction-for-interactive-bushu pc i)
-                (if (eq? mode 'tutcode-predicting-bushu)
-                  (tutcode-do-commit-prediction-for-bushu pc i)
-                  (tutcode-do-commit-prediction pc i
-                    (eq? mode 'tutcode-predicting-completion))))))
-          (tutcode-update-preedit pc))))))
+          (if (= new-page prev-page)
+            (if (< idx-in-page nr-in-page)
+              (let*
+                ((nr-predictions (tutcode-lib-get-nr-predictions pc))
+                 (p-idx (+ idx-in-page (* new-page nr-in-page)))
+                 (i (remainder p-idx nr-predictions))
+                 (mode (tutcode-context-predicting pc)))
+ (if (eq? candwin 'tutcode-candidate-window-interactive-bushu)
+                  (tutcode-do-commit-prediction-for-interactive-bushu pc i)
+                  (if (eq? mode 'tutcode-predicting-bushu)
+                    (tutcode-do-commit-prediction-for-bushu pc i)
+                    (tutcode-do-commit-prediction pc i
+                      (eq? mode 'tutcode-predicting-completion)))))
+              ;; ½Ï¸ì¥¬¥¤¥É
+              (let*
+                ((guide (tutcode-context-guide pc))
+                 (guide-len (length guide)))
+                (if (positive? guide-len)
+                  (let*
+                    ((guide-idx-in-page (- idx-in-page nr-in-page))
+                     (nr-guide-in-page (- page-limit nr-in-page))
+                     (guide-idx (+ guide-idx-in-page
+                                   (* new-page nr-guide-in-page)))
+                     (n (remainder guide-idx guide-len))
+                     (label-cands-alist (nth n guide))
+                     (label (car label-cands-alist)))
+                    (label-to-key-press label))))))
+          (tutcode-update-preedit pc)))
+        ((eq? candwin 'tutcode-candidate-window-stroke-help)
+          (candlist-to-key-press (tutcode-context-stroke-help pc)))
+        ((eq? candwin 'tutcode-candidate-window-auto-help)
+          (candlist-to-key-press (tutcode-context-auto-help pc))))))

 ;;; ÃÙ±äɽ¼¨¤ËÂбþ¤·¤Æ¤¤¤ë¸õÊ䥦¥£¥ó¥É¥¦¤¬¡¢ÂÔ¤Á»þ´ÖËþλ»þ¤Ë
 ;;; (¸õÊä¿ô¡¢¥Ú¡¼¥¸Æâ¸õÊäɽ¼¨¿ô¡¢ÁªÂò¤µ¤ì¤¿¥¤¥ó¥Ç¥Ã¥¯¥¹ÈÖ¹æ)¤ò

Reply via email to