comparison src/gtkimhtml.c @ 8506:887c0259b47b

[gaim-migrate @ 9242] " 6: Using CTRL+Up to get back a previous line breaks the formatting on any new text entered on that line. Text, while being entered appears extremely small, and when it's sent, the formatting is slightly smaller and may lose other elements of formatting. the problem was that in the key_press_cb in gtkconv.c was using gtk_text_buffer_get_text(gtkconv->entry_buffer, ...); this was not giving us the html tags. So I changed it to gtk_imthml_get_markup(GTK_IMHTML(gtkconv->entry)); Then I added a signal so that the toolbar gets update when gtk_imhtml_append_text_with_images is called so that the toolbar can be updated as well. I also rename the format_functions_update to format_buttons_update since it, to me atleast, makes more sense and because I couldn't think of a better name than format_function_update, which would have been very confusing. theres one issue that I was not able to fix in this. I'm planning on looking into it later, but after ctrl-up/down the closing tag gets added and ends at the last character from the buffer. Which means formatting returns to normal (ie plain text) if you type after you've used ctrl-up/down." --Gary Kramlich committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 26 Mar 2004 14:14:16 +0000
parents 112f5762a41a
children 0b0d70464cad
comparison
equal deleted inserted replaced
8505:112f5762a41a 8506:887c0259b47b
88 enum { 88 enum {
89 URL_CLICKED, 89 URL_CLICKED,
90 BUTTONS_UPDATE, 90 BUTTONS_UPDATE,
91 TOGGLE_FORMAT, 91 TOGGLE_FORMAT,
92 CLEAR_FORMAT, 92 CLEAR_FORMAT,
93 UPDATE_FORMAT,
93 LAST_SIGNAL 94 LAST_SIGNAL
94 }; 95 };
95 static guint signals [LAST_SIGNAL] = { 0 }; 96 static guint signals [LAST_SIGNAL] = { 0 };
96 97
97 GtkTargetEntry selection_targets[] = { 98 GtkTargetEntry selection_targets[] = {
623 NULL, 624 NULL,
624 0, 625 0,
625 g_cclosure_marshal_VOID__POINTER, 626 g_cclosure_marshal_VOID__POINTER,
626 G_TYPE_NONE, 1, 627 G_TYPE_NONE, 1,
627 G_TYPE_POINTER); 628 G_TYPE_POINTER);
628 signals[BUTTONS_UPDATE] = g_signal_new("format_functions_update", 629 signals[BUTTONS_UPDATE] = g_signal_new("format_buttons_update",
629 G_TYPE_FROM_CLASS(gobject_class), 630 G_TYPE_FROM_CLASS(gobject_class),
630 G_SIGNAL_RUN_FIRST, 631 G_SIGNAL_RUN_FIRST,
631 G_STRUCT_OFFSET(GtkIMHtmlClass, buttons_update), 632 G_STRUCT_OFFSET(GtkIMHtmlClass, buttons_update),
632 NULL, 633 NULL,
633 0, 634 0,
649 G_STRUCT_OFFSET(GtkIMHtmlClass, clear_format), 650 G_STRUCT_OFFSET(GtkIMHtmlClass, clear_format),
650 NULL, 651 NULL,
651 0, 652 0,
652 g_cclosure_marshal_VOID__VOID, 653 g_cclosure_marshal_VOID__VOID,
653 G_TYPE_NONE, 0); 654 G_TYPE_NONE, 0);
655 signals[UPDATE_FORMAT] = g_signal_new("format_function_update",
656 G_TYPE_FROM_CLASS(gobject_class),
657 G_SIGNAL_RUN_FIRST,
658 G_STRUCT_OFFSET(GtkIMHtmlClass, update_format),
659 NULL,
660 0,
661 g_cclosure_marshal_VOID__VOID,
662 G_TYPE_NONE, 0);
654 gobject_class->finalize = gtk_imhtml_finalize; 663 gobject_class->finalize = gtk_imhtml_finalize;
655 } 664 }
656 665
657 static void gtk_imhtml_init (GtkIMHtml *imhtml) 666 static void gtk_imhtml_init (GtkIMHtml *imhtml)
658 { 667 {
1413 sup = 0, 1422 sup = 0,
1414 title = 0, 1423 title = 0,
1415 pre = 0; 1424 pre = 0;
1416 1425
1417 GSList *fonts = NULL; 1426 GSList *fonts = NULL;
1427 GObject *object;
1418 GtkIMHtmlScalable *scalable = NULL; 1428 GtkIMHtmlScalable *scalable = NULL;
1419 int y, height; 1429 int y, height;
1420 1430
1421 g_return_val_if_fail (imhtml != NULL, NULL); 1431 g_return_val_if_fail (imhtml != NULL, NULL);
1422 g_return_val_if_fail (GTK_IS_IMHTML (imhtml), NULL); 1432 g_return_val_if_fail (GTK_IS_IMHTML (imhtml), NULL);
2040 } 2050 }
2041 } 2051 }
2042 g_free (ws); 2052 g_free (ws);
2043 if(bg) 2053 if(bg)
2044 g_free(bg); 2054 g_free(bg);
2045 gtk_imhtml_close_tags(imhtml); 2055 /* this shouldn't be necessary if we want to be able to continue
2056 * using the format if it was unclosed. But seeing as removing this
2057 * line does not help the ctrl-up/down from enabling open tags, I'm
2058 * leaving it up to sean, or unless I find some time to look into it
2059 * more -Gary */
2060 gtk_imhtml_close_tags(imhtml);
2046 if (!(options & GTK_IMHTML_NO_SCROLL)) 2061 if (!(options & GTK_IMHTML_NO_SCROLL))
2047 gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (imhtml), mark, 2062 gtk_text_view_scroll_to_mark (GTK_TEXT_VIEW (imhtml), mark,
2048 0, TRUE, 0.0, 1.0); 2063 0, TRUE, 0.0, 1.0);
2049 gtk_text_buffer_delete_mark (imhtml->text_buffer, mark); 2064 gtk_text_buffer_delete_mark (imhtml->text_buffer, mark);
2050 gtk_text_buffer_move_mark (imhtml->text_buffer, 2065 gtk_text_buffer_move_mark (imhtml->text_buffer,
2051 gtk_text_buffer_get_mark (imhtml->text_buffer, "insert"), 2066 gtk_text_buffer_get_mark (imhtml->text_buffer, "insert"),
2052 &iter); 2067 &iter);
2068
2069 object = g_object_ref(G_OBJECT(imhtml));
2070 g_signal_emit(object, signals[UPDATE_FORMAT], 0);
2071 g_object_unref(object);
2072
2053 return str; 2073 return str;
2054 } 2074 }
2055 2075
2056 void gtk_imhtml_remove_smileys(GtkIMHtml *imhtml) 2076 void gtk_imhtml_remove_smileys(GtkIMHtml *imhtml)
2057 { 2077 {