diff src/gtkimhtml.c @ 11269:1cbe76d30e81

[gaim-migrate @ 13451] Refactoring the duplicate format clearing code. Also: (23:29:52) Etan Reisner (deryni): Since you are removing send_formatting, do we still want to be renaming use_custom_font to it? (23:30:04) rlaager: probably not committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 15 Aug 2005 04:51:53 +0000
parents 477e5cca8287
children ffc86d9ad8b7
line wrap: on
line diff
--- a/src/gtkimhtml.c	Mon Aug 15 04:35:40 2005 +0000
+++ b/src/gtkimhtml.c	Mon Aug 15 04:51:53 2005 +0000
@@ -3828,6 +3828,30 @@
 	return imhtml->editable;
 }
 
+void
+gtk_imhtml_clear_formatting(GtkIMHtml *imhtml)
+{
+	gboolean bold, italic, uline;
+	bold = italic = uline = FALSE;
+
+	gtk_imhtml_get_current_format(imhtml, &bold, &italic, &uline);
+	if (bold)
+		gtk_imhtml_toggle_bold(imhtml);
+	if (italic)
+		gtk_imhtml_toggle_italic(imhtml);
+	if (uline)
+		gtk_imhtml_toggle_underline(imhtml);
+
+	gtk_imhtml_font_set_size(imhtml, 3);
+	gtk_imhtml_toggle_fontface(imhtml, NULL);
+
+	gtk_imhtml_toggle_forecolor(imhtml, NULL);
+	gtk_imhtml_toggle_backcolor(imhtml, NULL);
+	gtk_imhtml_toggle_background(imhtml, NULL);
+
+	gtk_widget_grab_focus(GTK_WIDGET(imhtml));
+}
+
 /*
  * I had this crazy idea about changing the text cursor color to reflex the foreground color
  * of the text about to be entered. This is the place you'd do it, along with the place where