Mercurial > pidgin.yaz
annotate src/gtkimhtml.c @ 4140:990eb517e38a
[gaim-migrate @ 4358]
Another memory leak fix from Ari.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Wed, 25 Dec 2002 05:20:42 +0000 |
parents | d03ace5af8da |
children | ccec4fde84f4 |
rev | line source |
---|---|
1428 | 1 /* |
2 * GtkIMHtml | |
3 * | |
4 * Copyright (C) 2000, Eric Warmenhoven <warmenhoven@yahoo.com> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
23 #include <config.h> |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
24 #endif |
1428 | 25 #include "gtkimhtml.h" |
26 #include <gtk/gtk.h> | |
4046 | 27 #include <gdk/gdkkeysyms.h> |
1428 | 28 #include <string.h> |
29 #include <ctype.h> | |
30 #include <stdio.h> | |
31 #include <math.h> | |
2541
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
32 #ifdef HAVE_LANGINFO_CODESET |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
33 #include <langinfo.h> |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
34 #include <locale.h> |
8229710b343b
[gaim-migrate @ 2554]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2365
diff
changeset
|
35 #endif |
1428 | 36 |
2349
60c716c32c40
[gaim-migrate @ 2362]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2348
diff
changeset
|
37 |
3922 | 38 /* POINT_SIZE converts from AIM font sizes to point sizes. It probably should be redone in such a |
39 * way that it base the sizes off the default font size rather than using arbitrary font sizes. */ | |
40 #define MAX_FONT_SIZE 7 | |
41 #define POINT_SIZE(x) (_point_sizes [MIN ((x), MAX_FONT_SIZE) - 1]) | |
3928 | 42 static gint _point_sizes [] = { 8, 10, 12, 14, 20, 30, 40 }; |
2349
60c716c32c40
[gaim-migrate @ 2362]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2348
diff
changeset
|
43 |
3922 | 44 /* The four elements present in a <FONT> tag contained in a struct */ |
45 typedef struct _FontDetail FontDetail; | |
1428 | 46 struct _FontDetail { |
47 gushort size; | |
48 gchar *face; | |
3922 | 49 gchar *fore; |
50 gchar *back; | |
4032 | 51 gchar *sml; |
1428 | 52 }; |
53 | |
4032 | 54 struct _GtkSmileyTree { |
55 GString *values; | |
56 GtkSmileyTree **children; | |
57 gchar *image; | |
58 }; | |
59 | |
60 static GtkSmileyTree* | |
61 gtk_smiley_tree_new () | |
62 { | |
63 return g_new0 (GtkSmileyTree, 1); | |
64 } | |
65 | |
66 static void | |
67 gtk_smiley_tree_insert (GtkSmileyTree *tree, | |
68 const gchar *text, | |
69 const gchar *path) | |
70 { | |
71 GtkSmileyTree *t = tree; | |
72 const gchar *x = text; | |
73 | |
74 if (!strlen (x)) | |
75 return; | |
76 | |
77 while (*x) { | |
78 gchar *pos; | |
79 gint index; | |
80 | |
81 if (!t->values) | |
82 t->values = g_string_new (""); | |
83 | |
84 pos = strchr (t->values->str, *x); | |
85 if (!pos) { | |
86 t->values = g_string_append_c (t->values, *x); | |
87 index = t->values->len - 1; | |
88 t->children = g_realloc (t->children, t->values->len * sizeof (GtkSmileyTree *)); | |
89 t->children [index] = g_new0 (GtkSmileyTree, 1); | |
90 } else | |
91 index = (int) pos - (int) t->values->str; | |
92 | |
93 t = t->children [index]; | |
94 | |
95 x++; | |
96 } | |
97 | |
4139 | 98 t->image = g_strdup(path); |
4032 | 99 } |
4041 | 100 |
101 gboolean gtk_smiley_tree_destroy (GtkSmileyTree *tree) | |
4032 | 102 { |
103 GSList *list = g_slist_append (NULL, tree); | |
104 | |
105 while (list) { | |
106 GtkSmileyTree *t = list->data; | |
107 gint i; | |
108 list = g_slist_remove(list, t); | |
109 if (t->values) { | |
110 for (i = 0; i < t->values->len; i++) | |
111 list = g_slist_append (list, t->children [i]); | |
112 g_string_free (t->values, TRUE); | |
113 g_free (t->children); | |
114 } | |
4140
990eb517e38a
[gaim-migrate @ 4358]
Christian Hammond <chipx86@chipx86.com>
parents:
4139
diff
changeset
|
115 g_free (t->image); |
4032 | 116 g_free (t); |
117 } | |
4041 | 118 return TRUE; |
4032 | 119 } |
120 | |
121 static GtkTextViewClass *parent_class = NULL; | |
122 | |
123 | |
3922 | 124 /* GtkIMHtml has one signal--URL_CLICKED */ |
1428 | 125 enum { |
126 URL_CLICKED, | |
127 LAST_SIGNAL | |
128 }; | |
129 static guint signals [LAST_SIGNAL] = { 0 }; | |
130 | |
4032 | 131 static void |
132 gtk_imhtml_finalize (GObject *object) | |
133 { | |
134 GtkIMHtml *imhtml = GTK_IMHTML(object); | |
135 | |
4138 | 136 g_hash_table_foreach_remove(imhtml->smiley_data, (GHRFunc)gtk_smiley_tree_destroy, NULL); |
137 g_hash_table_destroy(imhtml->smiley_data); | |
4032 | 138 gtk_smiley_tree_destroy(imhtml->default_smilies); |
4138 | 139 gdk_cursor_unref(imhtml->hand_cursor); |
140 gdk_cursor_unref(imhtml->arrow_cursor); | |
4032 | 141 G_OBJECT_CLASS(parent_class)->finalize (object); |
142 } | |
1428 | 143 |
3922 | 144 /* Boring GTK stuff */ |
145 static void gtk_imhtml_class_init (GtkIMHtmlClass *class) | |
1428 | 146 { |
3922 | 147 GtkObjectClass *object_class; |
4032 | 148 GObjectClass *gobject_class; |
3922 | 149 object_class = (GtkObjectClass*) class; |
4032 | 150 gobject_class = (GObjectClass*) class; |
151 parent_class = gtk_type_class(GTK_TYPE_TEXT_VIEW); | |
3922 | 152 signals[URL_CLICKED] = gtk_signal_new("url_clicked", |
153 GTK_RUN_FIRST, | |
154 GTK_CLASS_TYPE(object_class), | |
155 GTK_SIGNAL_OFFSET(GtkIMHtmlClass, url_clicked), | |
156 gtk_marshal_NONE__POINTER, | |
157 GTK_TYPE_NONE, 1, | |
158 GTK_TYPE_POINTER); | |
4032 | 159 gobject_class->finalize = gtk_imhtml_finalize; |
1428 | 160 } |
161 | |
3922 | 162 static void gtk_imhtml_init (GtkIMHtml *imhtml) |
1428 | 163 { |
3922 | 164 GtkTextIter iter; |
165 imhtml->text_buffer = gtk_text_buffer_new(NULL); | |
166 gtk_text_buffer_get_end_iter (imhtml->text_buffer, &iter); | |
167 imhtml->end = gtk_text_buffer_create_mark(imhtml->text_buffer, NULL, &iter, FALSE); | |
168 gtk_text_view_set_buffer(GTK_TEXT_VIEW(imhtml), imhtml->text_buffer); | |
169 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(imhtml), GTK_WRAP_WORD); | |
170 gtk_text_view_set_editable(GTK_TEXT_VIEW(imhtml), FALSE); | |
171 gtk_text_view_set_pixels_below_lines(GTK_TEXT_VIEW(imhtml), 5); | |
172 gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(imhtml), FALSE); | |
173 /*gtk_text_view_set_justification(GTK_TEXT_VIEW(imhtml), GTK_JUSTIFY_FILL);*/ | |
3465 | 174 |
3922 | 175 /* These tags will be used often and can be reused--we create them on init and then apply them by name |
176 * other tags (color, size, face, etc.) will have to be created and applied dynamically */ | |
177 gtk_text_buffer_create_tag(imhtml->text_buffer, "BOLD", "weight", PANGO_WEIGHT_BOLD, NULL); | |
178 gtk_text_buffer_create_tag(imhtml->text_buffer, "ITALICS", "style", PANGO_STYLE_ITALIC, NULL); | |
179 gtk_text_buffer_create_tag(imhtml->text_buffer, "UNDERLINE", "underline", PANGO_UNDERLINE_SINGLE, NULL); | |
180 gtk_text_buffer_create_tag(imhtml->text_buffer, "STRIKE", "strikethrough", TRUE, NULL); | |
181 gtk_text_buffer_create_tag(imhtml->text_buffer, "SUB", "rise", -5000, NULL); | |
182 gtk_text_buffer_create_tag(imhtml->text_buffer, "SUP", "rise", 5000, NULL); | |
183 gtk_text_buffer_create_tag(imhtml->text_buffer, "PRE", "family", "Monospace", NULL); | |
3465 | 184 |
3922 | 185 /* When hovering over a link, we show the hand cursor--elsewhere we show the plain ol' pointer cursor */ |
186 imhtml->hand_cursor = gdk_cursor_new (GDK_HAND2); | |
187 imhtml->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); | |
2993 | 188 |
4032 | 189 imhtml->smiley_data = g_hash_table_new (g_str_hash, g_str_equal); |
190 imhtml->default_smilies = gtk_smiley_tree_new(); | |
2993 | 191 } |
192 | |
3922 | 193 GtkWidget *gtk_imhtml_new(void *a, void *b) |
1428 | 194 { |
3922 | 195 return GTK_WIDGET(gtk_type_new(gtk_imhtml_get_type())); |
1428 | 196 } |
197 | |
3922 | 198 GtkType gtk_imhtml_get_type() |
1428 | 199 { |
3922 | 200 static guint imhtml_type = 0; |
1428 | 201 |
202 if (!imhtml_type) { | |
3922 | 203 GtkTypeInfo imhtml_info = { |
1428 | 204 "GtkIMHtml", |
205 sizeof (GtkIMHtml), | |
206 sizeof (GtkIMHtmlClass), | |
207 (GtkClassInitFunc) gtk_imhtml_class_init, | |
208 (GtkObjectInitFunc) gtk_imhtml_init, | |
209 NULL, | |
210 NULL | |
211 }; | |
3922 | 212 |
213 imhtml_type = gtk_type_unique (gtk_text_view_get_type (), &imhtml_info); | |
1428 | 214 } |
215 | |
216 return imhtml_type; | |
217 } | |
218 | |
3922 | 219 /* The call back for an event on a link tag. */ |
220 void tag_event(GtkTextTag *tag, GObject *arg1, GdkEvent *event, GtkTextIter *arg2, char *url) { | |
221 if (event->type == GDK_BUTTON_RELEASE) { | |
222 /* A link was clicked--we emit the "url_clicked" signal with the URL as the argument */ | |
223 // if ((GdkEventButton)(event)->button == 1) | |
224 gtk_signal_emit (G_OBJECT(arg1), signals[URL_CLICKED], url); | |
225 } else if (event->type == GDK_ENTER_NOTIFY) { | |
226 /* make a hand cursor and a tooltip timeout -- if GTK worked as it should */ | |
227 } else if (event->type == GDK_LEAVE_NOTIFY) { | |
228 /* clear timeout and make an arrow cursor again --if GTK worked as it should */ | |
1428 | 229 } |
230 } | |
231 | |
4032 | 232 static void |
233 gtk_smiley_tree_remove (GtkSmileyTree *tree, | |
234 const gchar *text) | |
235 { | |
236 GtkSmileyTree *t = tree; | |
237 const gchar *x = text; | |
238 gint len = 0; | |
239 | |
240 while (*x) { | |
241 gchar *pos; | |
242 | |
243 if (!t->values) | |
244 return; | |
245 | |
246 pos = strchr (t->values->str, *x); | |
247 if (pos) | |
248 t = t->children [(int) pos - (int) t->values->str]; | |
249 else | |
250 return; | |
251 | |
252 x++; len++; | |
253 } | |
254 | |
255 if (t->image) | |
256 t->image = NULL; | |
257 } | |
258 | |
259 static gint | |
260 gtk_smiley_tree_lookup (GtkSmileyTree *tree, | |
261 const gchar *text) | |
262 { | |
263 GtkSmileyTree *t = tree; | |
264 const gchar *x = text; | |
265 gint len = 0; | |
266 | |
267 while (*x) { | |
268 gchar *pos; | |
269 | |
270 if (!t->values) | |
271 break; | |
272 | |
273 pos = strchr (t->values->str, *x); | |
274 if (pos) | |
275 t = t->children [(int) pos - (int) t->values->str]; | |
276 else | |
277 break; | |
278 | |
279 x++; len++; | |
280 } | |
281 | |
282 if (t->image) | |
283 return len; | |
284 | |
285 return 0; | |
286 } | |
287 | |
288 void | |
289 gtk_imhtml_associate_smiley (GtkIMHtml *imhtml, | |
290 gchar *text, | |
291 gchar *sml, | |
292 gchar *path) | |
293 { | |
294 GtkSmileyTree *tree; | |
295 g_return_if_fail (imhtml != NULL); | |
296 g_return_if_fail (GTK_IS_IMHTML (imhtml)); | |
297 g_return_if_fail (text != NULL); | |
298 | |
299 if (sml == NULL) | |
300 tree = imhtml->default_smilies; | |
301 else if ((tree = g_hash_table_lookup(imhtml->smiley_data, sml))) { | |
302 } else { | |
303 tree = gtk_smiley_tree_new(); | |
304 g_hash_table_insert(imhtml->smiley_data, sml, tree); | |
305 } | |
306 | |
307 if (path == NULL) | |
308 gtk_smiley_tree_remove (tree, text); | |
309 else | |
310 gtk_smiley_tree_insert (tree, text, path); | |
311 } | |
312 | |
313 static gboolean | |
314 gtk_imhtml_is_smiley (GtkIMHtml *imhtml, | |
315 GSList *fonts, | |
316 const gchar *text, | |
317 gint *len) | |
318 { | |
319 GtkSmileyTree *tree; | |
320 FontDetail *font; | |
321 char *sml = NULL; | |
322 | |
323 if (fonts) { | |
324 font = fonts->data; | |
325 sml = font->sml; | |
326 } | |
327 | |
328 if (sml == NULL) | |
329 tree = imhtml->default_smilies; | |
330 else { | |
331 tree = g_hash_table_lookup(imhtml->smiley_data, sml); | |
332 } | |
333 if (tree == NULL) | |
334 return FALSE; | |
335 | |
336 *len = gtk_smiley_tree_lookup (tree, text); | |
337 return (*len > 0); | |
338 } | |
339 | |
340 static gchar* | |
341 gtk_smiley_tree_image (GtkIMHtml *imhtml, | |
342 const gchar *sml, | |
343 const gchar *text) | |
344 { | |
345 GtkSmileyTree *t; | |
346 const gchar *x = text; | |
347 | |
348 if (sml == NULL) | |
349 t = imhtml->default_smilies; | |
350 else | |
351 t = g_hash_table_lookup(imhtml->smiley_data, sml); | |
352 | |
353 | |
354 if (t == NULL) | |
355 return sml ? gtk_smiley_tree_image(imhtml, NULL, text) : NULL; | |
356 | |
357 while (*x) { | |
358 gchar *pos; | |
359 | |
360 if (!t->values) { | |
361 return sml ? gtk_smiley_tree_image(imhtml, NULL, text) : NULL; | |
362 } | |
363 | |
364 pos = strchr (t->values->str, *x); | |
365 if (pos) { | |
366 t = t->children [(int) pos - (int) t->values->str]; | |
367 } else { | |
368 return sml ? gtk_smiley_tree_image(imhtml, NULL, text) : NULL; | |
369 } | |
370 x++; | |
371 } | |
372 | |
373 return t->image; | |
374 } | |
3922 | 375 #define VALID_TAG(x) if (!g_strncasecmp (string, x ">", strlen (x ">"))) { \ |
376 *tag = g_strndup (string, strlen (x)); \ | |
377 *len = strlen (x) + 1; \ | |
378 return TRUE; \ | |
379 } \ | |
380 (*type)++ | |
1428 | 381 |
3922 | 382 #define VALID_OPT_TAG(x) if (!g_strncasecmp (string, x " ", strlen (x " "))) { \ |
383 const gchar *c = string + strlen (x " "); \ | |
384 gchar e = '"'; \ | |
385 gboolean quote = FALSE; \ | |
386 while (*c) { \ | |
387 if (*c == '"' || *c == '\'') { \ | |
388 if (quote && (*c == e)) \ | |
389 quote = !quote; \ | |
390 else if (!quote) { \ | |
391 quote = !quote; \ | |
392 e = *c; \ | |
393 } \ | |
394 } else if (!quote && (*c == '>')) \ | |
395 break; \ | |
396 c++; \ | |
397 } \ | |
398 if (*c) { \ | |
399 *tag = g_strndup (string, c - string); \ | |
400 *len = c - string + 1; \ | |
401 return TRUE; \ | |
402 } \ | |
403 } \ | |
404 (*type)++ | |
1428 | 405 |
406 | |
1472
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
407 static gboolean |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
408 gtk_imhtml_is_amp_escape (const gchar *string, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
409 gchar *replace, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
410 gint *length) |
1472
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
411 { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
412 g_return_val_if_fail (string != NULL, FALSE); |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
413 g_return_val_if_fail (replace != NULL, FALSE); |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
414 g_return_val_if_fail (length != NULL, FALSE); |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
415 |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
416 if (!g_strncasecmp (string, "&", 5)) { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
417 *replace = '&'; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
418 *length = 5; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
419 } else if (!g_strncasecmp (string, "<", 4)) { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
420 *replace = '<'; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
421 *length = 4; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
422 } else if (!g_strncasecmp (string, ">", 4)) { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
423 *replace = '>'; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
424 *length = 4; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
425 } else if (!g_strncasecmp (string, " ", 6)) { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
426 *replace = ' '; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
427 *length = 6; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
428 } else if (!g_strncasecmp (string, "©", 6)) { |
3717
988485669631
[gaim-migrate @ 3850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
429 *replace = '©'; /* was: '©' */ |
1472
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
430 *length = 6; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
431 } else if (!g_strncasecmp (string, """, 6)) { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
432 *replace = '\"'; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
433 *length = 6; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
434 } else if (!g_strncasecmp (string, "®", 5)) { |
3717
988485669631
[gaim-migrate @ 3850]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
3705
diff
changeset
|
435 *replace = '®'; /* was: '®' */ |
1472
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
436 *length = 5; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
437 } else if (*(string + 1) == '#') { |
2022
199ba82faacb
[gaim-migrate @ 2032]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2002
diff
changeset
|
438 guint pound = 0; |
3004 | 439 if ((sscanf (string, "&#%u;", £) == 1) && pound != 0) { |
1472
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
440 if (*(string + 3 + (gint)log10 (pound)) != ';') |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
441 return FALSE; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
442 *replace = (gchar)pound; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
443 *length = 2; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
444 while (isdigit ((gint) string [*length])) (*length)++; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
445 if (string [*length] == ';') (*length)++; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
446 } else { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
447 return FALSE; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
448 } |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
449 } else { |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
450 return FALSE; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
451 } |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
452 |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
453 return TRUE; |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
454 } |
be620a051d6d
[gaim-migrate @ 1482]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1463
diff
changeset
|
455 |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
456 static gboolean |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
457 gtk_imhtml_is_tag (const gchar *string, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
458 gchar **tag, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
459 gint *len, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
460 gint *type) |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
461 { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
462 *type = 1; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
463 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
464 if (!strchr (string, '>')) |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
465 return FALSE; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
466 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
467 VALID_TAG ("B"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
468 VALID_TAG ("BOLD"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
469 VALID_TAG ("/B"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
470 VALID_TAG ("/BOLD"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
471 VALID_TAG ("I"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
472 VALID_TAG ("ITALIC"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
473 VALID_TAG ("/I"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
474 VALID_TAG ("/ITALIC"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
475 VALID_TAG ("U"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
476 VALID_TAG ("UNDERLINE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
477 VALID_TAG ("/U"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
478 VALID_TAG ("/UNDERLINE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
479 VALID_TAG ("S"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
480 VALID_TAG ("STRIKE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
481 VALID_TAG ("/S"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
482 VALID_TAG ("/STRIKE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
483 VALID_TAG ("SUB"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
484 VALID_TAG ("/SUB"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
485 VALID_TAG ("SUP"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
486 VALID_TAG ("/SUP"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
487 VALID_TAG ("PRE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
488 VALID_TAG ("/PRE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
489 VALID_TAG ("TITLE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
490 VALID_TAG ("/TITLE"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
491 VALID_TAG ("BR"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
492 VALID_TAG ("HR"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
493 VALID_TAG ("/FONT"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
494 VALID_TAG ("/A"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
495 VALID_TAG ("P"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
496 VALID_TAG ("/P"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
497 VALID_TAG ("H3"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
498 VALID_TAG ("/H3"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
499 VALID_TAG ("HTML"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
500 VALID_TAG ("/HTML"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
501 VALID_TAG ("BODY"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
502 VALID_TAG ("/BODY"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
503 VALID_TAG ("FONT"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
504 VALID_TAG ("HEAD"); |
2993 | 505 VALID_TAG ("/HEAD"); |
506 VALID_TAG ("BINARY"); | |
507 VALID_TAG ("/BINARY"); | |
508 | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
509 VALID_OPT_TAG ("HR"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
510 VALID_OPT_TAG ("FONT"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
511 VALID_OPT_TAG ("BODY"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
512 VALID_OPT_TAG ("A"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
513 VALID_OPT_TAG ("IMG"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
514 VALID_OPT_TAG ("P"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
515 VALID_OPT_TAG ("H3"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
516 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
517 if (!g_strncasecmp(string, "!--", strlen ("!--"))) { |
2954
f6c4f2187c08
[gaim-migrate @ 2967]
Christian Hammond <chipx86@chipx86.com>
parents:
2898
diff
changeset
|
518 gchar *e = strstr (string + strlen("!--"), "-->"); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
519 if (e) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
520 *len = e - string + strlen ("-->"); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
521 *tag = g_strndup (string + strlen ("!--"), *len - strlen ("!---->")); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
522 return TRUE; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
523 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
524 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
525 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
526 return FALSE; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
527 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
528 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
529 static gchar* |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
530 gtk_imhtml_get_html_opt (gchar *tag, |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
531 const gchar *opt) |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
532 { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
533 gchar *t = tag; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
534 gchar *e, *a; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
535 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
536 while (g_strncasecmp (t, opt, strlen (opt))) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
537 gboolean quote = FALSE; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
538 if (*t == '\0') break; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
539 while (*t && !((*t == ' ') && !quote)) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
540 if (*t == '\"') |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
541 quote = ! quote; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
542 t++; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
543 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
544 while (*t && (*t == ' ')) t++; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
545 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
546 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
547 if (!g_strncasecmp (t, opt, strlen (opt))) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
548 t += strlen (opt); |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
549 } else { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
550 return NULL; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
551 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
552 |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
553 if ((*t == '\"') || (*t == '\'')) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
554 e = a = ++t; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
555 while (*e && (*e != *(t - 1))) e++; |
2993 | 556 if (*e == '\0') { |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
557 return NULL; |
2993 | 558 } else |
559 return g_strndup (a, e - a); | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
560 } else { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
561 e = a = t; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
562 while (*e && !isspace ((gint) *e)) e++; |
2993 | 563 return g_strndup (a, e - a); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
564 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
565 } |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
566 |
3922 | 567 |
568 | |
569 #define NEW_TEXT_BIT 0 | |
570 #define NEW_HR_BIT 1 | |
571 #define NEW_BIT(x) ws [wpos] = '\0'; \ | |
572 mark2 = gtk_text_buffer_create_mark(imhtml->text_buffer, NULL, &iter, TRUE); \ | |
573 gtk_text_buffer_insert(imhtml->text_buffer, &iter, ws, -1); \ | |
574 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); \ | |
575 gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &siter, mark2); \ | |
576 gtk_text_buffer_delete_mark(imhtml->text_buffer, mark2); \ | |
577 if (bold) \ | |
578 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "BOLD", &siter, &iter); \ | |
579 if (italics) \ | |
580 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "ITALICS", &siter, &iter); \ | |
581 if (underline) \ | |
582 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "UNDERLINE", &siter, &iter); \ | |
583 if (strike) \ | |
584 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "STRIKE", &siter, &iter); \ | |
585 if (sub) \ | |
586 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "SUB", &siter, &iter); \ | |
587 if (sup) \ | |
588 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "SUP", &siter, &iter); \ | |
589 if (pre) \ | |
590 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "PRE", &siter, &iter); \ | |
591 if (bg) { \ | |
592 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "background", bg, NULL); \ | |
593 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
594 } \ | |
595 if (fonts) { \ | |
596 FontDetail *fd = fonts->data; \ | |
597 if (fd->fore) { \ | |
598 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "foreground", fd->fore, NULL); \ | |
599 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
600 } \ | |
601 if (fd->back) { \ | |
602 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "background", fd->back, NULL); \ | |
603 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
604 } \ | |
605 if (fd->face) { \ | |
606 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "font", fd->face, NULL); \ | |
607 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
608 } \ | |
609 if (fd->size) { \ | |
610 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "size-points", (double)POINT_SIZE(fd->size), NULL); \ | |
611 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
612 } \ | |
613 } \ | |
614 if (url) { \ | |
615 texttag = gtk_text_buffer_create_tag(imhtml->text_buffer, NULL, "foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE, NULL); \ | |
616 g_signal_connect(G_OBJECT(texttag), "event", G_CALLBACK(tag_event), strdup(url)); \ | |
617 gtk_text_buffer_apply_tag(imhtml->text_buffer, texttag, &siter, &iter); \ | |
618 } \ | |
619 wpos = 0; \ | |
620 ws[0] = 0; \ | |
621 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); \ | |
622 | |
623 | |
624 /* if (x == NEW_HR_BIT) { \ | |
625 sep = gtk_hseparator_new(); \ | |
626 gtk_widget_size_request(GTK_WIDGET(imhtml), &req); \ | |
627 gtk_widget_set_size_request(sep, 20, -1); \ | |
628 anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, &iter); \ | |
629 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), sep, anchor); \ | |
630 gtk_widget_show(sep); \ | |
631 } */ | |
632 | |
633 GString* gtk_imhtml_append_text (GtkIMHtml *imhtml, | |
634 const gchar *text, | |
635 gint len, | |
636 GtkIMHtmlOptions options) | |
1428 | 637 { |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
638 gint pos = 0; |
3922 | 639 GString *str = NULL; |
640 GtkTextIter iter, siter; | |
641 GtkTextMark *mark, *mark2; | |
642 GtkTextChildAnchor *anchor; | |
643 GtkTextTag *texttag; | |
644 GtkWidget *sep; | |
645 GtkRequisition req; | |
646 gchar *ws; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
647 gchar *tag; |
3922 | 648 gchar *url = NULL; |
649 gchar *bg = NULL; | |
4032 | 650 gint tlen, smilelen, wpos=0; |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
651 gint type; |
3922 | 652 const gchar *c; |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
653 gchar amp; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
654 |
1428 | 655 guint bold = 0, |
656 italics = 0, | |
657 underline = 0, | |
658 strike = 0, | |
659 sub = 0, | |
660 sup = 0, | |
1691
d802b115800f
[gaim-migrate @ 1701]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
661 title = 0, |
3922 | 662 pre = 0; |
1428 | 663 |
3922 | 664 GSList *fonts = NULL; |
1428 | 665 |
666 g_return_val_if_fail (imhtml != NULL, NULL); | |
667 g_return_val_if_fail (GTK_IS_IMHTML (imhtml), NULL); | |
668 g_return_val_if_fail (text != NULL, NULL); | |
3922 | 669 g_return_val_if_fail (len != 0, NULL); |
670 | |
671 c = text; | |
672 if (len == -1) | |
673 len = strlen(text); | |
674 ws = g_malloc(len + 1); | |
675 ws[0] = 0; | |
1428 | 676 |
677 if (options & GTK_IMHTML_RETURN_LOG) | |
3922 | 678 str = g_string_new(""); |
1428 | 679 |
3922 | 680 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); |
681 mark = gtk_text_buffer_create_mark (imhtml->text_buffer, NULL, &iter, /* right grav */ FALSE); | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
682 while (pos < len) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
683 if (*c == '<' && gtk_imhtml_is_tag (c + 1, &tag, &tlen, &type)) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
684 c++; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
685 pos++; |
3922 | 686 switch (type) |
687 { | |
688 case 1: /* B */ | |
689 case 2: /* BOLD */ | |
690 NEW_BIT (NEW_TEXT_BIT); | |
691 bold++; | |
692 break; | |
693 case 3: /* /B */ | |
694 case 4: /* /BOLD */ | |
695 NEW_BIT (NEW_TEXT_BIT); | |
696 if (bold) | |
697 bold--; | |
698 break; | |
699 case 5: /* I */ | |
700 case 6: /* ITALIC */ | |
701 NEW_BIT (NEW_TEXT_BIT); | |
702 italics++; | |
703 break; | |
704 case 7: /* /I */ | |
705 case 8: /* /ITALIC */ | |
706 NEW_BIT (NEW_TEXT_BIT); | |
707 if (italics) | |
708 italics--; | |
709 break; | |
710 case 9: /* U */ | |
711 case 10: /* UNDERLINE */ | |
712 NEW_BIT (NEW_TEXT_BIT); | |
713 underline++; | |
714 break; | |
715 case 11: /* /U */ | |
716 case 12: /* /UNDERLINE */ | |
717 NEW_BIT (NEW_TEXT_BIT); | |
718 if (underline) | |
719 underline--; | |
720 break; | |
721 case 13: /* S */ | |
722 case 14: /* STRIKE */ | |
723 NEW_BIT (NEW_TEXT_BIT); | |
724 strike++; | |
725 break; | |
726 case 15: /* /S */ | |
727 case 16: /* /STRIKE */ | |
728 NEW_BIT (NEW_TEXT_BIT); | |
729 if (strike) | |
730 strike--; | |
731 break; | |
732 case 17: /* SUB */ | |
733 NEW_BIT (NEW_TEXT_BIT); | |
734 sub++; | |
735 break; | |
736 case 18: /* /SUB */ | |
737 NEW_BIT (NEW_TEXT_BIT); | |
738 if (sub) | |
739 sub--; | |
740 break; | |
741 case 19: /* SUP */ | |
742 NEW_BIT (NEW_TEXT_BIT); | |
743 sup++; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
744 break; |
3922 | 745 case 20: /* /SUP */ |
746 NEW_BIT (NEW_TEXT_BIT); | |
747 if (sup) | |
748 sup--; | |
749 break; | |
750 case 21: /* PRE */ | |
751 NEW_BIT (NEW_TEXT_BIT); | |
752 pre++; | |
753 break; | |
754 case 22: /* /PRE */ | |
755 NEW_BIT (NEW_TEXT_BIT); | |
756 if (pre) | |
757 pre--; | |
758 break; | |
759 case 23: /* TITLE */ | |
760 NEW_BIT (NEW_TEXT_BIT); | |
761 title++; | |
762 break; | |
763 case 24: /* /TITLE */ | |
764 if (title) { | |
765 if (options & GTK_IMHTML_NO_TITLE) { | |
766 wpos = 0; | |
767 ws [wpos] = '\0'; | |
768 } | |
769 title--; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
770 } |
3922 | 771 break; |
772 case 25: /* BR */ | |
773 ws[wpos] = '\n'; | |
774 wpos++; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
775 NEW_BIT (NEW_TEXT_BIT); |
3922 | 776 break; |
777 case 26: /* HR */ | |
778 case 42: /* HR (opt) */ | |
779 ws[wpos++] = '\n'; | |
780 NEW_BIT(NEW_HR_BIT); | |
781 break; | |
782 case 27: /* /FONT */ | |
783 if (fonts) { | |
784 FontDetail *font = fonts->data; | |
785 NEW_BIT (NEW_TEXT_BIT); | |
786 fonts = g_slist_remove (fonts, font); | |
787 if (font->face) | |
788 g_free (font->face); | |
789 if (font->fore) | |
790 g_free (font->fore); | |
791 if (font->back) | |
792 g_free (font->back); | |
4032 | 793 if (font->sml) |
794 g_free (font->sml); | |
3922 | 795 g_free (font); |
796 } | |
797 break; | |
798 case 28: /* /A */ | |
799 if (url) { | |
800 NEW_BIT(NEW_TEXT_BIT); | |
801 g_free(url); | |
802 url = NULL; | |
2993 | 803 break; |
804 } | |
3922 | 805 case 29: /* P */ |
806 case 30: /* /P */ | |
807 case 31: /* H3 */ | |
808 case 32: /* /H3 */ | |
809 case 33: /* HTML */ | |
810 case 34: /* /HTML */ | |
811 case 35: /* BODY */ | |
812 case 36: /* /BODY */ | |
813 case 37: /* FONT */ | |
814 case 38: /* HEAD */ | |
815 case 39: /* /HEAD */ | |
816 break; | |
817 case 40: /* BINARY */ | |
818 case 41: /* /BINARY */ | |
819 break; | |
820 case 43: /* FONT (opt) */ | |
821 { | |
4032 | 822 gchar *color, *back, *face, *size, *sml; |
3922 | 823 FontDetail *font, *oldfont = NULL; |
824 color = gtk_imhtml_get_html_opt (tag, "COLOR="); | |
825 back = gtk_imhtml_get_html_opt (tag, "BACK="); | |
826 face = gtk_imhtml_get_html_opt (tag, "FACE="); | |
827 size = gtk_imhtml_get_html_opt (tag, "SIZE="); | |
4032 | 828 sml = gtk_imhtml_get_html_opt (tag, "SML="); |
829 if (!(color || back || face || size || sml)) | |
3922 | 830 break; |
831 | |
832 NEW_BIT (NEW_TEXT_BIT); | |
833 | |
834 font = g_new0 (FontDetail, 1); | |
835 if (fonts) | |
836 oldfont = fonts->data; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
837 |
3922 | 838 if (color && !(options & GTK_IMHTML_NO_COLOURS)) |
839 font->fore = color; | |
840 else if (oldfont && oldfont->fore) | |
841 font->fore = g_strdup(oldfont->fore); | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
842 |
3922 | 843 if (back && !(options & GTK_IMHTML_NO_COLOURS)) |
844 font->back = back; | |
845 else if (oldfont && oldfont->back) | |
846 font->back = g_strdup(oldfont->back); | |
847 | |
848 if (face && !(options & GTK_IMHTML_NO_FONTS)) | |
849 font->face = face; | |
850 else if (oldfont && oldfont->face) | |
851 font->face = g_strdup(oldfont->face); | |
4032 | 852 |
853 if (sml) | |
854 font->sml = sml; | |
855 else if (oldfont && oldfont->sml) | |
856 font->sml = g_strdup(oldfont->sml); | |
857 | |
3922 | 858 if (size && !(options & GTK_IMHTML_NO_SIZES)) { |
859 if (*size == '+') { | |
860 sscanf (size + 1, "%hd", &font->size); | |
861 font->size += 3; | |
862 } else if (*size == '-') { | |
863 sscanf (size + 1, "%hd", &font->size); | |
864 font->size = MAX (0, 3 - font->size); | |
865 } else if (isdigit (*size)) { | |
866 sscanf (size, "%hd", &font->size); | |
867 } | |
868 } else if (oldfont) | |
869 font->size = oldfont->size; | |
870 g_free(size); | |
871 fonts = g_slist_prepend (fonts, font); | |
872 } | |
873 break; | |
874 case 44: /* BODY (opt) */ | |
875 if (!(options & GTK_IMHTML_NO_COLOURS)) { | |
876 char *bgcolor = gtk_imhtml_get_html_opt (tag, "BGCOLOR="); | |
877 if (bgcolor) { | |
878 NEW_BIT(NEW_TEXT_BIT); | |
879 if (bg) | |
880 g_free(bg); | |
881 bg = bgcolor; | |
2885
f72efa29c109
[gaim-migrate @ 2898]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2871
diff
changeset
|
882 } |
1428 | 883 } |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
884 break; |
3922 | 885 case 45: /* A (opt) */ |
886 { | |
887 gchar *href = gtk_imhtml_get_html_opt (tag, "HREF="); | |
888 if (href) { | |
889 NEW_BIT (NEW_TEXT_BIT); | |
890 if (url) | |
891 g_free (url); | |
892 url = href; | |
893 } | |
2993 | 894 } |
3922 | 895 break; |
896 case 47: /* P (opt) */ | |
897 case 48: /* H3 (opt) */ | |
2993 | 898 break; |
3922 | 899 case 49: /* comment */ |
900 NEW_BIT (NEW_TEXT_BIT); | |
901 wpos = g_snprintf (ws, len, "%s", tag); | |
902 NEW_BIT (NEW_COMMENT_BIT); | |
903 break; | |
904 default: | |
905 break; | |
2993 | 906 } |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
907 c += tlen; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
908 pos += tlen; |
4138 | 909 if(tag) |
910 g_free(tag); /* This was allocated back in VALID_TAG() */ | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
911 } else if (*c == '&' && gtk_imhtml_is_amp_escape (c, &, &tlen)) { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
912 ws [wpos++] = amp; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
913 c += tlen; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
914 pos += tlen; |
1428 | 915 } else if (*c == '\n') { |
916 if (!(options & GTK_IMHTML_NO_NEWLINE)) { | |
3922 | 917 ws[wpos] = '\n'; |
918 wpos++; | |
1428 | 919 NEW_BIT (NEW_TEXT_BIT); |
920 } | |
921 c++; | |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
922 pos++; |
4032 | 923 } else if (gtk_imhtml_is_smiley (imhtml, fonts, c, &smilelen) || gtk_imhtml_is_smiley(imhtml, NULL, c, &smilelen)) { |
924 FontDetail *fd; | |
925 gchar *sml = NULL; | |
926 if (fonts) { | |
927 fd = fonts->data; | |
928 sml = fd->sml; | |
929 } | |
930 NEW_BIT (NEW_TEXT_BIT); | |
931 wpos = g_snprintf (ws, smilelen + 1, "%s", c); | |
932 gtk_text_buffer_insert_pixbuf(imhtml->text_buffer, &iter, gdk_pixbuf_new_from_file(gtk_smiley_tree_image (imhtml, sml, ws), NULL)); | |
933 c += smilelen; | |
934 pos += smilelen; | |
935 wpos = 0; | |
936 ws[0] = 0; | |
937 } else if (*c) { | |
1428 | 938 ws [wpos++] = *c++; |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
939 pos++; |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
940 } else { |
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2826
diff
changeset
|
941 break; |
1428 | 942 } |
943 } | |
3922 | 944 |
945 NEW_BIT(NEW_TEXT_BIT); | |
1428 | 946 if (url) { |
947 g_free (url); | |
3922 | 948 if (str) |
949 str = g_string_append (str, "</A>"); | |
1428 | 950 } |
3922 | 951 |
4032 | 952 while (fonts) { |
953 FontDetail *font = fonts->data; | |
954 fonts = g_slist_remove (fonts, font); | |
955 if (font->face) | |
956 g_free (font->face); | |
957 if (font->fore) | |
958 g_free (font->fore); | |
959 if (font->back) | |
960 g_free (font->back); | |
961 if (font->sml) | |
962 g_free (font->sml); | |
963 g_free (font); | |
964 if (str) | |
965 str = g_string_append (str, "</FONT>"); | |
966 } | |
967 | |
3922 | 968 if (str) { |
1428 | 969 while (bold) { |
3922 | 970 str = g_string_append (str, "</B>"); |
1428 | 971 bold--; |
972 } | |
973 while (italics) { | |
3922 | 974 str = g_string_append (str, "</I>"); |
1428 | 975 italics--; |
976 } | |
977 while (underline) { | |
3922 | 978 str = g_string_append (str, "</U>"); |
1428 | 979 underline--; |
980 } | |
981 while (strike) { | |
3922 | 982 str = g_string_append (str, "</S>"); |
1428 | 983 strike--; |
984 } | |
985 while (sub) { | |
3922 | 986 str = g_string_append (str, "</SUB>"); |
1428 | 987 sub--; |
988 } | |
989 while (sup) { | |
3922 | 990 str = g_string_append (str, "</SUP>"); |
1428 | 991 sup--; |
992 } | |
993 while (title) { | |
3922 | 994 str = g_string_append (str, "</TITLE>"); |
1428 | 995 title--; |
996 } | |
1691
d802b115800f
[gaim-migrate @ 1701]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
997 while (pre) { |
3922 | 998 str = g_string_append (str, "</PRE>"); |
1691
d802b115800f
[gaim-migrate @ 1701]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
999 pre--; |
d802b115800f
[gaim-migrate @ 1701]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1647
diff
changeset
|
1000 } |
1428 | 1001 } |
4032 | 1002 g_free (ws); |
1003 if (!(options & GTK_IMHTML_NO_SCROLL)) | |
1004 gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (imhtml), mark, | |
1005 0, TRUE, 0.0, 1.0); | |
3922 | 1006 gtk_text_buffer_delete_mark (imhtml->text_buffer, mark); |
1007 return str; | |
1008 } | |
1009 | |
1010 void gtk_imhtml_set_img_handler (GtkIMHtml *imhtml, | |
1011 GtkIMHtmlImage handler){} | |
1012 | |
1013 void gtk_imhtml_remove_smileys (GtkIMHtml *imhtml){} | |
1014 void gtk_imhtml_show_smileys (GtkIMHtml *imhtml, | |
1015 gboolean show){} | |
1016 | |
1017 void gtk_imhtml_show_comments (GtkIMHtml *imhtml, | |
1018 gboolean show){} | |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1738
diff
changeset
|
1019 |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1738
diff
changeset
|
1020 void |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1738
diff
changeset
|
1021 gtk_imhtml_clear (GtkIMHtml *imhtml) |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1738
diff
changeset
|
1022 { |
3922 | 1023 GtkTextIter start, end; |
2993 | 1024 |
3922 | 1025 gtk_text_buffer_get_start_iter(imhtml->text_buffer, &start); |
1026 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &end); | |
1027 gtk_text_buffer_delete(imhtml->text_buffer, &start, &end); | |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1738
diff
changeset
|
1028 } |
2363
08c66712364c
[gaim-migrate @ 2376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2349
diff
changeset
|
1029 |
4046 | 1030 void gtk_imhtml_page_up (GtkIMHtml *imhtml) |
1031 { | |
1032 | |
1033 } | |
3922 | 1034 void gtk_imhtml_page_down (GtkIMHtml *imhtml){} |