Mercurial > pidgin
comparison src/conversation.c @ 3689:c78e0c031514
[gaim-migrate @ 3819]
some changes.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Mon, 14 Oct 2002 06:21:28 +0000 |
parents | 701348164c61 |
children | b56d6de58f48 |
comparison
equal
deleted
inserted
replaced
3688:7ad266626a5f | 3689:c78e0c031514 |
---|---|
48 | 48 |
49 #ifdef _WIN32 | 49 #ifdef _WIN32 |
50 #include "win32dep.h" | 50 #include "win32dep.h" |
51 #endif | 51 #endif |
52 | 52 |
53 #include "pixmaps/bold.xpm" | |
54 #include "pixmaps/italic.xpm" | |
55 #include "pixmaps/underline.xpm" | |
56 #include "pixmaps/strike.xpm" | |
57 #include "pixmaps/small.xpm" | |
58 #include "pixmaps/normal.xpm" | |
59 #include "pixmaps/big.xpm" | |
60 #include "pixmaps/fontface.xpm" | 53 #include "pixmaps/fontface.xpm" |
61 #include "pixmaps/fgcolor.xpm" | |
62 #include "pixmaps/bgcolor.xpm" | |
63 #include "pixmaps/link.xpm" | |
64 #include "pixmaps/smile_icon.xpm" | 54 #include "pixmaps/smile_icon.xpm" |
65 #include "pixmaps/wood.xpm" | |
66 #include "pixmaps/search_small.xpm" | 55 #include "pixmaps/search_small.xpm" |
67 #include "pixmaps/save_small.xpm" | 56 #include "pixmaps/save_small.xpm" |
68 #include "pixmaps/speaker.xpm" | 57 #include "pixmaps/speaker.xpm" |
69 #include "pixmaps/speaker_mute.xpm" | 58 #include "pixmaps/speaker_mute.xpm" |
70 #include "pixmaps/image_icon.xpm" | 59 #include "pixmaps/image_icon.xpm" |
2234 | 2223 |
2235 return menubar; | 2224 return menubar; |
2236 | 2225 |
2237 } | 2226 } |
2238 | 2227 |
2239 GtkWidget *build_conv_toolbar2(struct conversation *c) | 2228 GtkWidget *build_conv_toolbar(struct conversation *c) |
2240 { | 2229 { |
2241 GtkWidget *vbox; | 2230 GtkWidget *vbox; |
2242 GtkWidget *hbox; | 2231 GtkWidget *hbox; |
2243 GtkWidget *button; | 2232 GtkWidget *button; |
2244 GtkWidget *sep; | 2233 GtkWidget *sep; |
2361 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); | 2350 gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); |
2362 | 2351 |
2363 gtk_widget_show_all(vbox); | 2352 gtk_widget_show_all(vbox); |
2364 | 2353 |
2365 return vbox; | 2354 return vbox; |
2366 } | |
2367 | |
2368 GtkWidget *build_conv_toolbar(struct conversation *c) | |
2369 { | |
2370 GdkPixmap *strike_i, *small_i, *normal_i, *big_i, *bold_i, *italic_i, *underline_i, *speaker_i, | |
2371 *wood_i, *viewer_i, *fgcolor_i, *bgcolor_i, *link_i, *font_i, *smiley_i, *save_i, *image_i; | |
2372 GtkWidget *strike_p, *small_p, *normal_p, *big_p, *bold_p, *italic_p, *underline_p, *speaker_p, | |
2373 *wood_p, *viewer_p, *fgcolor_p, *bgcolor_p, *link_p, *font_p, *smiley_p, *save_p, *image_p; | |
2374 GtkWidget *strike, *small, *normal, *big, *bold, *italic, *underline, *speaker, *wood, *viewer, | |
2375 *fgcolorbtn, *bgcolorbtn, *link, *font, *smiley, *save, *image; | |
2376 GdkBitmap *mask; | |
2377 GtkWidget *toolbar; | |
2378 GtkWidget *win; | |
2379 GtkWidget *entry; | |
2380 | |
2381 toolbar = gtk_toolbar_new(); | |
2382 win = c->window; | |
2383 entry = c->entry; | |
2384 | |
2385 bold_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, bold_xpm); | |
2386 bold_p = gtk_pixmap_new(bold_i, mask); | |
2387 gtk_widget_show(bold_p); | |
2388 gdk_bitmap_unref(mask); | |
2389 | |
2390 italic_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, italic_xpm); | |
2391 italic_p = gtk_pixmap_new(italic_i, mask); | |
2392 gtk_widget_show(italic_p); | |
2393 gdk_bitmap_unref(mask); | |
2394 | |
2395 underline_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, | |
2396 &win->style->white, underline_xpm); | |
2397 underline_p = gtk_pixmap_new(underline_i, mask); | |
2398 gtk_widget_show(underline_p); | |
2399 gdk_bitmap_unref(mask); | |
2400 | |
2401 strike_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, strike_xpm); | |
2402 strike_p = gtk_pixmap_new(strike_i, mask); | |
2403 gtk_widget_show(strike_p); | |
2404 gdk_bitmap_unref(mask); | |
2405 | |
2406 small_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, small_xpm); | |
2407 small_p = gtk_pixmap_new(small_i, mask); | |
2408 gtk_widget_show(small_p); | |
2409 gdk_bitmap_unref(mask); | |
2410 | |
2411 normal_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, normal_xpm); | |
2412 normal_p = gtk_pixmap_new(normal_i, mask); | |
2413 gtk_widget_show(normal_p); | |
2414 gdk_bitmap_unref(mask); | |
2415 | |
2416 big_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, big_xpm); | |
2417 big_p = gtk_pixmap_new(big_i, mask); | |
2418 gtk_widget_show(big_p); | |
2419 gdk_bitmap_unref(mask); | |
2420 | |
2421 font_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, fontface_xpm); | |
2422 font_p = gtk_pixmap_new(font_i, mask); | |
2423 gtk_widget_show(font_p); | |
2424 gdk_bitmap_unref(mask); | |
2425 | |
2426 fgcolor_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, fgcolor_xpm); | |
2427 fgcolor_p = gtk_pixmap_new(fgcolor_i, mask); | |
2428 gtk_widget_show(fgcolor_p); | |
2429 gdk_bitmap_unref(mask); | |
2430 | |
2431 bgcolor_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, bgcolor_xpm); | |
2432 bgcolor_p = gtk_pixmap_new(bgcolor_i, mask); | |
2433 gtk_widget_show(bgcolor_p); | |
2434 gdk_bitmap_unref(mask); | |
2435 | |
2436 link_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, link_xpm); | |
2437 link_p = gtk_pixmap_new(link_i, mask); | |
2438 gtk_widget_show(link_p); | |
2439 gdk_bitmap_unref(mask); | |
2440 | |
2441 smiley_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, smile_icon_xpm); | |
2442 smiley_p = gtk_pixmap_new(smiley_i, mask); | |
2443 gtk_widget_show(smiley_p); | |
2444 gdk_bitmap_unref(mask); | |
2445 | |
2446 image_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, image_icon_xpm); | |
2447 image_p = gtk_pixmap_new(image_i, mask); | |
2448 gtk_widget_show(image_p); | |
2449 gdk_bitmap_unref(mask); | |
2450 | |
2451 wood_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, wood_xpm); | |
2452 wood_p = gtk_pixmap_new(wood_i, mask); | |
2453 gtk_widget_show(wood_p); | |
2454 gdk_bitmap_unref(mask); | |
2455 | |
2456 viewer_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, search_small_xpm); | |
2457 viewer_p = gtk_pixmap_new(viewer_i, mask); | |
2458 gtk_widget_show(viewer_p); | |
2459 gdk_bitmap_unref(mask); | |
2460 | |
2461 save_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, save_small_xpm); | |
2462 save_p = gtk_pixmap_new(save_i, mask); | |
2463 gtk_widget_show(save_p); | |
2464 gdk_bitmap_unref(mask); | |
2465 | |
2466 speaker_i = gdk_pixmap_create_from_xpm_d(win->window, &mask, &win->style->white, speaker_xpm); | |
2467 speaker_p = gtk_pixmap_new(speaker_i, mask); | |
2468 gtk_widget_show(speaker_p); | |
2469 gdk_bitmap_unref(mask); | |
2470 c->makesound = 1; | |
2471 | |
2472 bold = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
2473 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, | |
2474 NULL, _("Bold Text"), _("Bold"), bold_p, | |
2475 GTK_SIGNAL_FUNC(do_bold), entry); | |
2476 italic = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
2477 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
2478 NULL, NULL, _("Italics Text"), | |
2479 _("Italics"), italic_p, GTK_SIGNAL_FUNC(do_italic), entry); | |
2480 underline = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
2481 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
2482 NULL, NULL, _("Underline Text"), | |
2483 _("Underline"), underline_p, | |
2484 GTK_SIGNAL_FUNC(do_underline), entry); | |
2485 strike = | |
2486 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, | |
2487 NULL, _("Strike through Text"), _("Strike"), strike_p, | |
2488 GTK_SIGNAL_FUNC(do_strike), entry); | |
2489 | |
2490 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); | |
2491 | |
2492 small = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), | |
2493 NULL, _("Decrease font size"), _("Small"), | |
2494 small_p, GTK_SIGNAL_FUNC(do_small), entry); | |
2495 normal = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), | |
2496 NULL, _("Normal font size"), _("Normal"), | |
2497 normal_p, GTK_SIGNAL_FUNC(do_normal), entry); | |
2498 big = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), | |
2499 NULL, _("Increase font size"), _("Big"), | |
2500 big_p, GTK_SIGNAL_FUNC(do_big), entry); | |
2501 | |
2502 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); | |
2503 | |
2504 font = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
2505 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
2506 NULL, NULL, _("Select Font"), | |
2507 _("Font"), font_p, GTK_SIGNAL_FUNC(toggle_font), c); | |
2508 fgcolorbtn = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
2509 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
2510 NULL, NULL, _("Text Color"), | |
2511 _("Color"), fgcolor_p, GTK_SIGNAL_FUNC(toggle_fg_color), | |
2512 c); | |
2513 bgcolorbtn = | |
2514 gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, | |
2515 NULL, _("Background Color"), _("Color"), bgcolor_p, | |
2516 GTK_SIGNAL_FUNC(toggle_bg_color), c); | |
2517 | |
2518 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); | |
2519 | |
2520 link = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
2521 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
2522 NULL, NULL, _("Insert Link"), | |
2523 _("Link"), link_p, GTK_SIGNAL_FUNC(toggle_link), c); | |
2524 smiley = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
2525 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
2526 NULL, NULL, _("Insert smiley face"), _("Smiley"), | |
2527 smiley_p, GTK_SIGNAL_FUNC(insert_smiley), c); | |
2528 image = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), | |
2529 NULL, _("Insert IM Image"), _("Image"), | |
2530 image_p, GTK_SIGNAL_FUNC(insert_image), c); | |
2531 | |
2532 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); | |
2533 | |
2534 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
2535 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
2536 NULL, NULL, _("Enable logging"), | |
2537 _("Logging"), wood_p, GTK_SIGNAL_FUNC(toggle_loggle), c); | |
2538 state_lock = 1; | |
2539 if (find_log_info(c->name)) | |
2540 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), TRUE); | |
2541 else | |
2542 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(wood), FALSE); | |
2543 state_lock = 0; | |
2544 | |
2545 if (!c->is_chat) { | |
2546 viewer = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), | |
2547 NULL, _("Show Log Viewer"), _("Viewer"), | |
2548 viewer_p, GTK_SIGNAL_FUNC(conv_show_log), GINT_TO_POINTER(c->name)); | |
2549 } else { | |
2550 viewer = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), | |
2551 NULL, _("Show Log Viewer"), _("Viewer"), | |
2552 viewer_p, GTK_SIGNAL_FUNC(chat_show_log), GINT_TO_POINTER(c->name)); | |
2553 } | |
2554 | |
2555 save = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), | |
2556 NULL, _("Save Conversation"), | |
2557 _("Save"), save_p, GTK_SIGNAL_FUNC(save_convo), c); | |
2558 | |
2559 speaker = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | |
2560 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | |
2561 NULL, NULL, _("Toggle Sound"), | |
2562 _("Sound"), speaker_p, GTK_SIGNAL_FUNC(toggle_sound), c); | |
2563 c->makesound = 1; | |
2564 | |
2565 /* use a slicker look if the user wants to */ | |
2566 if (misc_options & OPT_MISC_COOL_LOOK) { | |
2567 gtk_button_set_relief(GTK_BUTTON(bold), GTK_RELIEF_NONE); | |
2568 gtk_button_set_relief(GTK_BUTTON(italic), GTK_RELIEF_NONE); | |
2569 gtk_button_set_relief(GTK_BUTTON(underline), GTK_RELIEF_NONE); | |
2570 gtk_button_set_relief(GTK_BUTTON(strike), GTK_RELIEF_NONE); | |
2571 gtk_button_set_relief(GTK_BUTTON(small), GTK_RELIEF_NONE); | |
2572 gtk_button_set_relief(GTK_BUTTON(normal), GTK_RELIEF_NONE); | |
2573 gtk_button_set_relief(GTK_BUTTON(big), GTK_RELIEF_NONE); | |
2574 gtk_button_set_relief(GTK_BUTTON(font), GTK_RELIEF_NONE); | |
2575 gtk_button_set_relief(GTK_BUTTON(fgcolorbtn), GTK_RELIEF_NONE); | |
2576 gtk_button_set_relief(GTK_BUTTON(bgcolorbtn), GTK_RELIEF_NONE); | |
2577 gtk_button_set_relief(GTK_BUTTON(link), GTK_RELIEF_NONE); | |
2578 gtk_button_set_relief(GTK_BUTTON(smiley), GTK_RELIEF_NONE); | |
2579 gtk_button_set_relief(GTK_BUTTON(image), GTK_RELIEF_NONE); | |
2580 gtk_button_set_relief(GTK_BUTTON(wood), GTK_RELIEF_NONE); | |
2581 gtk_button_set_relief(GTK_BUTTON(viewer), GTK_RELIEF_NONE); | |
2582 gtk_button_set_relief(GTK_BUTTON(save), GTK_RELIEF_NONE); | |
2583 gtk_button_set_relief(GTK_BUTTON(speaker), GTK_RELIEF_NONE); | |
2584 } | |
2585 | |
2586 gtk_widget_show(toolbar); | |
2587 | |
2588 gdk_pixmap_unref(bold_i); | |
2589 gdk_pixmap_unref(italic_i); | |
2590 gdk_pixmap_unref(underline_i); | |
2591 gdk_pixmap_unref(strike_i); | |
2592 gdk_pixmap_unref(small_i); | |
2593 gdk_pixmap_unref(normal_i); | |
2594 gdk_pixmap_unref(big_i); | |
2595 gdk_pixmap_unref(font_i); | |
2596 gdk_pixmap_unref(fgcolor_i); | |
2597 gdk_pixmap_unref(bgcolor_i); | |
2598 gdk_pixmap_unref(link_i); | |
2599 gdk_pixmap_unref(smiley_i); | |
2600 gdk_pixmap_unref(wood_i); | |
2601 gdk_pixmap_unref(viewer_i); | |
2602 gdk_pixmap_unref(save_i); | |
2603 gdk_pixmap_unref(speaker_i); | |
2604 gdk_pixmap_unref(image_i); | |
2605 | |
2606 c->toolbar = toolbar; | |
2607 c->bold = bold; | |
2608 c->strike = strike; | |
2609 c->italic = italic; | |
2610 c->underline = underline; | |
2611 c->log_button = wood; | |
2612 c->viewer_button = viewer; | |
2613 c->fgcolorbtn = fgcolorbtn; | |
2614 c->bgcolorbtn = bgcolorbtn; | |
2615 c->link = link; | |
2616 c->wood = wood; | |
2617 c->font = font; | |
2618 c->smiley = smiley; | |
2619 c->imagebtn = image; | |
2620 c->speaker = speaker; | |
2621 c->speaker_p = speaker_p; | |
2622 | |
2623 if (c->is_chat) | |
2624 gtk_widget_set_sensitive(c->log_button, ((logging_options & OPT_LOG_CHATS)) ? FALSE : TRUE); | |
2625 else | |
2626 gtk_widget_set_sensitive(c->log_button, ((logging_options & OPT_LOG_CONVOS)) ? FALSE : TRUE); | |
2627 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); | |
2628 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); | |
2629 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); | |
2630 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); | |
2631 | |
2632 return toolbar; | |
2633 } | 2355 } |
2634 | 2356 |
2635 static void convo_sel_send(GtkObject *m, struct gaim_connection *c) | 2357 static void convo_sel_send(GtkObject *m, struct gaim_connection *c) |
2636 { | 2358 { |
2637 struct conversation *cnv = gtk_object_get_user_data(m); | 2359 struct conversation *cnv = gtk_object_get_user_data(m); |
3196 entry = gtk_text_new(NULL, NULL); | 2918 entry = gtk_text_new(NULL, NULL); |
3197 c->entry = entry; | 2919 c->entry = entry; |
3198 if (!(im_options & OPT_IM_ONE_WINDOW)) | 2920 if (!(im_options & OPT_IM_ONE_WINDOW)) |
3199 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry); | 2921 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry); |
3200 | 2922 |
3201 toolbar = build_conv_toolbar2(c); | 2923 toolbar = build_conv_toolbar(c); |
3202 gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, FALSE, 0); | 2924 gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, FALSE, 0); |
3203 | 2925 |
3204 gtk_object_set_user_data(GTK_OBJECT(entry), c); | 2926 gtk_object_set_user_data(GTK_OBJECT(entry), c); |
3205 gtk_text_set_editable(GTK_TEXT(entry), TRUE); | 2927 gtk_text_set_editable(GTK_TEXT(entry), TRUE); |
3206 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE); | 2928 gtk_text_set_word_wrap(GTK_TEXT(entry), TRUE); |