]> Pileus Git - ~andy/gtk/blob - modules/input/imipa.c
Substantially rework the handling of status windows:
[~andy/gtk] / modules / input / imipa.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2000 Red Hat Software
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  *
19  * Author: Owen Taylor <otaylor@redhat.com>
20  *
21  */
22
23 #include <string.h>
24
25 #include <gdk/gdkkeysyms.h>
26
27 #include "gtk/gtkintl.h"
28 #include "gtk/gtkimcontextsimple.h"
29 #include "gtk/gtkimmodule.h"
30
31 GType type_ipa = 0;
32
33 static void ipa_class_init (GtkIMContextSimpleClass *class);
34 static void ipa_init (GtkIMContextSimple *im_context);
35
36 static void
37 ipa_register_type (GTypeModule *module)
38 {
39   static const GTypeInfo object_info =
40   {
41     sizeof (GtkIMContextSimpleClass),
42     (GBaseInitFunc) NULL,
43     (GBaseFinalizeFunc) NULL,
44     (GClassInitFunc) ipa_class_init,
45     NULL,           /* class_finalize */
46     NULL,           /* class_data */
47     sizeof (GtkIMContextSimple),
48     0,
49     (GInstanceInitFunc) ipa_init,
50   };
51
52   type_ipa = 
53     g_type_module_register_type (module,
54                                  GTK_TYPE_IM_CONTEXT_SIMPLE,
55                                  "GtkIMContextIpa",
56                                  &object_info, 0);
57 }
58
59 /* The sequences here match the sequences used in the emacs quail
60  * mode cryllic-translit; they allow entering all characters
61  * in iso-8859-5
62  */
63 static guint16 ipa_compose_seqs[] = {
64   GDK_ampersand, 0,           0,      0,      0,      0x263,    /* LATIN SMALL LETTER GAMMA */
65   GDK_apostrophe, 0,          0,      0,      0,      0x2C8,    /* MODIFIER LETTER VERTICAL LINE */
66   GDK_slash,  GDK_apostrophe, 0,      0,      0,      0x2CA,    /* MODIFIER LETTER ACUTE ACCENT */
67   GDK_slash,  GDK_slash,      0,      0,      0,      0x02F,    /* SOLIDUS */
68   GDK_slash,  GDK_3,          0,      0,      0,      0x25B,    /* LATIN SMALL LETTER OPEN E */
69   GDK_slash,  GDK_A,          0,      0,      0,      0x252,    /* LATIN LETTER TURNED ALPHA */
70   GDK_slash,  GDK_R,          0,      0,      0,      0x281,    /* LATIN LETTER SMALL CAPITAL INVERTED R */
71   GDK_slash,  GDK_a,          0,      0,      0,      0x250,    /* LATIN SMALL LETTER TURNED A */
72   GDK_slash,  GDK_c,          0,      0,      0,      0x254,    /* LATIN SMALL LETTER OPEN O */
73   GDK_slash,  GDK_e,          0,      0,      0,      0x259,    /* LATIN SMALL LETTER SCHWA */
74   GDK_slash,  GDK_h,          0,      0,      0,      0x265,    /* LATIN SMALL LETTER TURNED H */
75   GDK_slash,  GDK_m,          0,      0,      0,      0x26F,    /* LATIN SMALL LETTER TURNED M */
76   GDK_slash,  GDK_r,          0,      0,      0,      0x279,    /* LATIN SMALL LETTER TURNED R */
77   GDK_slash,  GDK_v,          0,      0,      0,      0x28C,    /* LATIN SMALL LETTER TURNED V */
78   GDK_slash,  GDK_w,          0,      0,      0,      0x28D,    /* LATIN SMALL LETTER TURNED W */
79   GDK_slash,  GDK_y,          0,      0,      0,      0x28E,    /* LATIN SMALL LETTER TRUEND Y*/
80   GDK_3,      0,              0,      0,      0,      0x292,    /* LATIN SMALL LETTER EZH */
81   GDK_colon,  0,              0,      0,      0,      0x2D0,    /* MODIFIER LETTER TRIANGULAR COLON */
82   GDK_A,      0,              0,      0,      0,      0x251,    /* LATIN SMALL LETTER ALPHA */
83   GDK_E,      0,              0,      0,      0,      0x25B,    /* LATIN SMALL LETTER OPEN E */
84   GDK_I,      0,              0,      0,      0,      0x26A,    /* LATIN LETTER SMALL CAPITAL I */
85   GDK_L,      0,              0,      0,      0,      0x29F,    /* LATIN LETTER SMALL CAPITAL L */
86   GDK_M,      0,              0,      0,      0,      0x28D,    /* LATIN SMALL LETTER TURNED W */
87   GDK_O,      0,              0,      0,      0,      0x04F,    /* LATIN LETTER SMALL CAPITAL OE */
88   GDK_O,      GDK_E,          0,      0,      0,      0x276,    /* LATIN LETTER SMALL CAPITAL OE */
89   GDK_R,      0,              0,      0,      0,      0x280,    /* LATIN LETTER SMALL CAPITAL R */
90   GDK_U,      0,              0,      0,      0,      0x28A,    /* LATIN SMALL LETTER UPSILON */
91   GDK_Y,      0,              0,      0,      0,      0x28F,    /* LATIN LETTER SMALL CAPITAL Y */
92   GDK_grave,  0,              0,      0,      0,      0x2CC,    /* MODIFIER LETTER LOW VERTICAL LINE */
93   GDK_a,      0,              0,      0,      0,      0x061,    /* LATIN SMALL LETTER A */
94   GDK_a,      GDK_e,          0,      0,      0,      0x0E6,    /* LATIN SMALL LETTER AE */
95   GDK_c,      0,              0,      0,      0,      0x063,    /* LATIN SMALL LETTER C */
96   GDK_c,      GDK_comma,      0,      0,      0,      0x0E7,    /* LATIN SMALL LETTER C WITH CEDILLA */
97   GDK_d,      0,              0,      0,      0,      0x064,    /* LATIN SMALL LETTER E */
98   GDK_d,      GDK_apostrophe, 0,      0,      0,      0x064,    /* LATIN SMALL LETTER D */
99   GDK_d,      GDK_h,          0,      0,      0,      0x0F0,    /* LATIN SMALL LETTER ETH */
100   GDK_e,      0,              0,      0,      0,      0x065,    /* LATIN SMALL LETTER E */
101   GDK_e,      GDK_minus,      0,      0,      0,      0x25A,    /* LATIN SMALL LETTER SCHWA WITH HOOK */
102   GDK_e,      GDK_bar,        0,      0,      0,      0x25A,    /* LATIN SMALL LETTER SCHWA WITH HOOK */
103   GDK_g,      0,              0,      0,      0,      0x067,    /* LATIN SMALL LETTER G */
104   GDK_g,      GDK_n,          0,      0,      0,      0x272,    /* LATIN SMALL LETTER N WITH LEFT HOOK */
105   GDK_i,      0,              0,      0,      0,      0x069,    /* LATIN SMALL LETTER I */
106   GDK_i,      GDK_minus,      0,      0,      0,      0x268,    /* LATIN SMALL LETTER I WITH STROKE */
107   GDK_n,      0,              0,      0,      0,      0x06e,    /* LATIN SMALL LETTER N */
108   GDK_n,      GDK_g,          0,      0,      0,      0x14B,    /* LATIN SMALL LETTER ENG */
109   GDK_o,      0,              0,      0,      0,      0x06f,    /* LATIN SMALL LETTER O */
110   GDK_o,      GDK_minus,      0,      0,      0,      0x275,    /* LATIN LETTER BARRED O */
111   GDK_o,      GDK_slash,      0,      0,      0,      0x0F8,    /* LATIN SMALL LETTER O WITH STROKE */
112   GDK_o,      GDK_e,          0,      0,      0,      0x153,    /* LATIN SMALL LIGATURE OE */
113   GDK_o,      GDK_bar,        0,      0,      0,      0x251,    /* LATIN SMALL LETTER ALPHA */
114   GDK_s,      0,              0,      0,      0,      0x073,    /* LATIN SMALL LETTER_ESH */
115   GDK_s,      GDK_h,          0,      0,      0,      0x283,    /* LATIN SMALL LETTER_ESH */
116   GDK_t,      0,              0,      0,      0,      0x074,    /* LATIN SMALL LETTER T */
117   GDK_t,      GDK_h,          0,      0,      0,      0x3B8,    /* GREEK SMALL LETTER THETA */
118   GDK_u,      0,              0,      0,      0,      0x075,    /* LATIN SMALL LETTER U */
119   GDK_u,      GDK_minus,      0,      0,      0,      0x289,    /* LATIN LETTER U BAR */
120   GDK_z,      0,              0,      0,      0,      0x07A,    /* LATIN SMALL LETTER Z */
121   GDK_z,      GDK_h,          0,      0,      0,      0x292,    /* LATIN SMALL LETTER EZH */
122   GDK_bar,    GDK_o,          0,      0,      0,      0x252,    /* LATIN LETTER TURNED ALPHA */
123
124   GDK_asciitilde, 0,          0,      0,      0,      0x303,    /* COMBINING TILDE */
125
126 };
127
128 static void
129 ipa_class_init (GtkIMContextSimpleClass *class)
130 {
131 }
132
133 static void
134 ipa_init (GtkIMContextSimple *im_context)
135 {
136   gtk_im_context_simple_add_table (im_context,
137                                    ipa_compose_seqs,
138                                    4,
139                                    G_N_ELEMENTS (ipa_compose_seqs) / (4 + 2));
140 }
141
142 static const GtkIMContextInfo ipa_info = { 
143   "ipa",                   /* ID */
144   N_("IPA"),                       /* Human readable name */
145   GETTEXT_PACKAGE,                 /* Translation domain */
146    GTK_LOCALEDIR,                  /* Dir for bindtextdomain (not strictly needed for "gtk+") */
147   ""                               /* Languages for which this module is the default */
148 };
149
150 static const GtkIMContextInfo *info_list[] = {
151   &ipa_info
152 };
153
154 void
155 im_module_init (GTypeModule *module)
156 {
157   ipa_register_type (module);
158 }
159
160 void 
161 im_module_exit (void)
162 {
163 }
164
165 void 
166 im_module_list (const GtkIMContextInfo ***contexts,
167                 int                      *n_contexts)
168 {
169   *contexts = info_list;
170   *n_contexts = G_N_ELEMENTS (info_list);
171 }
172
173 GtkIMContext *
174 im_module_create (const gchar *context_id)
175 {
176   if (strcmp (context_id, "ipa") == 0)
177     return GTK_IM_CONTEXT (g_object_new (type_ipa, NULL));
178   else
179     return NULL;
180 }