(gushort)0
};
+static GdkFont *text_sb_font;
+static GdkFont *text_mb_font;
+static gint text_sb_font_orig_ascent;
+static gint text_sb_font_orig_descent;
+static gint text_mb_font_orig_ascent;
+static gint text_mb_font_orig_descent;
static GdkFont *spacingfont;
static void textview_show_ertf (TextView *textview,
vbox = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), scrolledwin_sb, TRUE, TRUE, 0);
- textview->vbox = vbox;
- textview->scrolledwin = scrolledwin_sb;
- textview->scrolledwin_sb = scrolledwin_sb;
- textview->scrolledwin_mb = scrolledwin_mb;
- textview->text = text_sb;
- textview->text_sb = text_sb;
- textview->text_mb = text_mb;
- textview->text_is_mb = FALSE;
- textview->uri_list = NULL;
- textview->body_pos = 0;
- textview->cur_pos = 0;
+ gtk_widget_show(vbox);
+
+ textview->vbox = vbox;
+ textview->scrolledwin = scrolledwin_sb;
+ textview->scrolledwin_sb = scrolledwin_sb;
+ textview->scrolledwin_mb = scrolledwin_mb;
+ textview->text = text_sb;
+ textview->text_sb = text_sb;
+ textview->text_mb = text_mb;
+ textview->text_is_mb = FALSE;
+ textview->uri_list = NULL;
+ textview->body_pos = 0;
+ textview->cur_pos = 0;
+ textview->show_all_headers = FALSE;
textview->last_buttonpress = GDK_NOTHING;
return textview;
gtkut_widget_disable_theme_engine(textview->text_sb);
gtkut_widget_disable_theme_engine(textview->text_mb);
textview_update_message_colors();
+ textview_set_all_headers(textview, FALSE);
textview_set_font(textview, NULL);
}
procheader_header_array_destroy(headers);
}
-#if 0
+/* #if 0 */
tmpfp = procmime_decode_content(NULL, fp, mimeinfo);
if (tmpfp) {
textview_write_line(textview, buf, conv);
fclose(tmpfp);
}
-#else
+/* #else
tmpfp = procmime_get_text_content(mimeinfo, fp);
while (fgets(buf, sizeof(buf), tmpfp) != NULL)
textview_write_line(textview, buf, conv);
fclose(tmpfp);
-#endif
+#endif */
conv_code_converter_destroy(conv);
GdkColor *fg_color;
gint quotelevel = -1;
+#if 0
if (!conv)
strncpy2(buf, str, sizeof(buf));
else if (conv_convert(conv, buf, sizeof(buf), str) < 0) {
-1);
return;
}
+#endif
+ if (!conv || conv_convert(conv, buf, sizeof(buf), str) < 0)
+ strncpy2(buf, str, sizeof(buf));
strcrchomp(buf);
if (prefs_common.conv_mb_alnum) conv_mb_alnum(buf);
if (!textview->scrolledwin_mb->parent)
gtk_widget_destroy(textview->scrolledwin_mb);
- if (textview->msgfont) {
- textview->msgfont->ascent = textview->prev_ascent;
- textview->msgfont->descent = textview->prev_descent;
+ if (textview->msgfont)
gdk_font_unref(textview->msgfont);
- }
if (textview->boldfont)
gdk_font_unref(textview->boldfont);
g_free(textview);
}
+void textview_set_all_headers(TextView *textview, gboolean all_headers)
+{
+ textview->show_all_headers = all_headers;
+}
+
void textview_set_font(TextView *textview, const gchar *codeset)
{
gboolean use_fontset = TRUE;
}
if (prefs_common.textfont) {
- if (textview->msgfont) {
- textview->msgfont->ascent = textview->prev_ascent;
- textview->msgfont->descent = textview->prev_descent;
- gdk_font_unref(textview->msgfont);
- textview->msgfont = NULL;
- }
- if (use_fontset)
- textview->msgfont =
- gdk_fontset_load(prefs_common.textfont);
- else {
+ GdkFont *font;
+
+ if (use_fontset) {
+ if (text_mb_font) {
+ text_mb_font->ascent = text_mb_font_orig_ascent;
+ text_mb_font->descent = text_mb_font_orig_descent;
+ }
+ font = gdk_fontset_load(prefs_common.textfont);
+ if (font && text_mb_font != font) {
+ if (text_mb_font)
+ gdk_font_unref(text_mb_font);
+ text_mb_font = font;
+ text_mb_font_orig_ascent = font->ascent;
+ text_mb_font_orig_descent = font->descent;
+ }
+ } else {
+ if (text_sb_font) {
+ text_sb_font->ascent = text_sb_font_orig_ascent;
+ text_sb_font->descent = text_sb_font_orig_descent;
+ }
if (MB_CUR_MAX > 1) {
- FONT_LOAD(textview->msgfont,
- "-*-courier-medium-r-normal--14-*-*-*-*-*-iso8859-1");
+ FONT_LOAD(font, "-*-courier-medium-r-normal--14-*-*-*-*-*-iso8859-1");
} else {
- FONT_LOAD(textview->msgfont,
- prefs_common.textfont);
+ FONT_LOAD(font, prefs_common.textfont);
+ }
+ if (font && text_sb_font != font) {
+ if (text_sb_font)
+ gdk_font_unref(text_sb_font);
+ text_sb_font = font;
+ text_sb_font_orig_ascent = font->ascent;
+ text_sb_font_orig_descent = font->descent;
}
}
- if (textview->msgfont) {
+ if (font) {
gint ascent, descent;
- textview->prev_ascent = textview->msgfont->ascent;
- textview->prev_descent = textview->msgfont->descent;
descent = prefs_common.line_space / 2;
ascent = prefs_common.line_space - descent;
- textview->msgfont->ascent += ascent;
- textview->msgfont->descent += descent;
+ font->ascent += ascent;
+ font->descent += descent;
+
+ if (textview->msgfont)
+ gdk_font_unref(textview->msgfont);
+ textview->msgfont = font;
+ gdk_font_ref(font);
}
}
- if (!textview->boldfont)
- FONT_LOAD(textview->boldfont, BOLD_FONT);
+ if (!textview->boldfont && prefs_common.boldfont)
+ FONT_LOAD(textview->boldfont, prefs_common.boldfont);
if (!spacingfont)
spacingfont = gdk_font_load("-*-*-medium-r-normal--6-*");
}
g_return_val_if_fail(fp != NULL, NULL);
+ if (textview->show_all_headers)
+ return procheader_get_header_array_asis(fp);
+
if (!prefs_common.display_header) {
while (fgets(buf, sizeof(buf), fp) != NULL)
if (buf[0] == '\r' || buf[0] == '\n') break;