From: Nickolay V. Shmyrev Date: Fri, 6 Jan 2006 10:02:13 +0000 (+0000) Subject: Two page scrolling with Space and PageUp in dual mode. Second fix for the X-Git-Tag: EVINCE_0_5_0~16 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=d8d90e4a79195019fc19882729b8fda0be5ba563;p=evince.git Two page scrolling with Space and PageUp in dual mode. Second fix for the * shell/ev-view.c: (ev_view_scroll), (ev_view_previous_page), (ev_view_can_previous_page), (ev_view_can_next_page): * shell/ev-view.h: * shell/ev-window.c: (update_action_sensitivity): Two page scrolling with Space and PageUp in dual mode. Second fix for the bug #316608. --- diff --git a/ChangeLog b/ChangeLog index d3bd7431..d72ffc72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-01-06 Nickolay V. Shmyrev + + * shell/ev-view.c: (ev_view_scroll), (ev_view_previous_page), + (ev_view_can_previous_page), (ev_view_can_next_page): + * shell/ev-view.h: + * shell/ev-window.c: (update_action_sensitivity): + + Two page scrolling with Space and PageUp in dual mode. Second fix + for the bug #316608. + 2006-01-05 Nickolay V. Shmyrev * shell/ev-view.c: (scroll_to_current_page): diff --git a/shell/ev-view.c b/shell/ev-view.c index ebbd7848..d35d4fc4 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -578,7 +578,7 @@ ev_view_scroll (EvView *view, /* At the top of a page, assign the upper bound limit of previous page */ } else if (value == (adjustment->lower)) { value = adjustment->upper - adjustment->page_size; - ev_page_cache_set_current_page (view->page_cache, view->current_page - 1); + ev_view_previous_page (view); /* Jump to the top */ } else { value = MAX (value - increment, adjustment->lower); @@ -591,7 +591,7 @@ ev_view_scroll (EvView *view, /* At the bottom of a page, assign the lower bound limit of next page */ } else if (value == (adjustment->upper - adjustment->page_size)) { value = 0; - ev_page_cache_set_current_page (view->page_cache, view->current_page + 1); + ev_view_next_page (view); /* Jump to the bottom */ } else { value = MIN (value + increment, adjustment->upper - adjustment->page_size); @@ -3961,6 +3961,31 @@ ev_view_previous_page (EvView *view) } } +gboolean +ev_view_can_previous_page (EvView *view) +{ + int page; + + g_return_val_if_fail (EV_IS_VIEW (view), FALSE); + + page = ev_page_cache_get_current_page (view->page_cache); + page = ev_view_get_dual_page (view) ? page - 2 : page - 1; + + return (page >=0); +} + +gboolean ev_view_can_next_page (EvView *view) +{ + int page; + + g_return_val_if_fail (EV_IS_VIEW (view), FALSE); + + page = ev_page_cache_get_current_page (view->page_cache); + page = ev_view_get_dual_page (view) ? page + 2 : page + 1; + + return (page < ev_page_cache_get_n_pages (view->page_cache)); +} + /*** Enum description for usage in signal ***/ GType diff --git a/shell/ev-view.h b/shell/ev-view.h index 0378f285..85692e86 100644 --- a/shell/ev-view.h +++ b/shell/ev-view.h @@ -127,6 +127,8 @@ void ev_view_goto_link (EvView *view, EvLink *link); gboolean ev_view_next_page (EvView *view); gboolean ev_view_previous_page (EvView *view); +gboolean ev_view_can_next_page (EvView *view); +gboolean ev_view_can_previous_page (EvView *view); G_END_DECLS diff --git a/shell/ev-window.c b/shell/ev-window.c index 25b8a20d..1d6d4ef2 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -311,8 +311,8 @@ update_action_sensitivity (EvWindow *ev_window) /* Go menu */ if (document) { - set_action_sensitive (ev_window, "GoPreviousPage", page > 0); - set_action_sensitive (ev_window, "GoNextPage", page < n_pages - 1); + set_action_sensitive (ev_window, "GoPreviousPage", ev_view_can_previous_page (view)); + set_action_sensitive (ev_window, "GoNextPage", ev_view_can_next_page (view)); set_action_sensitive (ev_window, "GoFirstPage", page > 0); set_action_sensitive (ev_window, "GoLastPage", page < n_pages - 1); } else {