comparison src/gtkimhtml.c @ 6814:782907a6ae65

[gaim-migrate @ 7354] Added animated smiley support (patch by Ka-Hing Cheung, aka javabsp, aka he-who-wrote-animated-smiley-support) and added animated MSN 6 smileys. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 12 Sep 2003 05:31:55 +0000
parents adf49a9bb9a0
children bdc4e73f354d
comparison
equal deleted inserted replaced
6813:a5d579a4feef 6814:782907a6ae65
658 658
659 *len = gtk_smiley_tree_lookup (tree, text); 659 *len = gtk_smiley_tree_lookup (tree, text);
660 return (*len > 0); 660 return (*len > 0);
661 } 661 }
662 662
663 GdkPixbuf* 663 GdkPixbufAnimation *
664 gtk_smiley_tree_image (GtkIMHtml *imhtml, 664 gtk_smiley_tree_image (GtkIMHtml *imhtml,
665 const gchar *sml, 665 const gchar *sml,
666 const gchar *text) 666 const gchar *text)
667 { 667 {
668 GtkSmileyTree *t; 668 GtkSmileyTree *t;
691 } 691 }
692 x++; 692 x++;
693 } 693 }
694 694
695 if (!t->image->icon) 695 if (!t->image->icon)
696 t->image->icon = gdk_pixbuf_new_from_file(t->image->file, NULL); 696 t->image->icon = gdk_pixbuf_animation_new_from_file(t->image->file, NULL);
697 697
698 return t->image->icon; 698 return t->image->icon;
699 } 699 }
700 #define VALID_TAG(x) if (!g_ascii_strncasecmp (string, x ">", strlen (x ">"))) { \ 700 #define VALID_TAG(x) if (!g_ascii_strncasecmp (string, x ">", strlen (x ">"))) { \
701 *tag = g_strndup (string, strlen (x)); \ 701 *tag = g_strndup (string, strlen (x)); \
1370 NEW_BIT (NEW_TEXT_BIT); 1370 NEW_BIT (NEW_TEXT_BIT);
1371 } 1371 }
1372 c++; 1372 c++;
1373 pos++; 1373 pos++;
1374 } else if (imhtml->show_smileys && (gtk_imhtml_is_smiley (imhtml, fonts, c, &smilelen) || gtk_imhtml_is_smiley(imhtml, NULL, c, &smilelen))) { 1374 } else if (imhtml->show_smileys && (gtk_imhtml_is_smiley (imhtml, fonts, c, &smilelen) || gtk_imhtml_is_smiley(imhtml, NULL, c, &smilelen))) {
1375 GtkTextChildAnchor *anchor;
1376 GtkWidget *icon;
1377 GdkPixbufAnimation *pixbuf;
1375 GtkIMHtmlFontDetail *fd; 1378 GtkIMHtmlFontDetail *fd;
1376 gchar *sml = NULL; 1379 gchar *sml = NULL;
1377 if (fonts) { 1380 if (fonts) {
1378 fd = fonts->data; 1381 fd = fonts->data;
1379 sml = fd->sml; 1382 sml = fd->sml;
1380 } 1383 }
1381 NEW_BIT (NEW_TEXT_BIT); 1384 NEW_BIT (NEW_TEXT_BIT);
1382 wpos = g_snprintf (ws, smilelen + 1, "%s", c); 1385 wpos = g_snprintf (ws, smilelen + 1, "%s", c);
1383 gtk_text_buffer_insert_pixbuf(imhtml->text_buffer, &iter, gtk_smiley_tree_image (imhtml, sml, ws)); 1386 anchor = gtk_text_buffer_create_child_anchor(imhtml->text_buffer, &iter);
1387 pixbuf = gtk_smiley_tree_image(imhtml, sml, ws);
1388 icon = gtk_image_new_from_animation(pixbuf);
1389 g_object_unref(pixbuf);
1390 gtk_widget_show(icon);
1391 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), icon, anchor);
1392
1384 c += smilelen; 1393 c += smilelen;
1385 pos += smilelen; 1394 pos += smilelen;
1386 wpos = 0; 1395 wpos = 0;
1387 ws[0] = 0; 1396 ws[0] = 0;
1388 } else if (*c) { 1397 } else if (*c) {
1745 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), hr->sep, anchor); 1754 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(imhtml), hr->sep, anchor);
1746 } 1755 }
1747 1756
1748 void gtk_imhtml_hr_free(GtkIMHtmlScalable *scale) 1757 void gtk_imhtml_hr_free(GtkIMHtmlScalable *scale)
1749 { 1758 {
1750 /* gtk_widget_destroy(((GtkIMHtmlHr *)scale)->sep); */
1751 g_free(scale); 1759 g_free(scale);
1752 } 1760 }