comparison src/dialogs.c @ 4171:858822a27529

[gaim-migrate @ 4400] Alex Converse (alex4): "Gaim had a nasty habbit of not converting prefrenced colors from 48-bit to 24-bit for outputting as html. (causing malformed colors like #00FFFF00) I fixed this by doing all the conversions at the time of outputting." he further wrote, when i failed to see a need for this patch at first: "The issue is GdkColors are 48-bit (16 of Red, green, and blue) HTML colors are 24-bit (bit of Red, Green, and Blue) gaim stores colors as GdkColors but when sends the color as HTML. The problem is colors that were stored inb gaimrc never got downsampled to 24bit." committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 02 Jan 2003 16:24:53 +0000
parents d3c8d2b40494
children b173736b4ab0
comparison
equal deleted inserted replaced
4170:11e643c9ef51 4171:858822a27529
3024 gtk_color_selection_get_current_color(colorsel, &text_color); 3024 gtk_color_selection_get_current_color(colorsel, &text_color);
3025 3025
3026 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); 3026 c = gtk_object_get_user_data(GTK_OBJECT(colorsel));
3027 /* GTK_IS_EDITABLE(c->entry); huh? */ 3027 /* GTK_IS_EDITABLE(c->entry); huh? */
3028 3028
3029 text_color.red = text_color.red / 256;
3030 text_color.green = text_color.green / 256;
3031 text_color.blue = text_color.blue / 256;
3032
3033 c->fgcol = text_color; 3029 c->fgcol = text_color;
3034 c->hasfg = 1; 3030 c->hasfg = 1;
3035 g_snprintf(open_tag, 23, "<FONT COLOR=\"#%02X%02X%02X\">", text_color.red, text_color.green, 3031 g_snprintf(open_tag, 23, "<FONT COLOR=\"#%02X%02X%02X\">", text_color.red/256,
3036 text_color.blue); 3032 text_color.green/256, text_color.blue/256);
3037 surround(c, open_tag, "</FONT>"); 3033 surround(c, open_tag, "</FONT>");
3038 debug_printf("#%02X%02X%02X\n", text_color.red, text_color.green, text_color.blue); 3034 debug_printf("#%02X%02X%02X\n", text_color.red/256, text_color.green/256, text_color.blue/256);
3039 g_free(open_tag); 3035 g_free(open_tag);
3040 cancel_fgcolor(NULL, c); 3036 cancel_fgcolor(NULL, c);
3041 } 3037 }
3042 3038
3043 void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel) 3039 void do_bgcolor(GtkWidget *widget, GtkColorSelection *colorsel)
3051 gtk_color_selection_get_current_color(colorsel, &text_color); 3047 gtk_color_selection_get_current_color(colorsel, &text_color);
3052 3048
3053 c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); 3049 c = gtk_object_get_user_data(GTK_OBJECT(colorsel));
3054 /* GTK_IS_EDITABLE(c->entry); huh? */ 3050 /* GTK_IS_EDITABLE(c->entry); huh? */
3055 3051
3056 text_color.red = text_color.red / 256;
3057 text_color.green = text_color.green / 256;
3058 text_color.blue = text_color.blue / 256;
3059
3060 c->bgcol = text_color; 3052 c->bgcol = text_color;
3061 c->hasbg = 1; 3053 c->hasbg = 1;
3062 g_snprintf(open_tag, 25, "<BODY BGCOLOR=\"#%02X%02X%02X\">", text_color.red, text_color.green, 3054 g_snprintf(open_tag, 25, "<BODY BGCOLOR=\"#%02X%02X%02X\">", text_color.red/256,
3063 text_color.blue); 3055 text_color.green/256, text_color.blue/256);
3064 surround(c, open_tag, "</BODY>"); 3056 surround(c, open_tag, "</BODY>");
3065 debug_printf("#%02X%02X%02X\n", text_color.red, text_color.green, text_color.blue); 3057 debug_printf("#%02X%02X%02X\n", text_color.red/256, text_color.green/256, text_color.blue/256);
3066 g_free(open_tag); 3058 g_free(open_tag);
3067 cancel_bgcolor(NULL, c); 3059 cancel_bgcolor(NULL, c);
3068 } 3060 }
3069 3061
3070 void show_fgcolor_dialog(struct conversation *c, GtkWidget *color) 3062 void show_fgcolor_dialog(struct conversation *c, GtkWidget *color)
3073 gdouble fgclr[3]; 3065 gdouble fgclr[3];
3074 3066
3075 if (color == NULL) { /* we came from the prefs */ 3067 if (color == NULL) { /* we came from the prefs */
3076 if (fgcseld) 3068 if (fgcseld)
3077 return; 3069 return;
3078 fgclr[0] = (gdouble)(fgcolor.red) / 255; 3070 fgclr[0] = (gdouble)(fgcolor.red) ;
3079 fgclr[1] = (gdouble)(fgcolor.green) / 255; 3071 fgclr[1] = (gdouble)(fgcolor.green);
3080 fgclr[2] = (gdouble)(fgcolor.blue) / 255; 3072 fgclr[2] = (gdouble)(fgcolor.blue);
3081 3073
3082 fgcseld = gtk_color_selection_dialog_new(_("Select Text Color")); 3074 fgcseld = gtk_color_selection_dialog_new(_("Select Text Color"));
3083 gtk_color_selection_set_color(GTK_COLOR_SELECTION 3075 gtk_color_selection_set_color(GTK_COLOR_SELECTION
3084 (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), fgclr); 3076 (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), fgclr);
3085 g_signal_connect(GTK_OBJECT(fgcseld), "delete_event", 3077 g_signal_connect(GTK_OBJECT(fgcseld), "delete_event",
3093 gdk_window_raise(fgcseld->window); 3085 gdk_window_raise(fgcseld->window);
3094 return; 3086 return;
3095 } 3087 }
3096 3088
3097 if (!c->fg_color_dialog) { 3089 if (!c->fg_color_dialog) {
3098 fgclr[0] = (gdouble)(c->fgcol.red) / 255; 3090 fgclr[0] = (gdouble)(c->fgcol.red);
3099 fgclr[1] = (gdouble)(c->fgcol.green) / 255; 3091 fgclr[1] = (gdouble)(c->fgcol.green);
3100 fgclr[2] = (gdouble)(c->fgcol.blue) / 255; 3092 fgclr[2] = (gdouble)(c->fgcol.blue);
3101 3093
3102 c->fg_color_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); 3094 c->fg_color_dialog = gtk_color_selection_dialog_new(_("Select Text Color"));
3103 colorsel = GTK_COLOR_SELECTION_DIALOG(c->fg_color_dialog)->colorsel; 3095 colorsel = GTK_COLOR_SELECTION_DIALOG(c->fg_color_dialog)->colorsel;
3104 gtk_color_selection_set_color(GTK_COLOR_SELECTION(colorsel), fgclr); 3096 gtk_color_selection_set_color(GTK_COLOR_SELECTION(colorsel), fgclr);
3105 gtk_object_set_user_data(GTK_OBJECT(colorsel), c); 3097 gtk_object_set_user_data(GTK_OBJECT(colorsel), c);
3125 gdouble bgclr[3]; 3117 gdouble bgclr[3];
3126 3118
3127 if (color == NULL) { /* we came from the prefs */ 3119 if (color == NULL) { /* we came from the prefs */
3128 if (bgcseld) 3120 if (bgcseld)
3129 return; 3121 return;
3130 bgclr[0] = (gdouble)(bgcolor.red) / 255; 3122 bgclr[0] = (gdouble)(bgcolor.red);
3131 bgclr[1] = (gdouble)(bgcolor.green) / 255; 3123 bgclr[1] = (gdouble)(bgcolor.green);
3132 bgclr[2] = (gdouble)(bgcolor.blue) / 255; 3124 bgclr[2] = (gdouble)(bgcolor.blue);
3133 3125
3134 bgcseld = gtk_color_selection_dialog_new(_("Select Background Color")); 3126 bgcseld = gtk_color_selection_dialog_new(_("Select Background Color"));
3135 gtk_color_selection_set_color(GTK_COLOR_SELECTION 3127 gtk_color_selection_set_color(GTK_COLOR_SELECTION
3136 (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), bgclr); 3128 (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), bgclr);
3137 g_signal_connect(GTK_OBJECT(bgcseld), "delete_event", 3129 g_signal_connect(GTK_OBJECT(bgcseld), "delete_event",
3145 gdk_window_raise(bgcseld->window); 3137 gdk_window_raise(bgcseld->window);
3146 return; 3138 return;
3147 } 3139 }
3148 3140
3149 if (!c->bg_color_dialog) { 3141 if (!c->bg_color_dialog) {
3150 bgclr[0] = (gdouble)(c->bgcol.red) / 255; 3142 bgclr[0] = (gdouble)(c->bgcol.red);
3151 bgclr[1] = (gdouble)(c->bgcol.green) / 255; 3143 bgclr[1] = (gdouble)(c->bgcol.green);
3152 bgclr[2] = (gdouble)(c->bgcol.blue) / 255; 3144 bgclr[2] = (gdouble)(c->bgcol.blue);
3153 3145
3154 c->bg_color_dialog = gtk_color_selection_dialog_new(_("Select Background Color")); 3146 c->bg_color_dialog = gtk_color_selection_dialog_new(_("Select Background Color"));
3155 colorsel = GTK_COLOR_SELECTION_DIALOG(c->bg_color_dialog)->colorsel; 3147 colorsel = GTK_COLOR_SELECTION_DIALOG(c->bg_color_dialog)->colorsel;
3156 gtk_color_selection_set_color(GTK_COLOR_SELECTION(colorsel), bgclr); 3148 gtk_color_selection_set_color(GTK_COLOR_SELECTION(colorsel), bgclr);
3157 gtk_object_set_user_data(GTK_OBJECT(colorsel), c); 3149 gtk_object_set_user_data(GTK_OBJECT(colorsel), c);