[uim-commit] r154 - trunk/uim

yamaken@freedesktop.org yamaken@freedesktop.org
Fri Jan 7 02:25:23 PST 2005


Author: yamaken
Date: 2005-01-07 02:25:20 -0800 (Fri, 07 Jan 2005)
New Revision: 154

Modified:
   trunk/uim/uim-custom.c
   trunk/uim/uim-custom.h
Log:
* This commit adds new attribute editor_type to custom value of type
  'key'. This instructs widget type of the custom variable. uim-pref
  should passively reflect the attribute to select the type of
  widget. custom.scm will control the type

* uim/uim-custom.h
  - (enum UCustomKeyEditorType): New enum
  - (struct uim_custom_key): Add new member editor_type
  - (uim_custom_key_new): Add new arg editor_type
* uim/uim-custom.c
  - (uim_custom_choice_new, uim_custom_key_new): Remove redundant
    prototype declaration
  - (uim_custom_key_get, uim_custom_key_new): Add initialization of
    editor_type


Modified: trunk/uim/uim-custom.c
===================================================================
--- trunk/uim/uim-custom.c	2005-01-07 10:04:27 UTC (rev 153)
+++ trunk/uim/uim-custom.c	2005-01-07 10:25:20 UTC (rev 154)
@@ -69,7 +69,6 @@
 static struct uim_custom_choice *uim_custom_choice_get(const char *custom_sym, const char *choice_sym);
 static char *extract_choice_symbol(const struct uim_custom_choice *custom_choice);
 static char *choice_list_to_str(const struct uim_custom_choice *const *list, const char *sep);
-struct uim_custom_choice *uim_custom_choice_new(char *symbol, char *label, char *desc);
 static void uim_custom_choice_free(struct uim_custom_choice *custom_choice);
 static struct uim_custom_choice **extract_choice_list(const char *list_repl, const char *custom_sym);
 static struct uim_custom_choice **uim_custom_choice_item_list(const char *custom_sym);
@@ -78,7 +77,6 @@
 static struct uim_custom_choice **uim_custom_olist_item_list(const char *custom_sym);
 
 static struct uim_custom_key **uim_custom_key_get(const char *custom_sym);
-struct uim_custom_key *uim_custom_key_new(int type, char *literal, char *label, char *desc);
 static void uim_custom_key_free(struct uim_custom_key *custom_key);
 static char *extract_key_literal(const struct uim_custom_key *custom_key);
 static char *key_list_to_str(const struct uim_custom_key *const *list, const char *sep);
@@ -334,10 +332,10 @@
 uim_custom_key_get(const char *custom_sym)
 {
   char **key_literal_list, **key_label_list, **key_desc_list;
-  int *key_type_list, list_len, i;
+  int *key_type_list, editor_type, list_len, i;
   struct uim_custom_key *custom_key, **custom_key_list;
 
-  UIM_EVAL_FSTRING3(NULL, "(define #%s (custom-expand-key-references '%s (custom-range '%s))",
+  UIM_EVAL_FSTRING3(NULL, "(define %s (custom-expand-key-references '%s (custom-range '%s))",
 		    str_list_arg, custom_sym, custom_sym);
   key_literal_list =
     (char **)uim_scm_c_list(str_list_arg,
@@ -364,6 +362,10 @@
     return NULL;
   }
 
+  UIM_EVAL_FSTRING1(NULL, "(custom-key-advanced-editor? '%s)", custom_sym);
+  return_val = uim_scm_return_value();
+  editor_type = uim_scm_c_bool(return_val) ? UCustomKeyEditor_Advanced : UCustomKeyEditor_Basic;
+
   UIM_EVAL_FSTRING1(NULL, "(length %s)", str_list_arg);
   return_val = uim_scm_return_value();
   list_len = uim_scm_c_int(return_val);
@@ -375,7 +377,7 @@
     literal = key_literal_list[i];
     label = key_label_list[i];
     desc = key_desc_list[i];
-    custom_key = uim_custom_key_new(type, literal, label, desc);
+    custom_key = uim_custom_key_new(type, editor_type, literal, label, desc);
     key_literal_list[i] = (char *)custom_key;  /* intentionally overwrite */
   }
   /* reuse the list structure */
@@ -393,7 +395,8 @@
  * TODO
  */
 struct uim_custom_key *
-uim_custom_key_new(int type, char *literal, char *label, char *desc)
+uim_custom_key_new(int type, int editor_type,
+		   char *literal, char *label, char *desc)
 {
   struct uim_custom_key *custom_key;
 
@@ -402,6 +405,7 @@
     return NULL;
 
   custom_key->type = type;
+  custom_key->editor_type = editor_type;
   custom_key->literal = literal;
   custom_key->label = label;
   custom_key->desc = desc;

Modified: trunk/uim/uim-custom.h
===================================================================
--- trunk/uim/uim-custom.h	2005-01-07 10:04:27 UTC (rev 153)
+++ trunk/uim/uim-custom.h	2005-01-07 10:25:20 UTC (rev 154)
@@ -57,6 +57,11 @@
   UCustomKey_Reference  /* "generic-cancel-key" */
 };
 
+enum UCustomKeyEditorType {
+  UCustomKeyEditor_Basic,    /* only "<Control>j" style should be available */
+  UCustomKeyEditor_Advanced  /* "generic-cancel-key" style should be specifiable */
+};
+
 union uim_custom_value {
   int as_bool;
   int as_int;
@@ -74,7 +79,8 @@
 };
 
 struct uim_custom_key {
-  int type;  /* UCustomKeyType */
+  int type;         /* UCustomKeyType */
+  int editor_type;  /* UCustomKeyEditorType */
   char *literal;
   char *label;
   char *desc;
@@ -160,6 +166,7 @@
 
 /* custom key */
 struct uim_custom_key *uim_custom_key_new(int type,
+					  int editor_type,
 					  char *literal,
 					  char *label,
 					  char *desc);



More information about the Uim-commit mailing list