/* make some sanity check assertions */
if (! page_cache->uniform)
g_assert (page_cache->size_cache != NULL);
- if (page_cache->uniform)
+ if (page_cache->uniform && page_cache->n_pages > 0)
g_assert (page_cache->uniform_width > 0 && page_cache->uniform_height > 0);
ev_document_doc_mutex_unlock ();
return FALSE;
}
-void
-ev_page_cache_set_link (EvPageCache *page_cache,
- EvLink *link)
-{
- g_return_if_fail (EV_IS_PAGE_CACHE (page_cache));
- g_return_if_fail (EV_IS_LINK (link));
-
- ev_page_cache_set_current_page (page_cache, ev_link_get_page (link));
-}
-
const char *
ev_page_cache_get_title (EvPageCache *page_cache)
{
gint *width,
gint *height)
{
+ double w, h;
+
g_return_if_fail (EV_IS_PAGE_CACHE (page_cache));
g_return_if_fail (page >= 0 && page < page_cache->n_pages);
if (page_cache->uniform) {
- if (width)
- *width = page_cache->uniform_width;
- if (height)
- *height = page_cache->uniform_height;
+ w = page_cache->uniform_width;
+ h = page_cache->uniform_height;
} else {
EvPageCacheInfo *info;
info = &(page_cache->size_cache [page]);
- if (width)
- *width = info->width;
- if (height)
- *height = info->height;
+ w = info->width;
+ h = info->height;
}
+ w = w * scale + 0.5;
+ h = h * scale + 0.5;
+
if (rotation == 0 || rotation == 180) {
- if (width)
- *width = (int) ((*width) * scale + 0.5);
- if (height)
- *height = (int) ((*height) * scale + 0.5);
+ if (width) *width = (int)w;
+ if (height) *height = (int)h;
} else {
- if (width)
- *width = (int) ((*height) * scale + 0.5);
- if (height)
- *height = (int) ((*width) * scale + 0.5);
+ if (width) *width = (int)h;
+ if (height) *height = (int)w;
}
}
return page_cache->page_info;
}
-
-gboolean
-ev_page_cache_next_page (EvPageCache *page_cache)
-{
- g_return_val_if_fail (EV_IS_PAGE_CACHE (page_cache), FALSE);
-
- if (page_cache->current_page >= page_cache->n_pages - 1)
- return FALSE;
-
- ev_page_cache_set_current_page (page_cache, page_cache->current_page + 1);
- return TRUE;
-
-}
-
-gboolean
-ev_page_cache_prev_page (EvPageCache *page_cache)
-{
- g_return_val_if_fail (EV_IS_PAGE_CACHE (page_cache), FALSE);
-
- if (page_cache->current_page <= 0)
- return FALSE;
-
- ev_page_cache_set_current_page (page_cache, page_cache->current_page - 1);
- return TRUE;
-}
-
#define PAGE_CACHE_STRING "ev-page-cache"
EvPageCache *