[evolution-patches] plain image drawing fix



I noticed the plain drawing of images was offset incorrectly. I fixed
that and made them draw selection properly.

--Larry

Index: htmlimage.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlimage.c,v
retrieving revision 1.184
diff -u -p -r1.184 htmlimage.c
--- htmlimage.c	6 May 2003 11:03:19 -0000	1.184
+++ htmlimage.c	20 May 2003 05:50:14 -0000
@@ -343,9 +343,18 @@ draw_plain (HTMLObject *o, HTMLPainter *
 	HTMLImage *img = HTML_IMAGE (o);
 
 	if (img->alt && *img->alt) {
-		html_painter_set_pen (p, &html_colorset_get_color_allocated (p, HTMLTextColor)->color);
+
 		/* FIXME: cache items and glyphs? */
-		html_painter_draw_text (p, o->x + tx, o->y + ty - o->ascent, img->alt, g_utf8_strlen (img->alt, -1), NULL, NULL, 0, 0);
+		if (o->selected) {
+			html_painter_set_pen (p, &html_colorset_get_color_allocated
+					      (p, p->focus ? HTMLHighlightColor : HTMLHighlightNFColor)->color);
+			html_painter_fill_rect (p, o->x + tx, o->y + ty - o->ascent, o->width, o->ascent + o->descent);
+			html_painter_set_pen (p, &html_colorset_get_color_allocated
+					      (p, p->focus ? HTMLHighlightTextColor : HTMLHighlightTextNFColor)->color);
+		} else { 
+			html_painter_set_pen (p, &html_colorset_get_color_allocated (p, HTMLTextColor)->color);
+		}
+		html_painter_draw_text (p, o->x + tx, o->y + ty, img->alt, g_utf8_strlen (img->alt, -1), NULL, NULL, 0, 0);
 	}
 }
 
@@ -358,7 +367,7 @@ draw (HTMLObject *o,
 {
 	HTMLImage *image;
 	HTMLImagePointer *ip;
-	GdkPixbuf *pixbuf;
+	GdkPixbuf *pixbuf;1
 	gint base_x, base_y;
 	gint scale_width, scale_height;
 	GdkColor *highlight_color;
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.1803
diff -u -p -r1.1803 ChangeLog
--- ChangeLog	19 May 2003 19:10:35 -0000	1.1803
+++ ChangeLog	20 May 2003 05:50:18 -0000
@@ -1,3 +1,8 @@
+2003-05-20  Larry Ewing  <lewing ximian com>
+
+	* htmlimage.c (draw_plain): fix the text position, add
+	highlighting.
+
 2003-05-19  Larry Ewing  <lewing ximian com>
 
 	* gtkhtml-enums.h: make the flags actually be flags.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]