Revision: 6578
Author: deton.kih
Date: Sat Jul 24 14:35:14 2010
Log: * Add custom to set use of table style candidate window.
* scm/tutcode-custom.scm
  - (tutcode-use-table-style-candidate-window?):
    New custom variable and set hooks.
  - (tutcode-candidate-window-table-layout):
    New custom variable and activity hooks.
* scm/tutcode.scm
  - (uim-candwin-prog, uim-candwin-prog-layout):
    New variable for table style candidate window.
  - (uim-candwin-prog-layout-qwerty-jis,
     uim-candwin-prog-layout-qwerty-us,
     uim-candwin-prog-layout-dvorak): Ditto.
  - (tutcode-table-heading-label-char-list-qwerty-jis,
     tutcode-table-heading-label-char-list-qwerty-us,
     tutcode-table-heading-label-char-list-dvorak): Ditto.
  - (tutcode-table-heading-label-char-list-for-kigou-mode):
    Change to make from uim-candwin-prog-layout.
  - (tutcode-context-new):
    Change to use new custom tutcode-use-table-style-candidate-window?
* xim/canddisp.cpp
  - (candwin_command): Fix to ignore empty uim-candwin-prog.

http://code.google.com/p/uim/source/detail?r=6578

Modified:
 /trunk/scm/tutcode-custom.scm
 /trunk/scm/tutcode.scm
 /trunk/xim/canddisp.cpp

=======================================
--- /trunk/scm/tutcode-custom.scm       Mon Jul 19 00:07:47 2010
+++ /trunk/scm/tutcode-custom.scm       Sat Jul 24 14:35:14 2010
@@ -102,6 +102,21 @@
   (N_ "Use candidate window")
   (N_ "long description will be here."))

