comparison src/gtkimhtml.c @ 6124:16fd7811effd

[gaim-migrate @ 6598] Remove the f2-toggles-timestamps patch because it makes highlighting act ungood when timestamps are off. Another day, perhaps. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 14 Jul 2003 23:05:21 +0000
parents c99959f1bb73
children 7e967f2d6721
comparison
equal deleted inserted replaced
6123:adabfcf8abe1 6124:16fd7811effd
413 /* When hovering over a link, we show the hand cursor--elsewhere we show the plain ol' pointer cursor */ 413 /* When hovering over a link, we show the hand cursor--elsewhere we show the plain ol' pointer cursor */
414 imhtml->hand_cursor = gdk_cursor_new (GDK_HAND2); 414 imhtml->hand_cursor = gdk_cursor_new (GDK_HAND2);
415 imhtml->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); 415 imhtml->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR);
416 416
417 imhtml->show_smileys = TRUE; 417 imhtml->show_smileys = TRUE;
418 imhtml->show_comments = TRUE;
418 419
419 imhtml->smiley_data = g_hash_table_new_full(g_str_hash, g_str_equal, 420 imhtml->smiley_data = g_hash_table_new_full(g_str_hash, g_str_equal,
420 g_free, (GDestroyNotify)gtk_smiley_tree_destroy); 421 g_free, (GDestroyNotify)gtk_smiley_tree_destroy);
421 imhtml->default_smilies = gtk_smiley_tree_new(); 422 imhtml->default_smilies = gtk_smiley_tree_new();
422 423
429 imhtml->tip = NULL; 430 imhtml->tip = NULL;
430 imhtml->tip_timer = 0; 431 imhtml->tip_timer = 0;
431 imhtml->tip_window = NULL; 432 imhtml->tip_window = NULL;
432 433
433 imhtml->scalables = NULL; 434 imhtml->scalables = NULL;
434
435 gtk_text_buffer_create_tag(imhtml->text_buffer, "comment", "invisible", FALSE, NULL);
436 } 435 }
437 436
438 GtkWidget *gtk_imhtml_new(void *a, void *b) 437 GtkWidget *gtk_imhtml_new(void *a, void *b)
439 { 438 {
440 return GTK_WIDGET(g_object_new(gtk_imhtml_get_type(), NULL)); 439 return GTK_WIDGET(g_object_new(gtk_imhtml_get_type(), NULL));
991 scalable->add_to(scalable, imhtml, &iter); \ 990 scalable->add_to(scalable, imhtml, &iter); \
992 scalable->scale(scalable, rect.width, rect.height); \ 991 scalable->scale(scalable, rect.width, rect.height); \
993 imhtml->scalables = g_list_append(imhtml->scalables, scalable); \ 992 imhtml->scalables = g_list_append(imhtml->scalables, scalable); \
994 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); \ 993 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter); \
995 } \ 994 } \
996 if (x == NEW_COMMENT_BIT) { \
997 gtk_text_buffer_apply_tag_by_name(imhtml->text_buffer, "comment", &siter, &iter); \
998 } \
999 995
1000 996
1001 997
1002 GString* gtk_imhtml_append_text (GtkIMHtml *imhtml, 998 GString* gtk_imhtml_append_text (GtkIMHtml *imhtml,
1003 const gchar *text, 999 const gchar *text,
1350 case 56: /* SPAN */ 1346 case 56: /* SPAN */
1351 case 57: /* /SPAN */ 1347 case 57: /* /SPAN */
1352 break; 1348 break;
1353 case 59: /* comment */ 1349 case 59: /* comment */
1354 NEW_BIT (NEW_TEXT_BIT); 1350 NEW_BIT (NEW_TEXT_BIT);
1355 wpos = g_snprintf (ws, len, "%s", tag); 1351 if (imhtml->show_comments)
1352 wpos = g_snprintf (ws, len, "%s", tag);
1356 NEW_BIT (NEW_COMMENT_BIT); 1353 NEW_BIT (NEW_COMMENT_BIT);
1357 break; 1354 break;
1358 default: 1355 default:
1359 break; 1356 break;
1360 } 1357 }
1478 } 1475 }
1479 1476
1480 void gtk_imhtml_show_comments (GtkIMHtml *imhtml, 1477 void gtk_imhtml_show_comments (GtkIMHtml *imhtml,
1481 gboolean show) 1478 gboolean show)
1482 { 1479 {
1483 GtkTextIter iter; 1480 imhtml->show_comments = show;
1484 GtkTextTagTable *table = gtk_text_buffer_get_tag_table(imhtml->text_buffer);
1485 GtkTextTag *tag = gtk_text_tag_table_lookup(table, "comment");
1486 g_object_set(G_OBJECT(tag), "invisible", !show, NULL);
1487 gtk_text_buffer_get_end_iter(imhtml->text_buffer, &iter);
1488 gtk_text_buffer_move_mark_by_name(imhtml->text_buffer, "insert", &iter);
1489 gtk_text_buffer_move_mark_by_name(imhtml->text_buffer, "selection_bound", &iter);
1490
1491 } 1481 }
1492 1482
1493 void 1483 void
1494 gtk_imhtml_clear (GtkIMHtml *imhtml) 1484 gtk_imhtml_clear (GtkIMHtml *imhtml)
1495 { 1485 {