Revision: 6343
Author: ek.kato
Date: Mon Apr 26 23:25:31 2010
Log: * scm/prime-custom.scm
  - (prime-custom-display-usage?)
  - (prime-custom-display-comment?)
  - (prime-custom-display-form?)
    - Add custom-activity-hooks on enable-annotation?
* scm/prime.scm
  - (prime-get-candidate-handler) : Set candidate string and
    annotation string separately.
  - (prime-candidate-combine-string) : Removed.
  - (prime-candidate-combine-annotation) : New.

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

Modified:
 /trunk/scm/prime-custom.scm
 /trunk/scm/prime.scm

=======================================
--- /trunk/scm/prime-custom.scm Sun Apr  4 20:35:54 2010
+++ /trunk/scm/prime-custom.scm Mon Apr 26 23:25:31 2010
@@ -174,6 +174,19 @@
   (N_ "Show candidate forms")
   (N_ "long description will be here."))

+(custom-add-hook 'prime-custom-display-usage?
+  'custom-activity-hooks
+  (lambda ()
+    enable-annotation?))
+(custom-add-hook 'prime-custom-display-comment?
+  'custom-activity-hooks
+  (lambda ()
+    enable-annotation?))
+(custom-add-hook 'prime-custom-display-form?
+  'custom-activity-hooks
+  (lambda ()
+    enable-annotation?))
+
 ;; ------------------------------------------------------------

 (define-custom 'prime-custom-number-selection? #f
=======================================
--- /trunk/scm/prime.scm        Sun Apr  4 20:35:54 2010
+++ /trunk/scm/prime.scm        Mon Apr 26 23:25:31 2010
@@ -2255,28 +2255,31 @@
               (nth index-no (prime-context-segment-candidates context))
               (nth index-no (prime-context-candidates context)))))
;; The return value is a list with a candidate string and the next index.
-      (list (prime-candidate-combine-string context candidate)
+      (list (prime-candidate-get-literal candidate)
            (digit->string (+ index-no 1))
-           ""))))
-
-(define prime-candidate-combine-string
+           (prime-candidate-combine-annotation context candidate)))))
+
+(define prime-candidate-combine-annotation
   (lambda (context candidate)
-    (let ((string     (prime-candidate-get-literal candidate))
+    (let ((string     "")
          (usage      (prime-candidate-get-data    candidate "usage"))
          (comment    (prime-candidate-get-data    candidate "comment"))
          (form       (prime-candidate-get-data    candidate "form"))
          (state      (prime-context-state context)))
-      (if (and prime-custom-display-form?
+      (if (and enable-annotation?
+              prime-custom-display-form?
               form
               (or (eq? state 'prime-state-converting)
                   (eq? state 'prime-state-segment)))
-         (set! string (string-append string "  (" form ")")))
-      (if (and prime-custom-display-usage?
+         (set! string (string-append string "(" form ")")))
+      (if (and enable-annotation?
+              prime-custom-display-usage?
               usage
               (or (eq? state 'prime-state-converting)
                   (eq? state 'prime-state-segment)))
          (set! string (string-append string "\t¢¦" usage)))
-      (if (and prime-custom-display-comment?
+      (if (and enable-annotation?
+              prime-custom-display-comment?
               comment
               (or (eq? state 'prime-state-converting)
                   (eq? state 'prime-state-segment)))


--
Subscription settings: http://groups.google.com/group/uim-commit/subscribe?hl=en

Reply via email to