]> Pileus Git - ~andy/gtk/blob - modules/input/iminuktitut.c
printing: Don't load custom paper sizes in file backend
[~andy/gtk] / modules / input / iminuktitut.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 Inuktitut - 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_inuktitut_translit = 0;
34
35 static void inuktitut_class_init (GtkIMContextSimpleClass *class);
36 static void inuktitut_init (GtkIMContextSimple *im_context);
37
38 static void
39 inuktitut_register_type (GTypeModule *module)
40 {
41   const GTypeInfo object_info =
42   {
43     sizeof (GtkIMContextSimpleClass),
44     (GBaseInitFunc) NULL,
45     (GBaseFinalizeFunc) NULL,
46     (GClassInitFunc) inuktitut_class_init,
47     NULL,           /* class_finalize */
48     NULL,           /* class_data */
49     sizeof (GtkIMContextSimple),
50     0,
51     (GInstanceInitFunc) inuktitut_init,
52   };
53
54   type_inuktitut_translit = 
55     g_type_module_register_type (module,
56                                  GTK_TYPE_IM_CONTEXT_SIMPLE,
57                                  "GtkIMContextInuktitut",
58                                  &object_info, 0);
59 }
60
61 #define SYL(a,b,c,d) \
62   a, 0,   0, 0, 0, c, \
63   a, 'a', 0, 0, 0, b+7-d, \
64   a, 'a','a',0, 0, b+8-d, \
65   a, 'i', 0, 0, 0, b, \
66   a, 'i','i',0, 0, b+1, \
67   a, 'o', 0, 0, 0, b+2, \
68   a, 'o','o',0, 0, b+3, \
69   a, 'u', 0, 0, 0, b+2, \
70   a, 'u','u',0, 0, b+3,
71
72 static guint16 inuktitut_compose_seqs[] = {
73   'a', 0,   0,   0 ,  0,   0x140a,
74   'a', 'a', 0,   0,   0,   0x140b,
75
76   SYL('c', 0x148b, 0x14a1, 2) /* As g */
77   SYL('f', 0x1555, 0x155d, 2)
78   SYL('g', 0x148b, 0x14a1, 2)
79   SYL('h', 0x14ef, 0x1505, 2)
80
81   'i', 0,   0,   0 ,  0,   0x1403,
82   'i', 'i', 0,   0,   0,   0x1404,
83
84   SYL('j', 0x1528, 0x153e, 2)
85   SYL('k', 0x146d, 0x1483, 2)
86   SYL('l', 0x14d5, 0x14ea, 2)
87   SYL('m', 0x14a5, 0x14bb, 2)
88   SYL('n', 0x14c2, 0x14d0, 2)
89
90   'o', 0,   0,   0 ,  0,   0x1405, /* as u */
91   'o', 'o', 0,   0,   0,   0x1406,
92
93   SYL('p', 0x1431, 0x1449, 0)
94   SYL('q', 0x157f, 0x1585, 3)
95   SYL('r', 0x1546, 0x1550, 2)
96   SYL('s', 0x14ef, 0x1505, 2) /* As h */
97   SYL('t', 0x144e, 0x1466, 0)
98
99   'u', 0,   0,   0 ,  0,   0x1405,
100   'u', 'u', 0,   0,   0,   0x1406,
101
102   SYL('v', 0x1555, 0x155d, 2) /* as f */
103   SYL('y', 0x1528, 0x153e, 2) /* As j */
104
105   SYL(GDK_KEY_lstroke, 0x15a0, 0x15a6, 3) /* l- */
106   SYL(GDK_KEY_eng, 0x158f, 0x1595, 3)     /* ng */
107 };
108
109 static void
110 inuktitut_class_init (GtkIMContextSimpleClass *class)
111 {
112 }
113
114 static void
115 inuktitut_init (GtkIMContextSimple *im_context)
116 {
117   gtk_im_context_simple_add_table (im_context,
118                                    inuktitut_compose_seqs,
119                                    4,
120                                    G_N_ELEMENTS (inuktitut_compose_seqs) / (4 + 2));
121 }
122
123 static const GtkIMContextInfo inuktitut_info = { 
124   "inuktitut",             /* ID */
125   N_("Inuktitut (Transliterated)"),         /* Human readable name */
126   GETTEXT_PACKAGE,         /* Translation domain */
127   GTK_LOCALEDIR,           /* Dir for bindtextdomain (not strictly needed for "gtk+") */
128   "iu"                     /* Languages for which this module is the default */
129 };
130
131 static const GtkIMContextInfo *info_list[] = {
132   &inuktitut_info
133 };
134
135 #ifndef INCLUDE_IM_inuktitut
136 #define MODULE_ENTRY(type, function) G_MODULE_EXPORT type im_module_ ## function
137 #else
138 #define MODULE_ENTRY(type, function) type _gtk_immodule_inuktitut_ ## function
139 #endif
140
141 MODULE_ENTRY (void, init) (GTypeModule *module)
142 {
143   inuktitut_register_type (module);
144 }
145
146 MODULE_ENTRY (void, exit) (void)
147 {
148 }
149
150 MODULE_ENTRY (void, list) (const GtkIMContextInfo ***contexts,
151                            int                      *n_contexts)
152 {
153   *contexts = info_list;
154   *n_contexts = G_N_ELEMENTS (info_list);
155 }
156
157 MODULE_ENTRY (GtkIMContext *, create) (const gchar *context_id)
158 {
159   if (strcmp (context_id, "inuktitut") == 0)
160     return g_object_new (type_inuktitut_translit, NULL);
161   else
162     return NULL;
163 }