src/core.h

Go to the documentation of this file.
00001 //
00002 // Unihan Input Method
00003 //
00004 // Copyright © 2002-2007 Sun Wah Linux Ltd.
00005 //
00006 //
00007 // This library is free software; you can redistribute it and/or modify
00008 // it under the terms of the GNU Lesser General Public License as
00009 // published by the Free Software Foundation; either version 2.1 of the
00010 // License, or (at your option) any later version.
00011 //
00012 // This library is distributed in the hope that it will be useful, but
00013 // WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 // Lesser General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU Lesser General Public
00018 // License along with this program; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00020 // USA
00021 //
00022 // $Id: core.h 817 2007-08-24 16:31:08Z roger $
00023 //
00024 
00025 #ifndef __CORE_H
00026 #define __CORE_H
00027 
00028 #include <config.h>
00029 
00030 #include <iml/SunIM.h>
00031 #include <unihan_im.h>
00032 
00033 #include "unihan_property.h"
00034 
00035 typedef struct _IMConfigList {
00036         char *key;
00037         char *value;
00038         struct _IMConfigList *next;
00039 } IMConfigList;
00040 
00041 typedef enum {
00042     STATUS_STARTED  = 1 << 0,
00043     PREEDIT_STARTED = 1 << 1,
00044     LOOKUP_STARTED  = 1 << 2
00045 } UnihanStartedFlags;
00046 #define is_status_started(flags)  (flags & STATUS_STARTED)
00047 #define is_preedit_started(flags) (flags & PREEDIT_STARTED)
00048 #define is_lookup_started(flags)  (flags & LOOKUP_STARTED)
00049 
00050 typedef struct {
00051     UnihanStartedFlags aux_started;
00052 
00053     void *keyhandler_data;
00054     void *im_manager_data;
00055     void *phrase_data;
00056 
00057     UnihanTCSCMode tcsc;
00058     int phrase_mode;
00059 
00060     char *username;
00061     char *hostname;
00062     char *protocol_type;
00063     char *client_type;
00064     char *display_id;
00065     char *os_name;
00066     char *os_version;
00067     char *os_arch;
00068 
00069     IMConfigList **imConfig;
00070 
00071 #if TIMEBOMB
00072     int expired;
00073 #endif
00074 } DataPerDesktop;
00075 
00076 typedef struct {
00077         int created;
00078         void *data;
00079 } UserDataTable;
00080 
00081 typedef struct _UnihanRegisteredIMArg UnihanRegisteredIMArg, *UnihanRegisteredIMList;
00082 
00083 struct _UnihanRegisteredIMArg{
00084         char *imid;
00085         UnihanPropertyList *prop_list;
00086         UnihanRegisteredIMList next;
00087 };
00088 
00089 typedef enum {
00090     PHRASE_STATE_NEVER = 0,
00091     PHRASE_STATE_IDLE = 1,
00092     PHRASE_STATE_SELECTING = 2,
00093 } UnihanPhraseState;
00094 
00095 typedef struct {
00096     UnihanStartedFlags ui_started;
00097     char *locale;
00098     int lookup_cands_per_page;
00099 
00100         int conv_on;
00101 
00102 #if 0
00103         UnihanPropertyArgList currIMprop_list;
00104 #endif
00105 
00106 #if NEW_PROPERTY
00107 #else
00108         int fullwidth;
00109 
00110         int puncce;     /* 2004.2.11 arren */
00111         int shuangpin;  /* 2994.2.19 arren */
00112 #endif
00113                 
00114         void *currIM;
00115         int punctuation;
00116         int us_kbd;
00117         int us_kbd_caps_pressed;
00118         int us_kbd_shift_pressed;
00119         
00120         int shift_key_state;
00121         UnihanPhraseState phrase_state;
00122 
00123         UserDataTable *userData;
00124 
00125         void *phrase_data;
00126 } DataPerSession;
00127 
00128 void conversion_on(iml_session_t *s);
00129 void conversion_off(iml_session_t *s);
00130 void conversion_temp_on(iml_session_t *s);
00131 void conversion_temp_off(iml_session_t *s);
00132 
00133 void im_manager_init(iml_desktop_t *d);
00134 void im_manager_done(iml_desktop_t *d);
00135 int im_manager_get_num_im(iml_desktop_t *d);
00136 void im_manager_create_session(iml_session_t *s);
00137 void im_manager_destroy_session(iml_session_t *s);
00138 void im_manager_get_im_list(iml_session_t *s, IMAuxDrawCallbackStruct *aux);
00139 void im_manager_set_default_im(iml_session_t *s, char *imid);
00140 
00141 const char *im_get_curr_im_name(iml_session_t *s);
00142 int im_propagate_focus_event(iml_session_t *s, int focused);
00143 int im_propagate_key_event(iml_session_t *s, IMKeyListEvent *ev);
00144 int im_propagate_lookup_page_turn_event(iml_session_t *s, int direction);
00145 int im_propagate_lookup_select_event(iml_session_t *s, int num);
00146 void im_change_to_next_im(iml_session_t *s);
00147 void im_change_to_next_im1(iml_session_t *s);
00148 void im_change_to_prev_im(iml_session_t *s);
00149 void im_change_to_prev_im1(iml_session_t *s);
00150 void im_change_to_im(iml_session_t *s, char *imid);
00151 
00152 #if 0
00153 UnihanPropertyArgList im_get_current_im_props(iml_session_t *s);
00154 UnihanPropertyArgList im_get_runtime_property(iml_session_t *s,
00155                 UnihanRuntimePropertyType type,
00156                 int name);
00157 void im_update_property_list(iml_session_t *s,
00158                 UnihanPropertyArgList plist);
00159 void im_set_property_list(iml_session_t *s,
00160                 UnihanPropertyArgList prop_list);
00161 void destroy_im_property(UnihanPropertyArgList plist);
00162 
00163 int convert_props_to_string(iml_session_t *s,
00164                 UnihanPropertyArgList prop_list,
00165                 int num_props,
00166                 int int_values[],
00167                 UTFCHAR* string_values[]);
00168 int convert_string_to_props(int int_values,
00169                 char* string_values,
00170                 UnihanPropertyArgList *prop_list);
00171 
00172 void im_set_width(iml_session_t *s, int is_full);
00173 void im_set_puncce(iml_session_t *s, int is_CH);
00174 void status_update_width(iml_session_t *s, int is_full);
00175 void status_update_puncce(iml_session_t *s, int is_CH);
00176 UnihanPropertyArgList properties_dup(UnihanPropertyArgList proplist);
00177 #endif
00178 
00179 #if NEW_PROPERTY
00180 char *im_get_curr_im_id(iml_session_t *s);
00181 void toggle_property(iml_session_t *s, char* key);
00182 void register_im_property(iml_session_t *s, char* imid);
00183 void destroy_im_properties(UnihanPropertyList *prop_list);
00184 int convert_props_to_string(iml_session_t *s,
00185                                                         UnihanPropertyList *prop_list,
00186                                                         int int_values[],
00187                                                         UTFCHAR* string_values[]);
00188                                                         
00189 #else
00190 void check_fullwidth(iml_session_t *s);
00191 void check_puncce(iml_session_t *s);
00192 void toggle_width(iml_session_t *s);
00193 void toggle_puncce(iml_session_t *s);
00194 #endif
00195 
00196 void check_module_info(iml_session_t *s);
00197 void tcsc_set(iml_session_t *s, UnihanTCSCMode tcsc);
00198 
00199 void toggle_punctuation_keyboard(iml_session_t *s);
00200 void toggle_us_keyboard(iml_session_t *s);
00201 
00202 void im_config_change(iml_session_t *s, char *imid, char *key, char *val);
00203 IMConfigList *im_config_get(iml_session_t *s, char *imid);
00204 
00205 void im_set_symbol_user_table(iml_session_t *s,
00206                 int numSut,
00207                 SymbolUserTable *sut);
00208 void im_set_word_user_table(iml_session_t *s,
00209                 int numWut,
00210                 WordUserTable *wut);
00211 void im_config_unispim(iml_session_t *s,int count_values,int unispim_values[]);
00212 
00213 #if TIMEBOMB
00214 int check_expired(iml_desktop_t *d);
00215 void notify_timebomb(iml_session_t *s);
00216 void notify_expired(iml_session_t *s);
00217 #endif
00218 
00219 extern UTFCHAR lename_string[];
00220 extern UTFCHAR aux_name[];
00221 
00222 #endif /* __CORE_H */
00223 
00224 // vi:ts=4:sw=4:nowrap:cin:expandtab

Generated on Fri Sep 7 15:51:41 2007 for unihan-core-le by  doxygen 1.5.2