Mercurial > pidgin
changeset 869:6cca24db6137
[gaim-migrate @ 879]
better bgcolor handling
committer: Tailor Script <tailor@pidgin.im>
author | Todd Kulesza <fflewddur> |
---|---|
date | Sun, 10 Sep 2000 05:53:15 +0000 |
parents | d828bdc3854b |
children | 9b8b83592bb6 |
files | src/gtkhtml.c |
diffstat | 1 files changed, 47 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkhtml.c Fri Sep 08 17:38:40 2000 +0000 +++ b/src/gtkhtml.c Sun Sep 10 05:53:15 2000 +0000 @@ -169,6 +169,8 @@ static void draw_cursor(GtkHtml * html); static void undraw_cursor(GtkHtml * html); +static int get_line_height(GtkHtml *, GtkHtmlBit *); + static GtkWidgetClass *parent_class = NULL; GtkType gtk_html_get_type(void) @@ -1822,21 +1824,27 @@ return TRUE; } - static void gtk_html_draw_bit(GtkHtml * html, GtkHtmlBit * hb, int redraw) { int mypos, epos, - spos; + spos, + max_height; GdkGC *gc = html->gc; int shift; GtkStateType selected_state; GtkWidget *widget = GTK_WIDGET(html); GdkRectangle area; + GList *hbits; + GtkHtmlBit *hbit; if (html->frozen > 0) return; + hbits = html->html_bits; + + hbits = g_list_find(hbits, hb); + if (hb->type == HTML_BIT_TEXT) { @@ -2048,9 +2056,19 @@ /*end my stuff*/ - if (hb->text && hb->back != NULL && selected_state != GTK_STATE_SELECTED) { - int hwidth, hheight; - int hei = gdk_text_height(hb->font, "C", 1); + + + if (hb->text && hb->back != NULL && selected_state != GTK_STATE_SELECTED) + { + int hwidth, hheight, hei; + if (hbits->prev) + { + hbit = hbits->prev->data; + if (hbit->newline) + hei = get_line_height(html, hb); + } + else + hei = get_line_height(html, hb); gdk_window_get_size(html->html_area, &hwidth, &hheight); gdk_gc_set_foreground(gc, hb->back); gdk_draw_rectangle(html->html_area, gc, TRUE /* filled */, @@ -2089,7 +2107,6 @@ } else if (hb->type == HTML_BIT_SEP) { - gdk_draw_line(html->html_area, gc, hb->x + 2, hb->y - html->yoffset - (hb->height / 2 - 1), hb->x + hb->width, @@ -4329,3 +4346,27 @@ } } } + +static int get_line_height(GtkHtml *html, GtkHtmlBit *start) +{ + int height, max_height = 0; + GList *hbits = html->html_bits; + GtkHtmlBit *hbit; + + hbits = g_list_find(hbits, start); + + while (TRUE) + { + hbit = hbits->data; + if (hbit->font) + height = gdk_text_height(hbit->font, "C", 1); + + if (max_height < height) + max_height = height; + if (hbit->newline) + break; + hbits = hbits->next; + } + + return max_height; +} \ No newline at end of file