-#endif
-
-
-static gboolean
-get_page_extents (EvView *view,
- gint page,
- GdkRectangle *page_area,
- GtkBorder *border)
-{
- GtkWidget *widget;
- int width, height;
-
- widget = GTK_WIDGET (view);
-
- /* Quick sanity check */
- if (view->presentation) {
- if (view->current_page != page)
- return FALSE;
- } else if (view->continuous) {
- if (page < view->start_page ||
- page > view->end_page)
- return FALSE;
- } else if (view->dual_page) {
- if (ABS (page - view->current_page) > 1)
- return FALSE;
- } else {
- if (view->current_page != page)
- return FALSE;
- }
-
- /* Get the size of the page */
- ev_page_cache_get_size (view->page_cache, page,
- view->scale,
- &width, &height);
- compute_border (view, width, height, border);
- page_area->width = width + border->left + border->right;
- page_area->height = height + border->top + border->bottom;
-
- if (view->presentation) {
- page_area->x = (MAX (0, widget->allocation.width - width))/2;
- page_area->y = (MAX (0, widget->allocation.height - height))/2;
- } else if (view->continuous) {
- gint max_width, max_height;
- gint x, y;
-
- get_bounding_box_size (view, &max_width, &max_height);
- /* Get the location of the bounding box */
- if (view->dual_page) {
- x = view->spacing + (page % 2) * (max_width + view->spacing);
- y = view->spacing + (page / 2) * (max_height + view->spacing);
- x = x + MAX (0, widget->allocation.width - (max_width * 2 + view->spacing * 3))/2;
- } else {
- x = view->spacing;
- y = view->spacing + page * (max_height + view->spacing);
- x = x + MAX (0, widget->allocation.width - (max_width + view->spacing * 2))/2;
- }
- page_area->x = x;
- page_area->y = y;
- } else {
- gint x, y;
- if (view->dual_page) {
- gint width_2, height_2;
- gint max_width = width;
- gint max_height = height;
- GtkBorder overall_border;
- gint other_page;
-
- other_page = page ^ 1;
-
- /* First, we get the bounding box of the two pages */
- if (other_page < ev_page_cache_get_n_pages (view->page_cache)) {
- ev_page_cache_get_size (view->page_cache,
- page + 1,
- view->scale,
- &width_2, &height_2);
- if (width_2 > width)
- max_width = width_2;
- if (height_2 > height)
- max_height = height_2;
- }
- compute_border (view, max_width, max_height, &overall_border);
-
- /* Find the offsets */
- x = view->spacing;
- y = view->spacing;
-
- /* Adjust for being the left or right page */
- if (page % 2 == 0)
- x = x + max_width - width;
- else
- x = x + (max_width + overall_border.left + overall_border.right) + view->spacing;
-
- y = y + (max_height - height)/2;
-
- /* Adjust for extra allocation */
- x = x + MAX (0, widget->allocation.width -
- ((max_width + overall_border.left + overall_border.right) * 2 + view->spacing * 3))/2;
- y = y + MAX (0, widget->allocation.height - (height + view->spacing * 2))/2;
- } else {
- x = view->spacing;
- y = view->spacing;
-
- /* Adjust for extra allocation */
- x = x + MAX (0, widget->allocation.width - (width + view->spacing * 2))/2;
- y = y + MAX (0, widget->allocation.height - (height + view->spacing * 2))/2;
- }
-
- page_area->x = x;
- page_area->y = y;
- }
-
- return TRUE;
-}