/* image */
struct {
- gint exif_rotate_enable;
- gint scroll_reset_method;
- gint fit_window_to_image;
- gint limit_window_size;
+ gboolean exif_rotate_enable;
+ guint scroll_reset_method;
+ gboolean fit_window_to_image;
+ gboolean limit_window_size;
gint max_window_size;
- gint limit_autofit_size;
+ gboolean limit_autofit_size;
gint max_autofit_size;
gint tile_cache_max; /* in megabytes */
gint image_cache_max; /* in megabytes */
gint dither_quality;
- gint enable_read_ahead;
+ gboolean enable_read_ahead;
gint zoom_mode;
- gint zoom_2pass;
- gint zoom_to_fit_allow_expand;
+ gboolean zoom_2pass;
+ gboolean zoom_to_fit_allow_expand;
gint zoom_quality;
gint zoom_increment; /* 10 is 1.0, 5 is 0.05, 20 is 2.0, etc. */
#include "bar_exif.h"
#include "editors.h"
#include "filefilter.h"
+#include "pixbuf-renderer.h"
#include "secure_save.h"
#include "slideshow.h"
#include "ui_fileops.h"
return TRUE;
}
+static gboolean read_uint_option_clamp(FILE *f, gchar *option, gchar *label, gchar *value, guint *n, guint min, guint max)
+{
+ gboolean ret;
+
+ ret = read_uint_option(f, option, label, value, n);
+ if (ret) *n = CLAMP(*n, min, max);
+
+ return ret;
+}
+
+
static gboolean read_int_option_clamp(FILE *f, gchar *option, gchar *label, gchar *value, gint *n, gint min, gint max)
{
gboolean ret;
WRITE_INT(image.max_window_size);
WRITE_BOOL(image.limit_autofit_size);
WRITE_INT(image.max_autofit_size);
- WRITE_INT(image.scroll_reset_method);
+ WRITE_UINT(image.scroll_reset_method);
WRITE_INT(image.tile_cache_max);
WRITE_INT(image.image_cache_max);
WRITE_INT(image.dither_quality);
#define READ_INT(_name_) if (read_int_option(f, option, #_name_, value, &options->_name_)) continue;
#define READ_UINT(_name_) if (read_uint_option(f, option, #_name_, value, &options->_name_)) continue;
#define READ_INT_CLAMP(_name_, _min_, _max_) if (read_int_option_clamp(f, option, #_name_, value, &options->_name_, _min_, _max_)) continue;
+#define READ_UINT_CLAMP(_name_, _min_, _max_) if (read_uint_option_clamp(f, option, #_name_, value, &options->_name_, _min_, _max_)) continue;
#define READ_INT_UNIT(_name_, _unit_) if (read_int_unit_option(f, option, #_name_, value, &options->_name_, _unit_)) continue;
#define READ_CHAR(_name_) if (read_char_option(f, option, #_name_, value_all, &options->_name_)) continue;
#define READ_COLOR(_name_) if (read_color_option(f, option, #_name_, value, &options->_name_)) continue;
READ_INT(image.max_window_size);
READ_BOOL(image.limit_autofit_size);
READ_INT(image.max_autofit_size);
- READ_INT(image.scroll_reset_method);
+ READ_UINT_CLAMP(image.scroll_reset_method, 0, PR_SCROLL_RESET_COUNT - 1);
READ_INT(image.tile_cache_max);
READ_INT(image.image_cache_max);
READ_INT_CLAMP(image.zoom_quality, GDK_INTERP_NEAREST, GDK_INTERP_HYPER);