changeset 536:c9f994ea5833

[gaim-migrate @ 546] smileys wrap now. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 27 Jul 2000 18:21:01 +0000
parents f03f041c1aa9
children d050f88321a1
files FIXME src/conversation.c src/gtkhtml.c src/gtkhtml.h
diffstat 4 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/FIXME	Thu Jul 27 17:48:15 2000 +0000
+++ b/FIXME	Thu Jul 27 18:21:01 2000 +0000
@@ -1,5 +1,3 @@
 GAIM: Items to be fixed
 ------------------------
 
-Make sure the stupid smiley's dont run off the edge of the gtk_html 
-widget (needs to wrap the image around).
--- a/src/conversation.c	Thu Jul 27 17:48:15 2000 +0000
+++ b/src/conversation.c	Thu Jul 27 18:21:01 2000 +0000
@@ -1067,7 +1067,7 @@
 				if ((face = is_smiley(c, &what[i], &len)) != NULL) {
 					buf2[y] = 0;
 					gtk_html_append_text(GTK_HTML(c->text), buf2, (display_options & OPT_DISP_IGNORE_COLOUR) ? HTML_OPTION_NO_COLOURS : 0);
-					gtk_html_add_pixmap(GTK_HTML(c->text), face, 0);
+					gtk_html_add_pixmap(GTK_HTML(c->text), face, 0, 0);
 					y = 0;
 					i += len - 1;
 					add_space = TRUE;
--- a/src/gtkhtml.c	Thu Jul 27 17:48:15 2000 +0000
+++ b/src/gtkhtml.c	Thu Jul 27 18:21:01 2000 +0000
@@ -2326,7 +2326,7 @@
 		if (hb->type == HTML_BIT_PIXMAP)
 		{
 
-			gtk_html_add_pixmap(html, hb->pm, hb->fit);
+			gtk_html_add_pixmap(html, hb->pm, hb->fit, hb->newline);
 
 			g_free(hb);
 
@@ -2687,17 +2687,25 @@
 }
 
 
-void gtk_html_add_pixmap(GtkHtml * html, GdkPixmap * pm, int fit)
+void gtk_html_add_pixmap(GtkHtml * html, GdkPixmap * pm, int fit, int newline)
 {
 	GtkHtmlBit *last_hb;
 	GtkHtmlBit *hb = g_new0(GtkHtmlBit, 1);
 	GdkWindowPrivate *private = (GdkWindowPrivate *) pm;
+	int width, height;
 
 	last_hb = (GtkHtmlBit *) g_list_last(html->html_bits)->data;
 
 	/* make sure pixmaps drop down a line after a <BR> */
 	if (last_hb->newline)
 		html->current_y += private->height + 2;
+
+	/* wrap pixmaps */
+	gdk_window_get_size(html->html_area, &width, &height);
+	if ((html->current_x + private->width) >= width) {
+		html->current_y += private->height + 2;
+		html->current_x = 0;
+	}
 			
 	hb->fit = fit;
 	hb->x = html->current_x;
@@ -2716,7 +2724,7 @@
 	hb->uline = 0;
 	hb->strike = 0;
 	hb->was_selected = 0;
-	hb->newline = 0;
+	hb->newline = newline;
 	hb->pm = pm;
 
 	if (html->current_x == BORDER_WIDTH)
@@ -2730,6 +2738,9 @@
 
 	gtk_html_draw_bit(html, hb, 1);
 
+	if (hb->newline)
+		html->current_x = 0;
+
 	html->html_bits = g_list_append(html->html_bits, hb);
 
 
--- a/src/gtkhtml.h	Thu Jul 27 17:48:15 2000 +0000
+++ b/src/gtkhtml.h	Thu Jul 27 18:21:01 2000 +0000
@@ -148,7 +148,7 @@
 void       gtk_html_freeze           (GtkHtml      *html);
 void       gtk_html_thaw             (GtkHtml      *html);
 
-void	gtk_html_add_pixmap	(GtkHtml * html, GdkPixmap *pm, gint fint);
+void	gtk_html_add_pixmap	(GtkHtml * html, GdkPixmap *pm, gint fint, gint newline);
 
 
 #ifdef __cplusplus