+(define-custom 'tutcode-use-table-style-candidate-window? #f
+  '(tutcode candwin)
+  '(boolean)
+  (N_ "Use table style candidate window")
+  (N_ "long description will be here."))
+
+(define-custom 'tutcode-candidate-window-table-layout 'qwerty-jis
+  '(tutcode candwin)
+  (list 'choice
+       (list 'qwerty-jis (N_ "qwerty-jis") (N_ "Qwerty JIS"))
+       (list 'qwerty-us (N_ "qwerty-us") (N_ "Qwerty US"))
+       (list 'dvorak (N_ "dvorak") (N_ "Dvorak")))
+  (N_ "Key layout of table style candidate window")
+  (N_ "long description will be here."))
+
 (define-custom 'tutcode-commit-candidate-by-label-key? #t
   '(tutcode candwin)
   '(boolean)
@@ -164,3 +179,22 @@
                 'custom-activity-hooks
                 (lambda ()
                   tutcode-use-auto-help-window?))
+
+(custom-add-hook 'tutcode-use-table-style-candidate-window?
+  'custom-set-hooks
+  (lambda ()
+    (if tutcode-use-table-style-candidate-window?
+      (begin
+        (custom-set-value! 'tutcode-nr-candidate-max
+          (length tutcode-table-heading-label-char-list))
+        (custom-set-value!
+          'tutcode-nr-candidate-max-for-kigou-mode
+          (length tutcode-table-heading-label-char-list-for-kigou-mode)))
+      (begin
+        (custom-set-value! 'tutcode-nr-candidate-max 10)
+        (custom-set-value! 'tutcode-nr-candidate-max-for-kigou-mode 10)))))
+
+(custom-add-hook 'tutcode-candidate-window-table-layout
+                'custom-activity-hooks
+                (lambda ()
+                  tutcode-use-table-style-candidate-window?))
=======================================
--- /trunk/scm/tutcode.scm      Fri Jul 23 13:40:47 2010
+++ /trunk/scm/tutcode.scm      Sat Jul 24 14:35:14 2010
@@ -131,13 +131,83 @@
 ;;; tutcode-context-new»þ¤ËÈ¿±Ç¤¹¤ë¡£
 (define tutcode-rule-userconfig ())

+;;; ¸õÊ䥦¥£¥ó¥É¥¦¤Î¥×¥í¥°¥é¥à̾¡£
+;;; uim-xim¤¬¡¢UIM_LIBEXECDIR/uim-candwin-prog¤ò¸õÊ䥦¥£¥ó¥É¥¦¤È¤·¤Æ»ÈÍÑ¡£
+;;; gtk-immoduleÅù¤¬¡¢É½·Á¼°¸õÊ䥦¥£¥ó¥É¥¦¤ò»ÈÍѤ¹¤ë¤«È½ÃǤ¹¤ë¤¿¤á¡¢
+;;; "uim-candwin-tbl"¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤ë¤«¤É¤¦¤«¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤¤¤ë¡£
+;;; ɽ·Á¼°¸õÊ䥦¥£¥ó¥É¥¦¤òcustom¤ÇÀßÄê¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë¤¿¤á¡¢
+;;; ¤¢¤é¤«¤¸¤ádefine¡£
+;;; XXX:tutcode°Ê³°¤Ë¤â±Æ¶Á¤¹¤ë¤Î¤Ç¡¢Â¾¤Î¾ì½ê¤ÎÊý¤¬¤¤¤¤¤«¤â¡£
+(define uim-candwin-prog "")
+(if tutcode-use-table-style-candidate-window?
+  (set! uim-candwin-prog "uim-candwin-tbl-gtk"))
+
+;;; ɽ·Á¼°¤Î¸õÊ䥦¥£¥ó¥É¥¦¾å¤Î³Æ¥Ü¥¿¥ó¤È¥­¡¼¤ÎÂбþɽ(13Îó8¹Ô)¡£
+;;; ɽ·Á¼°¸õÊ䥦¥£¥ó¥É¥¦¤¬»²¾È¤·¤Æ»ÈÍѤ¹¤ë¡£
+(define uim-candwin-prog-layout ())
+;;; ɽ·Á¼°¸õÊ䥦¥£¥ó¥É¥¦¾å¤Î¥­¡¼¥ì¥¤¥¢¥¦¥È:QWERTY(JIS)ÇÛÎó¡£
+(define uim-candwin-prog-layout-qwerty-jis
+  '("1" "2" "3" "4" "5"  "6" "7" "8" "9" "0"  "-" "^" "\\"
+    "q" "w" "e" "r" "t"  "y" "u" "i" "o" "p"  "@" "[" ""
+    "a" "s" "d" "f" "g"  "h" "j" "k" "l" ";"  ":" "]" ""
+    "z" "x" "c" "v" "b"  "n" "m" "," "." "/"  ""  ""  " "
+    "!" "\"" "#" "$" "%" "&" "'" "(" ")" ""   "=" "~" "|"
+    "Q" "W" "E" "R" "T"  "Y" "U" "I" "O" "P"  "`" "{" ""
+    "A" "S" "D" "F" "G"  "H" "J" "K" "L" "+"  "*" "}" ""
+    "Z" "X" "C" "V" "B"  "N" "M" "<" ">" "?"  "_" ""  ""))
+;;; ɽ·Á¼°¸õÊ䥦¥£¥ó¥É¥¦¾å¤Î¥­¡¼¥ì¥¤¥¢¥¦¥È:QWERTY(US/ASCII)ÇÛÎó¡£
+(define uim-candwin-prog-layout-qwerty-us
+  '("1" "2" "3" "4" "5"  "6" "7" "8" "9" "0"  "-" "=" "\\"
+    "q" "w" "e" "r" "t"  "y" "u" "i" "o" "p"  "[" "]" ""
+    "a" "s" "d" "f" "g"  "h" "j" "k" "l" ";"  "'" "`" ""
+    "z" "x" "c" "v" "b"  "n" "m" "," "." "/"  ""  ""  " "
+    "!" "@" "#" "$" "%"  "^" "&" "*" "(" ")"  "_" "+" "|"
+    "Q" "W" "E" "R" "T"  "Y" "U" "I" "O" "P"  "{" "}" ""
+    "A" "S" "D" "F" "G"  "H" "J" "K" "L" ":"  "\"" "~" ""
+    "Z" "X" "C" "V" "B"  "N" "M" "<" ">" "?"  ""  ""  ""))
+;;; ɽ·Á¼°¸õÊ䥦¥£¥ó¥É¥¦¾å¤Î¥­¡¼¥ì¥¤¥¢¥¦¥È:DVORAKÇÛÎó¡£
+;;; (µ­¹æ¤ÎÇÛÃÖ¤ÏÅý°ì¤µ¤ì¤¿¤â¤Î¤Ï̵¤¤¤è¤¦¤Ê¤Î¤Ç°ìÎã)
+(define uim-candwin-prog-layout-dvorak
+  '("1" "2" "3" "4" "5"  "6" "7" "8" "9" "0"  "[" "]" "\\"
+    "'" "," "." "p" "y"  "f" "g" "c" "r" "l"  "/" "=" ""
+    "a" "o" "e" "u" "i"  "d" "h" "t" "n" "s"  "-" "`" ""
+    ";" "q" "j" "k" "x"  "b" "m" "w" "v" "z"  ""  ""  " "
+    "!" "@" "#" "$" "%"  "^" "&" "*" "(" ")"  "{" "}" "|"
+    "\"" "<" ">" "P" "Y" "F" "G" "C" "R" "L"  "?" "+" ""
+    "A" "O" "E" "U" "I"  "D" "H" "T" "N" "S"  "_" "~" ""
+    ":" "Q" "J" "K" "X"  "B" "M" "W" "V" "Z"  ""  ""  ""))
+;;; ɽ·Á¼°¤Î¸õÊ䥦¥£¥ó¥É¥¦¾å¤Î³Æ¥Ü¥¿¥ó¤È¥­¡¼¤ÎÂбþɽ¤òÀßÄê¡£
+;;; (~/.uim¤Ï¤³¤Î¸å¤Ç¼Â¹Ô¤µ¤ì¤ë¤Î¤Ç¡¢
+;;;  ~/.uim¤ÇÊѹ¹¤¹¤ë¤Ë¤Ïuim-candwin-prog-layout¤ò¾å½ñ¤­¤¹¤ëɬÍפ¢¤ê)
+(set! uim-candwin-prog-layout
+  (case tutcode-candidate-window-table-layout
+    ((qwerty-jis) uim-candwin-prog-layout-qwerty-jis)
+    ((qwerty-us) uim-candwin-prog-layout-qwerty-us)
+    ((dvorak) uim-candwin-prog-layout-dvorak)
+    (else ()))) ; default
+
 ;;; ¸ò¤¼½ñ¤­ÊÑ´¹»þ¤Î¸õÊäÁªÂòÍÑ¥é¥Ù¥ëʸ»ú¤Î¥ê¥¹¥È(ɽ·Á¼°¸õÊ䥦¥£¥ó¥É¥¦ÍÑ)¡£
-;;; (ÂǤÁ¤ä¤¹¤¤¾ì½ê¤«¤éÀè¤Ë¸õÊä¤òËä¤á¤ë)
-(define tutcode-table-heading-label-char-list
+;;; QWERTY(JIS)ÇÛÎóÍÑ¡£
+(define tutcode-table-heading-label-char-list-qwerty-jis
   '("a" "s" "d" "f" "g" "h" "j" "k" "l" ";"
     "q" "w" "e" "r" "t" "y" "u" "i" "o" "p"
     "z" "x" "c" "v" "b" "n" "m" "," "." "/"
     "1" "2" "3" "4" "5" "6" "7" "8" "9" "0"))
+;;; ¸ò¤¼½ñ¤­ÊÑ´¹»þ¤Î¸õÊäÁªÂòÍÑ¥é¥Ù¥ëʸ»ú¤Î¥ê¥¹¥È(ɽ·Á¼°¸õÊ䥦¥£¥ó¥É¥¦ÍÑ)¡£
+;;; QWERTY(US)ÇÛÎóÍÑ¡£
+(define tutcode-table-heading-label-char-list-qwerty-us
+  tutcode-table-heading-label-char-list-qwerty-jis)
+;;; ¸ò¤¼½ñ¤­ÊÑ´¹»þ¤Î¸õÊäÁªÂòÍÑ¥é¥Ù¥ëʸ»ú¤Î¥ê¥¹¥È(ɽ·Á¼°¸õÊ䥦¥£¥ó¥É¥¦ÍÑ)¡£
+;;; DVORAKÇÛÎóÍÑ¡£
+(define tutcode-table-heading-label-char-list-dvorak
+  '("a" "o" "e" "u" "i"  "d" "h" "t" "n" "s"
+    "'" "," "." "p" "y"  "f" "g" "c" "r" "l"
+    ";" "q" "j" "k" "x"  "b" "m" "w" "v" "z"
+    "1" "2" "3" "4" "5"  "6" "7" "8" "9" "0"))
+;;; ¸ò¤¼½ñ¤­ÊÑ´¹»þ¤Î¸õÊäÁªÂòÍÑ¥é¥Ù¥ëʸ»ú¤Î¥ê¥¹¥È(ɽ·Á¼°¸õÊ䥦¥£¥ó¥É¥¦ÍÑ)¡£
+;;; (ÂǤÁ¤ä¤¹¤¤¾ì½ê¤«¤éÀè¤Ë¸õÊä¤òËä¤á¤ë)
+(define tutcode-table-heading-label-char-list
+  tutcode-table-heading-label-char-list-qwerty-jis)
 ;;; ¸ò¤¼½ñ¤­ÊÑ´¹»þ¤Î¸õÊäÁªÂòÍÑ¥é¥Ù¥ëʸ»ú¤Î¥ê¥¹¥È(uim¥¹¥¿¥¤¥ëÍÑ)
 (define tutcode-uim-heading-label-char-list
   '("1" "2" "3" "4" "5" "6" "7" "8" "9" "0"
@@ -153,14 +223,9 @@
;;; µ­¹æÆþÎϥ⡼¥É»þ¤Î¸õÊäÁªÂòÍÑ¥é¥Ù¥ëʸ»ú¤Î¥ê¥¹¥È(ɽ·Á¼°¸õÊ䥦¥£¥ó¥É¥¦ÍÑ)¡£
 ;;; (¥­¡¼¥Ü¡¼¥É¥ì¥¤¥¢¥¦¥È¤Ë½¾¤Ã¤Æ¡¢º¸¾å¤«¤é±¦²¼¤Ø½ç¤Ë¸õÊä¤òËä¤á¤ë)
 (define tutcode-table-heading-label-char-list-for-kigou-mode
-  '("1" "2" "3" "4" "5" "6" "7" "8" "9" "0" "-" "^" "\\"
-    "q" "w" "e" "r" "t" "y" "u" "i" "o" "p" "@" "["
-    "a" "s" "d" "f" "g" "h" "j" "k" "l" ";" ":" "]"
-    "z" "x" "c" "v" "b" "n" "m" "," "." "/"         " "
-    "!" "\"" "#" "$" "%" "&" "'" "(" ")"    "=" "~" "|"
-    "Q" "W" "E" "R" "T" "Y" "U" "I" "O" "P" "`" "{"
-    "A" "S" "D" "F" "G" "H" "J" "K" "L" "+" "*" "}"
-    "Z" "X" "C" "V" "B" "N" "M" "<" ">" "?" "_"))
+  (if (null? uim-candwin-prog-layout)
+    (delete "" uim-candwin-prog-layout-qwerty-jis)
+    (delete "" uim-candwin-prog-layout)))
 ;;; µ­¹æÆþÎϥ⡼¥É»þ¤Î¸õÊäÁªÂòÍÑ¥é¥Ù¥ëʸ»ú¤Î¥ê¥¹¥È(uim¥¹¥¿¥¤¥ëÍÑ)
 (define tutcode-uim-heading-label-char-list-for-kigou-mode
   '(" "
@@ -356,13 +421,7 @@
       (require "tutcode-dialog.scm")
       (skk-lib-dic-open tutcode-dic-filename #f "localhost" 0 'unspecified)
       (tutcode-read-personal-dictionary)))
-  (let ((tc (tutcode-context-new-internal id im))
-        (candwintbl?
-          (and
-            (symbol-bound? 'uim-candwin-prog)
-            (string? uim-candwin-prog)
-            (>= (string-length uim-candwin-prog) 15)
- (string=? (substring uim-candwin-prog 0 15) "uim-candwin-tbl"))))
+  (let ((tc (tutcode-context-new-internal id im)))
     (tutcode-context-set-widgets! tc tutcode-widgets)
     (if (null? tutcode-rule)
       (begin
@@ -376,13 +435,17 @@
         (tutcode-rule-commit-sequences! tutcode-rule-userconfig)))
     ;; ɽ·Á¼°¸õÊ䥦¥£¥ó¥É¥¦ÍÑÀßÄê
     (if (null? tutcode-heading-label-char-list)
-      (if candwintbl?
+      (if tutcode-use-table-style-candidate-window?
         (set! tutcode-heading-label-char-list
-          tutcode-table-heading-label-char-list)
+          (case tutcode-candidate-window-table-layout
+            ((qwerty-jis) tutcode-table-heading-label-char-list-qwerty-jis)
+            ((qwerty-us) tutcode-table-heading-label-char-list-qwerty-us)
+            ((dvorak) tutcode-table-heading-label-char-list-dvorak)
+            (else tutcode-table-heading-label-char-list)))
         (set! tutcode-heading-label-char-list
           tutcode-uim-heading-label-char-list)))
     (if (null? tutcode-heading-label-char-list-for-kigou-mode)
-      (if candwintbl?
+      (if tutcode-use-table-style-candidate-window?
         (begin
           (set! tutcode-heading-label-char-list-for-kigou-mode
             tutcode-table-heading-label-char-list-for-kigou-mode)
=======================================
--- /trunk/xim/canddisp.cpp     Sat Jul  3 00:39:57 2010
+++ /trunk/xim/canddisp.cpp     Sat Jul 24 14:35:14 2010
@@ -85,7 +85,7 @@
     if (!user_config)
        user_config = uim_scm_symbol_value_str("uim-candwin-prog");

-    if (user_config) {
+    if (user_config && *user_config) {
        asprintf(&candwin_prog, UIM_LIBEXECDIR "/%s", user_config);
        return candwin_prog;
     }

Reply via email to