changeset 697:c7c0d2590681

[gaim-migrate @ 707] fixed a bug where default colors weren't always properly assigned committer: Tailor Script <tailor@pidgin.im>
author Todd Kulesza <fflewddur>
date Wed, 16 Aug 2000 04:30:32 +0000
parents 97b75ed155b0
children b2ab04e04194
files src/conversation.c src/dialogs.c src/gaim.h src/gaimrc.c
diffstat 4 files changed, 23 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Wed Aug 16 03:16:03 2000 +0000
+++ b/src/conversation.c	Wed Aug 16 04:30:32 2000 +0000
@@ -82,8 +82,8 @@
 GdkBitmap *dark_icon_bm = NULL;
 
 char fontface[64];
-int bgcolor = 0;
-int fgcolor = 0;
+GdkColor bgcolor;
+GdkColor fgcolor;
 
 void check_everything(GtkWidget *entry);
 gboolean keypress_callback(GtkWidget *entry, GdkEventKey *event,  struct conversation *c);
@@ -582,12 +582,12 @@
         }
 
 	if (font_options & OPT_FONT_FGCOL) {
-		g_snprintf(buf2, BUF_LONG, "<FONT COLOR=\"#%x\">%s</FONT>", c->fgcol, buf);
+		g_snprintf(buf2, BUF_LONG, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", c->fgcol.red, c->fgcol.green, c->fgcol.blue, buf);
 		strcpy(buf, buf2);
 	}
 
 	if (font_options & OPT_FONT_BGCOL) {
-		g_snprintf(buf2, BUF_LONG, "<BODY BGCOLOR=\"#%x\">%s</BODY>", c->bgcol, buf);
+		g_snprintf(buf2, BUF_LONG, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", c->bgcol.red, c->bgcol.green, c->bgcol.blue, buf);
 		strcpy(buf, buf2);
 	}
 
--- a/src/dialogs.c	Wed Aug 16 03:16:03 2000 +0000
+++ b/src/dialogs.c	Wed Aug 16 04:30:32 2000 +0000
@@ -2359,25 +2359,20 @@
 static void apply_color_dlg(GtkWidget *w, gpointer d)
 {
 	gdouble color[3];
-	int red, green, blue;
 	if ((int)d == 1) {
 		gtk_color_selection_get_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), color);
 		destroy_colorsel(NULL, (void *)1);
 
-		red = ((guint16)(color[0]*65535))>>8;
-		green = ((guint16)(color[1]*65535))>>8;
-		blue = ((guint16)(color[2]*65535))>>8;
-
-		fgcolor = ((red & 0xff) << 16) | ((green & 0xff) < 8) | (blue & 0xff);
+		fgcolor.red = ((guint16)(color[0]*65535))>>8;
+		fgcolor.green = ((guint16)(color[1]*65535))>>8;
+		fgcolor.blue = ((guint16)(color[2]*65535))>>8;
 	} else {
 		gtk_color_selection_get_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), color);
 		destroy_colorsel(NULL, (void *)0);
 
-		red = ((guint16)(color[0]*65535))>>8;
-		green = ((guint16)(color[1]*65535))>>8;
-		blue = ((guint16)(color[2]*65535))>>8;
-
-		bgcolor = ((red & 0xff) << 16) | ((green & 0xff) < 8) | (blue & 0xff);
+		bgcolor.red = ((guint16)(color[0]*65535))>>8;
+		bgcolor.green = ((guint16)(color[1]*65535))>>8;
+		bgcolor.blue = ((guint16)(color[2]*65535))>>8;
 	}
 }
 
--- a/src/gaim.h	Wed Aug 16 03:16:03 2000 +0000
+++ b/src/gaim.h	Wed Aug 16 04:30:32 2000 +0000
@@ -277,8 +277,8 @@
 	int makesound;
 	char fontface[128];
 	int hasfont;
-	int bgcol;
-	int fgcol;
+	GdkColor bgcol;
+	GdkColor fgcol;
 
 	/* stuff used just for IM */
 	GtkWidget *add_button;
@@ -397,7 +397,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 706 $"
+#define REVISION "gaim:$Revision: 707 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
@@ -426,8 +426,8 @@
 
 /* Globals in dialog.c */
 extern char fontface[64];
-extern int bgcolor;
-extern int fgcolor;
+extern GdkColor bgcolor;
+extern GdkColor fgcolor;
 extern int smiley_array[FACE_TOTAL];
 
 /* Globals in network.c */
--- a/src/gaimrc.c	Wed Aug 16 03:16:03 2000 +0000
+++ b/src/gaimrc.c	Wed Aug 16 04:30:32 2000 +0000
@@ -529,9 +529,13 @@
 			if (p->value[0] != NULL)
 					g_snprintf(fontface, sizeof(fontface), "%s", p->value[0]);
 		} else if (!strcmp(p->option, "foreground")) {
-			fgcolor = atoi(p->value[0]);
+			fgcolor.red = atoi(p->value[0]);
+			fgcolor.green = atoi(p->value[1]);
+			fgcolor.blue = atoi(p->value[2]);
 		} else if (!strcmp(p->option, "background")) {
-			bgcolor = atoi(p->value[0]);
+			bgcolor.red = atoi(p->value[0]);
+			bgcolor.green = atoi(p->value[1]);
+			bgcolor.blue = atoi(p->value[2]);
                 } else if (!strcmp(p->option, "report_idle")) {
                         report_idle = atoi(p->value[0]);
                 } else if (!strcmp(p->option, "web_browser")) {
@@ -575,8 +579,8 @@
 	fprintf(f, "\tfont_options { %d }\n", font_options);
 	if (fontface)
 		fprintf(f, "\tfont_face { %s }\n", fontface);
-	fprintf(f, "\tforeground { %d }\n", fgcolor);
-	fprintf(f, "\tbackground { %d }\n", bgcolor);
+	fprintf(f, "\tforeground { %d } { %d } { %d }\n", fgcolor.red, fgcolor.green, fgcolor.blue);
+	fprintf(f, "\tbackground { %d } { %d } { %d }\n", bgcolor.red, bgcolor.green, bgcolor.blue);
         fprintf(f, "\treport_idle { %d }\n", report_idle);
         fprintf(f, "\tweb_browser { %d }\n", web_browser);
         fprintf(f, "\tweb_command { %s }\n", web_command);