Mercurial > geeqie
diff src/pixbuf-renderer.c @ 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 | e213fb025621 |
line wrap: on
line diff
--- 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; }