]> www.fi.muni.cz Git - evince.git/commitdiff
Patch from Nickolay Shmyrev to to scroll to second page on page_changed if
authorJonathan Blandford <jrb@redhat.com>
Fri, 20 May 2005 05:29:43 +0000 (05:29 +0000)
committerJonathan Blandford <jrb@src.gnome.org>
Fri, 20 May 2005 05:29:43 +0000 (05:29 +0000)
Fri May 20 01:27:01 2005  Jonathan Blandford  <jrb@redhat.com>

        * shell/ev-view.c: Patch from Nickolay Shmyrev to to scroll to
        second page on page_changed if possible, #304669

ChangeLog
shell/ev-view.c

index ac328e3b9a29601b854b9cc89028f4e1ff6529c6..358d6487cacecc3deb7b98c8c6e6a3c2479cbae9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri May 20 01:27:01 2005  Jonathan Blandford  <jrb@redhat.com>
+
+       * shell/ev-view.c: Patch from Nickolay Shmyrev to to scroll to
+       second page on page_changed if possible, #304669
+
 Fri May 20 01:07:15 2005  Jonathan Blandford  <jrb@redhat.com>
 
        * shell/ev-view.c (view_update_adjustments): Use gdk_window_scroll
index 3da8d138fed932334dc6f52eb2786c79c60a0d92..04dfd73fd65e9d933d47e56f2eaa5c5c522024e3 100644 (file)
@@ -537,7 +537,7 @@ view_scroll_to_page (EvView *view, gint new_page)
        EvPageCache *page_cache = view->page_cache;
        int old_width, old_height;
        int new_width, new_height;
-       int max_height, n_rows;
+       int max_height, max_width, n_rows;
 
        ev_page_cache_get_size (page_cache,
                                view->current_page,
@@ -556,11 +556,11 @@ view_scroll_to_page (EvView *view, gint new_page)
        else
                gtk_widget_queue_draw (GTK_WIDGET (view));
        
-       if (view->continuous) {
+       get_bounding_box_size (view, &max_width, &max_height);
+       
+       if (view->continuous && view->vadjustment) {
                
                n_rows = view->dual_page ? new_page / 2 : new_page;
-               
-               get_bounding_box_size (view, NULL, &max_height);
 
                gtk_adjustment_clamp_page(view->vadjustment,
                                          (max_height + view->spacing) * n_rows, 
@@ -570,6 +570,20 @@ view_scroll_to_page (EvView *view, gint new_page)
                gtk_adjustment_set_value (view->vadjustment,
                                          view->vadjustment->lower);
        }
+       
+       if (view->dual_page && view->hadjustment) {
+               if (new_page % 2 == 0) {
+                       gtk_adjustment_set_value (view->hadjustment,
+                                                 view->hadjustment->lower);
+               } else {
+                       gtk_adjustment_clamp_page (view->hadjustment,
+                                                  view->hadjustment->lower + 
+                                                  max_width + view->spacing, 
+                                                  view->hadjustment->lower +
+                                                  max_width + view->spacing +
+                                                  view->hadjustment->page_size);
+               }
+       }
 
        view->current_page = new_page;
        view_update_range_and_current_page (view);