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