src/gtkimhtml.c

changeset 1462
69f0d88fbed3
parent 1461
c117868c525e
child 1463
dd25c559b99d
equal deleted inserted replaced
1461:c117868c525e 1462:69f0d88fbed3
1465 g_list_free (imhtml->line); 1465 g_list_free (imhtml->line);
1466 imhtml->line = NULL; 1466 imhtml->line = NULL;
1467 1467
1468 imhtml->x = BORDER_SIZE; 1468 imhtml->x = BORDER_SIZE;
1469 imhtml->y += imhtml->llheight; 1469 imhtml->y += imhtml->llheight;
1470 imhtml->llheight = 0;
1471 imhtml->llascent = 0;
1470 } 1472 }
1471 1473
1472 static void 1474 static void
1473 backwards_update (GtkIMHtml *imhtml, 1475 backwards_update (GtkIMHtml *imhtml,
1474 GtkIMHtmlBit *bit, 1476 GtkIMHtmlBit *bit,
1622 add_text_renderer (imhtml, bit, tmp); 1624 add_text_renderer (imhtml, bit, tmp);
1623 } else 1625 } else
1624 pos = 0; 1626 pos = 0;
1625 seenspace = FALSE; 1627 seenspace = FALSE;
1626 new_line (imhtml); 1628 new_line (imhtml);
1627 imhtml->llheight = 0;
1628 imhtml->llascent = 0;
1629 } 1629 }
1630 1630
1631 backwards_update (imhtml, bit, height, bit->font->ascent); 1631 backwards_update (imhtml, bit, height, bit->font->ascent);
1632 1632
1633 while (pos < strlen (bit->text)) { 1633 while (pos < strlen (bit->text)) {
1648 break; 1648 break;
1649 1649
1650 tmp = g_strndup (copy + pos, newpos); 1650 tmp = g_strndup (copy + pos, newpos);
1651 pos += newpos; 1651 pos += newpos;
1652 1652
1653 backwards_update (imhtml, bit, height, bit->font->ascent);
1653 add_text_renderer (imhtml, bit, tmp); 1654 add_text_renderer (imhtml, bit, tmp);
1654 1655
1655 seenspace = FALSE; 1656 seenspace = FALSE;
1656 new_line (imhtml); 1657 new_line (imhtml);
1657 } else { 1658 } else {
1658 tmp = g_strdup (copy + pos); 1659 tmp = g_strdup (copy + pos);
1659 1660
1661 backwards_update (imhtml, bit, height, bit->font->ascent);
1660 add_text_renderer (imhtml, bit, tmp); 1662 add_text_renderer (imhtml, bit, tmp);
1661 1663
1662 pos = strlen (bit->text); 1664 pos = strlen (bit->text);
1663 1665
1664 imhtml->x += width; 1666 imhtml->x += width;
1668 g_free (copy); 1670 g_free (copy);
1669 } else if ((bit->type == TYPE_SMILEY) || (bit->type == TYPE_IMG)) { 1671 } else if ((bit->type == TYPE_SMILEY) || (bit->type == TYPE_IMG)) {
1670 gdk_window_get_size (bit->pm, &width, &height); 1672 gdk_window_get_size (bit->pm, &width, &height);
1671 1673
1672 if ((imhtml->x != BORDER_SIZE) && 1674 if ((imhtml->x != BORDER_SIZE) &&
1673 ((imhtml->x + width + BORDER_SIZE + BORDER_SIZE + 5) > imhtml->xsize)) { 1675 ((imhtml->x + width + BORDER_SIZE + BORDER_SIZE + 5) > imhtml->xsize))
1674 new_line (imhtml); 1676 new_line (imhtml);
1675 imhtml->llheight = 0; 1677 else
1676 imhtml->llascent = 0;
1677 } else
1678 backwards_update (imhtml, bit, height, 0); 1678 backwards_update (imhtml, bit, height, 0);
1679 1679
1680 add_img_renderer (imhtml, bit); 1680 add_img_renderer (imhtml, bit);
1681 } else if (bit->type == TYPE_BR) { 1681 } else if (bit->type == TYPE_BR) {
1682 new_line (imhtml); 1682 new_line (imhtml);
1683 imhtml->llheight = 0;
1684 imhtml->llascent = 0;
1685 add_text_renderer (imhtml, bit, NULL); 1683 add_text_renderer (imhtml, bit, NULL);
1686 } else if (bit->type == TYPE_SEP) { 1684 } else if (bit->type == TYPE_SEP) {
1687 struct line_info *li; 1685 struct line_info *li;
1688 if (imhtml->llheight) { 1686 if (imhtml->llheight)
1689 new_line (imhtml); 1687 new_line (imhtml);
1690 imhtml->llheight = 0;
1691 imhtml->llascent = 0;
1692 }
1693 1688
1694 li = g_new0 (struct line_info, 1); 1689 li = g_new0 (struct line_info, 1);
1695 li->x = imhtml->x; 1690 li->x = imhtml->x;
1696 li->y = imhtml->y; 1691 li->y = imhtml->y;
1697 li->width = imhtml->xsize - BORDER_SIZE - BORDER_SIZE; 1692 li->width = imhtml->xsize - BORDER_SIZE - BORDER_SIZE;
1702 1697
1703 bit->chunks = g_list_append (bit->chunks, li); 1698 bit->chunks = g_list_append (bit->chunks, li);
1704 1699
1705 imhtml->llheight = HR_HEIGHT * 2; 1700 imhtml->llheight = HR_HEIGHT * 2;
1706 new_line (imhtml); 1701 new_line (imhtml);
1707 imhtml->llheight = 0;
1708 imhtml->llascent = 0;
1709 add_text_renderer (imhtml, bit, NULL); 1702 add_text_renderer (imhtml, bit, NULL);
1710 } 1703 }
1711 1704
1712 gtk_layout_set_size (GTK_LAYOUT (imhtml), imhtml->xsize, imhtml->y + 5); 1705 gtk_layout_set_size (GTK_LAYOUT (imhtml), imhtml->xsize, imhtml->y + 5);
1713 } 1706 }

mercurial