Mercurial > pidgin
comparison src/conversation.c @ 311:0a8b4edc4732
[gaim-migrate @ 321]
Per-conversation font and color dialogs. Thanks fflew! :)
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 02 Jun 2000 06:08:29 +0000 |
parents | 97cdac04c0f5 |
children | 68637b451377 |
comparison
equal
deleted
inserted
replaced
310:27efd816ff48 | 311:0a8b4edc4732 |
---|---|
206 } | 206 } |
207 | 207 |
208 void delete_conversation(struct conversation *cnv) | 208 void delete_conversation(struct conversation *cnv) |
209 { | 209 { |
210 conversations = g_list_remove(conversations, cnv); | 210 conversations = g_list_remove(conversations, cnv); |
211 if (cnv->color_dialog) | |
212 gtk_widget_destroy(cnv->color_dialog); | |
213 if (cnv->font_dialog) | |
214 gtk_widget_destroy(cnv->font_dialog); | |
211 g_free(cnv); | 215 g_free(cnv); |
212 } | 216 } |
213 | 217 |
214 void update_log_convs() | 218 void update_log_convs() |
215 { | 219 { |
244 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); | 248 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); |
245 | 249 |
246 if (c->strike) | 250 if (c->strike) |
247 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); | 251 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); |
248 | 252 |
249 if (c->font) | 253 /* if (c->font) |
250 gtk_widget_set_sensitive(c->font, ((font_options & OPT_FONT_FACE)) ? TRUE : FALSE); | 254 gtk_widget_set_sensitive(c->font, ((font_options & OPT_FONT_FACE)) ? TRUE : FALSE);*/ |
251 | 255 |
252 cnv = cnv->next; | 256 cnv = cnv->next; |
253 } | 257 } |
254 } | 258 } |
255 | 259 |
338 static gint delete_event_convo(GtkWidget *w, GdkEventAny *e, struct conversation *c) | 342 static gint delete_event_convo(GtkWidget *w, GdkEventAny *e, struct conversation *c) |
339 { | 343 { |
340 delete_conversation(c); | 344 delete_conversation(c); |
341 return FALSE; | 345 return FALSE; |
342 } | 346 } |
343 | |
344 | 347 |
345 static void color_callback(GtkWidget *widget, struct conversation *c) | 348 static void color_callback(GtkWidget *widget, struct conversation *c) |
346 { | 349 { |
347 /* show_color_dialog(c); */ | 350 /* show_color_dialog(c); */ |
348 gtk_widget_grab_focus(c->entry); | 351 gtk_widget_grab_focus(c->entry); |
490 | 493 |
491 quiet_set(c->bold, FALSE); | 494 quiet_set(c->bold, FALSE); |
492 quiet_set(c->strike, FALSE); | 495 quiet_set(c->strike, FALSE); |
493 quiet_set(c->italic, FALSE); | 496 quiet_set(c->italic, FALSE); |
494 quiet_set(c->underline, FALSE); | 497 quiet_set(c->underline, FALSE); |
498 quiet_set(c->font, FALSE); | |
495 quiet_set(c->palette, FALSE); | 499 quiet_set(c->palette, FALSE); |
496 quiet_set(c->link, FALSE); | 500 quiet_set(c->link, FALSE); |
497 | 501 |
498 if (c->makesound && (sound_options & OPT_SOUND_SEND)) | 502 if (c->makesound && (sound_options & OPT_SOUND_SEND)) |
499 play_sound(SEND); | 503 play_sound(SEND); |
500 | 504 |
501 if (awaymessage != NULL) { | 505 if (awaymessage != NULL) { |
667 debug_print(debug_buff); | 671 debug_print(debug_buff); |
668 gtk_editable_set_position(GTK_EDITABLE(entry), pos); | 672 gtk_editable_set_position(GTK_EDITABLE(entry), pos); |
669 gtk_widget_grab_focus(entry); | 673 gtk_widget_grab_focus(entry); |
670 } | 674 } |
671 | 675 |
672 static void toggle_color(GtkWidget *color, GtkWidget *entry) | 676 static void toggle_color(GtkWidget *color, struct conversation *c) |
673 { | 677 { |
674 if (state_lock) | 678 if (state_lock) |
675 return; | 679 return; |
676 if (GTK_TOGGLE_BUTTON(color)->active) | 680 if (GTK_TOGGLE_BUTTON(color)->active) |
677 show_color_dialog(entry, color); | 681 show_color_dialog(c, color); |
678 else | 682 else |
679 advance_past(entry, "<FONT COLOR>", "</FONT>" ); | 683 advance_past(c->entry, "<FONT COLOR>", "</FONT>" ); |
680 } | 684 } |
681 | 685 |
682 static void toggle_font(GtkWidget *font, GtkWidget *entry) | 686 static void toggle_font(GtkWidget *font, struct conversation *c) |
683 { | 687 { |
684 show_font_dialog(entry, font); | 688 if (state_lock) |
689 return; | |
690 if (GTK_TOGGLE_BUTTON(font)->active) | |
691 show_font_dialog(c, font); | |
692 else | |
693 advance_past(c->entry, "<FONT FACE>", "</FONT>"); | |
685 | 694 |
686 return; | 695 return; |
687 } | 696 } |
688 | 697 |
689 static void do_link(GtkWidget *linky, GtkWidget *entry) | 698 static void do_link(GtkWidget *linky, GtkWidget *entry) |
778 quiet_set(c->italic, TRUE); | 787 quiet_set(c->italic, TRUE); |
779 else | 788 else |
780 quiet_set(c->italic, FALSE); | 789 quiet_set(c->italic, FALSE); |
781 | 790 |
782 if (invert_tags(entry, "<FONT COLOR", "</FONT>", 0)) | 791 if (invert_tags(entry, "<FONT COLOR", "</FONT>", 0)) |
783 quiet_set(c->palette, TRUE); | 792 quiet_set(c->palette, TRUE); |
784 else if (count_tag(entry, "<FONT COLOR", "</FONT>")) | 793 else if (count_tag(entry, "<FONT COLOR", "</FONT>")) |
785 quiet_set(c->palette, TRUE); | 794 quiet_set(c->palette, TRUE); |
786 else | 795 else |
787 quiet_set(c->palette, FALSE); | 796 quiet_set(c->palette, FALSE); |
797 | |
798 if (invert_tags(entry, "<FONT FACE", "</FONT>", 0)) | |
799 quiet_set(c->font, TRUE); | |
800 else if (count_tag(entry, "<FONT FACE", "</FONT>")) | |
801 quiet_set(c->font, TRUE); | |
802 else | |
803 quiet_set(c->font, FALSE); | |
788 | 804 |
789 if (invert_tags(entry, "<A HREF", "</A>", 0)) | 805 if (invert_tags(entry, "<A HREF", "</A>", 0)) |
790 quiet_set(c->link, TRUE); | 806 quiet_set(c->link, TRUE); |
791 else if (count_tag(entry, "<A HREF", "</A>")) | 807 else if (count_tag(entry, "<A HREF", "</A>")) |
792 quiet_set(c->link, TRUE); | 808 quiet_set(c->link, TRUE); |
1075 "Strike", strike_p, GTK_SIGNAL_FUNC(do_strike), entry); | 1091 "Strike", strike_p, GTK_SIGNAL_FUNC(do_strike), entry); |
1076 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); | 1092 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); |
1077 small = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Small", "Decrease font size", "Small", small_p, GTK_SIGNAL_FUNC(do_small), entry); | 1093 small = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Small", "Decrease font size", "Small", small_p, GTK_SIGNAL_FUNC(do_small), entry); |
1078 normal = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Normal", "Normal font size", "Normal", normal_p, GTK_SIGNAL_FUNC(do_normal), entry); | 1094 normal = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Normal", "Normal font size", "Normal", normal_p, GTK_SIGNAL_FUNC(do_normal), entry); |
1079 big = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Big", "Increase font size", "Big", big_p, GTK_SIGNAL_FUNC(do_big), entry); | 1095 big = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Big", "Increase font size", "Big", big_p, GTK_SIGNAL_FUNC(do_big), entry); |
1080 font = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "Font", "Select Font", "Font", font_p, GTK_SIGNAL_FUNC(toggle_font), entry); | 1096 font = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1081 gtk_object_set_user_data(GTK_OBJECT(font), c); | 1097 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
1098 NULL, "Font", "Select Font", | |
1099 "Font", font_p, GTK_SIGNAL_FUNC(toggle_font), c); | |
1100 | |
1082 if (!(font_options & OPT_FONT_FACE)) | 1101 if (!(font_options & OPT_FONT_FACE)) |
1083 gtk_widget_set_sensitive(GTK_WIDGET(font), FALSE); | 1102 gtk_widget_set_sensitive(GTK_WIDGET(font), FALSE); |
1084 | 1103 |
1085 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); | 1104 gtk_toolbar_append_space(GTK_TOOLBAR(toolbar)); |
1086 link = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | 1105 link = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1087 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, "Link", "Insert Link", | 1106 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, "Link", "Insert Link", |
1088 "Link", link_p, GTK_SIGNAL_FUNC(do_link), entry); | 1107 "Link", link_p, GTK_SIGNAL_FUNC(do_link), entry); |
1089 palette = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | 1108 palette = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1090 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | 1109 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
1091 NULL, "Color", "Text Color", | 1110 NULL, "Color", "Text Color", |
1092 "Color", palette_p, GTK_SIGNAL_FUNC(toggle_color), entry); | 1111 "Color", palette_p, GTK_SIGNAL_FUNC(toggle_color), c); |
1093 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | 1112 wood = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1094 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, | 1113 GTK_TOOLBAR_CHILD_TOGGLEBUTTON, |
1095 NULL, "Logging", "Enable logging", | 1114 NULL, "Logging", "Enable logging", |
1096 "Logging", wood_p, GTK_SIGNAL_FUNC(toggle_loggle), c); | 1115 "Logging", wood_p, GTK_SIGNAL_FUNC(toggle_loggle), c); |
1097 speaker = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), | 1116 speaker = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), |
1187 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 5); | 1206 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 5); |
1188 gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, FALSE, 5); | 1207 gtk_box_pack_start(GTK_BOX(vbox2), toolbar, FALSE, FALSE, 5); |
1189 gtk_box_pack_start(GTK_BOX(vbox2), entry, TRUE, TRUE, 5); | 1208 gtk_box_pack_start(GTK_BOX(vbox2), entry, TRUE, TRUE, 5); |
1190 gtk_box_pack_start(GTK_BOX(vbox2), bbox, FALSE, FALSE, 5); | 1209 gtk_box_pack_start(GTK_BOX(vbox2), bbox, FALSE, FALSE, 5); |
1191 | 1210 |
1192 | |
1193 | |
1194 | |
1195 gtk_widget_show(send); | 1211 gtk_widget_show(send); |
1196 gtk_widget_show(info); | 1212 gtk_widget_show(info); |
1197 gtk_widget_show(warn); | 1213 gtk_widget_show(warn); |
1198 /* gtk_widget_show(color); */ | 1214 /* gtk_widget_show(color); */ |
1199 gtk_widget_show(close); | 1215 gtk_widget_show(close); |
1201 gtk_widget_show(block); | 1217 gtk_widget_show(block); |
1202 gtk_widget_show(bbox); | 1218 gtk_widget_show(bbox); |
1203 gtk_widget_show(vbox); | 1219 gtk_widget_show(vbox); |
1204 gtk_widget_show(entry); | 1220 gtk_widget_show(entry); |
1205 gtk_widget_show(text); | 1221 gtk_widget_show(text); |
1206 | 1222 |
1223 c->font_dialog = NULL; | |
1224 c->color_dialog = NULL; | |
1207 | 1225 |
1208 gtk_container_add(GTK_CONTAINER(win), paned); | 1226 gtk_container_add(GTK_CONTAINER(win), paned); |
1209 gtk_container_border_width(GTK_CONTAINER(win), 10); | 1227 gtk_container_border_width(GTK_CONTAINER(win), 10); |
1210 | 1228 |
1211 if ((find_log_info(c->name)) || ((general_options & OPT_GEN_LOG_ALL))) | 1229 if ((find_log_info(c->name)) || ((general_options & OPT_GEN_LOG_ALL))) |