]> www.fi.muni.cz Git - evince.git/commitdiff
[libview] Move get_dual_even_left from EvPageCache to EvView
authorCarlos Garcia Campos <carlosgc@gnome.org>
Thu, 20 Aug 2009 15:33:15 +0000 (17:33 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Tue, 15 Sep 2009 13:56:02 +0000 (15:56 +0200)
libview/ev-page-cache.c
libview/ev-page-cache.h
libview/ev-view.c

index d6fa538b04dcbb781d2dc6a2b8265ecb3967bd19..8257ce42763b7aeeddab270238cb3c74e5663d4e 100644 (file)
@@ -209,14 +209,6 @@ ev_page_cache_get_max_height (EvPageCache   *page_cache,
        *height = (rotation == 0 || rotation == 180) ? h * scale : w * scale;
 }
 
-gboolean
-ev_page_cache_get_dual_even_left (EvPageCache *page_cache)
-{
-       g_return_val_if_fail (EV_IS_PAGE_CACHE (page_cache), 0);
-
-       return (ev_document_get_n_pages (page_cache->document) > 2);
-}
-
 #define PAGE_CACHE_STRING "ev-page-cache"
 
 EvPageCache *
index 4d952e1efa3bbd2e102fae4a27da651ed75facfd..3d40565e311e16e3d28ab68ac84435045a5fb0f3 100644 (file)
@@ -49,8 +49,6 @@ void           ev_page_cache_get_max_height      (EvPageCache   *page_cache,
                                                  gint           rotation,
                                                  gfloat         scale,
                                                  gint          *height);
-gboolean       ev_page_cache_get_dual_even_left  (EvPageCache *page_cache);
-
 /* Navigation */
 gint           ev_page_cache_get_current_page    (EvPageCache *page_cache);
 void           ev_page_cache_set_current_page    (EvPageCache *page_cache,
index c7743a4e1d87fc4b8c3687d17021fbed32e32933..6947b951fcb630c18c7a073dc1bb5ce304a3eb57 100644 (file)
@@ -129,6 +129,7 @@ static void       doc_rect_to_view_rect                      (EvView
                                                              int                 page,
                                                              EvRectangle        *doc_rect,
                                                              GdkRectangle       *view_rect);
+static gboolean   get_dual_even_left                         (EvView             *view);
 static void       find_page_at_location                      (EvView             *view,
                                                              gdouble             x,
                                                              gdouble             y,
@@ -653,7 +654,7 @@ view_update_range_and_current_page (EvView *view)
                }
 
        } else if (view->dual_page) {
-               if (view->current_page % 2 == ev_page_cache_get_dual_even_left (view->page_cache)) {
+               if (view->current_page % 2 == get_dual_even_left (view)) {
                        view->start_page = view->current_page;
                        if (view->current_page + 1 < ev_document_get_n_pages (view->document))
                                view->end_page = view->start_page + 1;
@@ -917,7 +918,8 @@ get_page_y_offset (EvView *view, int page, int *y_offset)
 
        if (view->dual_page) {
                ev_view_get_height_to_page (view, page, NULL, &offset);
-               offset += ((page + ev_page_cache_get_dual_even_left (view->page_cache)) / 2 + 1) * view->spacing + ((page + ev_page_cache_get_dual_even_left (view->page_cache)) / 2 ) * (border.top + border.bottom);
+               offset += ((page + get_dual_even_left (view)) / 2 + 1) * view->spacing +
+                       ((page + get_dual_even_left (view)) / 2 ) * (border.top + border.bottom);
        } else {
                ev_view_get_height_to_page (view, page, &offset, NULL);
                offset += (page + 1) * view->spacing + page * (border.top + border.bottom);
@@ -959,9 +961,9 @@ get_page_extents (EvView       *view,
                max_width = max_width + border->left + border->right;
                /* Get the location of the bounding box */
                if (view->dual_page) {
-                       x = view->spacing + ((page % 2 == ev_page_cache_get_dual_even_left (view->page_cache)) ? 0 : 1) * (max_width + view->spacing);
+                       x = view->spacing + ((page % 2 == get_dual_even_left (view)) ? 0 : 1) * (max_width + view->spacing);
                        x = x + MAX (0, widget->allocation.width - (max_width * 2 + view->spacing * 3)) / 2;
-                       if (page % 2 == ev_page_cache_get_dual_even_left (view->page_cache))
+                       if (page % 2 == get_dual_even_left (view))
                                x = x + (max_width - width - border->left - border->right);
                } else {
                        x = view->spacing;
@@ -981,7 +983,7 @@ get_page_extents (EvView       *view,
                        GtkBorder overall_border;
                        gint other_page;
 
-                       other_page = (page % 2 == ev_page_cache_get_dual_even_left (view->page_cache)) ? page + 1: page - 1;
+                       other_page = (page % 2 == get_dual_even_left (view)) ? page + 1: page - 1;
 
                        /* First, we get the bounding box of the two pages */
                        if (other_page < ev_document_get_n_pages (view->document)
@@ -1003,7 +1005,7 @@ get_page_extents (EvView       *view,
                        y = view->spacing;
 
                        /* Adjust for being the left or right page */
-                       if (page % 2 == ev_page_cache_get_dual_even_left (view->page_cache))
+                       if (page % 2 == get_dual_even_left (view))
                                x = x + max_width - width;
                        else
                                x = x + (max_width + overall_border.left + overall_border.right) + view->spacing;
@@ -1156,6 +1158,12 @@ doc_rect_to_view_rect (EvView       *view,
        view_rect->height = h * view->scale;
 }
 
+static gboolean
+get_dual_even_left (EvView *view)
+{
+       return (ev_document_get_n_pages (view->document) > 2);
+}
+
 static void
 find_page_at_location (EvView  *view,
                       gdouble  x,