From 04c5cdf0f4fbd705590155bca093cce41b161322 Mon Sep 17 00:00:00 2001 From: Paul Mangan Date: Mon, 25 Nov 2002 18:11:42 +0000 Subject: [PATCH] sync with 0.8.6cvs5 --- ChangeLog | 6 +++ ChangeLog.claws | 5 +++ ChangeLog.jp | 6 +++ configure.in | 2 +- src/imageview.c | 97 ++++++++++++++++++++++++++++++---------------- src/imageview.h | 3 +- src/mimeview.c | 3 +- src/prefs_common.c | 69 +++++++++++++-------------------- src/prefs_common.h | 8 ++-- 9 files changed, 116 insertions(+), 83 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d505460b..72c826eb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-11-21 + + * src/imageview.[ch]: imageview_show_image(): resize images to fit + the window size if specified. + * src/prefs_common.[ch]: added an option 'Resize attached images'. + 2002-11-20 * refactoring for SMTP implementation. diff --git a/ChangeLog.claws b/ChangeLog.claws index d1fe28fcf..8b7f8855c 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,8 @@ +2002-11-25 [paul] 0.8.6claws8 + + * sync with 0.8.6cvs4 + see ChangeLog 2002-11-21 + 2002-11-25 [paul] 0.8.6claws7 * sync with 0.8.6cvs4 diff --git a/ChangeLog.jp b/ChangeLog.jp index 1e00f2496..6061697d4 100644 --- a/ChangeLog.jp +++ b/ChangeLog.jp @@ -1,3 +1,9 @@ +2002-11-21 + + * src/imageview.[ch]: imageview_show_image(): »ØÄꤵ¤ì¤ì¤Ð¥¦¥£¥ó¥É¥¦ + ¥µ¥¤¥º¤Ë¹ç¤¦¤è¤¦¤Ë²èÁü¤ò¥ê¥µ¥¤¥º¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£ + * src/prefs_common.[ch]: ¡ÖźÉÕ²èÁü¤ò¥ê¥µ¥¤¥º¤¹¤ë¡×¥ª¥×¥·¥ç¥ó¤òÄɲᣠ+ 2002-11-20 * SMTP ¤Î¼ÂÁõ¤ò¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°¡£ diff --git a/configure.in b/configure.in index ecdfa5df7..ca53e2b1f 100644 --- a/configure.in +++ b/configure.in @@ -11,7 +11,7 @@ MINOR_VERSION=8 MICRO_VERSION=6 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws7 +EXTRA_VERSION=claws8 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/imageview.c b/src/imageview.c index d3621deef..85443e8d8 100644 --- a/src/imageview.c +++ b/src/imageview.c @@ -40,7 +40,9 @@ #include "imageview.h" #include "utils.h" -void get_resized_size (int w, int h, int aw, int ah, int *sw, int *sh); +static void get_resized_size(gint w, gint h, gint aw, gint ah, + gint *sw, gint *sh); + ImageView *imageview_create(void) { @@ -70,17 +72,19 @@ void imageview_init(ImageView *imageview) #if HAVE_GDK_PIXBUF void imageview_show_image(ImageView *imageview, MimeInfo *mimeinfo, - const gchar *file) + const gchar *file, gboolean resize) { GdkPixbuf *pixbuf; GdkPixbuf *pixbuf_scaled; GdkPixmap *pixmap; GdkBitmap *mask; - int avail_height = imageview->scrolledwin->parent->allocation.height - 10; - int avail_width = imageview->scrolledwin->parent->allocation.width - 10; - int sized_height = -1; - int sized_width = -1; - + gint avail_width; + gint avail_height; + gint new_width; + gint new_height; + + g_return_if_fail(imageview != NULL); + imageview_clear(imageview); pixbuf = gdk_pixbuf_new_from_file(file); @@ -92,13 +96,25 @@ void imageview_show_image(ImageView *imageview, MimeInfo *mimeinfo, if (imageview->messageview->mainwin) main_window_cursor_wait(imageview->messageview->mainwin); - - get_resized_size (gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf), - avail_width, avail_height, &sized_width, &sized_height); - - pixbuf_scaled = gdk_pixbuf_scale_simple (pixbuf, sized_width, sized_height, 0); - - gdk_pixbuf_render_pixmap_and_mask(pixbuf_scaled, &pixmap, &mask, 0); + + if (resize) { + avail_width = imageview->scrolledwin->parent->allocation.width; + avail_height = imageview->scrolledwin->parent->allocation.height; + if (avail_width > 8) avail_width -= 8; + if (avail_height > 8) avail_height -= 8; + + get_resized_size(gdk_pixbuf_get_width(pixbuf), + gdk_pixbuf_get_height(pixbuf), + avail_width, avail_height, + &new_width, &new_height); + + pixbuf_scaled = gdk_pixbuf_scale_simple + (pixbuf, new_width, new_height, GDK_INTERP_BILINEAR); + gdk_pixbuf_unref(pixbuf); + pixbuf = pixbuf_scaled; + } + + gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap, &mask, 0); if (!imageview->image) { imageview->image = gtk_pixmap_new(pixmap, mask); @@ -112,7 +128,6 @@ void imageview_show_image(ImageView *imageview, MimeInfo *mimeinfo, gtk_widget_show(imageview->image); gdk_pixbuf_unref(pixbuf); - gdk_pixbuf_unref(pixbuf_scaled); if (imageview->messageview->mainwin) main_window_cursor_normal(imageview->messageview->mainwin); @@ -120,13 +135,15 @@ void imageview_show_image(ImageView *imageview, MimeInfo *mimeinfo, #else #if HAVE_GDK_IMLIB void imageview_show_image(ImageView *imageview, MimeInfo *mimeinfo, - const gchar *file) + const gchar *file, gboolean resize) { GdkImlibImage *im; - int avail_height = imageview->scrolledwin->parent->allocation.height - 10; - int avail_width = imageview->scrolledwin->parent->allocation.width - 10; - int sized_height = -1; - int sized_width = -1; + gint avail_width; + gint avail_height; + gint new_width; + gint new_height; + + g_return_if_fail(imageview != NULL); imageview_clear(imageview); @@ -140,10 +157,21 @@ void imageview_show_image(ImageView *imageview, MimeInfo *mimeinfo, if (imageview->messageview->mainwin) main_window_cursor_wait(imageview->messageview->mainwin); - get_resized_size (im->rgb_width, im->rgb_height, - avail_width, avail_height, &sized_width, &sized_height); + if (resize) { + avail_width = imageview->scrolledwin->parent->allocation.width; + avail_height = imageview->scrolledwin->parent->allocation.height; + if (avail_width > 8) avail_width -= 8; + if (avail_height > 8) avail_height -= 8; + + get_resized_size(im->rgb_width, im->rgb_height, + avail_width, avail_height, + &new_width, &new_height); + } else { + new_width = im->rgb_width; + new_height = im->rgb_height; + } - gdk_imlib_render(im, sized_width, sized_height); + gdk_imlib_render(im, new_width, new_height); if (!imageview->image) { imageview->image = gtk_pixmap_new(gdk_imlib_move_image(im), @@ -191,22 +219,23 @@ void imageview_destroy(ImageView *imageview) g_free(imageview); } -void get_resized_size (int w, int h, int aw, int ah, int *sw, int *sh) { - - float wratio = 1.0; - float hratio = 1.0; - float ratio = 1.0; +static void get_resized_size(gint w, gint h, gint aw, gint ah, + gint *sw, gint *sh) +{ + gfloat wratio = 1.0; + gfloat hratio = 1.0; + gfloat ratio = 1.0; if (w > aw) - wratio = (float)((float)aw/(float)w); + wratio = (gfloat)aw / (gfloat)w; if (h > ah) - hratio = (float)((float)ah/(float)h); - + hratio = (gfloat)ah / (gfloat)h; + ratio = (wratio > hratio) ? hratio : wratio; - *sw = (int)(w * ratio); - *sh = (int)(h * ratio); - + *sw = (gint)(w * ratio); + *sh = (gint)(h * ratio); + /* be paranoid */ if (*sw <= 0 || *sh <= 0) { *sw = w; diff --git a/src/imageview.h b/src/imageview.h index 1da0b8e50..ba1be743e 100644 --- a/src/imageview.h +++ b/src/imageview.h @@ -40,7 +40,8 @@ ImageView *imageview_create (void); void imageview_init (ImageView *imageview); void imageview_show_image (ImageView *imageview, MimeInfo *mimeinfo, - const gchar *file); + const gchar *file, + gboolean render); void imageview_clear (ImageView *imageview); void imageview_destroy (ImageView *imageview); diff --git a/src/mimeview.c b/src/mimeview.c index 6116e6565..f61b97cd0 100644 --- a/src/mimeview.c +++ b/src/mimeview.c @@ -466,7 +466,8 @@ static void mimeview_show_image_part(MimeView *mimeview, MimeInfo *partinfo) /* Workaround for the GTK+ bug with handling scroll adjustments * in GtkViewport */ imageview_clear(mimeview->imageview); - imageview_show_image(mimeview->imageview, partinfo, filename); + imageview_show_image(mimeview->imageview, partinfo, filename, + prefs_common.resize_image); unlink(filename); } diff --git a/src/prefs_common.c b/src/prefs_common.c index e24fa950d..74f0dc9c8 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -165,7 +165,6 @@ static struct Display { GtkWidget *entry_boldfont; GtkWidget *chkbtn_folder_unread; - GtkWidget *chkbtn_display_img; GtkWidget *entry_ng_abbrev_len; GtkWidget *spinbtn_ng_abbrev_len; GtkObject *spinbtn_ng_abbrev_len_adj; @@ -194,6 +193,9 @@ static struct Message { GtkWidget *spinbtn_scrollstep; GtkObject *spinbtn_scrollstep_adj; GtkWidget *chkbtn_halfpage; + + GtkWidget *chkbtn_display_img; + GtkWidget *chkbtn_resize_image; } message; #if USE_GPGME @@ -237,9 +239,7 @@ static struct Other { GtkWidget *checkbtn_warnqueued; GtkWidget *checkbtn_cliplog; GtkWidget *loglength_entry; -#ifdef USE_SSL - GtkWidget *checkbtn_ssl_ask_unknown_valid; -#endif + } other; static struct MessageColorButtons { @@ -488,10 +488,6 @@ static PrefParam param[] = { &display.chkbtn_folder_unread, prefs_set_data_from_toggle, prefs_set_toggle}, - {"display_img", "TRUE", - &prefs_common.display_img, P_BOOL, - &display.chkbtn_display_img, - prefs_set_data_from_toggle, prefs_set_toggle}, {"newsgroup_abbrev_len", "16", &prefs_common.ng_abbrev_len, P_INT, &display.spinbtn_ng_abbrev_len, @@ -688,6 +684,13 @@ static PrefParam param[] = { &message.chkbtn_halfpage, prefs_set_data_from_toggle, prefs_set_toggle}, + {"display_img", "TRUE", &prefs_common.display_img, P_BOOL, + &message.chkbtn_display_img, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"resize_image", "TRUE", &prefs_common.resize_image, P_BOOL, + &message.chkbtn_resize_image, + prefs_set_data_from_toggle, prefs_set_toggle}, + {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL, NULL, NULL, NULL}, @@ -799,11 +802,6 @@ static PrefParam param[] = { {"warn_queued_on_exit", "TRUE", &prefs_common.warn_queued_on_exit, P_BOOL, &other.checkbtn_warnqueued, prefs_set_data_from_toggle, prefs_set_toggle}, -#ifdef USE_SSL - {"ssl_ask_unknown_valid", "TRUE", &prefs_common.ssl_ask_unknown_valid, - P_BOOL, &other.checkbtn_ssl_ask_unknown_valid, - prefs_set_data_from_toggle, prefs_set_toggle}, -#endif {"work_offline", "FALSE", &prefs_common.work_offline, P_BOOL, NULL, NULL, NULL}, @@ -2102,7 +2100,6 @@ static void prefs_display_create(void) GtkWidget *label_textfont; GtkWidget *entry_textfont; GtkWidget *button_textfont; - GtkWidget *chkbtn_display_img; GtkWidget *chkbtn_transhdr; GtkWidget *chkbtn_folder_unread; GtkWidget *hbox1; @@ -2225,9 +2222,6 @@ static void prefs_display_create(void) PACK_CHECK_BUTTON (vbox2, chkbtn_folder_unread, _("Display unread number next to folder name")); - PACK_CHECK_BUTTON (vbox2, chkbtn_display_img, - _("Automatically display images")); - PACK_VSPACER(vbox2, vbox3, VSPACING_NARROW_2); hbox1 = gtk_hbox_new (FALSE, 8); @@ -2315,7 +2309,6 @@ static void prefs_display_create(void) display.entry_textfont = entry_textfont; display.button_textfont = button_textfont; - display.chkbtn_display_img = chkbtn_display_img; display.chkbtn_transhdr = chkbtn_transhdr; display.chkbtn_folder_unread = chkbtn_folder_unread; display.spinbtn_ng_abbrev_len = spinbtn_ng_abbrev_len; @@ -2356,6 +2349,9 @@ static void prefs_message_create(void) GtkWidget *spinbtn_scrollstep; GtkWidget *chkbtn_halfpage; + GtkWidget *chkbtn_display_img; + GtkWidget *chkbtn_resize_image; + vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1); @@ -2476,6 +2472,16 @@ static void prefs_message_create(void) SET_TOGGLE_SENSITIVITY (chkbtn_smoothscroll, hbox_scr) + vbox3 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox3); + gtk_box_pack_start (GTK_BOX (vbox1), vbox3, FALSE, FALSE, 0); + + PACK_CHECK_BUTTON(vbox3, chkbtn_display_img, + _("Automatically display attached images")); + + PACK_CHECK_BUTTON(vbox3, chkbtn_resize_image, + _("Resize attached images")); + message.chkbtn_enablecol = chkbtn_enablecol; message.button_edit_col = button_edit_col; message.chkbtn_mbalnum = chkbtn_mbalnum; @@ -2488,6 +2494,9 @@ static void prefs_message_create(void) message.spinbtn_scrollstep = spinbtn_scrollstep; message.spinbtn_scrollstep_adj = spinbtn_scrollstep_adj; message.chkbtn_halfpage = chkbtn_halfpage; + + message.chkbtn_display_img = chkbtn_display_img; + message.chkbtn_resize_image = chkbtn_resize_image; } #if USE_GPGME @@ -2871,11 +2880,6 @@ static void prefs_other_create(void) GtkWidget *checkbtn_cleanonexit; GtkWidget *checkbtn_askonclean; GtkWidget *checkbtn_warnqueued; - - GtkWidget *frame_ssl; - GtkWidget *vbox_ssl; - GtkWidget *hbox_ssl; - GtkWidget *checkbtn_ssl_ask_unknown_valid; vbox1 = gtk_vbox_new (FALSE, VSPACING); gtk_widget_show (vbox1); @@ -2974,21 +2978,6 @@ static void prefs_other_create(void) FALSE, TRUE, 0); SET_TOGGLE_SENSITIVITY(checkbtn_cliplog, loglength_entry); -#ifdef USE_SSL - /* SSL */ - PACK_FRAME (vbox1, frame_ssl, _("Security")); - - vbox_ssl = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox_ssl); - gtk_container_add (GTK_CONTAINER (frame_ssl), vbox_ssl); - gtk_container_set_border_width (GTK_CONTAINER (vbox_ssl), 8); - PACK_CHECK_BUTTON (vbox_ssl, checkbtn_ssl_ask_unknown_valid, - _("Confirm acception of all SSL certificates")); - hbox_ssl = gtk_hbox_new (FALSE, 3); - gtk_container_add (GTK_CONTAINER (vbox_ssl), hbox_ssl); - gtk_widget_show (hbox_ssl); -#endif - /* On Exit */ PACK_FRAME (vbox1, frame_exit, _("On exit")); @@ -3027,10 +3016,6 @@ static void prefs_other_create(void) other.checkbtn_cleanonexit = checkbtn_cleanonexit; other.checkbtn_askonclean = checkbtn_askonclean; other.checkbtn_warnqueued = checkbtn_warnqueued; - -#ifdef USE_SSL - other.checkbtn_ssl_ask_unknown_valid = checkbtn_ssl_ask_unknown_valid; -#endif } static void date_format_ok_btn_clicked(GtkButton *button, GtkWidget **widget) diff --git a/src/prefs_common.h b/src/prefs_common.h index c5282800a..3fe515ea0 100644 --- a/src/prefs_common.h +++ b/src/prefs_common.h @@ -122,7 +122,6 @@ struct _PrefsCommon gchar *boldfont; gchar *smallfont; gboolean display_folder_unread; - gboolean display_img; gint ng_abbrev_len; ToolbarStyle toolbar_style; gboolean show_statusbar; @@ -198,6 +197,9 @@ struct _PrefsCommon gint scroll_step; gboolean scroll_halfpage; + gboolean display_img; + gboolean resize_image; + gchar *force_charset; gboolean show_other_header; @@ -249,9 +251,7 @@ struct _PrefsCommon gboolean clean_on_exit; gboolean ask_on_clean; gboolean warn_queued_on_exit; -#ifdef USE_SSL - gboolean ssl_ask_unknown_valid; -#endif + /* Memory cache*/ gint cache_max_mem_usage; gint cache_min_keep_time; -- 2.25.1