diff src/gtkutils.c @ 9025:b24967757d46

[gaim-migrate @ 9801] " - Fixed text-decoration: underline; parsing from being dependent on font-size specified - IM HTML Toolbar dialogs now automatically fill with the color/font for the current text - Made most of the IMHTML formatting buttons fire signals where appropriate - Implemented a global on or off "Send default formatting with outgoing messages" option - If user previously sent a font name, we assume they want formatting on, otherwise it defaults to off. - Removed font and color from the GaimGtkConversation struct, because this wasn't being used anywhere, by anything and just resulted in more confusing code. - Removed three functions related to the struct, including one that was declared, but never actually written. - Added get_current_fontface, get_current_fontsize, get_current_forecolor, get_current_backcolor to gtk_imhtml_* to get the formatting at the cursor (or whole buffer when wbfo is on) - Removed all dialogs used only by the old default formatting preferences from dialogs.c - When font background, color, or face are "disabled" they are stored as an empty string in their prefs. - Fixed a bug where NULL for background, color, or face did not remove the tags in wbfo " all that, quoth SimGuy committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 23 May 2004 03:54:20 +0000
parents 4ff4c34b7500
children 6a17b7e2e3b2
line wrap: on
line diff
--- a/src/gtkutils.c	Sun May 23 02:42:01 2004 +0000
+++ b/src/gtkutils.c	Sun May 23 03:54:20 2004 +0000
@@ -875,59 +875,58 @@
 	buf = g_malloc(length);
 	g_snprintf(buf, length, "%s", text);
 
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) {
-		g_snprintf(tmp, length, "<B>%s</B>", buf);
-		strcpy(buf, tmp);
-	}
+	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) {
+		const char *font;
+		GdkColor fg_color, bg_color;
 
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) {
-		g_snprintf(tmp, length, "<I>%s</I>", buf);
-		strcpy(buf, tmp);
-	}
+		if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) {
+			g_snprintf(tmp, length, "<B>%s</B>", buf);
+			strcpy(buf, tmp);
+		}
 
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) {
-		g_snprintf(tmp, length, "<U>%s</U>", buf);
-		strcpy(buf, tmp);
-	}
-
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font")) {
-		const char *fontface;
+		if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) {
+			g_snprintf(tmp, length, "<I>%s</I>", buf);
+			strcpy(buf, tmp);
+		}
 
-		fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
+		if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) {
+			g_snprintf(tmp, length, "<U>%s</U>", buf);
+			strcpy(buf, tmp);
+		}
 
-		g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, buf);
-		strcpy(buf, tmp);
-	}
+		font = gaim_prefs_get_string("/gaim/gtk/conversations/font_face");
 
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) {
-		int fontsize = gaim_prefs_get_int("/gaim/gtk/conversations/font_size");
+		if (strcmp(font, "") != 0) {
+			g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", font, buf);
+			strcpy(buf, tmp);
+		}
 
-		g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf);
+		g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>",
+			gaim_prefs_get_int("/gaim/gtk/conversations/font_size"), buf);
 		strcpy(buf, tmp);
-	}
 
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) {
-		GdkColor fgcolor;
-
-		gdk_color_parse(
-			gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
-			&fgcolor);
+		if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0)
+		{
+			gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
+							&fg_color);
 
-		g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>",
-				   fgcolor.red/256, fgcolor.green/256, fgcolor.blue/256, buf);
-		strcpy(buf, tmp);
-	}
-
-	if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) {
-		GdkColor bgcolor;
+			g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>",
+					   fg_color.red/256, fg_color.green/256,
+					   fg_color.blue/256, buf);
+			strcpy(buf, tmp);
+		}
 
-		gdk_color_parse(
-			gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
-			&bgcolor);
+		if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0)
+		{
+			gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
+							&bg_color);
 
-		g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>",
-				   bgcolor.red/256, bgcolor.green/256, bgcolor.blue/256, buf);
-		strcpy(buf, tmp);
+			g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>",
+					   bg_color.red/256, bg_color.green/256,
+					   bg_color.blue/256, buf);
+			strcpy(buf, tmp);
+		}
+
 	}
 
 	g_free(tmp);