changeset 873:789df4b47508

[gaim-migrate @ 883] uh huh committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 11 Sep 2000 00:30:52 +0000
parents 0532f6f85fac
children 69669b9b3e3b
files TODO src/dialogs.c src/gaim.h src/prefs.c
diffstat 4 files changed, 94 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/TODO	Sun Sep 10 22:19:21 2000 +0000
+++ b/TODO	Mon Sep 11 00:30:52 2000 +0000
@@ -1,6 +1,5 @@
 --- STUFF FOR 0.10.1 RELEASE ---
 	Execute Command on Buddy Pounce
-	Redesign the Foreground/Background color options under preferences.
 	Have a page in the prefs for the Applet
 	The about window is very ugly.  I think this shall be fixed.  
 		You know, I really like the gnome look to some apps
--- a/src/dialogs.c	Sun Sep 10 22:19:21 2000 +0000
+++ b/src/dialogs.c	Mon Sep 11 00:30:52 2000 +0000
@@ -2425,6 +2425,7 @@
 		fgcolor.red = ((guint16)(color[0]*65535))>>8;
 		fgcolor.green = ((guint16)(color[1]*65535))>>8;
 		fgcolor.blue = ((guint16)(color[2]*65535))>>8;
+		update_color(NULL, pref_fg_picture);
 	} else {
 		gtk_color_selection_get_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), color);
 		destroy_colorsel(NULL, (void *)0);
@@ -2432,6 +2433,7 @@
 		bgcolor.red = ((guint16)(color[0]*65535))>>8;
 		bgcolor.green = ((guint16)(color[1]*65535))>>8;
 		bgcolor.blue = ((guint16)(color[2]*65535))>>8;
+		update_color(NULL, pref_bg_picture);
 	}
 }
 
--- a/src/gaim.h	Sun Sep 10 22:19:21 2000 +0000
+++ b/src/gaim.h	Mon Sep 11 00:30:52 2000 +0000
@@ -408,7 +408,7 @@
 #define TYPE_SIGNOFF   4
 #define TYPE_KEEPALIVE 5
 
-#define REVISION "gaim:$Revision: 874 $"
+#define REVISION "gaim:$Revision: 883 $"
 #define FLAPON "FLAPON\r\n\r\n"
 
 #define ROAST "Tic/Toc"
@@ -774,7 +774,11 @@
 extern void show_prefs();
 extern void show_debug(GtkObject *);
 extern void build_permit_tree();
+extern void update_color(GtkWidget *, GtkWidget *);
 extern GtkWidget *prefs_away_list;
+extern GtkWidget *pref_fg_picture;
+extern GtkWidget *pref_bg_picture;
+
 
 /* Functions in gaimrc.c */
 extern void set_defaults();
--- a/src/prefs.c	Sun Sep 10 22:19:21 2000 +0000
+++ b/src/prefs.c	Mon Sep 11 00:30:52 2000 +0000
@@ -976,6 +976,89 @@
 	gtk_widget_show(prefdialog);
 }
 
+static GtkWidget *show_color_pref(GtkWidget *box, gboolean fgc)
+{
+	/* more stuff stolen from X-Chat */
+	GtkWidget *swid;
+	GdkColor c;
+	GtkStyle *style;
+	c.pixel = 0;
+	if (fgc) {
+		if (font_options & OPT_FONT_FGCOL) {
+			c.red = fgcolor.red << 8;
+			c.blue = fgcolor.blue << 8;
+			c.green = fgcolor.green << 8;
+		} else {
+			c.red = 0;
+			c.blue = 0;
+			c.green = 0;
+		}
+	} else {
+		if (font_options & OPT_FONT_BGCOL) {
+			c.red = bgcolor.red << 8;
+			c.blue = bgcolor.blue << 8;
+			c.green = bgcolor.green << 8;
+		} else {
+			c.red = 0xffff;
+			c.blue = 0xffff;
+			c.green = 0xffff;
+		}
+	}
+
+	style = gtk_style_new();
+	style->bg[0] = c;
+
+	swid = gtk_event_box_new();
+	gtk_widget_set_style(GTK_WIDGET(swid), style);
+	gtk_style_unref(style);
+	gtk_widget_set_usize(GTK_WIDGET(swid), 40, -1);
+	gtk_box_pack_start(GTK_BOX(box), swid, FALSE, FALSE, 5);
+	gtk_widget_show(swid);
+	return swid;
+}
+
+GtkWidget *pref_fg_picture = NULL;
+GtkWidget *pref_bg_picture = NULL;
+
+static fgbgdes(GtkWidget *w, gpointer d)
+{
+	pref_fg_picture = NULL;
+	pref_bg_picture = NULL;
+}
+
+void update_color(GtkWidget *w, GtkWidget *pic)
+{
+	GdkColor c;
+	GtkStyle *style;
+	c.pixel = 0;
+	if (pic == pref_fg_picture) {
+		if (font_options & OPT_FONT_FGCOL) {
+			c.red = fgcolor.red << 8;
+			c.blue = fgcolor.blue << 8;
+			c.green = fgcolor.green << 8;
+		} else {
+			c.red = 0;
+			c.blue = 0;
+			c.green = 0;
+		}
+	} else {
+		if (font_options & OPT_FONT_BGCOL) {
+			c.red = bgcolor.red << 8;
+			c.blue = bgcolor.blue << 8;
+			c.green = bgcolor.green << 8;
+		} else {
+			c.red = 0xffff;
+			c.blue = 0xffff;
+			c.green = 0xffff;
+		}
+	}
+
+	style = gtk_style_new();
+	style->bg[0] = c;
+	gtk_widget_set_style(pic, style);
+	gtk_style_unref(style);
+}
+
 static void font_page()
 {
 	GtkWidget *parent;
@@ -1013,6 +1096,7 @@
 	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5);
 	gtk_widget_show(hbox);
 	
+	pref_fg_picture = show_color_pref(hbox, TRUE);
 	button = gaim_button(_("Text Color"), &font_options, OPT_FONT_FGCOL, hbox);
 
 	select = picture_button(prefs, _("Select"), fgcolor_xpm);
@@ -1023,11 +1107,13 @@
 	gtk_widget_show(select);
 
 	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select);
+	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_color), pref_fg_picture);
 
 	hbox = gtk_hbox_new(FALSE, 5);
 	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5);
 	gtk_widget_show(hbox);
 	
+	pref_bg_picture = show_color_pref(hbox, FALSE);
 	button = gaim_button(_("Background Color"), &font_options, OPT_FONT_BGCOL, hbox);
 
 	select = picture_button(prefs, _("Select"), bgcolor_xpm);
@@ -1038,6 +1124,7 @@
 	gtk_widget_show(select);
 
 	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select);
+	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_color), pref_bg_picture);
 
 	sep = gtk_hseparator_new();
 	gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 5);