changeset 1038:db720c5a9169

Allow to change image.scroll_reset_method in Preferences > Image.
author zas_
date Thu, 04 Sep 2008 21:38:28 +0000
parents 86148ec8a299
children 9c8d7ba674cf
files src/preferences.c
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/preferences.c	Thu Sep 04 21:19:09 2008 +0000
+++ b/src/preferences.c	Thu Sep 04 21:38:28 2008 +0000
@@ -138,6 +138,12 @@
 		c_options->image.zoom_mode = ZOOM_RESET_NONE;
 }
 
+static void scroll_reset_cb(GtkWidget *widget, gpointer data)
+{
+	if (GTK_TOGGLE_BUTTON (widget)->active)
+		c_options->image.scroll_reset_method = GPOINTER_TO_INT(data);
+}
+
 static void zoom_increment_cb(GtkWidget *spin, gpointer data)
 {
 	c_options->image.zoom_increment = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(spin)) * 10.0 + 0.01);
@@ -236,6 +242,7 @@
 	options->layout.tools_restore_state = c_options->layout.tools_restore_state;
 	options->layout.save_window_positions = c_options->layout.save_window_positions;
 	options->image.zoom_mode = c_options->image.zoom_mode;
+	options->image.scroll_reset_method = c_options->image.scroll_reset_method;
 	options->image.zoom_2pass = c_options->image.zoom_2pass;
 	options->image.fit_window_to_image = c_options->image.fit_window_to_image;
 	options->image.limit_window_size = c_options->image.limit_window_size;
@@ -1032,6 +1039,20 @@
 				      (options->image.zoom_mode == ZOOM_RESET_NONE),
 				      G_CALLBACK(zoom_mode_none_cb), NULL);
 
+	group = pref_group_new(vbox, FALSE, _("Scroll reset method:"), GTK_ORIENTATION_VERTICAL);
+
+	c_options->image.scroll_reset_method = options->image.scroll_reset_method;
+	button = pref_radiobutton_new(group, NULL, _("Top left"),
+				      (options->image.scroll_reset_method == SCROLL_RESET_TOPLEFT),
+				      G_CALLBACK(scroll_reset_cb), GINT_TO_POINTER(SCROLL_RESET_TOPLEFT));
+	button = pref_radiobutton_new(group, button, _("Center"),
+				      (options->image.scroll_reset_method == SCROLL_RESET_CENTER),
+				      G_CALLBACK(scroll_reset_cb), GINT_TO_POINTER(SCROLL_RESET_CENTER));
+	button = pref_radiobutton_new(group, button, _("No change"),
+				      (options->image.scroll_reset_method == SCROLL_RESET_NOCHANGE),
+				      G_CALLBACK(scroll_reset_cb), GINT_TO_POINTER(SCROLL_RESET_NOCHANGE));
+
+
 	group = pref_group_new(vbox, FALSE, _("Appearance"), GTK_ORIENTATION_VERTICAL);
 
 	pref_checkbox_new_int(group, _("Custom border color"),