Mercurial > pidgin
comparison src/gtkhtml.c @ 914:215fe9039ae1
[gaim-migrate @ 924]
now i just need to do the same for pixmaps and we're set.
pixmaps are going to be harder to do though because we add the pixmaps, not gtkhtml, which means we're going to have to figure out what the font is supposed to be ourselves.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 15 Sep 2000 16:51:31 +0000 |
parents | 65c8bd1feec5 |
children | 5871e1eec10c |
comparison
equal
deleted
inserted
replaced
913:8de59874f5ce | 914:215fe9039ae1 |
---|---|
124 GtkRequisition * requisition); | 124 GtkRequisition * requisition); |
125 static void gtk_html_size_allocate(GtkWidget * widget, | 125 static void gtk_html_size_allocate(GtkWidget * widget, |
126 GtkAllocation * allocation); | 126 GtkAllocation * allocation); |
127 static void gtk_html_adjustment(GtkAdjustment * adjustment, GtkHtml * html); | 127 static void gtk_html_adjustment(GtkAdjustment * adjustment, GtkHtml * html); |
128 static void gtk_html_disconnect(GtkAdjustment * adjustment, GtkHtml * html); | 128 static void gtk_html_disconnect(GtkAdjustment * adjustment, GtkHtml * html); |
129 static void gtk_html_add_seperator(GtkHtml * html); | 129 static void gtk_html_add_seperator(GtkHtml *, GdkFont *, GdkColor *, GdkColor *); |
130 // static void gtk_html_add_pixmap(GtkHtml * html, GdkPixmap * pm, gint fit); | 130 // static void gtk_html_add_pixmap(GtkHtml * html, GdkPixmap * pm, gint fit); |
131 static void gtk_html_add_text(GtkHtml * html, | 131 static void gtk_html_add_text(GtkHtml * html, |
132 GdkFont * font, | 132 GdkFont * font, |
133 GdkColor * fore, | 133 GdkColor * fore, |
134 GdkColor * back, | 134 GdkColor * back, |
2045 } | 2045 } |
2046 | 2046 |
2047 /*end my stuff*/ | 2047 /*end my stuff*/ |
2048 | 2048 |
2049 | 2049 |
2050 if (hb->text && hb->back != NULL && selected_state != GTK_STATE_SELECTED) { | 2050 if (hb->text && hb->back != NULL) { |
2051 int hwidth, hheight, hei, tmpcnt; | 2051 int hwidth, hheight, hei, tmpcnt; |
2052 hei = get_line_height(html, hb); | 2052 hei = get_line_height(html, hb); |
2053 gdk_window_get_size(html->html_area, &hwidth, &hheight); | 2053 gdk_window_get_size(html->html_area, &hwidth, &hheight); |
2054 gdk_gc_set_foreground(gc, hb->back); | 2054 gdk_gc_set_foreground(gc, hb->back); |
2055 gdk_draw_rectangle(html->html_area, gc, TRUE /* filled */, | 2055 gdk_draw_rectangle(html->html_area, gc, TRUE /* filled */, |
2087 | 2087 |
2088 } | 2088 } |
2089 } | 2089 } |
2090 else if (hb->type == HTML_BIT_SEP) | 2090 else if (hb->type == HTML_BIT_SEP) |
2091 { | 2091 { |
2092 if (hb->back != NULL) { | |
2093 int hwidth, hheight, hei, tmpcnt; | |
2094 hei = get_line_height(html, hb); | |
2095 gdk_window_get_size(html->html_area, &hwidth, &hheight); | |
2096 gdk_gc_set_foreground(gc, hb->back); | |
2097 gdk_draw_rectangle(html->html_area, gc, TRUE, | |
2098 1, hb->y - html->yoffset, | |
2099 hwidth, 5); | |
2100 for (tmpcnt = 0; tmpcnt < hb->newline; tmpcnt++) { | |
2101 int eoff = hei + hei + 2; | |
2102 eoff *= tmpcnt; | |
2103 eoff += 5; | |
2104 gdk_draw_rectangle(html->html_area, gc, TRUE, | |
2105 1, hb->y - html->yoffset + eoff, | |
2106 hwidth, hei + hei + 2); | |
2107 } | |
2108 } | |
2109 | |
2110 if (hb->fore != NULL) | |
2111 gdk_gc_set_foreground(gc, hb->fore); | |
2112 else | |
2113 gdk_gc_set_foreground(gc, &widget->style->fg[GTK_STATE_NORMAL]); | |
2114 | |
2092 gdk_draw_line(html->html_area, gc, hb->x + 2, | 2115 gdk_draw_line(html->html_area, gc, hb->x + 2, |
2093 hb->y - html->yoffset - (hb->height / 2 - 1), | 2116 hb->y - html->yoffset - (hb->height / 2 - 1), |
2094 hb->x + hb->width, | 2117 hb->x + hb->width, |
2095 hb->y - html->yoffset - (hb->height / 2 - 1)); | 2118 hb->y - html->yoffset - (hb->height / 2 - 1)); |
2096 | 2119 |
2100 area.x = hb->x - html->xoffset; | 2123 area.x = hb->x - html->xoffset; |
2101 area.y = hb->y - hb->height + 5 - html->yoffset; | 2124 area.y = hb->y - hb->height + 5 - html->yoffset; |
2102 area.width = hb->width; | 2125 area.width = hb->width; |
2103 area.height = hb->height; | 2126 area.height = hb->height; |
2104 clear_area(html, &area); | 2127 clear_area(html, &area); |
2128 if (hb->back != NULL && selected_state != GTK_STATE_SELECTED) { | |
2129 int hwidth, hheight, hei, tmpcnt; | |
2130 hei = get_line_height(html, hb); | |
2131 gdk_window_get_size(html->html_area, &hwidth, &hheight); | |
2132 gdk_gc_set_foreground(gc, hb->back); | |
2133 for (tmpcnt = 1; tmpcnt < hb->newline; tmpcnt++) { | |
2134 int eoff = hei + hei + 2; | |
2135 eoff *= tmpcnt - 1; | |
2136 eoff += 5; | |
2137 gdk_draw_rectangle(html->html_area, gc, TRUE, | |
2138 1, hb->y - html->yoffset - 11 + eoff, | |
2139 hwidth, hei + hei + 2); | |
2140 } | |
2141 } | |
2142 | |
2143 if (hb->fore != NULL) | |
2105 gdk_gc_set_background(gc, &widget->style->base[GTK_STATE_NORMAL]); | 2144 gdk_gc_set_background(gc, &widget->style->base[GTK_STATE_NORMAL]); |
2106 gdk_draw_pixmap(html->html_area, gc, hb->pm, 0, 0, hb->x, | 2145 gdk_draw_pixmap(html->html_area, gc, hb->pm, 0, 0, hb->x, |
2107 hb->y - html->yoffset - (hb->height) + 4, -1, -1); | 2146 hb->y - html->yoffset - (hb->height) + 4, -1, -1); |
2108 } | 2147 } |
2109 } | 2148 } |
2327 { | 2366 { |
2328 hb = (GtkHtmlBit *) hbits->data; | 2367 hb = (GtkHtmlBit *) hbits->data; |
2329 if (hb->type == HTML_BIT_SEP) | 2368 if (hb->type == HTML_BIT_SEP) |
2330 { | 2369 { |
2331 | 2370 |
2332 gtk_html_add_seperator(html); | 2371 gtk_html_add_seperator(html, hb->font, hb->fore, hb->back); |
2333 | 2372 |
2334 g_free(hb); | 2373 g_free(hb); |
2335 | 2374 |
2336 hbits = hbits->next; | 2375 hbits = hbits->next; |
2337 continue; | 2376 continue; |
2753 html->html_bits = g_list_append(html->html_bits, hb); | 2792 html->html_bits = g_list_append(html->html_bits, hb); |
2754 | 2793 |
2755 | 2794 |
2756 } | 2795 } |
2757 | 2796 |
2758 static void gtk_html_add_seperator(GtkHtml * html) | 2797 static void gtk_html_add_seperator(GtkHtml * html, GdkFont *font, GdkColor *fore, GdkColor *back) |
2759 { | 2798 { |
2760 GtkHtmlBit *hb = g_new0(GtkHtmlBit, 1); | 2799 GtkHtmlBit *hb = g_new0(GtkHtmlBit, 1); |
2761 gint width, | 2800 gint width, |
2762 height; | 2801 height; |
2763 | 2802 |
2774 width - | 2813 width - |
2775 GTK_SCROLLED_WINDOW(GTK_WIDGET(html)->parent)->vscrollbar->allocation. | 2814 GTK_SCROLLED_WINDOW(GTK_WIDGET(html)->parent)->vscrollbar->allocation. |
2776 width - 10; | 2815 width - 10; |
2777 hb->text = NULL; | 2816 hb->text = NULL; |
2778 hb->url = NULL; | 2817 hb->url = NULL; |
2779 hb->fore = NULL; | 2818 if (fore) |
2780 hb->back = NULL; | 2819 hb->fore = gdk_color_copy(fore); |
2781 hb->font = NULL; | 2820 else |
2821 hb->fore = NULL; | |
2822 | |
2823 if (back) | |
2824 hb->back = gdk_color_copy(back); | |
2825 else | |
2826 hb->back = NULL; | |
2827 hb->font = font; | |
2782 hb->uline = 0; | 2828 hb->uline = 0; |
2783 hb->strike = 0; | 2829 hb->strike = 0; |
2784 hb->was_selected = 0; | 2830 hb->was_selected = 0; |
2785 hb->newline = 0; | 2831 hb->newline = 0; |
2786 hb->pm = NULL; | 2832 hb->pm = NULL; |
3241 else if (!strcasecmp(tag, "U")) | 3287 else if (!strcasecmp(tag, "U")) |
3242 uline = 1; | 3288 uline = 1; |
3243 else if (!strcasecmp(tag, "PRE")) | 3289 else if (!strcasecmp(tag, "PRE")) |
3244 fixed = 1; | 3290 fixed = 1; |
3245 else if (!strcasecmp(tag, "HR")) | 3291 else if (!strcasecmp(tag, "HR")) |
3246 gtk_html_add_seperator(html); | 3292 gtk_html_add_seperator(html, cfont, current->color, current->bgcol); |
3247 else if (!strcasecmp(tag, "/B")) | 3293 else if (!strcasecmp(tag, "/B")) |
3248 bold = 0; | 3294 bold = 0; |
3249 else if (!strcasecmp(tag, "/STRIKE") || !strcasecmp(tag, "/S")) | 3295 else if (!strcasecmp(tag, "/STRIKE") || !strcasecmp(tag, "/S")) |
3250 strike = 0; | 3296 strike = 0; |
3251 else if (!strcasecmp(tag, "/I")) | 3297 else if (!strcasecmp(tag, "/I")) |