Mercurial > pidgin.yaz
comparison src/conversation.c @ 2725:f3c094e78609
[gaim-migrate @ 2738]
this actually doesn't change anything, unless you want to use gtk2.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 15 Nov 2001 22:47:04 +0000 |
parents | abecab600451 |
children | aeae739353d0 |
comparison
equal
deleted
inserted
replaced
2724:7f3f4aa114ad | 2725:f3c094e78609 |
---|---|
709 case '*': | 709 case '*': |
710 sprintf(buf, ":-D"); | 710 sprintf(buf, ":-D"); |
711 break; | 711 break; |
712 } | 712 } |
713 if (buf[0]) { | 713 if (buf[0]) { |
714 if (GTK_EDITABLE(c->entry)->has_selection) { | 714 if (GTK_OLD_EDITABLE(c->entry)->has_selection) { |
715 int finish = GTK_EDITABLE(c->entry)->selection_end_pos; | 715 int finish = GTK_OLD_EDITABLE(c->entry)->selection_end_pos; |
716 gtk_editable_insert_text(GTK_EDITABLE(c->entry), | 716 gtk_editable_insert_text(GTK_EDITABLE(c->entry), |
717 buf, strlen(buf), &finish); | 717 buf, strlen(buf), &finish); |
718 } else { | 718 } else { |
719 pos = GTK_EDITABLE(c->entry)->current_pos; | 719 pos = GTK_OLD_EDITABLE(c->entry)->current_pos; |
720 gtk_editable_insert_text(GTK_EDITABLE(c->entry), | 720 gtk_editable_insert_text(GTK_EDITABLE(c->entry), |
721 buf, strlen(buf), &pos); | 721 buf, strlen(buf), &pos); |
722 } | 722 } |
723 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | 723 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
724 } | 724 } |
777 } | 777 } |
778 } | 778 } |
779 } else if ((event->keyval == GDK_Tab) && c->is_chat && (chat_options & OPT_CHAT_TAB_COMPLETE)) { | 779 } else if ((event->keyval == GDK_Tab) && c->is_chat && (chat_options & OPT_CHAT_TAB_COMPLETE)) { |
780 tab_complete(c); | 780 tab_complete(c); |
781 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | 781 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
782 return TRUE; | |
782 } else if (((!c->is_chat && (im_options & OPT_IM_ONE_WINDOW)) || | 783 } else if (((!c->is_chat && (im_options & OPT_IM_ONE_WINDOW)) || |
783 (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) && | 784 (c->is_chat && (chat_options & OPT_CHAT_ONE_WINDOW))) && |
784 (event->state & GDK_MOD1_MASK) && (event->keyval > '0') && (event->keyval <= '9')) { | 785 (event->state & GDK_MOD1_MASK) && (event->keyval > '0') && (event->keyval <= '9')) { |
785 GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook); | 786 GtkWidget *notebook = (c->is_chat ? chat_notebook : convo_notebook); |
786 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), event->keyval - '1'); | 787 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), event->keyval - '1'); |
787 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); | 788 gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); |
788 } | 789 } |
789 | 790 |
790 return TRUE; | 791 return FALSE; |
791 } | 792 } |
792 | 793 |
793 | 794 |
794 void send_callback(GtkWidget *widget, struct conversation *c) | 795 void send_callback(GtkWidget *widget, struct conversation *c) |
795 { | 796 { |
939 } | 940 } |
940 | 941 |
941 int entry_key_pressed(GtkWidget *w, GtkWidget *entry) | 942 int entry_key_pressed(GtkWidget *w, GtkWidget *entry) |
942 { | 943 { |
943 check_everything(w); | 944 check_everything(w); |
944 return TRUE; | 945 return FALSE; |
945 } | 946 } |
946 | 947 |
947 /*------------------------------------------------------------------------*/ | 948 /*------------------------------------------------------------------------*/ |
948 /* HTML-type stuff */ | 949 /* HTML-type stuff */ |
949 /*------------------------------------------------------------------------*/ | 950 /*------------------------------------------------------------------------*/ |
952 { | 953 { |
953 char *p1, *p2; | 954 char *p1, *p2; |
954 int res = 0; | 955 int res = 0; |
955 char *tmp, *tmpo, h; | 956 char *tmp, *tmpo, h; |
956 tmpo = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | 957 tmpo = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
957 h = tmpo[GTK_EDITABLE(entry)->current_pos]; | 958 h = tmpo[GTK_OLD_EDITABLE(entry)->current_pos]; |
958 tmpo[GTK_EDITABLE(entry)->current_pos] = '\0'; | 959 tmpo[GTK_OLD_EDITABLE(entry)->current_pos] = '\0'; |
959 tmp = tmpo; | 960 tmp = tmpo; |
960 do { | 961 do { |
961 p1 = strstr(tmp, s1); | 962 p1 = strstr(tmp, s1); |
962 p2 = strstr(tmp, s2); | 963 p2 = strstr(tmp, s2); |
963 if (p1 && p2) { | 964 if (p1 && p2) { |
976 res = 0; | 977 res = 0; |
977 tmp = p2 + strlen(s2); | 978 tmp = p2 + strlen(s2); |
978 } | 979 } |
979 } | 980 } |
980 } while (p1 || p2); | 981 } while (p1 || p2); |
981 tmpo[GTK_EDITABLE(entry)->current_pos] = h; | 982 tmpo[GTK_OLD_EDITABLE(entry)->current_pos] = h; |
982 g_free(tmpo); | 983 g_free(tmpo); |
983 return res; | 984 return res; |
984 } | 985 } |
985 | 986 |
986 | 987 |
987 int invert_tags(GtkWidget *entry, char *s1, char *s2, int really) | 988 int invert_tags(GtkWidget *entry, char *s1, char *s2, int really) |
988 { | 989 { |
989 int start = GTK_EDITABLE(entry)->selection_start_pos; | 990 int start = GTK_OLD_EDITABLE(entry)->selection_start_pos; |
990 int finish = GTK_EDITABLE(entry)->selection_end_pos; | 991 int finish = GTK_OLD_EDITABLE(entry)->selection_end_pos; |
991 char *s; | 992 char *s; |
992 | 993 |
993 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | 994 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
994 if (!g_strncasecmp(&s[start], s1, strlen(s1)) && | 995 if (!g_strncasecmp(&s[start], s1, strlen(s1)) && |
995 !g_strncasecmp(&s[finish - strlen(s2)], s2, strlen(s2))) { | 996 !g_strncasecmp(&s[finish - strlen(s2)], s2, strlen(s2))) { |
1007 | 1008 |
1008 | 1009 |
1009 void remove_tags(GtkWidget *entry, char *tag) | 1010 void remove_tags(GtkWidget *entry, char *tag) |
1010 { | 1011 { |
1011 char *s, *t; | 1012 char *s, *t; |
1012 int start = GTK_EDITABLE(entry)->selection_start_pos; | 1013 int start = GTK_OLD_EDITABLE(entry)->selection_start_pos; |
1013 int finish = GTK_EDITABLE(entry)->selection_end_pos; | 1014 int finish = GTK_OLD_EDITABLE(entry)->selection_end_pos; |
1014 int temp; | 1015 int temp; |
1015 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | 1016 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
1016 t = s; | 1017 t = s; |
1017 | 1018 |
1018 if (start > finish) { | 1019 if (start > finish) { |
1088 return buffer_start; | 1089 return buffer_start; |
1089 } | 1090 } |
1090 | 1091 |
1091 void surround(GtkWidget *entry, char *pre, char *post) | 1092 void surround(GtkWidget *entry, char *pre, char *post) |
1092 { | 1093 { |
1093 int temp, pos = GTK_EDITABLE(entry)->current_pos; | 1094 int temp, pos = GTK_OLD_EDITABLE(entry)->current_pos; |
1094 int dummy; | 1095 int dummy; |
1095 int start, finish; | 1096 int start, finish; |
1096 | 1097 |
1097 if (convo_options & OPT_CONVO_CHECK_SPELLING) { | 1098 if (convo_options & OPT_CONVO_CHECK_SPELLING) { |
1098 gtkspell_detach(GTK_TEXT(entry)); | 1099 gtkspell_detach(GTK_TEXT(entry)); |
1099 } | 1100 } |
1100 | 1101 |
1101 if (GTK_EDITABLE(entry)->has_selection) { | 1102 if (GTK_OLD_EDITABLE(entry)->has_selection) { |
1102 remove_tags(entry, pre); | 1103 remove_tags(entry, pre); |
1103 remove_tags(entry, post); | 1104 remove_tags(entry, post); |
1104 start = GTK_EDITABLE(entry)->selection_start_pos; | 1105 start = GTK_OLD_EDITABLE(entry)->selection_start_pos; |
1105 finish = GTK_EDITABLE(entry)->selection_end_pos; | 1106 finish = GTK_OLD_EDITABLE(entry)->selection_end_pos; |
1106 if (start > finish) { | 1107 if (start > finish) { |
1107 dummy = finish; | 1108 dummy = finish; |
1108 finish = start; | 1109 finish = start; |
1109 start = dummy; | 1110 start = dummy; |
1110 } | 1111 } |
1140 char *s, *s2; | 1141 char *s, *s2; |
1141 int pos; | 1142 int pos; |
1142 if (invert_tags(entry, pre, post, 1)) | 1143 if (invert_tags(entry, pre, post, 1)) |
1143 return; | 1144 return; |
1144 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); | 1145 s = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); |
1145 pos = GTK_EDITABLE(entry)->current_pos; | 1146 pos = GTK_OLD_EDITABLE(entry)->current_pos; |
1146 debug_printf(_("Currently at %d, "), pos); | 1147 debug_printf(_("Currently at %d, "), pos); |
1147 s2 = strstr(&s[pos], post); | 1148 s2 = strstr(&s[pos], post); |
1148 if (s2) { | 1149 if (s2) { |
1149 pos = s2 - s + strlen(post); | 1150 pos = s2 - s + strlen(post); |
1150 } else { | 1151 } else { |
1604 if ((c->unseen == 2) || ((c->unseen == 1) && !(flags & WFLAG_NICK))) | 1605 if ((c->unseen == 2) || ((c->unseen == 1) && !(flags & WFLAG_NICK))) |
1605 return; | 1606 return; |
1606 style = gtk_style_new(); | 1607 style = gtk_style_new(); |
1607 if (!GTK_WIDGET_REALIZED(label)) | 1608 if (!GTK_WIDGET_REALIZED(label)) |
1608 gtk_widget_realize(label); | 1609 gtk_widget_realize(label); |
1609 gdk_font_unref(style->font); | 1610 gdk_font_unref(gtk_style_get_font(style)); |
1610 style->font = gdk_font_ref(label->style->font); | 1611 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); |
1611 if (flags & WFLAG_NICK) { | 1612 if (flags & WFLAG_NICK) { |
1612 style->fg[0].red = 0x0000; | 1613 style->fg[0].red = 0x0000; |
1613 style->fg[0].green = 0x0000; | 1614 style->fg[0].green = 0x0000; |
1614 style->fg[0].blue = 0xcccc; | 1615 style->fg[0].blue = 0xcccc; |
1615 c->unseen = 2; | 1616 c->unseen = 2; |
2109 if (c && c->window && c->entry) | 2110 if (c && c->window && c->entry) |
2110 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry); | 2111 gtk_window_set_focus(GTK_WINDOW(c->window), c->entry); |
2111 if (!GTK_WIDGET_REALIZED(label)) | 2112 if (!GTK_WIDGET_REALIZED(label)) |
2112 return; | 2113 return; |
2113 style = gtk_style_new(); | 2114 style = gtk_style_new(); |
2114 gdk_font_unref(style->font); | 2115 gdk_font_unref(gtk_style_get_font(style)); |
2115 style->font = gdk_font_ref(label->style->font); | 2116 gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style))); |
2116 gtk_widget_set_style(label, style); | 2117 gtk_widget_set_style(label, style); |
2117 gtk_style_unref(style); | 2118 gtk_style_unref(style); |
2118 c->unseen = 0; | 2119 c->unseen = 0; |
2119 } | 2120 } |
2120 | 2121 |