+2006-02-01 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
+
+ * shell/ev-page-cache.c: (build_height_to_page),
+ (ev_page_cache_new), (ev_page_cache_get_max_label_chars),
+ (ev_page_cache_get_dual_even_left):
+ * shell/ev-page-cache.h:
+ * shell/ev-view.c: (view_update_range_and_current_page),
+ (get_page_y_offset), (get_page_extents):
+
+ Place even pages to the left if document has less then
+ two pages. Fix for the bug #328856.
+
2006-01-31 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
* thumbnailer/evince-thumbnailer-comics.schemas.in:
gint max_label_chars;
gboolean has_labels;
gboolean uniform;
+ gboolean dual_even_left;
double uniform_width;
double uniform_height;
}
}
- if (DUAL_EVEN_LEFT && !page_cache->uniform) {
+ if (page_cache->dual_even_left && !page_cache->uniform) {
if (!swap) {
saved_height = page_cache->size_cache [0].height;
} else {
} else {
saved_height = 0;
}
- for (i = DUAL_EVEN_LEFT; i < page_cache->n_pages + 2; i += 2) {
+ for (i = page_cache->dual_even_left; i < page_cache->n_pages + 2; i += 2) {
if (page_cache->uniform) {
if (!swap) {
uniform_height = page_cache->uniform_height;
} else {
uniform_height = page_cache->uniform_width;
}
- page_cache->dual_height_to_page [i] = ((i + DUAL_EVEN_LEFT) / 2) * uniform_height;
+ page_cache->dual_height_to_page [i] = ((i + page_cache->dual_even_left) / 2) * uniform_height;
if (i + 1 < page_cache->n_pages + 2)
- page_cache->dual_height_to_page [i + 1] = ((i + DUAL_EVEN_LEFT) / 2) * uniform_height;
+ page_cache->dual_height_to_page [i + 1] = ((i + page_cache->dual_even_left) / 2) * uniform_height;
} else {
if (i + 1 < page_cache->n_pages) {
if (!swap) {
page_cache->uniform = TRUE;
page_cache->has_labels = FALSE;
page_cache->n_pages = ev_document_get_n_pages (document);
+ page_cache->dual_even_left = (page_cache->n_pages > 2);
page_cache->page_labels = g_new0 (char *, page_cache->n_pages);
page_cache->max_width = 0;
page_cache->max_height = 0;
return page_cache->max_label_chars;
}
+gboolean
+ev_page_cache_get_dual_even_left (EvPageCache *page_cache)
+{
+ g_return_val_if_fail (EV_IS_PAGE_CACHE (page_cache), 0);
+
+ return page_cache->dual_even_left;
+}
+
gchar *
ev_page_cache_get_page_label (EvPageCache *page_cache,
gint page)
#include <gtk/gtkwidget.h>
#include "ev-document.h"
-#define DUAL_EVEN_LEFT 1
-
G_BEGIN_DECLS
#define EV_TYPE_PAGE_CACHE (ev_page_cache_get_type ())
#define EV_PAGE_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EV_TYPE_PAGE_CACHE, EvPageCache))
gboolean ev_page_cache_has_nonnumeric_page_labels (EvPageCache *page_cache);
const EvDocumentInfo *ev_page_cache_get_info (EvPageCache *page_cache);
+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,
EvPageCache *ev_page_cache_get (EvDocument *document);
+
G_END_DECLS
#endif /* __EV_PAGE_CACHE_H__ */
} else {
if (view->dual_page) {
- if (view->current_page % 2 == DUAL_EVEN_LEFT) {
+ if (view->current_page % 2 == ev_page_cache_get_dual_even_left (view->page_cache)) {
view->start_page = view->current_page;
if (view->current_page + 1 < ev_page_cache_get_n_pages (view->page_cache))
view->end_page = view->start_page + 1;
if (view->dual_page) {
ev_page_cache_get_height_to_page (view->page_cache, page,
view->rotation, zoom, NULL, &offset);
- offset += ((page + DUAL_EVEN_LEFT) / 2 + 1) * view->spacing + ((page + DUAL_EVEN_LEFT) / 2 ) * (border.top + border.bottom);
+ 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);
} else {
ev_page_cache_get_height_to_page (view->page_cache, page,
view->rotation, zoom, &offset, NULL);
max_width = max_width + border->left + border->right;
/* Get the location of the bounding box */
if (view->dual_page) {
- x = view->spacing + ((page % 2 == DUAL_EVEN_LEFT) ? 0 : 1) * (max_width + view->spacing);
+ x = view->spacing + ((page % 2 == ev_page_cache_get_dual_even_left (view->page_cache)) ? 0 : 1) * (max_width + view->spacing);
x = x + MAX (0, widget->allocation.width - (max_width * 2 + view->spacing * 3)) / 2;
- if (page % 2 == DUAL_EVEN_LEFT)
+ if (page % 2 == ev_page_cache_get_dual_even_left (view->page_cache))
x = x + (max_width - width - border->left - border->right);
} else {
x = view->spacing;
GtkBorder overall_border;
gint other_page;
- other_page = (page % 2 == DUAL_EVEN_LEFT) ? page + 1: page - 1;
+ other_page = (page % 2 == ev_page_cache_get_dual_even_left (view->page_cache)) ? page + 1: page - 1;
/* First, we get the bounding box of the two pages */
if (other_page < ev_page_cache_get_n_pages (view->page_cache)
y = view->spacing;
/* Adjust for being the left or right page */
- if (page % 2 == DUAL_EVEN_LEFT)
+ if (page % 2 == ev_page_cache_get_dual_even_left (view->page_cache))
x = x + max_width - width;
else
x = x + (max_width + overall_border.left + overall_border.right) + view->spacing;