1;;; anthy-custom.scm: Customization variables for anthy.scm
2;;;
3;;; Copyright (c) 2003-2013 uim Project https://github.com/uim/uim
4;;;
5;;; All rights reserved.
6;;;
7;;; Redistribution and use in source and binary forms, with or without
8;;; modification, are permitted provided that the following conditions
9;;; are met:
10;;; 1. Redistributions of source code must retain the above copyright
11;;;    notice, this list of conditions and the following disclaimer.
12;;; 2. Redistributions in binary form must reproduce the above copyright
13;;;    notice, this list of conditions and the following disclaimer in the
14;;;    documentation and/or other materials provided with the distribution.
15;;; 3. Neither the name of authors nor the names of its contributors
16;;;    may be used to endorse or promote products derived from this software
17;;;    without specific prior written permission.
18;;;
19;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
20;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
23;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29;;; SUCH DAMAGE.
30;;;;
31
32(require "i18n.scm")
33
34
35(define anthy-im-name-label (N_ "Anthy"))
36(define anthy-im-short-desc (N_ "A multi-segment kana-kanji conversion engine"))
37
38(define-custom-group 'anthy
39                     anthy-im-name-label
40                     anthy-im-short-desc)
41
42(define-custom-group 'anthy-advanced
43		     (N_ "Anthy (advanced)")
44		     (N_ "Advanced settings for Anthy"))
45
46(define-custom-group 'anthy-prediction
47		     (N_ "Prediction")
48		     (N_ "long description will be here."))
49
50;;
51;; segment separator
52;;
53
54(define-custom 'anthy-show-segment-separator? #f
55  '(anthy segment-sep)
56  '(boolean)
57  (N_ "Show segment separator")
58  (N_ "long description will be here."))
59
60(define-custom 'anthy-segment-separator "|"
61  '(anthy segment-sep)
62  '(string ".*")
63  (N_ "Segment separator")
64  (N_ "long description will be here."))
65
66(custom-add-hook 'anthy-segment-separator
67		 'custom-activity-hooks
68		 (lambda ()
69		   anthy-show-segment-separator?))
70
71;;
72;; candidate window
73;;
74
75(define-custom 'anthy-use-candidate-window? #t
76  '(anthy candwin)
77  '(boolean)
78  (N_ "Use candidate window")
79  (N_ "long description will be here."))
80
81(define-custom 'anthy-candidate-op-count 1
82  '(anthy candwin)
83  '(integer 0 99)
84  (N_ "Conversion key press count to show candidate window")
85  (N_ "long description will be here."))
86
87(define-custom 'anthy-nr-candidate-max 10
88  '(anthy candwin)
89  '(integer 1 20)
90  (N_ "Number of candidates in candidate window at a time")
91  (N_ "long description will be here."))
92
93(define-custom 'anthy-select-candidate-by-numeral-key? #f
94  '(anthy candwin)
95  '(boolean)
96  (N_ "Select candidate by numeral keys")
97  (N_ "long description will be here."))
98
99;; activity dependency
100(custom-add-hook 'anthy-candidate-op-count
101		 'custom-activity-hooks
102		 (lambda ()
103		   anthy-use-candidate-window?))
104
105(custom-add-hook 'anthy-nr-candidate-max
106		 'custom-activity-hooks
107		 (lambda ()
108		   anthy-use-candidate-window?))
109
110(custom-add-hook 'anthy-select-candidate-by-numeral-key?
111		 'custom-activity-hooks
112		 (lambda ()
113		   anthy-use-candidate-window?))
114
115;;
116;; toolbar
117;;
118
119;; Can't be unified with action definitions in anthy.scm until uim
120;; 0.4.6.
121(define anthy-input-mode-indication-alist
122  (list
123   (list 'action_anthy_direct
124	 'ja_direct
125	 "-"
126	 (N_ "Direct input")
127	 (N_ "Direct input mode"))
128   (list 'action_anthy_hiragana
129	 'ja_hiragana
130	 "��"
131	 (N_ "Hiragana")
132	 (N_ "Hiragana input mode"))
133   (list 'action_anthy_katakana
134	 'ja_katakana
135	 "��"
136	 (N_ "Katakana")
137	 (N_ "Katakana input mode"))
138   (list 'action_anthy_halfkana
139	 'ja_halfkana
140	 "��"
141	 (N_ "Halfwidth Katakana")
142	 (N_ "Halfwidth Katakana input mode"))
143   (list 'action_anthy_halfwidth_alnum
144	 'ja_halfwidth_alnum
145	 "a"
146	 (N_ "Halfwidth Alphanumeric")
147	 (N_ "Halfwidth Alphanumeric input mode"))
148   (list 'action_anthy_fullwidth_alnum
149	 'ja_fullwidth_alnum
150	 "��"
151	 (N_ "Fullwidth Alphanumeric")
152	 (N_ "Fullwidth Alphanumeric input mode"))))
153
154(define anthy-kana-input-method-indication-alist
155  (list
156   (list 'action_anthy_roma
157	 'ja_romaji
158	 "��"
159	 (N_ "Romaji")
160	 (N_ "Romaji input mode"))
161   (list 'action_anthy_kana
162	 'ja_kana
163	 "��"
164	 (N_ "Kana")
165	 (N_ "Kana input mode"))
166   (list 'action_anthy_azik
167	 'ja_azik
168	 "��"
169	 (N_ "AZIK")
170	 (N_ "AZIK extended romaji input mode"))
171   (list 'action_anthy_act
172	 'ja_act
173	 "��"
174	 (N_ "ACT")
175	 (N_ "ACT extended romaji input mode"))
176   (list 'action_anthy_kzik
177	 'ja_kzik
178	 "��"
179	 (N_ "KZIK")
180	 (N_ "KZIK extended romaji input mode"))))
181
182;;; Buttons
183
184(define-custom 'anthy-widgets '(widget_anthy_input_mode
185				widget_anthy_kana_input_method)
186  '(anthy toolbar-widget)
187  (list 'ordered-list
188	(list 'widget_anthy_input_mode
189	      (N_ "Input mode")
190	      (N_ "Input mode"))
191	(list 'widget_anthy_kana_input_method
192	      (N_ "Kana input method")
193	      (N_ "Kana input method")))
194  (N_ "Enabled toolbar buttons")
195  (N_ "long description will be here."))
196
197;; dynamic reconfiguration
198;; anthy-configure-widgets is not defined at this point. So wrapping
199;; into lambda.
200(custom-add-hook 'anthy-widgets
201		 'custom-set-hooks
202		 (lambda ()
203		   (anthy-configure-widgets)))
204
205
206;;; Input mode
207
208(define-custom 'default-widget_anthy_input_mode 'action_anthy_direct
209  '(anthy toolbar-widget)
210  (cons 'choice
211	(map indication-alist-entry-extract-choice
212	     anthy-input-mode-indication-alist))
213  (N_ "Default input mode")
214  (N_ "long description will be here."))
215
216(define-custom 'anthy-input-mode-actions
217               (map car anthy-input-mode-indication-alist)
218  '(anthy toolbar-widget)
219  (cons 'ordered-list
220	(map indication-alist-entry-extract-choice
221	     anthy-input-mode-indication-alist))
222  (N_ "Input mode menu items")
223  (N_ "long description will be here."))
224
225;; value dependency
226(if custom-full-featured?
227    (custom-add-hook 'anthy-input-mode-actions
228		     'custom-set-hooks
229		     (lambda ()
230		       (custom-choice-range-reflect-olist-val
231			'default-widget_anthy_input_mode
232			'anthy-input-mode-actions
233			anthy-input-mode-indication-alist))))
234
235;; activity dependency
236(custom-add-hook 'default-widget_anthy_input_mode
237		 'custom-activity-hooks
238		 (lambda ()
239		   (memq 'widget_anthy_input_mode anthy-widgets)))
240
241(custom-add-hook 'anthy-input-mode-actions
242		 'custom-activity-hooks
243		 (lambda ()
244		   (memq 'widget_anthy_input_mode anthy-widgets)))
245
246;; dynamic reconfiguration
247(custom-add-hook 'default-widget_anthy_input_mode
248		 'custom-set-hooks
249		 (lambda ()
250		   (anthy-configure-widgets)))
251
252(custom-add-hook 'anthy-input-mode-actions
253		 'custom-set-hooks
254		 (lambda ()
255		   (anthy-configure-widgets)))
256
257;;; Kana input method
258
259(define-custom 'default-widget_anthy_kana_input_method 'action_anthy_roma
260  '(anthy toolbar-widget)
261  (cons 'choice
262	(map indication-alist-entry-extract-choice
263	     anthy-kana-input-method-indication-alist))
264  (N_ "Default kana input method")
265  (N_ "long description will be here."))
266
267(define-custom 'anthy-kana-input-method-actions
268               (map car anthy-kana-input-method-indication-alist)
269  '(anthy toolbar-widget)
270  (cons 'ordered-list
271	(map indication-alist-entry-extract-choice
272	     anthy-kana-input-method-indication-alist))
273  (N_ "Kana input method menu items")
274  (N_ "long description will be here."))
275
276;; value dependency
277(if custom-full-featured?
278    (custom-add-hook 'anthy-kana-input-method-actions
279		     'custom-set-hooks
280		     (lambda ()
281		       (custom-choice-range-reflect-olist-val
282			'default-widget_anthy_kana_input_method
283			'anthy-kana-input-method-actions
284			anthy-kana-input-method-indication-alist))))
285
286;; activity dependency
287(custom-add-hook 'default-widget_anthy_kana_input_method
288		 'custom-activity-hooks
289		 (lambda ()
290		   (memq 'widget_anthy_kana_input_method anthy-widgets)))
291
292(custom-add-hook 'anthy-kana-input-method-actions
293		 'custom-activity-hooks
294		 (lambda ()
295		   (memq 'widget_anthy_kana_input_method anthy-widgets)))
296
297;; dynamic reconfiguration
298(custom-add-hook 'default-widget_anthy_kana_input_method
299		 'custom-set-hooks
300		 (lambda ()
301		   (anthy-configure-widgets)))
302
303(custom-add-hook 'anthy-kana-input-method-actions
304		 'custom-set-hooks
305		 (lambda ()
306		   (anthy-configure-widgets)))
307
308(define-custom 'anthy-use-prediction? #f
309  '(anthy-advanced anthy-prediction)
310  '(boolean)
311  (N_ "Enable input prediction")
312  (N_ "long description will be here."))
313
314(define-custom 'anthy-select-prediction-by-numeral-key? #f
315  '(anthy-advanced anthy-prediction)
316  '(boolean)
317  (N_ "Select prediction candidate by numeral keys")
318  (N_ "long description will be here."))
319
320(define-custom 'anthy-use-implicit-commit-prediction? #t
321  '(anthy-advanced anthy-prediction)
322  '(boolean)
323  (N_ "Show selected prediction candidate in preedit area")
324  (N_ "long description will be here."))
325
326(define-custom 'anthy-prediction-start-char-count 1
327  '(anthy-advanced anthy-prediction)
328  '(integer 1 65535)
329  (N_ "Character count to start input prediction")
330  (N_ "long description will be here."))
331
332(custom-add-hook 'anthy-use-candidate-window?
333		 'custom-get-hooks
334		 (lambda ()
335		   (if (not anthy-use-candidate-window?)
336		       (set! anthy-use-prediction? #f))))
337
338(custom-add-hook 'anthy-use-prediction?
339		 'custom-activity-hooks
340		 (lambda ()
341		   anthy-use-candidate-window?))
342
343(custom-add-hook 'anthy-select-prediction-by-numeral-key?
344		 'custom-activity-hooks
345		 (lambda ()
346		   anthy-use-prediction?))
347
348(custom-add-hook 'anthy-use-implicit-commit-prediction?
349		 'custom-activity-hooks
350		 (lambda ()
351		   anthy-use-prediction?))
352
353(custom-add-hook 'anthy-prediction-start-char-count
354		 'custom-activity-hooks
355		 (lambda ()
356		   anthy-use-prediction?))
357
358(define-custom 'anthy-use-with-vi? #f
359  '(anthy-advanced special-op)
360  '(boolean)
361  (N_ "Enable vi-cooperative mode")
362  (N_ "long description will be here."))
363
364(define-custom 'anthy-auto-start-henkan? #f
365  '(anthy-advanced special-op)
366  '(boolean)
367  (N_ "Enable auto conversion with punctuation marks")
368  (N_ "long description will be here."))
369
370(define-custom 'anthy-use-mode-transition-keys-in-off-mode? #f
371  '(anthy-advanced mode-transition)
372  '(boolean)
373  (N_ "Enable input mode transition keys in direct (off state) input mode")
374  (N_ "long description will be here."))
375