Mercurial > pidgin.yaz
comparison src/dialogs.c @ 3557:1f026237d819
[gaim-migrate @ 3649]
color selector works now.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Thu, 26 Sep 2002 21:03:06 +0000 |
parents | cf00549c53d7 |
children | bdd0bebd2d04 |
comparison
equal
deleted
inserted
replaced
3556:4d70a24c0fd6 | 3557:1f026237d819 |
---|---|
3023 c->bg_color_dialog = NULL; | 3023 c->bg_color_dialog = NULL; |
3024 } | 3024 } |
3025 | 3025 |
3026 void do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel) | 3026 void do_fgcolor(GtkWidget *widget, GtkColorSelection *colorsel) |
3027 { | 3027 { |
3028 gdouble color[3]; | |
3029 GdkColor text_color; | 3028 GdkColor text_color; |
3030 struct conversation *c; | 3029 struct conversation *c; |
3031 char *open_tag; | 3030 char *open_tag; |
3032 | 3031 |
3033 open_tag = g_malloc(30); | 3032 open_tag = g_malloc(30); |
3034 | 3033 |
3035 gtk_color_selection_get_color(colorsel, color); | 3034 gtk_color_selection_get_current_color(colorsel, &text_color); |
3036 | 3035 |
3037 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); | 3036 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); |
3038 /* GTK_IS_EDITABLE(c->entry); huh? */ | 3037 /* GTK_IS_EDITABLE(c->entry); huh? */ |
3039 | 3038 |
3040 text_color.red = ((guint16)(color[0] * 65535)) >> 8; | 3039 text_color.red = text_color.red * 256 / 65535; |
3041 text_color.green = ((guint16)(color[1] * 65535)) >> 8; | 3040 text_color.green = text_color.green * 256 /65535; |
3042 text_color.blue = ((guint16)(color[2] * 65535)) >> 8; | 3041 text_color.blue = text_color.blue * 256 / 65535; |
3043 | 3042 |
3044 c->fgcol = text_color; | 3043 c->fgcol = text_color; |
3045 c->hasfg = 1; | 3044 c->hasfg = 1; |
3046 g_snprintf(open_tag, 23, "<FONT COLOR=\"#%02X%02X%02X\">", text_color.red, text_color.green, | 3045 g_snprintf(open_tag, 23, "<FONT COLOR=\"#%02X%02X%02X\">", text_color.red, text_color.green, |
3047 text_color.blue); | 3046 text_color.blue); |
3048 surround(c->entry, open_tag, "</FONT>"); | 3047 surround(c->entry, open_tag, "</FONT>"); |
3051 cancel_fgcolor(NULL, c); | 3050 cancel_fgcolor(NULL, c); |
3052 } | 3051 } |
3053 | 3052 |
3054 void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) | 3053 void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) |
3055 { | 3054 { |
3056 gdouble color[3]; | |
3057 GdkColor text_color; | 3055 GdkColor text_color; |
3058 struct conversation *c; | 3056 struct conversation *c; |
3059 char *open_tag; | 3057 char *open_tag; |
3060 | 3058 |
3061 open_tag = g_malloc(30); | 3059 open_tag = g_malloc(30); |
3062 | 3060 |
3063 gtk_color_selection_get_color(colorsel, color); | 3061 gtk_color_selection_get_current_color(colorsel, &text_color); |
3064 | 3062 |
3065 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); | 3063 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); |
3066 /* GTK_IS_EDITABLE(c->entry); huh? */ | 3064 /* GTK_IS_EDITABLE(c->entry); huh? */ |
3067 | 3065 |
3068 text_color.red = ((guint16)(color[0] * 65535)) >> 8; | 3066 text_color.red = text_color.red * 256 / 65535; |
3069 text_color.green = ((guint16)(color[1] * 65535)) >> 8; | 3067 text_color.green = text_color.green * 256 /65535; |
3070 text_color.blue = ((guint16)(color[2] * 65535)) >> 8; | 3068 text_color.blue = text_color.blue * 256 / 65535; |
3071 | 3069 |
3072 c->bgcol = text_color; | 3070 c->bgcol = text_color; |
3073 c->hasbg = 1; | 3071 c->hasbg = 1; |
3074 g_snprintf(open_tag, 25, "<BODY BGCOLOR=\"#%02X%02X%02X\">", text_color.red, text_color.green, | 3072 g_snprintf(open_tag, 25, "<BODY BGCOLOR=\"#%02X%02X%02X\">", text_color.red, text_color.green, |
3075 text_color.blue); | 3073 text_color.blue); |