[uim-commit] r259 - in trunk: helper scm test uim

yamaken@freedesktop.org yamaken@freedesktop.org
Tue Jan 11 11:27:48 PST 2005


Author: yamaken
Date: 2005-01-11 11:27:45 -0800 (Tue, 11 Jan 2005)
New Revision: 259

Modified:
   trunk/helper/pref-gtk.c
   trunk/scm/custom-vars.scm
   trunk/scm/custom.scm
   trunk/test/test-custom.scm
   trunk/uim/uim-custom.c
Log:
* This commit provides some custom variables for testing new custom
  types 'key' and 'ordered-list'

* scm/custom.scm
  - (custom-key-advanced-editor?): New procedure
  - (custom-range): Fix ordered-list handling
* test/test-custom.scm
  - (test custom-range): Follow ordered-list specification fix

* scm/custom-vars.scm
  - (pyunihan-im-canonical-name, pinyin-big5-im-canonical-name,
    py-im-canonical-name): Update label string
  - (custom custom-preserved-default-im-name): Replace manual list
    construction with custom-choice-rec-new as proper operation
  - (custom-default-enabled-im-list): New variable
  - (custom enabled-im-list): New custom
  - (custom-group key, custom-group global-keys): New custom group
  - (custom generic-on-key, custom generic-off-key, custom
    generic-begin-conv-key, custom generic-commit-key, custom
    generic-cancel-key, custom generic-next-candidate-key, custom
    generic-prev-candidate-key, custom generic-next-page-key, custom
    generic-prev-page-key, custom generic-beginning-of-preedit-key,
    custom generic-end-of-preedit-key, custom generic-kill-key, custom
    generic-kill-backward-key, custom generic-backspace-key, custom
    generic-delete-key, custom generic-go-left-key, custom
    generic-go-right-key, custom generic-return-key): New custom
* helper/pref-gtk.c
  - (add_custom_type_orderedlist): New function as placeholder. Rename
    and implement this function appropriately
  - (add_custom): Add ordered-list handling


Modified: trunk/helper/pref-gtk.c
===================================================================
--- trunk/helper/pref-gtk.c	2005-01-11 19:11:55 UTC (rev 258)
+++ trunk/helper/pref-gtk.c	2005-01-11 19:27:45 UTC (rev 259)
@@ -561,6 +561,25 @@
 }
 
 static void
+add_custom_type_orderedlist(GtkWidget *vbox, struct uim_custom *custom)
+{
+  GtkWidget *hbox;
+  GtkWidget *label;
+
+  hbox = gtk_hbox_new(FALSE, 8);
+  label = gtk_label_new(custom->label);
+  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+
+  /*
+  g_object_set_data_full(G_OBJECT(hoge),
+			 OBJECT_DATA_UIM_CUSTOM, custom,
+			 (GDestroyNotify) uim_custom_free);
+  */
+
+  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+}
+
+static void
 add_custom_type_key(GtkWidget *vbox, struct uim_custom *custom)
 {
   GtkWidget *hbox;
@@ -603,6 +622,9 @@
     case UCustom_Choice:
       add_custom_type_choice(vbox, custom);
       break;
+    case UCustom_OrderedList:
+      add_custom_type_orderedlist(vbox, custom);
+      break;
     case UCustom_Key:
       add_custom_type_key(vbox, custom);
       break;

Modified: trunk/scm/custom-vars.scm
===================================================================
--- trunk/scm/custom-vars.scm	2005-01-11 19:11:55 UTC (rev 258)
+++ trunk/scm/custom-vars.scm	2005-01-11 19:27:45 UTC (rev 259)
@@ -38,9 +38,9 @@
 (define canna-im-canonical-name (_ "Canna"))
 (define skk-im-canonical-name (_ "SKK"))
 (define prime-im-canonical-name (_ "PRIME"))
-(define pyunihan-im-canonical-name (_ "pyunihan"))
-(define pinyin-big5-im-canonical-name (_ "pinyin-big5"))
-(define py-im-canonical-name (_ "Pinyin"))
+(define pyunihan-im-canonical-name (_ "Pinyin (Unicode)"))
+(define pinyin-big5-im-canonical-name (_ "Pinyin (Traditional)"))
+(define py-im-canonical-name (_ "Pinyin (Simplified)"))
 (define ipa-im-canonical-name (_ "International Phonetic Alphabet"))
 (define romaja-im-canonical-name (_ "Hangul (Romaja)"))
 (define hangul3-im-canonical-name (_ "Hangul (3-bul)"))
@@ -75,7 +75,7 @@
   (_ "Specify default IM")
   (_ "long description will be here."))
 
