Hiroyuki Komatsu
komat****@users*****
2005年 3月 3日 (木) 18:02:55 JST
Index: prime/uim/ChangeLog diff -u prime/uim/ChangeLog:1.1.2.19 prime/uim/ChangeLog:1.1.2.20 --- prime/uim/ChangeLog:1.1.2.19 Thu Mar 3 10:14:57 2005 +++ prime/uim/ChangeLog Thu Mar 3 18:02:54 2005 @@ -1,10 +1,21 @@ 2005-03-03 Hiroyuki Komatsu <komat****@taiya*****> + * prime-custom.scm: [NEW FILE] + Modified to integrate with the custom prime.scm. + + * prime-key-custom.scm: [NEW FILE] + The same with the original file in uim-0.4.6. + * prime.scm: - Changed behaviors of prime-any-keys on prime-modify-state and prime-segment-state. - Fixed a bug of prime-application-mode. - + - Fixed a bug of prime-convert-selection-move. + - Allowed to select the default language from Japanese or English. + - Allowed to select the default space character. + - Allowed to toggle the vi user's option. + - Allowed to toggle the word annotations. + 2005-03-02 Hiroyuki Komatsu <komat****@taiya*****> * prime.scm: Index: prime/uim/prime-custom.scm diff -u /dev/null prime/uim/prime-custom.scm:1.1.2.1 --- /dev/null Thu Mar 3 18:02:54 2005 +++ prime/uim/prime-custom.scm Thu Mar 3 18:02:54 2005 @@ -0,0 +1,220 @@ +;;; prime-custom.scm: Customization variables for prime.scm +;;; +;;; Copyright (c) 2003-2005 uim Project http://uim.freedesktop.org/ +;;; +;;; All rights reserved. +;;; +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: +;;; 1. Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. +;;; 2. Redistributions in binary form must reproduce the above copyright +;;; notice, this list of conditions and the following disclaimer in the +;;; documentation and/or other materials provided with the distribution. +;;; 3. Neither the name of authors nor the names of its contributors +;;; may be used to endorse or promote products derived from this software +;;; without specific prior written permission. +;;; +;;; THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +;;; SUCH DAMAGE. +;;;; + +(require "i18n.scm") + +(define prime-im-name-label (N_ "PRIME")) +(define prime-im-short-desc (N_ "Japanese predictive input method")) + +(define-custom-group 'prime + (ugettext prime-im-name-label) + (ugettext prime-im-short-desc)) + +(define-custom-group 'prime-advanced + (_ "PRIME (advanced)") + (_ "Advanced settings for PRIME")) + +(define-custom-group 'japanese + (_ "Japanese") + (_ "Japanese specific settings")) + +(define-custom 'prime-custom-default-language 'Japanese + '(prime) + (list 'choice + (list 'Japanese (_ "Japanese") (_ "Japanese")) + (list 'English (_ "English") (_ "English"))) + (_ "Default language") + (_ "long description will be here.")) + +(define-custom 'prime-auto-register-mode? #t + '(prime) + '(boolean) + (_ "Enable auto register mode") + (_ "long description will be here.")) + +(define-custom 'prime-use-unixdomain? #f + '(prime) + '(boolean) + (_ "Use Unix Domain Socket to communicate with PRIME") + (_ "long description will be here.")) + +(define-custom 'prime-custom-japanese-space 'wide + '(prime japanese) + (list 'choice + (list 'wide (_ "Wide width (Zenkaku)") (_ "Wide width (Zenkaku)")) + (list 'half (_ "Half width (Hankaku)") (_ "Half width (Hankaku)"))) + (_ "Space character") + (_ "long description will be here.")) + +;(define-custom 'prime-use-candidate-window? #t +; '(prime candwin) +; '(boolean) +; "Use candidate window" +; "long description will be here.") + +;(define-custom 'prime-candidate-op-count 1 +; '(prime candwin) +; '(integer 0 99) +; "Conversion key press count to show candidate window" +; "long description will be here.") + +(define-custom 'prime-nr-candidate-max 10 + '(prime-advanced candwin) + '(integer 1 20) + (_ "Number of candidates in candidate window at a time") + (_ "long description will be here.")) + +(define-custom 'prime-always-show-window? #t + '(prime-advanced candwin) + '(boolean) + (_ "Always showing candidate window") + (_ "long description will be here.")) + +;; If #t a candidate window displays usage examples of candidate words. +(define-custom 'prime-custom-display-usage? #t + '(prime-advanced annotation) + '(boolean) + (_ "Show usage examples of candidate words") + (_ "long description will be here.")) + +;; If #t a candidate window displays comments of candidate words. +(define-custom 'prime-custom-display-comment? #t + '(prime-advanced annotation) + '(boolean) + (_ "Show candidate annotations") + (_ "long description will be here.")) + +;; If #t a candidate window displays forms of candidate words such as +;; 'l (small L)', 'I (large i)'. +(define-custom 'prime-custom-display-form? #t + '(prime-advanced annotation) + '(boolean) + (_ "Show candidate forms") + (_ "long description will be here.")) + +;; ------------------------------------------------------------ + +(define-custom 'prime-pseudo-mode-cursor? #f + '(prime-advanced special-op) + '(boolean) + (_ "Enable pseudo mode cursor") + (_ "long description will be here.")) + +(define-custom 'prime-custom-app-mode-vi? #f + '(prime-advanced special-op) + '(boolean) + (_ "Friendly for vi user") + (_ "long description will be here.")) + +;(define-custom 'prime-mask-pending-preedit? #f +; '(prime) +; '(boolean) +; (_ "Mask preedit strings (For T-Code users)") +; (_ "long description will be here.")) + +;(define-custom 'prime-use-numeral-key-to-select-cand? #t +; '(prime) +; '(boolean) +; "Use numeral key to select candidate directly" +; "long description will be here.") + + +;; +;; toolbar +;; + +;; Can't be unified with action definitions in prime.scm until uim +;; 0.4.6. +(define prime-input-mode-indication-alist + (list + (list 'action_prime_mode_latin + 'figure_prime_mode_latin + "P" + (N_ "Direct input") + (N_ "PRIME off")) + (list 'action_prime_mode_hiragana + 'figure_prime_mode_hiragana + "ぷ" + (N_ "Japanese") + (N_ "PRIME on")) + (list 'action_prime_mode_wide_latin + 'figure_prime_mode_wide_latin + "P" + (N_ "Fullwidth Alphanumeric") + (N_ "Fullwidth Alphanumeric input mode")))) + +(define prime-widgets '(widget_prime_input_mode)) + +;;; Input mode + +(define default-widget_prime_input_mode 'action_prime_mode_latin) +;; Users don't care this option. +;; (2005-03-03) <Hiroyuki Komatsu> +;(define-custom 'default-widget_prime_input_mode 'action_prime_mode_latin +; '(prime-advanced toolbar) +; (cons 'choice +; (map indication-alist-entry-extract-choice +; prime-input-mode-indication-alist)) +; (_ "Default input mode") +; (_ "long description will be here.")) + +(define prime-input-mode-actions (map car prime-input-mode-indication-alist)) +;; Users don't care this option. +;; (2005-03-03) <Hiroyuki Komatsu> +;(define-custom 'prime-input-mode-actions +; (map car prime-input-mode-indication-alist) +; '(prime-advanced toolbar) +; (cons 'ordered-list +; (map indication-alist-entry-extract-choice +; prime-input-mode-indication-alist)) +; (_ "Input mode menu items") +; (_ "long description will be here.")) + +;; value dependency +(if custom-full-featured? + (custom-add-hook 'prime-input-mode-actions + 'custom-set-hooks + (lambda () + (custom-choice-range-reflect-olist-val + 'default-widget_prime_input_mode + 'prime-input-mode-actions + prime-input-mode-indication-alist)))) + +;; dynamic reconfiguration +(custom-add-hook 'default-widget_prime_input_mode + 'custom-set-hooks + (lambda () + (prime-configure-widgets))) + +(custom-add-hook 'prime-input-mode-actions + 'custom-set-hooks + (lambda () + (prime-configure-widgets))) Index: prime/uim/prime-key-custom.scm diff -u /dev/null prime/uim/prime-key-custom.scm:1.1.2.1 --- /dev/null Thu Mar 3 18:02:54 2005 +++ prime/uim/prime-key-custom.scm Thu Mar 3 18:02:54 2005 @@ -0,0 +1,208 @@ +;;; prime-key-custom.scm: Customization variables for PRIME key bindings +;;; +;;; Copyright (c) 2003-2005 uim Project http://uim.freedesktop.org/ +;;; +;;; All rights reserved. +;;; +;;; Redistribution and use in source and binary forms, with or without +;;; modification, are permitted provided that the following conditions +;;; are met: +;;; 1. Redistributions of source code must retain the above copyright +;;; notice, this list of conditions and the following disclaimer. +;;; 2. Redistributions in binary form must reproduce the above copyright +;;; notice, this list of conditions and the following disclaimer in the +;;; documentation and/or other materials provided with the distribution. +;;; 3. Neither the name of authors nor the names of its contributors +;;; may be used to endorse or promote products derived from this software +;;; without specific prior written permission. +;;; +;;; THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +;;; ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +;;; SUCH DAMAGE. +;;;; + +(require "i18n.scm") + +;; original key definitions + +;;(define-key prime-latin-key? '("<Control>l" generic-off-key?)) +;;(define-key prime-wide-latin-key? "<Control>L") +;;(define-key prime-begin-conv-key? 'generic-begin-conv-key?) +;;(define-key prime-on-key? '("<Control>j" "<Control>J" generic-on-key?)) +;;(define-key prime-commit-key? 'generic-commit-key?) +;;(define-key prime-next-candidate-key? 'generic-next-candidate-key?) +;;(define-key prime-prev-candidate-key? 'generic-prev-candidate-key?) +;;(define-key prime-next-page-key? 'generic-next-page-key?) +;;(define-key prime-prev-page-key? 'generic-prev-page-key?) +;;(define-key prime-cancel-key? 'generic-cancel-key?) +;;(define-key prime-backspace-key? 'generic-backspace-key?) +;;(define-key prime-delete-key? 'generic-delete-key?) +;;(define-key prime-go-left-key? 'generic-go-left-key?) +;;(define-key prime-go-right-key? 'generic-go-right-key?) +;;(define-key prime-go-left-edge-key? '("<Control>a" "<Control>left")) +;;(define-key prime-go-right-edge-key? '("<Control>e" "<Control>right")) +;;(define-key prime-register-key? '("<Control>w")) +;;(define-key prime-typing-mode-hiragana-key? "F6") +;;(define-key prime-typing-mode-katakana-key? "F7") +;;(define-key prime-typing-mode-hankana-key? "F8") +;;(define-key prime-typing-mode-wideascii-key? "F9") +;;(define-key prime-typing-mode-ascii-key? "F10") + +(define-custom-group 'prime-keys1 + (_ "PRIME key bindings 1") + (_ "long description will be here.")) + +(define-custom-group 'prime-keys2 + (_ "PRIME key bindings 2") + (_ "long description will be here.")) + +(define-custom-group 'prime-keys3 + (_ "PRIME key bindings 3") + (_ "long description will be here.")) + + +(define-custom 'prime-register-key '("<Control>w") + '(prime-keys1) + '(key) + (_ "[PRIME] prime-register-key") + (_ "long description will be here")) + +(define-custom 'prime-typing-mode-hiragana-key '("F6") + '(prime-keys1 mode-transition) + '(key) + (_ "[PRIME] prime-typing-mode-hiragana-key") + (_ "long description will be here")) + +(define-custom 'prime-typing-mode-katakana-key '("F7") + '(prime-keys1 mode-transition) + '(key) + (_ "[PRIME] prime-typing-mode-katakana-key") + (_ "long description will be here")) + +(define-custom 'prime-typing-mode-hankana-key '("F8") + '(prime-keys1 mode-transition) + '(key) + (_ "[PRIME] prime-typing-mode-hankana-key") + (_ "long description will be here")) + +(define-custom 'prime-typing-mode-wideascii-key '("F9") + '(prime-keys1 mode-transition) + '(key) + (_ "[PRIME] prime-typing-mode-wideascii-key") + (_ "long description will be here")) + +(define-custom 'prime-typing-mode-ascii-key '("F10") + '(prime-keys1 mode-transition) + '(key) + (_ "[PRIME] prime-typing-mode-ascii-key") + (_ "long description will be here")) + +;; +;; advanced 1 +;; +(define-custom 'prime-on-key '("<IgnoreCase><Control>j" generic-on-key) + '(prime-keys2 mode-transition) + '(key) + (_ "[PRIME] on") + (_ "long description will be here")) + +(define-custom 'prime-latin-key '("<Control>l" generic-off-key) + '(prime-keys2 mode-transition) + '(key) + (_ "[PRIME] off") + (_ "long description will be here")) + +(define-custom 'prime-wide-latin-key '("<Control>L") + '(prime-keys2 mode-transition) + '(key) + (_ "[PRIME] fullwidth alphanumeric mode") + (_ "long description will be here")) + +(define-custom 'prime-begin-conv-key '(generic-begin-conv-key) + '(prime-keys2) + '(key) + (_ "[PRIME] begin conversion") + (_ "long description will be here")) + +(define-custom 'prime-commit-key '(generic-commit-key) + '(prime-keys2) + '(key) + (_ "[PRIME] commit") + (_ "long description will be here")) + +(define-custom 'prime-cancel-key '(generic-cancel-key) + '(prime-keys2) + '(key) + (_ "[PRIME] cancel") + (_ "long description will be here")) + +(define-custom 'prime-next-candidate-key '(generic-next-candidate-key) + '(prime-keys2) + '(key) + (_ "[PRIME] next candidate") + (_ "long description will be here")) + +(define-custom 'prime-prev-candidate-key '(generic-prev-candidate-key) + '(prime-keys2) + '(key) + (_ "[PRIME] previous candidate") + (_ "long description will be here")) + +(define-custom 'prime-next-page-key '(generic-next-page-key) + '(prime-keys2) + '(key) + (_ "[PRIME] next page of candidate window") + (_ "long description will be here")) + +(define-custom 'prime-prev-page-key '(generic-prev-page-key) + '(prime-keys2) + '(key) + (_ "[PRIME] previous page of candidate window") + (_ "long description will be here")) + +;; +;; advanced 2 +;; +(define-custom 'prime-go-left-edge-key '("<IgnoreCase><Control>a" "<Control>left") + '(prime-keys3) + '(key) + (_ "[PRIME] beginning of preedit") + (_ "long description will be here")) + +(define-custom 'prime-go-right-edge-key '("<IgnoreCase><Control>e" "<Control>right") + '(prime-keys3) + '(key) + (_ "[PRIME] end of preedit") + (_ "long description will be here")) + +(define-custom 'prime-backspace-key '(generic-backspace-key) + '(prime-keys3) + '(key) + (_ "[PRIME] backspace") + (_ "long description will be here")) + +(define-custom 'prime-delete-key '(generic-delete-key) + '(prime-keys3) + '(key) + (_ "[PRIME] delete") + (_ "long description will be here")) + +(define-custom 'prime-go-left-key '(generic-go-left-key) + '(prime-keys3) + '(key) + (_ "[PRIME] go left") + (_ "long description will be here")) + +(define-custom 'prime-go-right-key '(generic-go-right-key) + '(prime-keys3) + '(key) + (_ "[PRIME] go right") + (_ "long description will be here")) Index: prime/uim/prime.scm diff -u prime/uim/prime.scm:1.1.2.23 prime/uim/prime.scm:1.1.2.24 --- prime/uim/prime.scm:1.1.2.23 Thu Mar 3 10:14:57 2005 +++ prime/uim/prime.scm Thu Mar 3 18:02:54 2005 @@ -47,12 +47,6 @@ (require-custom "prime-key-custom.scm") ;; configs -;; If #t a candidate window displays comments of candidate words. -(define prime-custom-display-comment? #t) -;; If #t a candidate window displays forms of candidate words such as -;; 'l (small L)', 'I (large i)'. -(define prime-custom-display-form? #t) - (define prime-always-number-selection? #f) ;; config function @@ -79,13 +73,16 @@ "!" "?")) ;;;; If you're a Vi user, modify the lines below. -;; Default -(define-key prime-app-mode-start-key? #f) -(define prime-app-mode-end-stroke-list #f) -;; For Vi users -;(define-key prime-app-mode-start-key? prime-escape-key?) -;(define prime-app-mode-end-stroke-list -; '("i" "I" "a" "A" "o" "O" "C" "s" "S" ("c" . ("l" "w" "e" "c" "G")))) +(if prime-custom-app-mode-vi? + (begin + ;; For Vi users + (define-key prime-app-mode-start-key? prime-escape-key?) + (define prime-app-mode-end-stroke-list + '("i" "I" "a" "A" "o" "O" "C" "s" "S" ("c" . ("l" "w" "e" "c" "G"))))) + (begin + ;; Default + (define-key prime-app-mode-start-key? #f) + (define prime-app-mode-end-stroke-list #f))) (define prime-cand-select-key? (lambda (key key-state) @@ -155,20 +152,21 @@ (set! keymap prime-keymap-modify-state)) ((= state 'prime-state-converting) - (if (string=? language "Japanese") + (if (= language 'Japanese) (set! keymap prime-keymap-conv-state) (set! keymap prime-keymap-english-conv-state))) ((= state 'prime-state-preedit) - (if (string=? language "Japanese") + (if (= language 'Japanese) (set! keymap prime-keymap-preedit-state) (set! keymap prime-keymap-english-preedit-state))) ((= state 'prime-state-fund) - (if (string=? language "Japanese") + (if (= language 'Japanese) (if (prime-context-parent-context context) (set! keymap prime-keymap-child-fund-state) - (set! keymap prime-keymap-fund-state))))) + (set! keymap prime-keymap-fund-state)) + (set! keymap prime-keymap-english-fund-state)))) keymap))) (define prime-keymap-get-command @@ -507,7 +505,8 @@ (list 'mode prime-mode-latin) (list 'last-word "") ;; PRIMEやPOBoxの用語でいうContext (list 'session #f) ; the actual value is -default or -register. - (list 'language "Japanese") ; language of the current session. + ; language of the current session. + (list 'language prime-custom-default-language) (list 'lang-session-list ()) ; session data of each language (list 'modification '("" "" "")) (list 'segment-nth 0) @@ -859,13 +858,19 @@ (define prime-engine-session-language-set (lambda (language) - (car (prime-engine-send-command (list "session_start" language))))) + (let ((language-string (if (= language 'English) "English" "Japanese"))) + (car (prime-engine-send-command + (list "session_start" language-string)))))) + (define prime-engine-session-language-get (lambda (prime-session) - (nth 1 (prime-util-string-split - (car (prime-engine-send-command - (list "session_get_env" prime-session "language"))) - "\t")))) + (let ((language-string + (nth 1 (prime-util-string-split + (car (prime-engine-send-command + (list "session_get_env" prime-session "language"))) + "\t")))) + (if (string=? language-string "English") + 'English 'Japanese)))) ;; composing operations (define prime-engine-edit-insert @@ -1019,14 +1024,14 @@ (define prime-command-language-toggle (lambda (context key key-state) - (let ((next-language (if (string=? (prime-context-language context) - "English") - "Japanese" "English"))) + (let ((next-language (if (= (prime-context-language context) 'English) + 'Japanese 'English))) (prime-mode-language-set context next-language)))) (define prime-command-japanese-mode (lambda (context key key-state) (prime-context-initialize! context) + (prime-mode-language-set context (prime-context-language context)) (prime-mode-set context prime-mode-hiragana))) (define prime-command-wide-latin-mode @@ -1306,8 +1311,8 @@ (define prime-command-fund-space (lambda (context key key-state) (cond - ((string=? (prime-context-language context) "Japanese") - (let ((space (ja-direct " "))) + ((= (prime-context-language context) 'Japanese) + (let ((space (if (= prime-custom-japanese-space 'wide) " " " "))) (prime-commit-without-learning context space))) (t (prime-commit-without-learning context " "))))) @@ -1315,8 +1320,8 @@ (define prime-command-fund-altspace (lambda (context key key-state) (cond - ((string=? (prime-context-language context) "Japanese") - (let ((space (if (string=? (ja-direct " ") " ") " " " "))) + ((= (prime-context-language context) 'Japanese) + (let ((space (if (= prime-custom-japanese-space 'wide) " " " "))) (prime-commit-without-learning context space))) (t (prime-commit-without-learning context " "))))) @@ -1549,7 +1554,7 @@ (prime-dont-use-numeral-key-to-select-cand)) ((string=? typing-method "tcode") (prime-dont-use-numeral-key-to-select-cand) - (set! prime-mask-pending-preedit? #t) +; (set! prime-mask-pending-preedit? #t) ) )) )) @@ -1687,6 +1692,7 @@ selection-index) (begin (prime-context-set-nth! context 0) + (prime-engine-conv-select (prime-context-session context) 0) (if prime-auto-register-mode? (prime-register-mode-on context))))))