Revision: 6468
Author: iratqq
Date: Mon Jun 21 03:53:12 2010
Log: * scm/look.scm (look-context-new, look-release-handler):
  - Change calling eb function to annotate one.
  (look-format-annotation):
  - Rename.
  (look-update-preedit):
  - Sync.
* scm/look-custom.scm (look-use-annotation?)
  (look-annotation-show-lines):
  - Rename "-eb-" to "-annotation-".
  (look-eb-dict-path):
  - Remove.

  Change to use annotation framework.

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

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

=======================================
--- /trunk/scm/look-custom.scm  Sun Apr  4 20:35:54 2010
+++ /trunk/scm/look-custom.scm  Mon Jun 21 03:53:12 2010
@@ -53,34 +53,22 @@
   (N_ "[Look] Personal dictionary file")
   (N_ "long description will be here."))

-(define-custom 'look-use-eb? #f
+(define-custom 'look-use-annotation? #f
   '(look)
   '(boolean)
-  (N_ "[Look] Use eb library to search annotations")
+  (N_ "[Look] Use annotations")
   (N_ "long description will be here."))

-(define-custom 'look-eb-dict-path
-  (string-append (sys-datadir) "/dict")
+(define-custom 'look-annotation-show-lines 2
   '(look)
-  '(pathname regular-file)
-  (N_ "[Look] The directory which contains EB dictionary file")
-  (N_ "long description will be here."))
-
-(custom-add-hook 'look-eb-dict-path
-                 'custom-activity-hooks
-                 (lambda ()
-                   look-use-eb?))
-
-(define-custom 'look-eb-show-lines 2
-  '(look)
-  '(integer 1 65535)
+  '(integer 1 80)
   (N_ "[Look] Show annotation of lines")
   (N_ "long description will be here."))

-(custom-add-hook 'look-eb-show-lines
+(custom-add-hook 'look-annotation-show-lines
                  'custom-activity-hooks
                  (lambda ()
-                   look-use-eb?))
+                   look-use-annotation?))

 (define-custom 'look-beginning-character-length 1
   '(look)
=======================================
--- /trunk/scm/look.scm Sun Jun 20 21:12:12 2010
+++ /trunk/scm/look.scm Mon Jun 21 03:53:12 2010
@@ -33,7 +33,7 @@
 (require-custom "generic-key-custom.scm")
 (require-custom "look-custom.scm")

-(require-dynlib "eb")
+(require "annotation.scm")

 ;; widgets
 (define look-widgets '(widget_look_input_mode))
@@ -106,8 +106,7 @@
     (list 'left       "")
(list 'prev ()) ; simple queue: ([string]prevword1 prevword2 ...) (list 'dict #f) ; list ((([string]prevword1 prevword2 ...) . [alist]history) ...)
-    (list 'dictlen    0)
-    (list 'eb-ctx     #f))))
+    (list 'dictlen    0))))
 (define look-context-rec-spec look-context-rec-spec)
 (define-record 'look-context look-context-rec-spec)
 (define look-context-new-internal look-context-new)
@@ -336,9 +335,8 @@
 (define (look-context-new . args)
   (let ((lc (apply look-context-new-internal args)))
     (look-context-set-widgets! lc look-widgets)
-    (if (and look-use-eb?
-             (provided? "eb"))
-        (look-context-set-eb-ctx! lc (eb-new look-eb-dict-path)))
+    (if look-use-annotation?
+        (annotation-init))
     lc))

 (define (look-context-clean lc)
@@ -368,11 +366,8 @@
     lc))

 (define (look-release-handler lc)
-  (if (and look-use-eb?
-           (provided? "eb")
-           (look-context-eb-ctx lc))
-      (eb-destroy (look-context-eb-ctx lc)))
-  (look-context-set-eb-ctx! lc #f)
+  (if look-use-annotation?
+      (annotation-release))
   #f)

 (define (look-alphabetic-char? key state)
@@ -432,8 +427,8 @@
                        (number->string candidates)
                        "]"))))

-(define (look-format-eb lc)
-  (define (eb-format-entry str lines)
+(define (look-format-annotation lc)
+  (define (annotation-format-entry str lines)
     (let loop ((l (string->list str))
              (lines lines)
              (rest '()))
@@ -448,12 +443,11 @@
     (if (or (= 0 (string-length (look-context-left lc)))
             (<= (length candidates) (look-context-nth lc)))
         ""
-        (eb-format-entry (eb-search-text (look-context-eb-ctx lc)
-                                         (string-append
-                                          (look-context-left lc)
- (nth (look-context-nth lc) candidates))
-                                         "UTF-8")
-                         look-eb-show-lines))))
+        (annotation-format-entry (annotation-get-text (string-append
+ (look-context-left lc) + (nth (look-context-nth lc) candidates))
+                                                      "UTF-8")
+                                 look-annotation-show-lines))))


 (define (look-update-preedit lc)
@@ -471,11 +465,10 @@
       (im-pushback-preedit
        lc preedit-reverse
        (look-format-candidates-nth lc)))
-  (if (and look-use-eb?
-           (provided? "eb"))
+  (if look-use-annotation?
       (im-pushback-preedit
        lc preedit-none
-       (look-format-eb lc)))
+       (look-format-annotation lc)))
   (im-update-preedit lc))

 (define (look-key-press-state-look lc key state)

Reply via email to