comparison src/gtk-glue.c @ 4962:e813cf16c015

merge
author Ben Wing <ben@xemacs.org>
date Mon, 01 Feb 2010 05:29:05 -0600
parents 304aebb79cd3 b3ce27ca7647
children 8af6a32b170d 8b2f75cecb89
comparison
equal deleted inserted replaced
4961:b90f8cf474e0 4962:e813cf16c015
23 GtkType GTK_TYPE_LISTOF = 0; 23 GtkType GTK_TYPE_LISTOF = 0;
24 GtkType GTK_TYPE_STRING_LIST = 0; 24 GtkType GTK_TYPE_STRING_LIST = 0;
25 GtkType GTK_TYPE_OBJECT_LIST = 0; 25 GtkType GTK_TYPE_OBJECT_LIST = 0;
26 GtkType GTK_TYPE_GDK_GC = 0; 26 GtkType GTK_TYPE_GDK_GC = 0;
27 27
28 #include "console-gtk.h"
28 #include "objects-gtk-impl.h" 29 #include "objects-gtk-impl.h"
29 30
30 static GtkType 31 static GtkType
31 xemacs_type_register (gchar *name, GtkType parent) 32 xemacs_type_register (gchar *name, GtkType parent)
32 { 33 {
84 { 85 {
85 strings = g_list_append (strings, XSTRING_DATA (XCAR (temp))); 86 strings = g_list_append (strings, XSTRING_DATA (XCAR (temp)));
86 temp = XCDR (temp); 87 temp = XCDR (temp);
87 } 88 }
88 89
89 GTK_VALUE_POINTER(*arg) = strings; 90 GTK_VALUE_POINTER (*arg) = strings;
90 } 91 }
91 else if (arg->type == GTK_TYPE_OBJECT_LIST) 92 else if (arg->type == GTK_TYPE_OBJECT_LIST)
92 { 93 {
93 Lisp_Object temp = obj; 94 Lisp_Object temp = obj;
94 GList *objects = NULL; 95 GList *objects = NULL;
105 { 106 {
106 objects = g_list_append (objects, XGTK_OBJECT (XCAR (temp))->object); 107 objects = g_list_append (objects, XGTK_OBJECT (XCAR (temp))->object);
107 temp = XCDR (temp); 108 temp = XCDR (temp);
108 } 109 }
109 110
110 GTK_VALUE_POINTER(*arg) = objects; 111 GTK_VALUE_POINTER (*arg) = objects;
111 } 112 }
112 else 113 else
113 { 114 {
114 ABORT(); 115 ABORT ();
115 } 116 }
116 } 117 }
117 118
118 static void 119 static void
119 __make_gtk_object_mapper (gpointer data, gpointer user_data) 120 __make_gtk_object_mapper (gpointer data, gpointer user_data)
146 { 147 {
147 g_list_foreach ((GList*) GTK_VALUE_POINTER (*arg), __make_gtk_object_mapper, &rval); 148 g_list_foreach ((GList*) GTK_VALUE_POINTER (*arg), __make_gtk_object_mapper, &rval);
148 } 149 }
149 else 150 else
150 { 151 {
151 ABORT(); 152 ABORT ();
152 } 153 }
153 } 154 }
154 return (rval); 155 return (rval);
155 } 156 }
156 157
180 { \ 181 { \
181 array[length++] = extract_fn (XCAR (temp)); \ 182 array[length++] = extract_fn (XCAR (temp)); \
182 temp = XCDR (temp); \ 183 temp = XCDR (temp); \
183 } \ 184 } \
184 \ 185 \
185 GTK_VALUE_POINTER(*arg) = array; \ 186 GTK_VALUE_POINTER (*arg) = array; \
186 } while (0); 187 } while (0);
187 188
188 if (arg->type == GTK_TYPE_STRING_ARRAY) 189 if (arg->type == GTK_TYPE_STRING_ARRAY)
189 { 190 {
190 FROB(gchar *, CHECK_STRING, (gchar*) XSTRING_DATA); 191 FROB (gchar *, CHECK_STRING, (gchar*) XSTRING_DATA);
191 } 192 }
192 else if (arg->type == GTK_TYPE_FLOAT_ARRAY) 193 else if (arg->type == GTK_TYPE_FLOAT_ARRAY)
193 { 194 {
194 FROB(gfloat, CHECK_FLOAT, extract_float); 195 FROB (gfloat, CHECK_FLOAT, extract_float);
195 } 196 }
196 else if (arg->type == GTK_TYPE_INT_ARRAY) 197 else if (arg->type == GTK_TYPE_INT_ARRAY)
197 { 198 {
198 FROB(gint, CHECK_INT, XINT); 199 FROB (gint, CHECK_INT, XINT);
199 } 200 }
200 else 201 else
201 { 202 {
202 ABORT(); 203 ABORT ();
203 } 204 }
204 #undef FROB 205 #undef FROB
205 } 206 }
206
207 extern GdkGC *gtk_get_gc (struct device *d, Lisp_Object font, Lisp_Object fg, Lisp_Object bg,
208 Lisp_Object bg_pmap, Lisp_Object lwidth);
209 207
210 static GdkGC * 208 static GdkGC *
211 face_to_gc (Lisp_Object face) 209 face_to_gc (Lisp_Object face)
212 { 210 {
213 Lisp_Object device = Fselected_device (Qnil); 211 Lisp_Object device = Fselected_device (Qnil);
214 212
215 return (gtk_get_gc (XDEVICE (device), 213 return (gtk_get_gc (XDEVICE (device),
216 Fspecifier_instance (Fget (face, Qfont, Qnil), device, Qnil, Qnil), 214 Fspecifier_instance (Fget (face, Qfont, Qnil),
217 Fspecifier_instance (Fget (face, Qforeground, Qnil), device, Qnil, Qnil), 215 device, Qnil, Qnil),
218 Fspecifier_instance (Fget (face, Qbackground, Qnil), device, Qnil, Qnil), 216 Fspecifier_instance (Fget (face, Qforeground, Qnil),
219 Fspecifier_instance (Fget (face, Qbackground_pixmap, Qnil), device, Qnil, Qnil), 217 device, Qnil, Qnil),
218 Fspecifier_instance (Fget (face, Qbackground, Qnil),
219 device, Qnil, Qnil),
220 Fspecifier_instance (Fget (face, Qbackground_pixmap,
221 Qnil), device, Qnil, Qnil),
220 Qnil)); 222 Qnil));
221 } 223 }
222 224
223 static GtkStyle * 225 static GtkStyle *
224 face_to_style (Lisp_Object face) 226 face_to_style (Lisp_Object face)
225 { 227 {
226 Lisp_Object device = Fselected_device (Qnil); 228 Lisp_Object device = Fselected_device (Qnil);
227 GtkStyle *style = gtk_style_new (); 229 GtkStyle *style = gtk_style_new ();
228 int i; 230 int i;
229 231
230 Lisp_Object font = Fspecifier_instance (Fget (face, Qfont, Qnil), device, Qnil, Qnil); 232 Lisp_Object font = Fspecifier_instance (Fget (face, Qfont, Qnil),
231 Lisp_Object fg = Fspecifier_instance (Fget (face, Qforeground, Qnil), device, Qnil, Qnil); 233 device, Qnil, Qnil);
232 Lisp_Object bg = Fspecifier_instance (Fget (face, Qbackground, Qnil), device, Qnil, Qnil); 234 Lisp_Object fg = Fspecifier_instance (Fget (face, Qforeground, Qnil),
233 Lisp_Object pm = Fspecifier_instance (Fget (face, Qbackground_pixmap, Qnil), device, Qnil, Qnil); 235 device, Qnil, Qnil);
234 236 Lisp_Object bg = Fspecifier_instance (Fget (face, Qbackground, Qnil),
235 for (i = 0; i < 5; i++) style->fg[i] = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (fg)); 237 device, Qnil, Qnil);
236 for (i = 0; i < 5; i++) style->bg[i] = * COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (bg)); 238 Lisp_Object pm = Fspecifier_instance (Fget (face, Qbackground_pixmap,
239 Qnil), device, Qnil, Qnil);
240
241 for (i = 0; i < 5; i++)
242 style->fg[i] = *COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (fg));
243 for (i = 0; i < 5; i++)
244 style->bg[i] = *COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (bg));
237 245
238 if (IMAGE_INSTANCEP (pm)) 246 if (IMAGE_INSTANCEP (pm))
239 { 247 {
240 for (i = 0; i < 5; i++) style->bg_pixmap[i] = XIMAGE_INSTANCE_GTK_PIXMAP (pm); 248 for (i = 0; i < 5; i++)
249 style->bg_pixmap[i] = XIMAGE_INSTANCE_GTK_PIXMAP (pm);
241 } 250 }
242 251
243 style->font = FONT_INSTANCE_GTK_FONT (XFONT_INSTANCE (font)); 252 style->font = FONT_INSTANCE_GTK_FONT (XFONT_INSTANCE (font));
244 253
245 return (style); 254 return (style);
246 } 255 }
247 256
248 static Lisp_Object 257 static Lisp_Object
249 gdk_event_to_emacs_event(GdkEvent *ev) 258 gdk_event_to_emacs_event (GdkEvent *ev)
250 { 259 {
251 Lisp_Object event = Qnil; 260 Lisp_Object event = Qnil;
252 261
253 if (ev) 262 if (ev)
254 { 263 {