From: Carlos Garcia Campos Date: Thu, 20 Aug 2009 15:47:36 +0000 (+0200) Subject: [libview] Move get_max_width/height from EvPageCache to EvView X-Git-Tag: EVINCE_2_29_1~97 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=af6e8468fa9a8b26d4ac431b1a92e556a61c9ce7;p=evince.git [libview] Move get_max_width/height from EvPageCache to EvView --- diff --git a/libview/ev-page-cache.c b/libview/ev-page-cache.c index 8257ce42..1bf689ee 100644 --- a/libview/ev-page-cache.c +++ b/libview/ev-page-cache.c @@ -175,40 +175,6 @@ ev_page_cache_get_size (EvPageCache *page_cache, } } -void -ev_page_cache_get_max_width (EvPageCache *page_cache, - gint rotation, - gfloat scale, - gint *width) -{ - double w, h; - - g_return_if_fail (EV_IS_PAGE_CACHE (page_cache)); - - if (!width) - return; - - ev_document_get_max_page_size (page_cache->document, &w, &h); - *width = (rotation == 0 || rotation == 180) ? w * scale : h * scale; -} - -void -ev_page_cache_get_max_height (EvPageCache *page_cache, - gint rotation, - gfloat scale, - gint *height) -{ - double w, h; - - g_return_if_fail (EV_IS_PAGE_CACHE (page_cache)); - - if (!height) - return; - - ev_document_get_max_page_size (page_cache->document, &w, &h); - *height = (rotation == 0 || rotation == 180) ? h * scale : w * scale; -} - #define PAGE_CACHE_STRING "ev-page-cache" EvPageCache * diff --git a/libview/ev-page-cache.h b/libview/ev-page-cache.h index 3d40565e..f3888b40 100644 --- a/libview/ev-page-cache.h +++ b/libview/ev-page-cache.h @@ -41,14 +41,6 @@ void ev_page_cache_get_size (EvPageCache *page_cache, gfloat scale, gint *width, gint *height); -void ev_page_cache_get_max_width (EvPageCache *page_cache, - gint rotation, - gfloat scale, - gint *width); -void ev_page_cache_get_max_height (EvPageCache *page_cache, - gint rotation, - gfloat scale, - gint *height); /* Navigation */ gint ev_page_cache_get_current_page (EvPageCache *page_cache); void ev_page_cache_set_current_page (EvPageCache *page_cache, diff --git a/libview/ev-view.c b/libview/ev-view.c index 6947b951..497da187 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -904,6 +904,25 @@ compute_border (EvView *view, int width, int height, GtkBorder *border) } } +static void +ev_view_get_max_page_size (EvView *view, + gint *max_width, + gint *max_height) +{ + double w, h; + gint width, height; + + ev_document_get_max_page_size (view->document, &w, &h); + + width = (gint)(w * view->scale + 0.5); + height = (gint)(h * view->scale + 0.5); + + if (max_width) + *max_width = (view->rotation == 0 || view->rotation == 180) ? width : height; + if (max_height) + *max_height = (view->rotation == 0 || view->rotation == 180) ? height : width; +} + static void get_page_y_offset (EvView *view, int page, int *y_offset) { @@ -912,8 +931,7 @@ get_page_y_offset (EvView *view, int page, int *y_offset) g_return_if_fail (y_offset != NULL); - ev_page_cache_get_max_width (view->page_cache, view->rotation, view->scale, &max_width); - + ev_view_get_max_page_size (view, &max_width, NULL); compute_border (view, max_width, max_width, &border); if (view->dual_page) { @@ -956,8 +974,7 @@ get_page_extents (EvView *view, gint max_width; gint x, y; - ev_page_cache_get_max_width (view->page_cache, view->rotation, - view->scale, &max_width); + ev_view_get_max_page_size (view, &max_width, NULL); max_width = max_width + border->left + border->right; /* Get the location of the bounding box */ if (view->dual_page) { @@ -2623,8 +2640,7 @@ ev_view_size_request_continuous_dual_page (EvView *view, gint n_pages; GtkBorder border; - ev_page_cache_get_max_width (view->page_cache, view->rotation, - view->scale, &max_width); + ev_view_get_max_page_size (view, &max_width, NULL); compute_border (view, max_width, max_width, &border); n_pages = ev_document_get_n_pages (view->document) + 1; @@ -2650,9 +2666,7 @@ ev_view_size_request_continuous (EvView *view, int n_pages; GtkBorder border; - - ev_page_cache_get_max_width (view->page_cache, view->rotation, - view->scale, &max_width); + ev_view_get_max_page_size (view, &max_width, NULL); n_pages = ev_document_get_n_pages (view->document); compute_border (view, max_width, max_width, &border);