]> Pileus Git - ~andy/gtk/blob - modules/input/imviqr.c
Revert name change
[~andy/gtk] / modules / input / imviqr.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2000 Red Hat Software
3  * Copyright (C) 2000 SuSE Linux Ltd
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Original author: Owen Taylor <otaylor@redhat.com>
21  * 
22  * Modified for VIQR - Robert Brady <robert@suse.co.uk>
23  *
24  */
25
26 #include "config.h"
27 #include <string.h>
28
29 #include "gtk/gtk.h"
30 #include "gdk/gdkkeysyms.h"
31
32 #include "gtk/gtkimmodule.h"
33 #include "gtk/gtkintl.h"
34
35 GType type_viqr_translit = 0;
36
37 static void viqr_class_init (GtkIMContextSimpleClass *class);
38 static void viqr_init (GtkIMContextSimple *im_context);
39
40 static void
41 viqr_register_type (GTypeModule *module)
42 {
43   static const GTypeInfo object_info =
44   {
45     sizeof (GtkIMContextSimpleClass),
46     (GBaseInitFunc) NULL,
47     (GBaseFinalizeFunc) NULL,
48     (GClassInitFunc) viqr_class_init,
49     NULL,           /* class_finalize */
50     NULL,           /* class_data */
51     sizeof (GtkIMContextSimple),
52     0,
53     (GInstanceInitFunc) viqr_init,
54   };
55
56   type_viqr_translit = 
57     g_type_module_register_type (module,
58                                  GTK_TYPE_IM_CONTEXT_SIMPLE,
59                                  "GtkIMContextViqr",
60                                  &object_info, 0);
61 }
62
63 static guint16 viqr_compose_seqs[] = {
64   GDK_A,                   0,                0, 0, 0, 'A',
65   GDK_A,                   GDK_apostrophe,   0, 0, 0, 0xc1,
66   GDK_A,  GDK_parenleft,   0,                0, 0,    0x102,
67   GDK_A,  GDK_parenleft,   GDK_apostrophe,   0, 0,    0x1eae,
68   GDK_A,  GDK_parenleft,   GDK_period,       0, 0,    0x1eb6,
69   GDK_A,  GDK_parenleft,   GDK_question,     0, 0,    0x1eb2,
70   GDK_A,  GDK_parenleft,   GDK_grave,        0, 0,    0x1eb0,
71   GDK_A,  GDK_parenleft,   GDK_asciitilde,   0, 0,    0x1eb4,
72   GDK_A,                   GDK_period,       0, 0, 0, 0x1ea0,
73   GDK_A,                   GDK_question,     0, 0, 0, 0x1ea2,
74   GDK_A,  GDK_asciicircum, 0,                0, 0,    0xc2,
75   GDK_A,  GDK_asciicircum, GDK_apostrophe,   0, 0,    0x1ea4,
76   GDK_A,  GDK_asciicircum, GDK_period,       0, 0,    0x1eac,
77   GDK_A,  GDK_asciicircum, GDK_question,     0, 0,    0x1ea8,
78   GDK_A,  GDK_asciicircum, GDK_grave,        0, 0,    0x1ea6,
79   GDK_A,  GDK_asciicircum, GDK_asciitilde,   0, 0,    0x1eaa,
80   GDK_A,                   GDK_grave,        0, 0, 0, 0xc0,
81   GDK_A,                   GDK_asciitilde,   0, 0, 0, 0xc3,
82   GDK_D,                   0,                0, 0, 0, 'D',
83   GDK_D,                   GDK_D,            0, 0, 0, 0x110,
84   GDK_D,                   GDK_d,            0, 0, 0, 0x110,
85   GDK_E,                   0,                0, 0, 0, 'E',
86   GDK_E,                   GDK_apostrophe,   0, 0, 0, 0xc9,
87   GDK_E,                   GDK_period,       0, 0, 0, 0x1eb8,
88   GDK_E,                   GDK_question,     0, 0, 0, 0x1eba,
89   GDK_E,  GDK_asciicircum, 0,                0, 0,    0xca,
90   GDK_E,  GDK_asciicircum, GDK_apostrophe,   0, 0,    0x1ebe,
91   GDK_E,  GDK_asciicircum, GDK_period,       0, 0,    0x1ec6,
92   GDK_E,  GDK_asciicircum, GDK_question,     0, 0,    0x1ec2,
93   GDK_E,  GDK_asciicircum, GDK_grave,        0, 0,    0x1ec0,
94   GDK_E,  GDK_asciicircum, GDK_asciitilde,   0, 0,    0x1ec4,
95   GDK_E,                   GDK_grave,        0, 0, 0, 0xc8,
96   GDK_E,                   GDK_asciitilde,   0, 0, 0, 0x1ebc,
97   GDK_I,                   0,                0, 0, 0, 'I',
98   GDK_I,                   GDK_apostrophe,   0, 0, 0, 0xcd,
99   GDK_I,                   GDK_period,       0, 0, 0, 0x1eca,
100   GDK_I,                   GDK_question,     0, 0, 0, 0x1ec8,
101   GDK_I,                   GDK_grave,        0, 0, 0, 0xcc,
102   GDK_I,                   GDK_asciitilde,   0, 0, 0, 0x128,
103   GDK_O,                   0,                0, 0, 0, 'O',
104   GDK_O,                   GDK_apostrophe,   0, 0, 0, 0xD3,
105   GDK_O,  GDK_plus,        0,                0, 0,    0x1a0,
106   GDK_O,  GDK_plus,        GDK_apostrophe,   0, 0,    0x1eda,
107   GDK_O,  GDK_plus,        GDK_period,       0, 0,    0x1ee2,
108   GDK_O,  GDK_plus,        GDK_question,     0, 0,    0x1ede,
109   GDK_O,  GDK_plus,        GDK_grave,        0, 0,    0x1edc,
110   GDK_O,  GDK_plus,        GDK_asciitilde,   0, 0,    0x1ee0,
111   GDK_O,                   GDK_period,       0, 0, 0, 0x1ecc,
112   GDK_O,                   GDK_question,     0, 0, 0, 0x1ece,
113   GDK_O,  GDK_asciicircum, 0,                0, 0,    0xd4,
114   GDK_O,  GDK_asciicircum, GDK_apostrophe,   0, 0,    0x1ed0,
115   GDK_O,  GDK_asciicircum, GDK_period,       0, 0,    0x1ed8,
116   GDK_O,  GDK_asciicircum, GDK_question,     0, 0,    0x1ed4,
117   GDK_O,  GDK_asciicircum, GDK_grave,        0, 0,    0x1ed2,
118   GDK_O,  GDK_asciicircum, GDK_asciitilde,   0, 0,    0x1ed6,
119   GDK_O,                   GDK_grave,        0, 0, 0, 0xD2,
120   GDK_O,                   GDK_asciitilde,   0, 0, 0, 0xD5,
121   GDK_U,                   0,                0, 0, 0, 'U',
122   GDK_U,                   GDK_apostrophe,   0, 0, 0, 0xDA,
123   GDK_U,  GDK_plus,        0,                0, 0,    0x1af,
124   GDK_U,  GDK_plus,        GDK_apostrophe,   0, 0,    0x1ee8,
125   GDK_U,  GDK_plus,        GDK_period,       0, 0,    0x1ef0,
126   GDK_U,  GDK_plus,        GDK_question,     0, 0,    0x1eec,
127   GDK_U,  GDK_plus,        GDK_grave,        0, 0,    0x1eea,
128   GDK_U,  GDK_plus,        GDK_asciitilde,   0, 0,    0x1eee,
129   GDK_U,                   GDK_period,       0, 0, 0, 0x1ee4,
130   GDK_U,                   GDK_question,     0, 0, 0, 0x1ee6,
131   GDK_U,                   GDK_grave,        0, 0, 0, 0xd9,
132   GDK_U,                   GDK_asciitilde,   0, 0, 0, 0x168,
133   GDK_Y,                   0,                0, 0, 0, 'Y',
134   GDK_Y,                   GDK_apostrophe,   0, 0, 0, 0xdd,
135   GDK_Y,                   GDK_period,       0, 0, 0, 0x1ef4,
136   GDK_Y,                   GDK_question,     0, 0, 0, 0x1ef6,
137   GDK_Y,                   GDK_grave,        0, 0, 0, 0x1ef2,
138   GDK_Y,                   GDK_asciitilde,   0, 0, 0, 0x1ef8,
139   /* Do we need anything else here? */
140   GDK_backslash,           0,                0, 0, 0, 0,
141   GDK_backslash,           GDK_apostrophe,   0, 0, 0, '\'',
142   GDK_backslash,           GDK_parenleft,    0, 0, 0, '(',
143   GDK_backslash,           GDK_plus,         0, 0, 0, '+',
144   GDK_backslash,           GDK_period,       0, 0, 0, '.',
145   GDK_backslash,           GDK_question,     0, 0, 0, '?',
146   GDK_backslash,           GDK_D,            0, 0, 0, 'D',
147   GDK_backslash,           GDK_backslash,    0, 0, 0, '\\',
148   GDK_backslash,           GDK_asciicircum,  0, 0, 0, '^',
149   GDK_backslash,           GDK_grave,        0, 0, 0, '`',
150   GDK_backslash,           GDK_d,            0, 0, 0, 'd',
151   GDK_backslash,           GDK_asciitilde,   0, 0, 0, '~',
152   GDK_a,                   0,                0, 0, 0, 'a',
153   GDK_a,                   GDK_apostrophe,   0, 0, 0, 0xe1,
154   GDK_a, GDK_parenleft,    0,                0, 0,    0x103,
155   GDK_a, GDK_parenleft,    GDK_apostrophe,   0, 0,    0x1eaf,
156   GDK_a, GDK_parenleft,    GDK_period,       0, 0,    0x1eb7,
157   GDK_a, GDK_parenleft,    GDK_question,     0, 0,    0x1eb3,
158   GDK_a, GDK_parenleft,    GDK_grave,        0, 0,    0x1eb1,
159   GDK_a, GDK_parenleft,    GDK_asciitilde,   0, 0,    0x1eb5,
160   GDK_a,                   GDK_period,       0, 0, 0, 0x1ea1,
161   GDK_a,                   GDK_question,     0, 0, 0, 0x1ea3,
162   GDK_a, GDK_asciicircum,  0,                0, 0,    0xe2,
163   GDK_a, GDK_asciicircum,  GDK_apostrophe,   0, 0,    0x1ea5,
164   GDK_a, GDK_asciicircum,  GDK_period,       0, 0,    0x1ead,
165   GDK_a, GDK_asciicircum,  GDK_question,     0, 0,    0x1ea9,
166   GDK_a, GDK_asciicircum,  GDK_grave,        0, 0,    0x1ea7,
167   GDK_a, GDK_asciicircum,  GDK_asciitilde,   0, 0,    0x1eab,
168   GDK_a,                   GDK_grave,        0, 0, 0, 0xe0,
169   GDK_a,                   GDK_asciitilde,   0, 0, 0, 0xe3,
170   GDK_d,                   0,                0, 0, 0, 'd',
171   GDK_d,                   GDK_d,            0, 0, 0, 0x111,
172   GDK_e,                   0,                0, 0, 0, 'e',
173   GDK_e,                   GDK_apostrophe,   0, 0, 0, 0xe9,
174   GDK_e,                   GDK_period,       0, 0, 0, 0x1eb9,
175   GDK_e,                   GDK_question,     0, 0, 0, 0x1ebb,
176   GDK_e, GDK_asciicircum,  0,                0, 0,    0xea,
177   GDK_e, GDK_asciicircum,  GDK_apostrophe,   0, 0,    0x1ebf,
178   GDK_e, GDK_asciicircum,  GDK_period,       0, 0,    0x1ec7,
179   GDK_e, GDK_asciicircum,  GDK_question,     0, 0,    0x1ec3,
180   GDK_e, GDK_asciicircum,  GDK_grave,        0, 0,    0x1ec1,
181   GDK_e, GDK_asciicircum,  GDK_asciitilde,   0, 0,    0x1ec5,
182   GDK_e,                   GDK_grave,        0, 0, 0, 0xe8,
183   GDK_e,                   GDK_asciitilde,   0, 0, 0, 0x1ebd,
184   GDK_i,                   0,                0, 0, 0, 'i',
185   GDK_i,                   GDK_apostrophe,   0, 0, 0, 0xed,
186   GDK_i,                   GDK_period,       0, 0, 0, 0x1ecb,
187   GDK_i,                   GDK_question,     0, 0, 0, 0x1ec9,
188   GDK_i,                   GDK_grave,        0, 0, 0, 0xec,
189   GDK_i,                   GDK_asciitilde,   0, 0, 0, 0x129,
190   GDK_o,                   0,                0, 0, 0, 'o',
191   GDK_o,                   GDK_apostrophe,   0, 0, 0, 0xF3,
192   GDK_o,  GDK_plus,        0,                0, 0,    0x1a1,
193   GDK_o,  GDK_plus,        GDK_apostrophe,   0, 0,    0x1edb,
194   GDK_o,  GDK_plus,        GDK_period,       0, 0,    0x1ee3,
195   GDK_o,  GDK_plus,        GDK_question,     0, 0,    0x1edf,
196   GDK_o,  GDK_plus,        GDK_grave,        0, 0,    0x1edd,
197   GDK_o,  GDK_plus,        GDK_asciitilde,   0, 0,    0x1ee1,
198   GDK_o,                   GDK_period,       0, 0, 0, 0x1ecd,
199   GDK_o,                   GDK_question,     0, 0, 0, 0x1ecf,
200   GDK_o,  GDK_asciicircum, 0,                0, 0,    0xf4,
201   GDK_o,  GDK_asciicircum, GDK_apostrophe,   0, 0,    0x1ed1,
202   GDK_o,  GDK_asciicircum, GDK_period,       0, 0,    0x1ed9,
203   GDK_o,  GDK_asciicircum, GDK_question,     0, 0,    0x1ed5,
204   GDK_o,  GDK_asciicircum, GDK_grave,        0, 0,    0x1ed3,
205   GDK_o,  GDK_asciicircum, GDK_asciitilde,   0, 0,    0x1ed7,
206   GDK_o,                   GDK_grave,        0, 0, 0, 0xF2,
207   GDK_o,                   GDK_asciitilde,   0, 0, 0, 0xF5,
208   GDK_u,                   0,                0, 0, 0, 'u',
209   GDK_u,                   GDK_apostrophe,   0, 0, 0, 0xFA,
210   GDK_u,  GDK_plus,        0,                0, 0,    0x1b0,
211   GDK_u,  GDK_plus,        GDK_apostrophe,   0, 0,    0x1ee9,
212   GDK_u,  GDK_plus,        GDK_period,       0, 0,    0x1ef1,
213   GDK_u,  GDK_plus,        GDK_question,     0, 0,    0x1eed,
214   GDK_u,  GDK_plus,        GDK_grave,        0, 0,    0x1eeb,
215   GDK_u,  GDK_plus,        GDK_asciitilde,   0, 0,    0x1eef,
216   GDK_u,                   GDK_period,       0, 0, 0, 0x1ee5,
217   GDK_u,                   GDK_question,     0, 0, 0, 0x1ee7,
218   GDK_u,                   GDK_grave,        0, 0, 0, 0xf9,
219   GDK_u,                   GDK_asciitilde,   0, 0, 0, 0x169,
220   GDK_y,                   0,                0, 0, 0, 'y',
221   GDK_y,                   GDK_apostrophe,   0, 0, 0, 0xfd,
222   GDK_y,                   GDK_period,       0, 0, 0, 0x1ef5,
223   GDK_y,                   GDK_question,     0, 0, 0, 0x1ef7,
224   GDK_y,                   GDK_grave,        0, 0, 0, 0x1ef3,
225   GDK_y,                   GDK_asciitilde,   0, 0, 0, 0x1ef9,
226 };
227
228 static void
229 viqr_class_init (GtkIMContextSimpleClass *class)
230 {
231 }
232
233 static void
234 viqr_init (GtkIMContextSimple *im_context)
235 {
236   gtk_im_context_simple_add_table (im_context,
237                                    viqr_compose_seqs,
238                                    4,
239                                    G_N_ELEMENTS (viqr_compose_seqs) / (4 + 2));
240 }
241
242 static const GtkIMContextInfo viqr_info = { 
243   "viqr",                  /* ID */
244   N_("Vietnamese (VIQR)"), /* Human readable name */
245   GETTEXT_PACKAGE,         /* Translation domain */
246    GTK_LOCALEDIR,          /* Dir for bindtextdomain (not strictly needed for "gtk+") */
247   "vi"                     /* Languages for which this module is the default */
248 };
249
250 static const GtkIMContextInfo *info_list[] = {
251   &viqr_info
252 };
253
254 #ifndef INCLUDE_IM_viqr
255 #define MODULE_ENTRY(type, function) G_MODULE_EXPORT type im_module_ ## function
256 #else
257 #define MODULE_ENTRY(type, function) type _gtk_immodule_viqr_ ## function
258 #endif
259
260 MODULE_ENTRY (void, init) (GTypeModule *module)
261 {
262   viqr_register_type (module);
263 }
264
265 MODULE_ENTRY (void, exit) (void)
266 {
267 }
268
269 MODULE_ENTRY (void, list) (const GtkIMContextInfo ***contexts,
270                            int                      *n_contexts)
271 {
272   *contexts = info_list;
273   *n_contexts = G_N_ELEMENTS (info_list);
274 }
275
276 MODULE_ENTRY (GtkIMContext *, create) (const gchar *context_id)
277 {
278   if (strcmp (context_id, "viqr") == 0)
279     return g_object_new (type_viqr_translit, NULL);
280   else
281     return NULL;
282 }