Mercurial > geeqie
changeset 209:ad78ad18523a
configurable frame around image - geeqie_autofit_maxsize.patch by Laurent MONIN
author | nadvornik |
---|---|
date | Sat, 29 Mar 2008 14:59:14 +0000 |
parents | fa0e05f985c3 |
children | 3fa93ab9b119 |
files | src/globals.c src/gqview.h src/image.c src/pixbuf-renderer.c src/pixbuf-renderer.h src/preferences.c src/rcfile.c |
diffstat | 7 files changed, 70 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/globals.c Sat Mar 29 10:38:15 2008 +0000 +++ b/src/globals.c Sat Mar 29 14:59:14 2008 +0000 @@ -52,6 +52,8 @@ gint limit_window_size = FALSE; gint zoom_to_fit_expands = TRUE; gint max_window_size = 100; +gint limit_autofit_size = FALSE; +gint max_autofit_size = 100; gint thumb_max_width = 96; gint thumb_max_height = 72; gint enable_thumb_caching = TRUE;
--- a/src/gqview.h Sat Mar 29 10:38:15 2008 +0000 +++ b/src/gqview.h Sat Mar 29 14:59:14 2008 +0000 @@ -132,6 +132,8 @@ extern gint limit_window_size; extern gint zoom_to_fit_expands; extern gint max_window_size; +extern gint limit_autofit_size; +extern gint max_autofit_size; extern gint thumb_max_width; extern gint thumb_max_height; extern gint enable_thumb_caching;
--- a/src/image.c Sat Mar 29 10:38:15 2008 +0000 +++ b/src/image.c Sat Mar 29 14:59:14 2008 +0000 @@ -1720,6 +1720,9 @@ "window_fit", (imd->top_window_sync && fit_window), "window_limit", limit_window_size, "window_limit_value", max_window_size, + "autofit_limit", limit_autofit_size, + "autofit_limit_value", max_autofit_size, + NULL); pixbuf_renderer_set_parent((PixbufRenderer *)imd->pr, (GtkWindow *)imd->top_window);
--- a/src/pixbuf-renderer.c Sat Mar 29 10:38:15 2008 +0000 +++ b/src/pixbuf-renderer.c Sat Mar 29 14:59:14 2008 +0000 @@ -156,7 +156,9 @@ PROP_CACHE_SIZE_TILES, PROP_WINDOW_FIT, PROP_WINDOW_LIMIT, - PROP_WINDOW_LIMIT_VALUE + PROP_WINDOW_LIMIT_VALUE, + PROP_AUTOFIT_LIMIT, + PROP_AUTOFIT_LIMIT_VALUE }; @@ -383,6 +385,25 @@ 150, 100, G_PARAM_READABLE | G_PARAM_WRITABLE)); + + g_object_class_install_property(gobject_class, + PROP_AUTOFIT_LIMIT, + g_param_spec_boolean("autofit_limit", + "Limit size of image when autofitting", + NULL, + FALSE, + G_PARAM_READABLE | G_PARAM_WRITABLE)); + + g_object_class_install_property(gobject_class, + PROP_AUTOFIT_LIMIT_VALUE, + g_param_spec_uint("autofit_limit_value", + "Size limit of image when autofitting", + NULL, + 10, + 150, + 100, + G_PARAM_READABLE | G_PARAM_WRITABLE)); + signals[SIGNAL_ZOOM] = g_signal_new("zoom", @@ -550,6 +571,12 @@ case PROP_WINDOW_LIMIT_VALUE: pr->window_limit_size = g_value_get_uint(value); break; + case PROP_AUTOFIT_LIMIT: + pr->autofit_limit = g_value_get_boolean(value); + break; + case PROP_AUTOFIT_LIMIT_VALUE: + pr->autofit_limit_size = g_value_get_uint(value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -610,6 +637,12 @@ case PROP_WINDOW_LIMIT_VALUE: g_value_set_uint(value, pr->window_limit_size); break; + case PROP_AUTOFIT_LIMIT: + g_value_set_boolean(value, pr->autofit_limit); + break; + case PROP_AUTOFIT_LIMIT_VALUE: + g_value_set_uint(value, pr->autofit_limit_size); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -2630,6 +2663,13 @@ h = h * scale + 0.5; if (h > max_h) h = max_h; } + + if (pr->autofit_limit) + { + w = w * pr->autofit_limit_size / 100; + h = h * pr->autofit_limit_size / 100; + } + if (w < 1) w = 1; if (h < 1) h = 1; }
--- a/src/pixbuf-renderer.h Sat Mar 29 10:38:15 2008 +0000 +++ b/src/pixbuf-renderer.h Sat Mar 29 14:59:14 2008 +0000 @@ -86,6 +86,10 @@ gboolean window_limit; gint window_limit_size; + gboolean autofit_limit; + gint autofit_limit_size; + + gint tile_cache_max; /* max mb to use for offscreen buffer */ /*< private >*/
--- a/src/preferences.c Sat Mar 29 10:38:15 2008 +0000 +++ b/src/preferences.c Sat Mar 29 14:59:14 2008 +0000 @@ -81,6 +81,8 @@ static gint limit_window_size_c; static gint zoom_to_fit_expands_c; static gint max_window_size_c; +static gint limit_autofit_size_c; +static gint max_autofit_size_c; static gint progressive_key_scrolling_c; static gint thumb_max_width_c; static gint thumb_max_height_c; @@ -242,6 +244,8 @@ limit_window_size = limit_window_size_c; zoom_to_fit_expands = zoom_to_fit_expands_c; max_window_size = max_window_size_c; + limit_autofit_size = limit_autofit_size_c; + max_autofit_size = max_autofit_size_c; progressive_key_scrolling = progressive_key_scrolling_c; thumb_max_width = thumb_max_width_c; thumb_max_height = thumb_max_height_c; @@ -938,6 +942,14 @@ pref_checkbox_new_int(group, _("Allow enlargement of image for zoom to fit"), zoom_to_fit_expands, &zoom_to_fit_expands_c); + hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); + ct_button = pref_checkbox_new_int(hbox, _("Limit image size when autofitting (%):"), + limit_autofit_size, &limit_autofit_size_c); + spin = pref_spin_new_int(hbox, NULL, NULL, + 10, 150, 1, + max_autofit_size, &max_autofit_size_c); + pref_checkbox_link_sensitivity(ct_button, spin); + zoom_increment_c = zoom_increment; spin = pref_spin_new(group, _("Zoom increment:"), NULL, 0.1, 4.0, 1.0, 1, (double)zoom_increment / 10.0,
--- a/src/rcfile.c Sat Mar 29 10:38:15 2008 +0000 +++ b/src/rcfile.c Sat Mar 29 14:59:14 2008 +0000 @@ -253,6 +253,8 @@ write_bool_option(f, "fit_window_to_image", fit_window); write_bool_option(f, "limit_window_size", limit_window_size); write_int_option(f, "max_window_size", max_window_size); + write_bool_option(f, "limit_autofit_size", limit_autofit_size); + write_int_option(f, "max_autofit_size", max_autofit_size); fprintf(f,"\n"); write_bool_option(f, "progressive_keyboard_scrolling", progressive_key_scrolling); @@ -491,6 +493,10 @@ "limit_window_size", value, limit_window_size); max_window_size = read_int_option(f, option, "max_window_size", value, max_window_size); + limit_autofit_size = read_bool_option(f, option, + "limit_autofit_size", value, limit_autofit_size); + max_autofit_size = read_int_option(f, option, + "max_autofit_size", value, max_autofit_size); progressive_key_scrolling = read_bool_option(f, option, "progressive_keyboard_scrolling", value, progressive_key_scrolling); scroll_reset_method = read_int_option(f, option,