Back to index

im-sdk  12.3.91
engine-property.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <assert.h>
00003 #include "engine-property.h"
00004 
00005 static KOLE_property *pleproperty;
00006 static int g_leproperty_initialized = 0;
00007 
00008 struct _KOLE_property {
00009   INPUT_MODE_T input_mode;
00010   OPTION_KEYBOARD_LAYOUT keyboard;
00011   OPTION_CHARSET charset;
00012   OPTION_DELETION deletion;
00013   OPTION_COMMIT_MODE commit;
00014 };
00015 
00016 
00017 KOLE_property *
00018 leproperty_init ()
00019 {
00020   if (g_leproperty_initialized)
00021     return pleproperty;
00022   
00023   pleproperty =
00024     (KOLE_property *) malloc (sizeof (KOLE_property));
00025 
00026   assert (pleproperty != NULL);
00027   
00028   if (!pleproperty)
00029     return NULL;
00030   
00031   pleproperty->input_mode = INPUT_MODE_ENGLISH;
00032   pleproperty->keyboard = LAYOUT_2PART;
00033   pleproperty->charset = IN_UNICODE;
00034   pleproperty->deletion = BY_CHAR;
00035   pleproperty->commit = COMMIT_BY_HOTKEY;
00036 
00037   g_leproperty_initialized = 1;
00038   
00039   return pleproperty;
00040 }
00041 
00042 int
00043 leproperty_get_input_mode (KOLE_property *pp)
00044 {
00045   return (int) pp->input_mode;
00046 }
00047 
00048 void
00049 leproperty_set_input_mode (KOLE_property *pp, INPUT_MODE_T imode)
00050 {
00051    if(pp == NULL)
00052        return;
00053    pp->input_mode = imode;
00054 }
00055 
00056 int
00057 leproperty_get_keyboard (KOLE_property *pp)
00058 {
00059   return (int) pp->keyboard;
00060 }
00061 
00062 void
00063 leproperty_set_keyboard (KOLE_property *pp, KEYBOARD_LAYOUT_T k)
00064 {
00065   pleproperty->keyboard = k;
00066 }
00067 
00068 int
00069 leproperty_get_charset (KOLE_property *pp)
00070 {
00071   return (int) pp->charset;
00072 }
00073 
00074 void
00075 leproperty_set_charset (KOLE_property *pp, OPTION_CHARSET c)
00076 {
00077   pleproperty->charset = c; 
00078 }
00079 
00080 int
00081 leproperty_get_deletion (KOLE_property *pp)
00082 {
00083   return (int) pp->deletion;
00084 }
00085 
00086 void
00087 leproperty_set_deletion (KOLE_property *pp, OPTION_DELETION d)
00088 {
00089   pleproperty->deletion = d; 
00090 }
00091 
00092 int
00093 leproperty_get_commit (KOLE_property *pp)
00094 {
00095   return (int) pp->commit;
00096 }
00097 
00098 void
00099 leproperty_set_commit (KOLE_property *pp, OPTION_COMMIT_MODE c)
00100 {
00101   pleproperty->commit = c; 
00102 }
00103 
00104 void
00105 leproperty_done (KOLE_property *pp)
00106 {
00107   if (pp && g_leproperty_initialized){
00108     free (pp);
00109     pp = NULL;
00110   }
00111 }