[uim-commit] r779 - trunk/scm
yamaken at freedesktop.org
yamaken at freedesktop.org
Wed Mar 9 04:44:59 PST 2005
Author: yamaken
Date: 2005-03-09 04:44:56 -0800 (Wed, 09 Mar 2005)
New Revision: 779
Modified:
trunk/scm/skk-custom.scm
trunk/scm/skk.scm
Log:
* This commit adds dynamic kana input method switching for skk
including AZIK
* scm/skk-custom.scm
- (custom-group skk-dict): New custom group
- (skk-kana-input-method-indication-alist): New variable
- (custom skk-widgets, custom 'default-widget_skk_kana_input_method,
custom 'skk-kana-input-method-actions, ): New custom variable
- (custom skk-dic-file-name, custom skk-personal-dic-filename,
custom skk-uim-personal-dic-filename): Move skk-dict group
- (custom skk-use-azik?): Removed
* scm/skk.scm
- (skk-input-rule-roma, skk-input-rule-azik): New variable
- (action action_skk_roma, action action_skk_azik): New action
- (skk-configure-widgets): Add initilization of
widget_skk_kana_input_method
- (skk-context-rec-spec): Add new member 'input-rule'
- (skk-context-new): Remove skk-use-azik? handling
Modified: trunk/scm/skk-custom.scm
===================================================================
--- trunk/scm/skk-custom.scm 2005-03-09 11:45:53 UTC (rev 778)
+++ trunk/scm/skk-custom.scm 2005-03-09 12:44:56 UTC (rev 779)
@@ -39,6 +39,10 @@
(ugettext skk-im-name-label)
(ugettext skk-im-short-desc))
+(define-custom-group 'skk-dict
+ (_ "SKK dictionaries")
+ (_ "Dictionary settings for SKK"))
+
(define-custom-group 'skk-advanced
(_ "SKK (advanced)")
(_ "Advanced settings for SKK"))
@@ -122,8 +126,43 @@
(N_ "Fullwidth Alphanumeric")
(N_ "Fullwidth Alphanumeric input mode"))))
-(define skk-widgets '(widget_skk_input_mode))
+(define skk-kana-input-method-indication-alist
+ (list
+ (list 'action_skk_roma
+ 'figure_ja_roma
+ "£Ò"
+ (N_ "Romaji")
+ (N_ "Romaji input mode"))
+ (list 'action_skk_azik
+ 'figure_ja_azik
+ "£Á"
+ (N_ "AZIK")
+ (N_ "AZIK extended romaji input mode"))))
+;;; Buttons
+
+(define-custom 'skk-widgets '(widget_skk_input_mode
+ widget_skk_kana_input_method)
+ '(skk toolbar)
+ (list 'ordered-list
+ (list 'widget_skk_input_mode
+ (_ "Input mode")
+ (_ "Input mode"))
+ (list 'widget_skk_kana_input_method
+ (_ "Kana input method")
+ (_ "Kana input method")))
+ (_ "Enabled toolbar buttons")
+ (_ "long description will be here."))
+
+;; dynamic reconfiguration
+;; skk-configure-widgets is not defined at this point. So wrapping
+;; into lambda.
+(custom-add-hook 'skk-widgets
+ 'custom-set-hooks
+ (lambda ()
+ (skk-configure-widgets)))
+
+
;;; Input mode
(define-custom 'default-widget_skk_input_mode 'action_skk_latin
@@ -164,27 +203,79 @@
(lambda ()
(skk-configure-widgets)))
+;;; Kana input method
+
+(define-custom 'default-widget_skk_kana_input_method 'action_skk_roma
+ '(skk toolbar)
+ (cons 'choice
+ (map indication-alist-entry-extract-choice
+ skk-kana-input-method-indication-alist))
+ (_ "Default kana input method")
+ (_ "long description will be here."))
+
+(define-custom 'skk-kana-input-method-actions
+ (map car skk-kana-input-method-indication-alist)
+ '(skk toolbar)
+ (cons 'ordered-list
+ (map indication-alist-entry-extract-choice
+ skk-kana-input-method-indication-alist))
+ (_ "Kana input method menu items")
+ (_ "long description will be here."))
+
+;; value dependency
+(if custom-full-featured?
+ (custom-add-hook 'skk-kana-input-method-actions
+ 'custom-set-hooks
+ (lambda ()
+ (custom-choice-range-reflect-olist-val
+ 'default-widget_skk_kana_input_method
+ 'skk-kana-input-method-actions
+ skk-kana-input-method-indication-alist))))
+
+;; activity dependency
+(custom-add-hook 'default-widget_skk_kana_input_method
+ 'custom-activity-hooks
+ (lambda ()
+ (memq 'widget_skk_kana_input_method skk-widgets)))
+
+(custom-add-hook 'skk-kana-input-method-actions
+ 'custom-activity-hooks
+ (lambda ()
+ (memq 'widget_skk_kana_input_method skk-widgets)))
+
+;; dynamic reconfiguration
+(custom-add-hook 'default-widget_skk_kana_input_method
+ 'custom-set-hooks
+ (lambda ()
+ (skk-configure-widgets)))
+
+(custom-add-hook 'skk-kana-input-method-actions
+ 'custom-set-hooks
+ (lambda ()
+ (skk-configure-widgets)))
+
+
;;
;; dictionary
;;
(define-custom 'skk-dic-file-name (string-append (sys-datadir)
"/skk/SKK-JISYO.L")
- '(skk dictionary)
+ '(skk-dict)
'(pathname)
(_ "Dictionary file")
(_ "long description will be here."))
(define-custom 'skk-personal-dic-filename
(string-append (getenv "HOME") "/.skk-jisyo")
- '(skk dictionary)
+ '(skk-dict)
'(pathname)
(_ "Personal dictionary file")
(_ "long description will be here."))
(define-custom 'skk-uim-personal-dic-filename
(string-append (getenv "HOME") "/.skk-uim-jisyo")
- '(skk dictionary)
+ '(skk-dict)
'(pathname)
(_ "Personal dictionary file (dedicated to uim)")
(_ "long description will be here."))
@@ -207,12 +298,6 @@
(_ "Use recursive learning")
(_ "long description will be here."))
-(define-custom 'skk-use-azik? #f
- '(skk-advanced)
- '(boolean)
- (_ "AZIK extended romaji input mode")
- (_ "long description will be here."))
-
(define-custom 'skk-use-numeric-conversion? #t
'(skk-advanced)
'(boolean)
Modified: trunk/scm/skk.scm
===================================================================
--- trunk/scm/skk.scm 2005-03-09 11:45:53 UTC (rev 778)
+++ trunk/scm/skk.scm 2005-03-09 12:44:56 UTC (rev 779)
@@ -44,7 +44,6 @@
;;
;;
(require "japanese.scm")
-(require "japanese-azik.scm")
(require-custom "generic-key-custom.scm")
(require-custom "skk-custom.scm")
(require-custom "skk-key-custom.scm")
@@ -114,6 +113,9 @@
(define skk-type-katakana 1)
(define skk-type-hankana 2)
+(define skk-input-rule-roma 0)
+(define skk-input-rule-azik 1)
+
;; style elements
(define skk-preedit-attr-mode-mark #f)
(define skk-preedit-attr-head #f)
@@ -218,6 +220,38 @@
(skk-prepare-activation dsc)
(skk-context-set-state! dsc 'skk-state-wide-latin))))
+(register-action 'action_skk_roma
+ (lambda (sc)
+ '(figure_ja_roma
+ "£Ò"
+ "¥í¡¼¥Þ»ú"
+ "¥í¡¼¥Þ»úÆþÎϥ⡼¥É"))
+ (lambda (sc)
+ (= (skk-context-input-rule sc)
+ skk-input-rule-roma))
+ (lambda (sc)
+ (skk-prepare-activation sc)
+ (rk-context-set-rule! (skk-context-rk-context sc)
+ ja-rk-rule)
+ (skk-context-set-input-rule! sc skk-input-rule-roma)))
+
+
+(register-action 'action_skk_azik
+ (lambda (sc)
+ '(figure_ja_azik
+ "£Á"
+ "AZIK"
+ "AZIK³ÈÄ¥¥í¡¼¥Þ»úÆþÎϥ⡼¥É"))
+ (lambda (sc)
+ (= (skk-context-input-rule sc)
+ skk-input-rule-azik))
+ (lambda (sc)
+ (require "japanese-azik.scm")
+ (skk-prepare-activation sc)
+ (rk-context-set-rule! (skk-context-rk-context sc)
+ ja-azik-rule)
+ (skk-context-set-input-rule! sc skk-input-rule-azik)))
+
;; Update widget definitions based on action configurations. The
;; procedure is needed for on-the-fly reconfiguration involving the
;; custom API
@@ -226,6 +260,10 @@
(register-widget 'widget_skk_input_mode
(activity-indicator-new skk-input-mode-actions)
(actions-new skk-input-mode-actions))
+
+ (register-widget 'widget_skk_kana_input_method
+ (activity-indicator-new skk-kana-input-method-actions)
+ (actions-new skk-kana-input-method-actions))
(context-list-replace-widgets! 'skk skk-widgets)))
(define skk-context-rec-spec
@@ -234,6 +272,7 @@
(list
(list 'state 'skk-state-latin)
(list 'kana-mode skk-type-hiragana)
+ (list 'input-rule skk-input-rule-roma)
(list 'head '())
(list 'okuri-head "")
(list 'okuri '())
@@ -302,7 +341,6 @@
(skk-read-personal-dictionary)))
(let ((sc (skk-context-new-internal id im))
(rkc (rk-context-new ja-rk-rule #t #f)))
- (if skk-use-azik? (rk-context-set-rule! rkc ja-azik-rule))
(skk-context-set-widgets! sc skk-widgets)
(skk-context-set-head! sc '())
(skk-context-set-rk-context! sc rkc)
More information about the Uim-commit
mailing list