comparison src/dialogs.c @ 766:936c132ea0a1

[gaim-migrate @ 776] whoa, that did wacky things for me. i don't think it's necessary for colors anyway. it's too hard to pick the same point again. if you don't want to change just hit cancel. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 25 Aug 2000 05:11:32 +0000
parents c5f455b6f79a
children c075cf268129
comparison
equal deleted inserted replaced
765:bf31bf916f53 766:936c132ea0a1
2387 bgcolor.green = ((guint16)(color[1]*65535))>>8; 2387 bgcolor.green = ((guint16)(color[1]*65535))>>8;
2388 bgcolor.blue = ((guint16)(color[2]*65535))>>8; 2388 bgcolor.blue = ((guint16)(color[2]*65535))>>8;
2389 } 2389 }
2390 } 2390 }
2391 2391
2392 void set_color_selection(GtkWidget *selection, GdkColor color)
2393 {
2394 gdouble colors[4];
2395
2396 colors[0] = color.red;
2397 colors[1] = color.green;
2398 colors[2] = color.blue;
2399 colors[3] = 0; /* opacity, currently unused */
2400 gtk_color_selection_set_color(GTK_COLOR_SELECTION(selection), colors);
2401
2402 return;
2403 }
2404
2405 void show_color_dialog(struct conversation *c, GtkWidget *color) 2392 void show_color_dialog(struct conversation *c, GtkWidget *color)
2406 { 2393 {
2407 GtkWidget *colorsel; 2394 GtkWidget *colorsel;
2408 2395
2409 if ((int)color == 1) { /* foreground */ 2396 if ((int)color == 1) { /* foreground */
2410 if (fgcseld) return; 2397 if (fgcseld) return;
2411 fgcseld = gtk_color_selection_dialog_new(_("Select Text Color")); 2398 fgcseld = gtk_color_selection_dialog_new(_("Select Text Color"));
2412
2413 set_color_selection(GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel, fgcolor);
2414 2399
2415 gtk_signal_connect(GTK_OBJECT(fgcseld), "delete_event", GTK_SIGNAL_FUNC(destroy_colorsel), (void *)1); 2400 gtk_signal_connect(GTK_OBJECT(fgcseld), "delete_event", GTK_SIGNAL_FUNC(destroy_colorsel), (void *)1);
2416 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->cancel_button), "clicked", GTK_SIGNAL_FUNC(destroy_colorsel), (void *)1); 2401 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->cancel_button), "clicked", GTK_SIGNAL_FUNC(destroy_colorsel), (void *)1);
2417 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->ok_button), "clicked", GTK_SIGNAL_FUNC(apply_color_dlg), (void *)1); 2402 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->ok_button), "clicked", GTK_SIGNAL_FUNC(apply_color_dlg), (void *)1);
2418 gtk_widget_realize(fgcseld); 2403 gtk_widget_realize(fgcseld);
2422 return; 2407 return;
2423 } else if ((int)color == 2) { /* background */ 2408 } else if ((int)color == 2) { /* background */
2424 if (bgcseld) return; 2409 if (bgcseld) return;
2425 bgcseld = gtk_color_selection_dialog_new(_("Select Background Color")); 2410 bgcseld = gtk_color_selection_dialog_new(_("Select Background Color"));
2426 2411
2427 set_color_selection(GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel, bgcolor);
2428
2429 gtk_signal_connect(GTK_OBJECT(bgcseld), "delete_event", GTK_SIGNAL_FUNC(destroy_colorsel), NULL); 2412 gtk_signal_connect(GTK_OBJECT(bgcseld), "delete_event", GTK_SIGNAL_FUNC(destroy_colorsel), NULL);
2430 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->cancel_button), "clicked", GTK_SIGNAL_FUNC(destroy_colorsel), NULL); 2413 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->cancel_button), "clicked", GTK_SIGNAL_FUNC(destroy_colorsel), NULL);
2431 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->ok_button), "clicked", GTK_SIGNAL_FUNC(apply_color_dlg), (void *)2); 2414 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->ok_button), "clicked", GTK_SIGNAL_FUNC(apply_color_dlg), (void *)2);
2432 gtk_widget_realize(bgcseld); 2415 gtk_widget_realize(bgcseld);
2433 aol_icon(bgcseld->window); 2416 aol_icon(bgcseld->window);
2439 if (!c->color_dialog) 2422 if (!c->color_dialog)
2440 { 2423 {
2441 c->color_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); 2424 c->color_dialog = gtk_color_selection_dialog_new(_("Select Text Color"));
2442 2425
2443 colorsel = GTK_COLOR_SELECTION_DIALOG(c->color_dialog)->colorsel; 2426 colorsel = GTK_COLOR_SELECTION_DIALOG(c->color_dialog)->colorsel;
2444
2445 set_color_selection(colorsel, fgcolor);
2446 2427
2447 gtk_object_set_user_data(GTK_OBJECT(colorsel), c); 2428 gtk_object_set_user_data(GTK_OBJECT(colorsel), c);
2448 2429
2449 gtk_signal_connect(GTK_OBJECT(c->color_dialog), "delete_event", GTK_SIGNAL_FUNC(delete_event_dialog), c); 2430 gtk_signal_connect(GTK_OBJECT(c->color_dialog), "delete_event", GTK_SIGNAL_FUNC(delete_event_dialog), c);
2450 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(c->color_dialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(do_color), colorsel); 2431 gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(c->color_dialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(do_color), colorsel);