[uim-commit] r1577 - trunk/scm
yamamoto at freedesktop.org
yamamoto at freedesktop.org
Sat Sep 24 22:48:30 PDT 2005
Author: yamamoto
Date: 2005-09-24 22:48:28 -0700 (Sat, 24 Sep 2005)
New Revision: 1577
Modified:
trunk/scm/anthy.scm
trunk/scm/canna.scm
Log:
* scm/anthy.scm:
-(anthy-context-change-kana-mode!): New function.
-(action_anthy_hiragana, action_anthy_katakana, action_anthy_hankana,
action_anthy_kana, anthy-context-kana-toggle,
anthy-proc-input-state-no-preedit): Replace
anthy-context-set-kana-mode! with anthy-context-change-kana-mode!
-(anthy-proc-transposing-state): Don't transpose to latin and wide
latin if input rule is kana.
* scm/canna.scm:
-(canna-prepare-activation): Reset conversion if needed.
-(canna-context-change-kana-mode!): New function.
-(action_canna_hiragana, action_canna_katakana, action_canna_hankana,
action_canna_kana, canna-context-kana-toggle,
canna-proc-input-state-no-preedit): Replace
canna-context-set-kana-mode! with canna-context-change-kana-mode!
-(canna-proc-input-state-with-preedit, canna-input-state-preedit):
Fix invalid arguments of multi-segment-make-*-string.
-(canna-proc-input-state-with-preedit): Include pending string in
commit string.
Modified: trunk/scm/anthy.scm
===================================================================
--- trunk/scm/anthy.scm 2005-09-24 23:32:20 UTC (rev 1576)
+++ trunk/scm/anthy.scm 2005-09-25 05:48:28 UTC (rev 1577)
@@ -76,7 +76,7 @@
(lambda (ac) ;; action handler
(anthy-prepare-activation ac)
(anthy-context-set-on! ac #t)
- (anthy-context-set-kana-mode! ac anthy-type-hiragana)))
+ (anthy-context-change-kana-mode! ac anthy-type-hiragana)))
(register-action 'action_anthy_katakana
;; (indication-alist-indicator 'action_anthy_katakana
@@ -93,13 +93,8 @@
(lambda (ac)
(anthy-prepare-activation ac)
(anthy-context-set-on! ac #t)
+ (anthy-context-change-kana-mode! ac anthy-type-katakana)))
- (if (= anthy-input-rule-kana
- (anthy-context-input-rule ac))
- (rk-context-set-rule! (anthy-context-rkc ac)
- ja-kana-katakana-rule))
- (anthy-context-set-kana-mode! ac anthy-type-katakana)))
-
(register-action 'action_anthy_hankana
;; (indication-alist-indicator 'action_anthy_hankana
;; anthy-input-mode-indication-alist)
@@ -115,7 +110,7 @@
(lambda (ac)
(anthy-prepare-activation ac)
(anthy-context-set-on! ac #t)
- (anthy-context-set-kana-mode! ac anthy-type-hankana)))
+ (anthy-context-change-kana-mode! ac anthy-type-hankana)))
(register-action 'action_anthy_direct
;; (indication-alist-indicator 'action_anthy_direct
@@ -179,13 +174,8 @@
anthy-input-rule-kana))
(lambda (ac)
(anthy-prepare-activation ac)
- (rk-context-set-rule! (anthy-context-rkc ac)
- (if (= (anthy-context-kana-mode ac)
- anthy-type-katakana)
- ja-kana-katakana-rule
- ja-kana-hiragana-rule))
-
(anthy-context-set-input-rule! ac anthy-input-rule-kana)
+ (anthy-context-change-kana-mode! ac (anthy-context-kana-mode ac))
;;(define-key anthy-kana-toggle-key? "")
;;(define-key anthy-latin-key? generic-on-key?)
;;(define-key anthy-wide-latin-key? "")
@@ -277,8 +267,20 @@
(lambda (ac)
(let* ((kana (anthy-context-kana-mode ac))
(opposite-kana (multi-segment-opposite-kana kana)))
- (anthy-context-set-kana-mode! ac opposite-kana))))
+ (anthy-context-change-kana-mode! ac opposite-kana))))
+(define anthy-context-change-kana-mode!
+ (lambda (ac kana-mode)
+ (if (= (anthy-context-input-rule ac)
+ anthy-input-rule-kana)
+ (rk-context-set-rule!
+ (anthy-context-rkc ac)
+ (cond
+ ((= kana-mode anthy-type-hiragana) ja-kana-hiragana-rule)
+ ((= kana-mode anthy-type-katakana) ja-kana-katakana-rule)
+ ((= kana-mode anthy-type-hankana) ja-kana-hankana-rule))))
+ (anthy-context-set-kana-mode! ac kana-mode)))
+
;; TODO: generarize as multi-segment procedure
;; side effect: none. rkc will not be altered
(define anthy-make-whole-string
@@ -444,7 +446,7 @@
(anthy-commit-raw ac))
((anthy-hankaku-kana-key? key key-state)
- (anthy-context-set-kana-mode! ac anthy-type-hankana))
+ (anthy-context-change-kana-mode! ac anthy-type-hankana))
((anthy-kana-toggle-key? key key-state)
(anthy-context-kana-toggle ac))
@@ -494,10 +496,14 @@
(anthy-context-set-transposing-type! ac anthy-type-hankana))
((anthy-transpose-as-latin-key? key key-state)
- (anthy-context-set-transposing-type! ac anthy-type-latin))
+ (if (not (= (anthy-context-input-rule ac)
+ anthy-input-rule-kana))
+ (anthy-context-set-transposing-type! ac anthy-type-latin)))
((anthy-transpose-as-wide-latin-key? key key-state)
- (anthy-context-set-transposing-type! ac anthy-type-wide-latin))
+ (if (not (= (anthy-context-input-rule ac)
+ anthy-input-rule-kana))
+ (anthy-context-set-transposing-type! ac anthy-type-wide-latin)))
(else
(begin
Modified: trunk/scm/canna.scm
===================================================================
--- trunk/scm/canna.scm 2005-09-24 23:32:20 UTC (rev 1576)
+++ trunk/scm/canna.scm 2005-09-25 05:48:28 UTC (rev 1577)
@@ -47,6 +47,9 @@
(define canna-prepare-activation
(lambda (cc)
+ (if (canna-context-state cc)
+ (let ((cc-id (canna-context-cc-id cc)))
+ (canna-lib-reset-conversion cc-id)))
(canna-flush cc)
(canna-update-preedit cc)))
@@ -65,7 +68,7 @@
(lambda (cc) ;; action handler
(canna-prepare-activation cc)
(canna-context-set-on! cc #t)
- (canna-context-set-kana-mode! cc
+ (canna-context-change-kana-mode! cc
multi-segment-type-hiragana)))
(register-action 'action_canna_katakana
@@ -81,7 +84,7 @@
(lambda (cc)
(canna-prepare-activation cc)
(canna-context-set-on! cc #t)
- (canna-context-set-kana-mode! cc
+ (canna-context-change-kana-mode! cc
multi-segment-type-katakana)))
(register-action 'action_canna_hankana
@@ -97,7 +100,7 @@
(lambda (cc)
(canna-prepare-activation cc)
(canna-context-set-on! cc #t)
- (canna-context-set-kana-mode! cc
+ (canna-context-change-kana-mode! cc
multi-segment-type-hankana)))
(register-action 'action_canna_direct
@@ -154,9 +157,9 @@
canna-input-rule-kana))
(lambda (cc)
(canna-prepare-activation cc)
- (rk-context-set-rule! (canna-context-rkc cc)
- ja-kana-hiragana-rule)
- (canna-context-set-input-rule! cc canna-input-rule-kana)))
+ (canna-context-set-input-rule! cc canna-input-rule-kana)
+ (canna-context-change-kana-mode!
+ cc (canna-context-kana-mode cc))))
(register-action 'action_canna_azik
(lambda (cc)
@@ -240,8 +243,20 @@
(define (canna-context-kana-toggle cc)
(let* ((kana (canna-context-kana-mode cc))
(opposite-kana (canna-opposite-kana kana)))
- (canna-context-set-kana-mode! cc opposite-kana)))
+ (canna-context-change-kana-mode! cc opposite-kana)))
+(define canna-context-change-kana-mode!
+ (lambda (cc kana-mode)
+ (if (= (canna-context-input-rule cc)
+ canna-input-rule-kana)
+ (rk-context-set-rule!
+ (canna-context-rkc cc)
+ (cond
+ ((= kana-mode multi-segment-type-hiragana) ja-kana-hiragana-rule)
+ ((= kana-mode multi-segment-type-katakana) ja-kana-katakana-rule)
+ ((= kana-mode multi-segment-type-hankana) ja-kana-hankana-rule))))
+ (canna-context-set-kana-mode! cc kana-mode)))
+
(define (canna-flush cc)
(rk-flush (canna-context-rkc cc))
(canna-context-set-left-string! cc '())
@@ -340,7 +355,7 @@
(canna-commit-raw cc))
((canna-hankaku-kana-key? key key-state)
- (canna-context-set-kana-mode! cc multi-segment-type-hankana))
+ (canna-context-change-kana-mode! cc multi-segment-type-hankana))
((canna-kana-toggle-key? key key-state)
(canna-context-kana-toggle cc))
@@ -395,9 +410,11 @@
(canna-proc-input-state cc key key-state)))))))
(define (canna-proc-input-state-with-preedit cc key key-state)
- (let ((rkc (canna-context-rkc cc))
- (kana (canna-context-kana-mode cc))
- (rule (canna-context-input-rule cc)))
+ (let* ((rkc (canna-context-rkc cc))
+ (rule (canna-context-input-rule cc))
+ (kana (if (= rule canna-input-rule-kana)
+ multi-segment-type-hiragana
+ (canna-context-kana-mode cc))))
(cond
;; begin conversion
@@ -433,14 +450,17 @@
;; ¤Ò¤é¤¬¤Ê¥â¡¼¥É¤Ç¥«¥¿¥«¥Ê¤ò³ÎÄꤹ¤ë
((canna-commit-as-opposite-kana-key? key key-state)
- (begin
+ (let ((opposite-kana (if (= rule canna-input-rule-kana)
+ multi-segment-type-hiragana
+ (canna-opposite-kana kana))))
(im-commit
cc
(string-append
(multi-segment-make-left-string (canna-context-left-string cc)
- (canna-opposite-kana kana))
+ opposite-kana)
+ (rk-pending rkc)
(multi-segment-make-right-string (canna-context-right-string cc)
- (canna-opposite-kana kana))))
+ opposite-kana)))
(canna-flush cc)))
;; Transposing¾õÂ֤ذܹÔ
@@ -460,6 +480,7 @@
(string-append
(multi-segment-make-left-string (canna-context-left-string cc)
kana)
+ (rk-pending rkc)
(multi-segment-make-right-string (canna-context-right-string cc)
kana)))
(canna-flush cc)
@@ -622,7 +643,10 @@
(define (canna-input-state-preedit cc)
(let ((rkc (canna-context-rkc cc))
- (kana (canna-context-kana-mode cc)))
+ (kana (if (= (canna-context-input-rule cc)
+ canna-input-rule-kana)
+ multi-segment-type-hiragana
+ (canna-context-kana-mode cc))))
(im-clear-preedit cc)
(im-pushback-preedit
cc preedit-underline
More information about the uim-commit
mailing list