1;;; wnn-custom.scm: Customization variables for wnn.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 wnn-im-name-label (N_ "Wnn"))
36(define wnn-im-short-desc (N_ "A multi-segment kana-kanji conversion engine"))
37
38(define-custom-group 'wnn
39                     wnn-im-name-label
40                     wnn-im-short-desc)
41
42(define-custom-group 'wnnserver
43		     (N_ "Wnn server")
44		     (N_ "long description will be here."))
45
46(define-custom-group 'wnn-advanced
47		     (N_ "Wnn (advanced)")
48		     (N_ "long description will be here."))
49
50(define-custom-group 'wnn-prediction
51		     (N_ "Prediction")
52		     (N_ "long description will be here."))
53
54;;
55;; segment separator
56;;
57
58(define-custom 'wnn-show-segment-separator? #f
59  '(wnn segment-sep)
60  '(boolean)
61  (N_ "Show segment separator")
62  (N_ "long description will be here."))
63
64(define-custom 'wnn-segment-separator "|"
65  '(wnn segment-sep)
66  '(string ".*")
67  (N_ "Segment separator")
68  (N_ "long description will be here."))
69
70(custom-add-hook 'wnn-segment-separator
71		 'custom-activity-hooks
72		 (lambda ()
73		   wnn-show-segment-separator?))
74
75;;
76;; candidate window
77;;
78
79(define-custom 'wnn-use-candidate-window? #t
80  '(wnn candwin)
81  '(boolean)
82  (N_ "Use candidate window")
83  (N_ "long description will be here."))
84
85(define-custom 'wnn-candidate-op-count 1
86  '(wnn candwin)
87  '(integer 0 99)
88  (N_ "Conversion key press count to show candidate window")
89  (N_ "long description will be here."))
90
91(define-custom 'wnn-nr-candidate-max 10
92  '(wnn candwin)
93  '(integer 1 20)
94  (N_ "Number of candidates in candidate window at a time")
95  (N_ "long description will be here."))
96
97(define-custom 'wnn-select-candidate-by-numeral-key? #f
98  '(wnn candwin)
99  '(boolean)
100  (N_ "Select candidate by numeral keys")
101  (N_ "long description will be here."))
102
103;; activity dependency
104(custom-add-hook 'wnn-candidate-op-count
105		 'custom-activity-hooks
106		 (lambda ()
107		   wnn-use-candidate-window?))
108
109(custom-add-hook 'wnn-nr-candidate-max
110		 'custom-activity-hooks
111		 (lambda ()
112		   wnn-use-candidate-window?))
113
114(custom-add-hook 'wnn-select-candidate-by-numeral-key?
115		 'custom-activity-hooks
116		 (lambda ()
117		   wnn-use-candidate-window?))
118
119;;
120;; toolbar
121;;
122
123;; Can't be unified with action definitions in wnn.scm until uim
124;; 0.4.6.
125(define wnn-input-mode-indication-alist
126  (list
127   (list 'action_wnn_direct
128	 'ja_direct
129	 "-"
130	 (N_ "Direct input")
131	 (N_ "Direct input mode"))
132   (list 'action_wnn_hiragana
133	 'ja_hiragana
134	 "��"
135	 (N_ "Hiragana")
136	 (N_ "Hiragana input mode"))
137   (list 'action_wnn_katakana
138	 'ja_katakana
139	 "��"
140	 (N_ "Katakana")
141	 (N_ "Katakana input mode"))
142   (list 'action_wnn_halfkana
143	 'ja_halfkana
144	 "��"
145	 (N_ "Halfwidth Katakana")
146	 (N_ "Halfwidth Katakana input mode"))
147   (list 'action_wnn_halfwidth_alnum
148	 'ja_halfwidth_alnum
149	 "a"
150	 (N_ "Halfwidth Alphanumeric")
151	 (N_ "Halfwidth Alphanumeric input mode"))
152
153   (list 'action_wnn_fullwidth_alnum
154	 'ja_fullwidth_alnum
155	 "��"
156	 (N_ "Fullwidth Alphanumeric")
157	 (N_ "Fullwidth Alphanumeric input mode"))))
158
159(define wnn-kana-input-method-indication-alist
160  (list
161   (list 'action_wnn_roma
162	 'ja_romaji
163	 "��"
164	 (N_ "Romaji")
165	 (N_ "Romaji input mode"))
166   (list 'action_wnn_kana
167	 'ja_kana
168	 "��"
169	 (N_ "Kana")
170	 (N_ "Kana input mode"))
171   (list 'action_wnn_azik
172	 'ja_azik
173	 "��"
174	 (N_ "AZIK")
175	 (N_ "AZIK extended romaji input mode"))
176   (list 'action_wnn_act
177	 'ja_act
178	 "��"
179	 (N_ "ACT")
180	 (N_ "ACT extended romaji input mode"))
181   (list 'action_wnn_kzik
182	 'ja_kzik
183	 "��"
184	 (N_ "KZIK")
185	 (N_ "KZIK extended romaji input mode"))))
186
187;;; Buttons
188
189(define-custom 'wnn-widgets '(widget_wnn_input_mode
190				widget_wnn_kana_input_method)
191  '(wnn toolbar-widget)
192  (list 'ordered-list
193	(list 'widget_wnn_input_mode
194	      (N_ "Input mode")
195	      (N_ "Input mode"))
196	(list 'widget_wnn_kana_input_method
197	      (N_ "Kana input method")
198	      (N_ "Kana input method")))
199  (N_ "Enabled toolbar buttons")
200  (N_ "long description will be here."))
201
202;; dynamic reconfiguration
203;; wnn-configure-widgets is not defined at this point. So wrapping
204;; into lambda.
205(custom-add-hook 'wnn-widgets
206		 'custom-set-hooks
207		 (lambda ()
208		   (wnn-configure-widgets)))
209
210
211;;; Input mode
212
213(define-custom 'default-widget_wnn_input_mode 'action_wnn_direct
214  '(wnn toolbar-widget)
215  (cons 'choice
216	(map indication-alist-entry-extract-choice
217	     wnn-input-mode-indication-alist))
218  (N_ "Default input mode")
219  (N_ "long description will be here."))
220
221(define-custom 'wnn-input-mode-actions
222               (map car wnn-input-mode-indication-alist)
223  '(wnn toolbar-widget)
224  (cons 'ordered-list
225	(map indication-alist-entry-extract-choice
226	     wnn-input-mode-indication-alist))
227  (N_ "Input mode menu items")
228  (N_ "long description will be here."))
229
230;; value dependency
231(if custom-full-featured?
232    (custom-add-hook 'wnn-input-mode-actions
233		     'custom-set-hooks
234		     (lambda ()
235		       (custom-choice-range-reflect-olist-val
236			'default-widget_wnn_input_mode
237			'wnn-input-mode-actions
238			wnn-input-mode-indication-alist))))
239
240;; activity dependency
241(custom-add-hook 'default-widget_wnn_input_mode
242		 'custom-activity-hooks
243		 (lambda ()
244		   (memq 'widget_wnn_input_mode wnn-widgets)))
245
246(custom-add-hook 'wnn-input-mode-actions
247		 'custom-activity-hooks
248		 (lambda ()
249		   (memq 'widget_wnn_input_mode wnn-widgets)))
250
251;; dynamic reconfiguration
252(custom-add-hook 'default-widget_wnn_input_mode
253		 'custom-set-hooks
254		 (lambda ()
255		   (wnn-configure-widgets)))
256
257(custom-add-hook 'wnn-input-mode-actions
258		 'custom-set-hooks
259		 (lambda ()
260		   (wnn-configure-widgets)))
261
262;;; Kana input method
263
264(define-custom 'default-widget_wnn_kana_input_method 'action_wnn_roma
265  '(wnn toolbar-widget)
266  (cons 'choice
267	(map indication-alist-entry-extract-choice
268	     wnn-kana-input-method-indication-alist))
269  (N_ "Default kana input method")
270  (N_ "long description will be here."))
271
272(define-custom 'wnn-kana-input-method-actions
273               (map car wnn-kana-input-method-indication-alist)
274  '(wnn toolbar-widget)
275  (cons 'ordered-list
276	(map indication-alist-entry-extract-choice
277	     wnn-kana-input-method-indication-alist))
278  (N_ "Kana input method menu items")
279  (N_ "long description will be here."))
280
281;; value dependency
282(if custom-full-featured?
283    (custom-add-hook 'wnn-kana-input-method-actions
284		     'custom-set-hooks
285		     (lambda ()
286		       (custom-choice-range-reflect-olist-val
287			'default-widget_wnn_kana_input_method
288			'wnn-kana-input-method-actions
289			wnn-kana-input-method-indication-alist))))
290
291;; activity dependency
292(custom-add-hook 'default-widget_wnn_kana_input_method
293		 'custom-activity-hooks
294		 (lambda ()
295		   (memq 'widget_wnn_kana_input_method wnn-widgets)))
296
297(custom-add-hook 'wnn-kana-input-method-actions
298		 'custom-activity-hooks
299		 (lambda ()
300		   (memq 'widget_wnn_kana_input_method wnn-widgets)))
301
302;; dynamic reconfiguration
303(custom-add-hook 'default-widget_wnn_kana_input_method
304		 'custom-set-hooks
305		 (lambda ()
306		   (wnn-configure-widgets)))
307
308(custom-add-hook 'wnn-kana-input-method-actions
309		 'custom-set-hooks
310		 (lambda ()
311		   (wnn-configure-widgets)))
312
313
314;;
315;; wnn-server-name
316;;
317
318(define-custom 'wnn-use-remote-server? #f
319  '(wnn-advanced wnnserver)
320  '(boolean)
321  (N_ "Use remote Wnn server")
322  (N_ "long description will be here."))
323
324
325(define-custom 'wnn-server-name "localhost"
326  '(wnn-advanced wnnserver)
327  '(string ".*")
328  (N_ "Wnn server name")
329  (N_ "long description will be here."))
330
331(custom-add-hook 'wnn-server-name
332                 'custom-activity-hooks
333                 (lambda ()
334                   wnn-use-remote-server?))
335
336(define-custom 'wnn-rcfile ""
337  '(wnn-advanced wnnserver)
338  '(pathname regular-file)
339  (N_ "Wnn resource file")
340  (N_ "long description will be here."))
341
342(define-custom 'wnn-use-with-vi? #f
343  '(wnn-advanced special-op)
344  '(boolean)
345  (N_ "Enable vi-cooperative mode")
346  (N_ "long description will be here."))
347
348(define-custom 'wnn-use-mode-transition-keys-in-off-mode? #f
349  '(wnn-advanced mode-transition)
350  '(boolean)
351  (N_ "Enable input mode transition keys in direct (off state) input mode")
352  (N_ "long description will be here."))
353
354;; prediction
355(define-custom 'wnn-use-prediction? #f
356  '(wnn-advanced wnn-prediction)
357  '(boolean)
358  (N_ "Enable input prediction")
359  (N_ "long description will be here."))
360
361(define-custom 'wnn-select-prediction-by-numeral-key? #f
362  '(wnn-advanced wnn-prediction)
363  '(boolean)
364  (N_ "Select prediction candidate by numeral keys")
365  (N_ "long description will be here."))
366
367(define-custom 'wnn-use-implicit-commit-prediction? #t
368  '(wnn-advanced wnn-prediction)
369  '(boolean)
370  (N_ "Show selected prediction candidate in preedit area")
371  (N_ "long description will be here."))
372
373(define-custom 'wnn-prediction-cache-words 256
374  '(wnn-advanced wnn-prediction)
375  '(integer 1 65535)
376  (N_ "Number of cache of prediction candidates")
377  (N_ "long description will be here."))
378
379(define-custom 'wnn-prediction-start-char-count 2
380  '(wnn-advanced wnn-prediction)
381  '(integer 1 65535)
382  (N_ "Character count to start input prediction")
383  (N_ "long description will be here."))
384
385(custom-add-hook 'wnn-use-candidate-window?
386                 'custom-get-hooks
387                 (lambda ()
388                   (if (not wnn-use-candidate-window?)
389                       (set! wnn-use-prediction? #f))))
390
391(custom-add-hook 'wnn-use-prediction?
392                 'custom-activity-hooks
393                 (lambda ()
394                   wnn-use-candidate-window?))
395
396(custom-add-hook 'wnn-select-prediction-by-numeral-key?
397                 'custom-activity-hooks
398                 (lambda ()
399                   wnn-use-prediction?))
400
401(custom-add-hook 'wnn-use-implicit-commit-prediction?
402                 'custom-activity-hooks
403                 (lambda ()
404                   wnn-use-prediction?))
405
406(custom-add-hook 'wnn-prediction-cache-words
407                 'custom-activity-hooks
408                 (lambda ()
409                   wnn-use-prediction?))
410
411(custom-add-hook 'wnn-prediction-start-char-count
412                 'custom-activity-hooks
413                 (lambda ()
414                   wnn-use-prediction?))
415