]> Pileus Git - ~andy/gtk/blob - modules/input/imviqr.c
Create enum PrinterStateLevel
[~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, see <http://www.gnu.org/licenses/>.
17  *
18  * Original author: Owen Taylor <otaylor@redhat.com>
19  * 
20  * Modified for VIQR - Robert Brady <robert@suse.co.uk>
21  *
22  */
23
24 #include "config.h"
25 #include <string.h>
26
27 #include "gtk/gtk.h"
28 #include "gdk/gdkkeysyms.h"
29
30 #include "gtk/gtkimmodule.h"
31 #include "gtk/gtkintl.h"
32
33 GType type_viqr_translit = 0;
34
35 static void viqr_class_init (GtkIMContextSimpleClass *class);
36 static void viqr_init (GtkIMContextSimple *im_context);
37
38 static void
39 viqr_register_type (GTypeModule *module)
40 {
41   const GTypeInfo object_info =
42   {
43     sizeof (GtkIMContextSimpleClass),
44     (GBaseInitFunc) NULL,
45     (GBaseFinalizeFunc) NULL,
46     (GClassInitFunc) viqr_class_init,
47     NULL,           /* class_finalize */
48     NULL,           /* class_data */
49     sizeof (GtkIMContextSimple),
50     0,
51     (GInstanceInitFunc) viqr_init,
52   };
53
54   type_viqr_translit = 
55     g_type_module_register_type (module,
56                                  GTK_TYPE_IM_CONTEXT_SIMPLE,
57                                  "GtkIMContextViqr",
58                                  &object_info, 0);
59 }
60
61 static guint16 viqr_compose_seqs[] = {
62   GDK_KEY_A,                   0,                0, 0, 0, 'A',
63   GDK_KEY_A,                   GDK_KEY_apostrophe,   0, 0, 0, 0xc1,
64   GDK_KEY_A,  GDK_KEY_parenleft,   0,                0, 0,    0x102,
65   GDK_KEY_A,  GDK_KEY_parenleft,   GDK_KEY_apostrophe,   0, 0,    0x1eae,
66   GDK_KEY_A,  GDK_KEY_parenleft,   GDK_KEY_period,       0, 0,    0x1eb6,
67   GDK_KEY_A,  GDK_KEY_parenleft,   GDK_KEY_question,     0, 0,    0x1eb2,
68   GDK_KEY_A,  GDK_KEY_parenleft,   GDK_KEY_grave,        0, 0,    0x1eb0,
69   GDK_KEY_A,  GDK_KEY_parenleft,   GDK_KEY_asciitilde,   0, 0,    0x1eb4,
70   GDK_KEY_A,                   GDK_KEY_period,       0, 0, 0, 0x1ea0,
71   GDK_KEY_A,                   GDK_KEY_question,     0, 0, 0, 0x1ea2,
72   GDK_KEY_A,  GDK_KEY_asciicircum, 0,                0, 0,    0xc2,
73   GDK_KEY_A,  GDK_KEY_asciicircum, GDK_KEY_apostrophe,   0, 0,    0x1ea4,
74   GDK_KEY_A,  GDK_KEY_asciicircum, GDK_KEY_period,       0, 0,    0x1eac,
75   GDK_KEY_A,  GDK_KEY_asciicircum, GDK_KEY_question,     0, 0,    0x1ea8,
76   GDK_KEY_A,  GDK_KEY_asciicircum, GDK_KEY_grave,        0, 0,    0x1ea6,
77   GDK_KEY_A,  GDK_KEY_asciicircum, GDK_KEY_asciitilde,   0, 0,    0x1eaa,
78   GDK_KEY_A,                   GDK_KEY_grave,        0, 0, 0, 0xc0,
79   GDK_KEY_A,                   GDK_KEY_asciitilde,   0, 0, 0, 0xc3,
80   GDK_KEY_D,                   0,                0, 0, 0, 'D',
81   GDK_KEY_D,                   GDK_KEY_D,            0, 0, 0, 0x110,
82   GDK_KEY_D,                   GDK_KEY_d,            0, 0, 0, 0x110,
83   GDK_KEY_E,                   0,                0, 0, 0, 'E',
84   GDK_KEY_E,                   GDK_KEY_apostrophe,   0, 0, 0, 0xc9,
85   GDK_KEY_E,                   GDK_KEY_period,       0, 0, 0, 0x1eb8,
86   GDK_KEY_E,                   GDK_KEY_question,     0, 0, 0, 0x1eba,
87   GDK_KEY_E,  GDK_KEY_asciicircum, 0,                0, 0,    0xca,
88   GDK_KEY_E,  GDK_KEY_asciicircum, GDK_KEY_apostrophe,   0, 0,    0x1ebe,
89   GDK_KEY_E,  GDK_KEY_asciicircum, GDK_KEY_period,       0, 0,    0x1ec6,
90   GDK_KEY_E,  GDK_KEY_asciicircum, GDK_KEY_question,     0, 0,    0x1ec2,
91   GDK_KEY_E,  GDK_KEY_asciicircum, GDK_KEY_grave,        0, 0,    0x1ec0,
92   GDK_KEY_E,  GDK_KEY_asciicircum, GDK_KEY_asciitilde,   0, 0,    0x1ec4,
93   GDK_KEY_E,                   GDK_KEY_grave,        0, 0, 0, 0xc8,
94   GDK_KEY_E,                   GDK_KEY_asciitilde,   0, 0, 0, 0x1ebc,
95   GDK_KEY_I,                   0,                0, 0, 0, 'I',
96   GDK_KEY_I,                   GDK_KEY_apostrophe,   0, 0, 0, 0xcd,
97   GDK_KEY_I,                   GDK_KEY_period,       0, 0, 0, 0x1eca,
98   GDK_KEY_I,                   GDK_KEY_question,     0, 0, 0, 0x1ec8,
99   GDK_KEY_I,                   GDK_KEY_grave,        0, 0, 0, 0xcc,
100   GDK_KEY_I,                   GDK_KEY_asciitilde,   0, 0, 0, 0x128,
101   GDK_KEY_O,                   0,                0, 0, 0, 'O',
102   GDK_KEY_O,                   GDK_KEY_apostrophe,   0, 0, 0, 0xD3,
103   GDK_KEY_O,  GDK_KEY_plus,        0,                0, 0,    0x1a0,
104   GDK_KEY_O,  GDK_KEY_plus,        GDK_KEY_apostrophe,   0, 0,    0x1eda,
105   GDK_KEY_O,  GDK_KEY_plus,        GDK_KEY_period,       0, 0,    0x1ee2,
106   GDK_KEY_O,  GDK_KEY_plus,        GDK_KEY_question,     0, 0,    0x1ede,
107   GDK_KEY_O,  GDK_KEY_plus,        GDK_KEY_grave,        0, 0,    0x1edc,
108   GDK_KEY_O,  GDK_KEY_plus,        GDK_KEY_asciitilde,   0, 0,    0x1ee0,
109   GDK_KEY_O,                   GDK_KEY_period,       0, 0, 0, 0x1ecc,
110   GDK_KEY_O,                   GDK_KEY_question,     0, 0, 0, 0x1ece,
111   GDK_KEY_O,  GDK_KEY_asciicircum, 0,                0, 0,    0xd4,
112   GDK_KEY_O,  GDK_KEY_asciicircum, GDK_KEY_apostrophe,   0, 0,    0x1ed0,
113   GDK_KEY_O,  GDK_KEY_asciicircum, GDK_KEY_period,       0, 0,    0x1ed8,
114   GDK_KEY_O,  GDK_KEY_asciicircum, GDK_KEY_question,     0, 0,    0x1ed4,
115   GDK_KEY_O,  GDK_KEY_asciicircum, GDK_KEY_grave,        0, 0,    0x1ed2,
116   GDK_KEY_O,  GDK_KEY_asciicircum, GDK_KEY_asciitilde,   0, 0,    0x1ed6,
117   GDK_KEY_O,                   GDK_KEY_grave,        0, 0, 0, 0xD2,
118   GDK_KEY_O,                   GDK_KEY_asciitilde,   0, 0, 0, 0xD5,
119   GDK_KEY_U,                   0,                0, 0, 0, 'U',
120   GDK_KEY_U,                   GDK_KEY_apostrophe,   0, 0, 0, 0xDA,
121   GDK_KEY_U,  GDK_KEY_plus,        0,                0, 0,    0x1af,
122   GDK_KEY_U,  GDK_KEY_plus,        GDK_KEY_apostrophe,   0, 0,    0x1ee8,
123   GDK_KEY_U,  GDK_KEY_plus,        GDK_KEY_period,       0, 0,    0x1ef0,
124   GDK_KEY_U,  GDK_KEY_plus,        GDK_KEY_question,     0, 0,    0x1eec,
125   GDK_KEY_U,  GDK_KEY_plus,        GDK_KEY_grave,        0, 0,    0x1eea,
126   GDK_KEY_U,  GDK_KEY_plus,        GDK_KEY_asciitilde,   0, 0,    0x1eee,
127   GDK_KEY_U,                   GDK_KEY_period,       0, 0, 0, 0x1ee4,
128   GDK_KEY_U,                   GDK_KEY_question,     0, 0, 0, 0x1ee6,
129   GDK_KEY_U,                   GDK_KEY_grave,        0, 0, 0, 0xd9,
130   GDK_KEY_U,                   GDK_KEY_asciitilde,   0, 0, 0, 0x168,
131   GDK_KEY_Y,                   0,                0, 0, 0, 'Y',
132   GDK_KEY_Y,                   GDK_KEY_apostrophe,   0, 0, 0, 0xdd,
133   GDK_KEY_Y,                   GDK_KEY_period,       0, 0, 0, 0x1ef4,
134   GDK_KEY_Y,                   GDK_KEY_question,     0, 0, 0, 0x1ef6,
135   GDK_KEY_Y,                   GDK_KEY_grave,        0, 0, 0, 0x1ef2,
136   GDK_KEY_Y,                   GDK_KEY_asciitilde,   0, 0, 0, 0x1ef8,
137   /* Do we need anything else here? */
138   GDK_KEY_backslash,           0,                0, 0, 0, 0,
139   GDK_KEY_backslash,           GDK_KEY_apostrophe,   0, 0, 0, '\'',
140   GDK_KEY_backslash,           GDK_KEY_parenleft,    0, 0, 0, '(',
141   GDK_KEY_backslash,           GDK_KEY_plus,         0, 0, 0, '+',
142   GDK_KEY_backslash,           GDK_KEY_period,       0, 0, 0, '.',
143   GDK_KEY_backslash,           GDK_KEY_question,     0, 0, 0, '?',
144   GDK_KEY_backslash,           GDK_KEY_D,            0, 0, 0, 'D',
145   GDK_KEY_backslash,           GDK_KEY_backslash,    0, 0, 0, '\\',
146   GDK_KEY_backslash,           GDK_KEY_asciicircum,  0, 0, 0, '^',
147   GDK_KEY_backslash,           GDK_KEY_grave,        0, 0, 0, '`',
148   GDK_KEY_backslash,           GDK_KEY_d,            0, 0, 0, 'd',
149   GDK_KEY_backslash,           GDK_KEY_asciitilde,   0, 0, 0, '~',
150   GDK_KEY_a,                   0,                0, 0, 0, 'a',
151   GDK_KEY_a,                   GDK_KEY_apostrophe,   0, 0, 0, 0xe1,
152   GDK_KEY_a, GDK_KEY_parenleft,    0,                0, 0,    0x103,
153   GDK_KEY_a, GDK_KEY_parenleft,    GDK_KEY_apostrophe,   0, 0,    0x1eaf,
154   GDK_KEY_a, GDK_KEY_parenleft,    GDK_KEY_period,       0, 0,    0x1eb7,
155   GDK_KEY_a, GDK_KEY_parenleft,    GDK_KEY_question,     0, 0,    0x1eb3,
156   GDK_KEY_a, GDK_KEY_parenleft,    GDK_KEY_grave,        0, 0,    0x1eb1,
157   GDK_KEY_a, GDK_KEY_parenleft,    GDK_KEY_asciitilde,   0, 0,    0x1eb5,
158   GDK_KEY_a,                   GDK_KEY_period,       0, 0, 0, 0x1ea1,
159   GDK_KEY_a,                   GDK_KEY_question,     0, 0, 0, 0x1ea3,
160   GDK_KEY_a, GDK_KEY_asciicircum,  0,                0, 0,    0xe2,
161   GDK_KEY_a, GDK_KEY_asciicircum,  GDK_KEY_apostrophe,   0, 0,    0x1ea5,
162   GDK_KEY_a, GDK_KEY_asciicircum,  GDK_KEY_period,       0, 0,    0x1ead,
163   GDK_KEY_a, GDK_KEY_asciicircum,  GDK_KEY_question,     0, 0,    0x1ea9,
164   GDK_KEY_a, GDK_KEY_asciicircum,  GDK_KEY_grave,        0, 0,    0x1ea7,
165   GDK_KEY_a, GDK_KEY_asciicircum,  GDK_KEY_asciitilde,   0, 0,    0x1eab,
166   GDK_KEY_a,                   GDK_KEY_grave,        0, 0, 0, 0xe0,
167   GDK_KEY_a,                   GDK_KEY_asciitilde,   0, 0, 0, 0xe3,
168   GDK_KEY_d,                   0,                0, 0, 0, 'd',
169   GDK_KEY_d,                   GDK_KEY_d,            0, 0, 0, 0x111,
170   GDK_KEY_e,                   0,                0, 0, 0, 'e',
171   GDK_KEY_e,                   GDK_KEY_apostrophe,   0, 0, 0, 0xe9,
172   GDK_KEY_e,                   GDK_KEY_period,       0, 0, 0, 0x1eb9,
173   GDK_KEY_e,                   GDK_KEY_question,     0, 0, 0, 0x1ebb,
174   GDK_KEY_e, GDK_KEY_asciicircum,  0,                0, 0,    0xea,
175   GDK_KEY_e, GDK_KEY_asciicircum,  GDK_KEY_apostrophe,   0, 0,    0x1ebf,
176   GDK_KEY_e, GDK_KEY_asciicircum,  GDK_KEY_period,       0, 0,    0x1ec7,
177   GDK_KEY_e, GDK_KEY_asciicircum,  GDK_KEY_question,     0, 0,    0x1ec3,
178   GDK_KEY_e, GDK_KEY_asciicircum,  GDK_KEY_grave,        0, 0,    0x1ec1,
179   GDK_KEY_e, GDK_KEY_asciicircum,  GDK_KEY_asciitilde,   0, 0,    0x1ec5,
180   GDK_KEY_e,                   GDK_KEY_grave,        0, 0, 0, 0xe8,
181   GDK_KEY_e,                   GDK_KEY_asciitilde,   0, 0, 0, 0x1ebd,
182   GDK_KEY_i,                   0,                0, 0, 0, 'i',
183   GDK_KEY_i,                   GDK_KEY_apostrophe,   0, 0, 0, 0xed,
184   GDK_KEY_i,                   GDK_KEY_period,       0, 0, 0, 0x1ecb,
185   GDK_KEY_i,                   GDK_KEY_question,     0, 0, 0, 0x1ec9,
186   GDK_KEY_i,                   GDK_KEY_grave,        0, 0, 0, 0xec,
187   GDK_KEY_i,                   GDK_KEY_asciitilde,   0, 0, 0, 0x129,
188   GDK_KEY_o,                   0,                0, 0, 0, 'o',
189   GDK_KEY_o,                   GDK_KEY_apostrophe,   0, 0, 0, 0xF3,
190   GDK_KEY_o,  GDK_KEY_plus,        0,                0, 0,    0x1a1,
191   GDK_KEY_o,  GDK_KEY_plus,        GDK_KEY_apostrophe,   0, 0,    0x1edb,
192   GDK_KEY_o,  GDK_KEY_plus,        GDK_KEY_period,       0, 0,    0x1ee3,
193   GDK_KEY_o,  GDK_KEY_plus,        GDK_KEY_question,     0, 0,    0x1edf,
194   GDK_KEY_o,  GDK_KEY_plus,        GDK_KEY_grave,        0, 0,    0x1edd,
195   GDK_KEY_o,  GDK_KEY_plus,        GDK_KEY_asciitilde,   0, 0,    0x1ee1,
196   GDK_KEY_o,                   GDK_KEY_period,       0, 0, 0, 0x1ecd,
197   GDK_KEY_o,                   GDK_KEY_question,     0, 0, 0, 0x1ecf,
198   GDK_KEY_o,  GDK_KEY_asciicircum, 0,                0, 0,    0xf4,
199   GDK_KEY_o,  GDK_KEY_asciicircum, GDK_KEY_apostrophe,   0, 0,    0x1ed1,
200   GDK_KEY_o,  GDK_KEY_asciicircum, GDK_KEY_period,       0, 0,    0x1ed9,
201   GDK_KEY_o,  GDK_KEY_asciicircum, GDK_KEY_question,     0, 0,    0x1ed5,
202   GDK_KEY_o,  GDK_KEY_asciicircum, GDK_KEY_grave,        0, 0,    0x1ed3,
203   GDK_KEY_o,  GDK_KEY_asciicircum, GDK_KEY_asciitilde,   0, 0,    0x1ed7,
204   GDK_KEY_o,                   GDK_KEY_grave,        0, 0, 0, 0xF2,
205   GDK_KEY_o,                   GDK_KEY_asciitilde,   0, 0, 0, 0xF5,
206   GDK_KEY_u,                   0,                0, 0, 0, 'u',
207   GDK_KEY_u,                   GDK_KEY_apostrophe,   0, 0, 0, 0xFA,
208   GDK_KEY_u,  GDK_KEY_plus,        0,                0, 0,    0x1b0,
209   GDK_KEY_u,  GDK_KEY_plus,        GDK_KEY_apostrophe,   0, 0,    0x1ee9,
210   GDK_KEY_u,  GDK_KEY_plus,        GDK_KEY_period,       0, 0,    0x1ef1,
211   GDK_KEY_u,  GDK_KEY_plus,        GDK_KEY_question,     0, 0,    0x1eed,
212   GDK_KEY_u,  GDK_KEY_plus,        GDK_KEY_grave,        0, 0,    0x1eeb,
213   GDK_KEY_u,  GDK_KEY_plus,        GDK_KEY_asciitilde,   0, 0,    0x1eef,
214   GDK_KEY_u,                   GDK_KEY_period,       0, 0, 0, 0x1ee5,
215   GDK_KEY_u,                   GDK_KEY_question,     0, 0, 0, 0x1ee7,
216   GDK_KEY_u,                   GDK_KEY_grave,        0, 0, 0, 0xf9,
217   GDK_KEY_u,                   GDK_KEY_asciitilde,   0, 0, 0, 0x169,
218   GDK_KEY_y,                   0,                0, 0, 0, 'y',
219   GDK_KEY_y,                   GDK_KEY_apostrophe,   0, 0, 0, 0xfd,
220   GDK_KEY_y,                   GDK_KEY_period,       0, 0, 0, 0x1ef5,
221   GDK_KEY_y,                   GDK_KEY_question,     0, 0, 0, 0x1ef7,
222   GDK_KEY_y,                   GDK_KEY_grave,        0, 0, 0, 0x1ef3,
223   GDK_KEY_y,                   GDK_KEY_asciitilde,   0, 0, 0, 0x1ef9,
224 };
225
226 static void
227 viqr_class_init (GtkIMContextSimpleClass *class)
228 {
229 }
230
231 static void
232 viqr_init (GtkIMContextSimple *im_context)
233 {
234   gtk_im_context_simple_add_table (im_context,
235                                    viqr_compose_seqs,
236                                    4,
237                                    G_N_ELEMENTS (viqr_compose_seqs) / (4 + 2));
238 }
239
240 static const GtkIMContextInfo viqr_info = { 
241   "viqr",                  /* ID */
242   N_("Vietnamese (VIQR)"), /* Human readable name */
243   GETTEXT_PACKAGE,         /* Translation domain */
244    GTK_LOCALEDIR,          /* Dir for bindtextdomain (not strictly needed for "gtk+") */
245   "vi"                     /* Languages for which this module is the default */
246 };
247
248 static const GtkIMContextInfo *info_list[] = {
249   &viqr_info
250 };
251
252 #ifndef INCLUDE_IM_viqr
253 #define MODULE_ENTRY(type, function) G_MODULE_EXPORT type im_module_ ## function
254 #else
255 #define MODULE_ENTRY(type, function) type _gtk_immodule_viqr_ ## function
256 #endif
257
258 MODULE_ENTRY (void, init) (GTypeModule *module)
259 {
260   viqr_register_type (module);
261 }
262
263 MODULE_ENTRY (void, exit) (void)
264 {
265 }
266
267 MODULE_ENTRY (void, list) (const GtkIMContextInfo ***contexts,
268                            int                      *n_contexts)
269 {
270   *contexts = info_list;
271   *n_contexts = G_N_ELEMENTS (info_list);
272 }
273
274 MODULE_ENTRY (GtkIMContext *, create) (const gchar *context_id)
275 {
276   if (strcmp (context_id, "viqr") == 0)
277     return g_object_new (type_viqr_translit, NULL);
278   else
279     return NULL;
280 }