-;; requires predefined *-im-canonical-name and *-im-desc
+;; requires predefined *-im-canonical-name
 (define-custom 'custom-preserved-default-im-name (im-name (find-default-im #f))
   '(global default-im-name)
   (cons
@@ -88,7 +88,7 @@
 				    (symbol->string sym)))
 			  (desc-proc (symbolconc sym '-im-desc))
 			  (desc (im-short-desc im)))
-		     (list sym name desc)))
+		     (custom-choice-rec-new sym name desc)))
 		 im-list)))
   (_ "Default input method")
   (_ "long description will be here."))
@@ -146,6 +146,32 @@
 		 custom-hook-literalize-preserved-default-im-name)
 
 ;;
+;; Enabled IM list
+;;
+
+;; requires predefined *-im-canonical-name
+(define custom-default-enabled-im-list
+  (reverse (map (lambda (im)
+		  (let* ((sym (im-name im))
+			 (cname-proc (symbolconc sym '-im-canonical-name))
+			 (name (or (and (symbol-bound? cname-proc)
+					(symbol-value cname-proc))
+				   (symbol->string sym)))
+			 (desc-proc (symbolconc sym '-im-desc))
+			 (desc (im-short-desc im)))
+		    (custom-choice-rec-new sym name desc)))
+		im-list)))
+
+(define-custom 'enabled-im-list
+               (map custom-choice-rec-sym custom-default-enabled-im-list)
+  '(global)
+  (cons
+   'ordered-list
+   custom-default-enabled-im-list)
+  (_ "Enabled input methods")
+  (_ "long description will be here."))
+
+;;
 ;; im-switching
 ;;
 (define-custom-group 'im-switching
@@ -180,6 +206,127 @@
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+;; global-keys
+
+;; subgroup 'key'
+(define-custom-group 'key
+		     (_ "Key bindings")
+		     (_ "long description will be here."))
+
+(define-custom-group 'global-keys
+		     (_ "Global key bindings")
+		     (_ "long description will be here."))
+
+(define-custom 'generic-on-key '("zenkaku-hankaku" "<Shift> ")
+               '(global-keys key)
+	       '(key)
+	       "[Global] on"
+	       "long description will be here")
+
+(define-custom 'generic-off-key '("zenkaku-hankaku" "<Shift> ")
+               '(global-keys key)
+	       '(key)
+	       "[Global] off"
+	       "long description will be here")
+
+(define-custom 'generic-begin-conv-key '(" ")
+               '(global-keys key)
+	       '(key)
+	       "[Global] begin conversion"
+	       "long description will be here")
+
+(define-custom 'generic-commit-key '("<Control>j" "<Control>J" generic-return-key)
+               '(global-keys key)
+	       '(key)
+	       "[Global] commit"
+	       "long description will be here")
+
+(define-custom 'generic-cancel-key '("escape" "<Control>g" "<Control>G")
+               '(global-keys key)
+	       '(key)
+	       "[Global] cancel"
+	       "long description will be here")
+
+(define-custom 'generic-next-candidate-key '(" " "down" "<Control>n" "<Control>N")
+               '(global-keys key)
+	       '(key)
+	       "[Global] next candidate"
+	       "long description will be here")
+
+(define-custom 'generic-prev-candidate-key '("up" "<Control>p" "<Control>P")
+               '(global-keys key)
+	       '(key)
+	       "[Global] previous candidate"
+	       "long description will be here")
+
+(define-custom 'generic-next-page-key '("next")
+               '(global-keys key)
+	       '(key)
+	       "[Global] next page of candidate window"
+	       "long description will be here")
+
+(define-custom 'generic-prev-page-key '("prior")
+               '(global-keys key)
+	       '(key)
+	       "[Global] previous page of candidate window"
+	       "long description will be here")
+
+(define-custom 'generic-beginning-of-preedit-key '("home" "<Control>a" "<Control>A")
+               '(global-keys key)
+	       '(key)
+	       "[Global] beginning of preedit"
+	       "long description will be here")
+
+(define-custom 'generic-end-of-preedit-key '("end" "<Control>e" "<Control>E")
+               '(global-keys key)
+	       '(key)
+	       "[Global] end of preedit"
+	       "long description will be here")
+
+(define-custom 'generic-kill-key '("<Control>k" "<Control>K")
+               '(global-keys key advanced)
+	       '(key)
+	       "[Global] erase after cursor"
+	       "long description will be here")
+
+(define-custom 'generic-kill-backward-key '("<Control>u" "<Control>U")
+               '(global-keys key advanced)
+	       '(key)
+	       "[Global] erase before cursor"
+	       "long description will be here")
+
+(define-custom 'generic-backspace-key '("backspace" "<Control>h" "<Control>H")
+               '(global-keys key advanced)
+	       '(key)
+	       "[Global] backspace"
+	       "long description will be here")
+
+(define-custom 'generic-delete-key '("delete" "<Control>d" "<Control>D")
+               '(global-keys key advanced)
+	       '(key)
+	       "[Global] delete"
+	       "long description will be here")
+
+(define-custom 'generic-go-left-key '("left" "<Control>b" "<Control>B")
+               '(global-keys key advanced)
+	       '(key)
+	       "[Global] left"
+	       "long description will be here")
+
+(define-custom 'generic-go-right-key '("right" "<Control>f" "<Control>F")
+               '(global-keys key advanced)
+	       '(key)
+	       "[Global] right"
+	       "long description will be here")
+
+(define-custom 'generic-return-key '("return" "<Control>m" "<Control>M")
+               '(global-keys key advanced)
+	       '(key)
+	       "[Global] return"
+	       "long description will be here")
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
 ;; anthy
 
 (define-custom-group 'anthy

Modified: trunk/scm/custom.scm
===================================================================
--- trunk/scm/custom.scm	2005-01-11 19:11:55 UTC (rev 258)
+++ trunk/scm/custom.scm	2005-01-11 19:27:45 UTC (rev 259)
@@ -119,6 +119,11 @@
      (else
       ()))))
 
+;; TODO
+(define custom-key-advanced-editor?
+  (lambda (custom-sym)
+    #f))
+
 (define-record 'custom-choice-rec
   '((sym   #f)
     (label "")
@@ -365,7 +370,8 @@
     (let* ((type (custom-type sym))
 	   (attrs (custom-type-attrs sym)))
       (cond
-       ((eq? type 'choice)
+       ((or (eq? type 'choice)
+	    (eq? type 'ordered-list))
 	(map custom-choice-rec-sym attrs))
        (else
 	attrs)))))

Modified: trunk/test/test-custom.scm
===================================================================
--- trunk/test/test-custom.scm	2005-01-11 19:11:55 UTC (rev 258)
+++ trunk/test/test-custom.scm	2005-01-11 19:27:45 UTC (rev 259)
@@ -1864,9 +1864,7 @@
   ("test custom-range"
    (assert-equal '(test-style-uim test-style-ddskk test-style-canna)
 		 (uim '(custom-range 'test-style)))
-   (assert-equal '((anthy "Anthy" "Anthy")
-		   (canna "Cannd" "Canna")
-		   (skk "SKK" "SKK"))
+   (assert-equal '(anthy canna skk)
 		 (uim '(custom-range 'test-available-ims)))
    (assert-equal ()
 		 (uim '(custom-range 'test-cancel-key)))

Modified: trunk/uim/uim-custom.c
===================================================================
--- trunk/uim/uim-custom.c	2005-01-11 19:11:55 UTC (rev 258)
+++ trunk/uim/uim-custom.c	2005-01-11 19:27:45 UTC (rev 259)
@@ -339,7 +339,7 @@
 		    str_list_arg, custom_sym);
   key_literal_list =
     (char **)uim_scm_c_list(str_list_arg,
-			    "(lambda (key) (if (symbol? key) symbol->string key))",
+			    "(lambda (key) (if (symbol? key) (symbol->string key) key))",
 			    (uim_scm_c_list_conv_func)uim_scm_c_str);
   key_type_list =
     (int *)uim_scm_c_list(str_list_arg,



More information about the Uim-commit mailing list