comparison src/gtkimhtml.c @ 7787:666f672a869a

[gaim-migrate @ 8432] cleaner compiles mean correct code, right? :-P committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 07 Dec 2003 16:29:44 +0000
parents de9a47ff006a
children 27f55b264446
comparison
equal deleted inserted replaced
7786:203a18e56dc6 7787:666f672a869a
58 #endif 58 #endif
59 59
60 #define TOOLTIP_TIMEOUT 500 60 #define TOOLTIP_TIMEOUT 500
61 61
62 static void insert_cb(GtkTextBuffer *buffer, GtkTextIter *iter, gchar *text, gint len, GtkIMHtml *imhtml); 62 static void insert_cb(GtkTextBuffer *buffer, GtkTextIter *iter, gchar *text, gint len, GtkIMHtml *imhtml);
63 void gtk_imhtml_close_tags(GtkIMHtml *imhtml);
63 64
64 /* POINT_SIZE converts from AIM font sizes to point sizes. It probably should be redone in such a 65 /* POINT_SIZE converts from AIM font sizes to point sizes. It probably should be redone in such a
65 * way that it base the sizes off the default font size rather than using arbitrary font sizes. */ 66 * way that it base the sizes off the default font size rather than using arbitrary font sizes. */
66 #define MAX_FONT_SIZE 7 67 #define MAX_FONT_SIZE 7
67 #define POINT_SIZE(x) (options & GTK_IMHTML_USE_POINTSIZE ? x : _point_sizes [MIN ((x), MAX_FONT_SIZE) - 1]) 68 #define POINT_SIZE(x) (options & GTK_IMHTML_USE_POINTSIZE ? x : _point_sizes [MIN ((x), MAX_FONT_SIZE) - 1])
378 char *selection = g_convert(str->str, str->len, "UCS-2", "UTF-8", NULL, &len, NULL); 379 char *selection = g_convert(str->str, str->len, "UCS-2", "UTF-8", NULL, &len, NULL);
379 gtk_selection_data_set (selection_data, gdk_atom_intern("text/html", FALSE), 16, selection, len); 380 gtk_selection_data_set (selection_data, gdk_atom_intern("text/html", FALSE), 16, selection, len);
380 g_string_free(str, TRUE); 381 g_string_free(str, TRUE);
381 g_free(selection); 382 g_free(selection);
382 } else { 383 } else {
383 text = gtk_text_buffer_get_text(imhtml, &start, &end, FALSE); 384 text = gtk_text_buffer_get_text(imhtml->text_buffer, &start, &end, FALSE);
384 gtk_selection_data_set_text(selection_data, text, strlen(text)); 385 gtk_selection_data_set_text(selection_data, text, strlen(text));
385 } 386 }
386 g_free(text); 387 g_free(text);
387 } 388 }
388 389
1110 NEW_TEXT_BIT, 1111 NEW_TEXT_BIT,
1111 NEW_COMMENT_BIT, 1112 NEW_COMMENT_BIT,
1112 NEW_SCALABLE_BIT 1113 NEW_SCALABLE_BIT
1113 } GtkIMHtmlBitType; 1114 } GtkIMHtmlBitType;
1114 1115
1115 static inline new_bit(GtkIMHtml *imhtml, GtkTextIter *iter, GtkIMHtmlBitType x, char *ws, int *wpos) 1116 static inline void new_bit(GtkIMHtml *imhtml, GtkTextIter *iter, GtkIMHtmlBitType x, char *ws, int *wpos)
1116 { 1117 {
1117 GtkTextMark *mark2; 1118 GtkTextMark *mark2;
1118 GtkTextIter siter; 1119 GtkTextIter siter;
1119 GtkIMHtmlScalable *scalable = NULL; 1120 GtkIMHtmlScalable *scalable = NULL;
1120 1121
1121 ws [*wpos] = '\0'; 1122 ws [*wpos] = '\0';
1122 mark2 = gtk_text_buffer_create_mark(imhtml->text_buffer, NULL, &iter, TRUE); 1123 mark2 = gtk_text_buffer_create_mark(imhtml->text_buffer, NULL, iter, TRUE);
1123 gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, -1); 1124 gtk_text_buffer_insert(imhtml->text_buffer, iter, ws, -1);
1124 1125
1125 gtk_text_buffer_delete_mark(imhtml->text_buffer, mark2); 1126 gtk_text_buffer_delete_mark(imhtml->text_buffer, mark2);
1126 /*if (bold) 1127 /*if (bold)
1127 gtk 1128 gtk
1169 } \ 1170 } \
1170 */ 1171 */
1171 *wpos = 0; 1172 *wpos = 0;
1172 ws[0] = 0; 1173 ws[0] = 0;
1173 gtk_text_buffer_get_end_iter(imhtml->text_buffer, iter); 1174 gtk_text_buffer_get_end_iter(imhtml->text_buffer, iter);
1174 if (x == NEW_SCALABLE_BIT) { 1175 if (x == NEW_SCALABLE_BIT) {
1175 GdkRectangle rect; 1176 GdkRectangle rect;
1176 gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect); 1177 gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(imhtml), &rect);
1177 scalable->add_to(scalable, imhtml, &iter); 1178 scalable->add_to(scalable, imhtml, iter);
1178 scalable->scale(scalable, rect.width, rect.height); 1179 scalable->scale(scalable, rect.width, rect.height);
1179 imhtml->scalables = g_list_append(imhtml->scalables, scalable); 1180 imhtml->scalables = g_list_append(imhtml->scalables, scalable);
1180 gtk_text_buffer_get_end_iter(imhtml->text_buffer, iter); 1181 gtk_text_buffer_get_end_iter(imhtml->text_buffer, iter);
1181 } 1182 }
1182 } 1183 }
1183 1184
1184 1185
1185 GString* gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml, 1186 GString* gtk_imhtml_append_text_with_images (GtkIMHtml *imhtml,
1186 const gchar *text, 1187 const gchar *text,