comparison src/gtkhtml.c @ 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 5bf71b39cba2
children d050f88321a1
comparison
equal deleted inserted replaced
535:f03f041c1aa9 536:c9f994ea5833
2324 continue; 2324 continue;
2325 } 2325 }
2326 if (hb->type == HTML_BIT_PIXMAP) 2326 if (hb->type == HTML_BIT_PIXMAP)
2327 { 2327 {
2328 2328
2329 gtk_html_add_pixmap(html, hb->pm, hb->fit); 2329 gtk_html_add_pixmap(html, hb->pm, hb->fit, hb->newline);
2330 2330
2331 g_free(hb); 2331 g_free(hb);
2332 2332
2333 hbits = hbits->next; 2333 hbits = hbits->next;
2334 continue; 2334 continue;
2685 if (GTK_WIDGET_CLASS(parent_class)->unrealize) 2685 if (GTK_WIDGET_CLASS(parent_class)->unrealize)
2686 (*GTK_WIDGET_CLASS(parent_class)->unrealize) (widget); 2686 (*GTK_WIDGET_CLASS(parent_class)->unrealize) (widget);
2687 } 2687 }
2688 2688
2689 2689
2690 void gtk_html_add_pixmap(GtkHtml * html, GdkPixmap * pm, int fit) 2690 void gtk_html_add_pixmap(GtkHtml * html, GdkPixmap * pm, int fit, int newline)
2691 { 2691 {
2692 GtkHtmlBit *last_hb; 2692 GtkHtmlBit *last_hb;
2693 GtkHtmlBit *hb = g_new0(GtkHtmlBit, 1); 2693 GtkHtmlBit *hb = g_new0(GtkHtmlBit, 1);
2694 GdkWindowPrivate *private = (GdkWindowPrivate *) pm; 2694 GdkWindowPrivate *private = (GdkWindowPrivate *) pm;
2695 int width, height;
2695 2696
2696 last_hb = (GtkHtmlBit *) g_list_last(html->html_bits)->data; 2697 last_hb = (GtkHtmlBit *) g_list_last(html->html_bits)->data;
2697 2698
2698 /* make sure pixmaps drop down a line after a <BR> */ 2699 /* make sure pixmaps drop down a line after a <BR> */
2699 if (last_hb->newline) 2700 if (last_hb->newline)
2700 html->current_y += private->height + 2; 2701 html->current_y += private->height + 2;
2702
2703 /* wrap pixmaps */
2704 gdk_window_get_size(html->html_area, &width, &height);
2705 if ((html->current_x + private->width) >= width) {
2706 html->current_y += private->height + 2;
2707 html->current_x = 0;
2708 }
2701 2709
2702 hb->fit = fit; 2710 hb->fit = fit;
2703 hb->x = html->current_x; 2711 hb->x = html->current_x;
2704 hb->y = html->current_y; 2712 hb->y = html->current_y;
2705 if (fit) 2713 if (fit)
2714 hb->back = NULL; 2722 hb->back = NULL;
2715 hb->font = NULL; 2723 hb->font = NULL;
2716 hb->uline = 0; 2724 hb->uline = 0;
2717 hb->strike = 0; 2725 hb->strike = 0;
2718 hb->was_selected = 0; 2726 hb->was_selected = 0;
2719 hb->newline = 0; 2727 hb->newline = newline;
2720 hb->pm = pm; 2728 hb->pm = pm;
2721 2729
2722 if (html->current_x == BORDER_WIDTH) 2730 if (html->current_x == BORDER_WIDTH)
2723 { 2731 {
2724 html->current_y += hb->height; 2732 html->current_y += hb->height;
2727 2735
2728 2736
2729 html->current_x += hb->width; 2737 html->current_x += hb->width;
2730 2738
2731 gtk_html_draw_bit(html, hb, 1); 2739 gtk_html_draw_bit(html, hb, 1);
2740
2741 if (hb->newline)
2742 html->current_x = 0;
2732 2743
2733 html->html_bits = g_list_append(html->html_bits, hb); 2744 html->html_bits = g_list_append(html->html_bits, hb);
2734 2745
2735 2746
2736 } 2747 }