X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=shell%2Fev-view.c;h=09539990f65a072191bc2455a5b780de1dddb63a;hb=646b17b09453da438218e6b86a2b8b830e5b73c0;hp=cf79ded0ba8b20f263cf308903e628a7e56ea7e6;hpb=c942b6d86230a5525b00206ca2a7acabe2e0b729;p=evince.git diff --git a/shell/ev-view.c b/shell/ev-view.c index cf79ded0..09539990 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -149,6 +149,7 @@ struct _EvView { int find_result; int spacing; + EvOrientation orientation; double scale; gboolean continuous; @@ -531,6 +532,7 @@ view_update_range_and_current_page (EvView *view) ev_pixbuf_cache_set_page_range (view->pixbuf_cache, view->start_page, view->end_page, + view->orientation, view->scale, view->selection_info.selections); } @@ -705,6 +707,8 @@ ensure_rectangle_is_visible (EvView *view, GdkRectangle *rect) GtkAdjustment *adjustment; int value; + view->pending_scroll = SCROLL_TO_KEEP_POSITION; + adjustment = view->vadjustment; if (rect->y < adjustment->value) { @@ -745,25 +749,25 @@ compute_border (EvView *view, int width, int height, GtkBorder *border) } } -static void get_page_y_offset (EvView *view, - int page, - double zoom, - int *y_offset) +static void +get_page_y_offset (EvView *view, int page, double zoom, int *y_offset) { int max_width, offset; GtkBorder border; g_return_if_fail (y_offset != NULL); - ev_page_cache_get_max_width (view->page_cache, zoom, &max_width); + ev_page_cache_get_max_width (view->page_cache, view->orientation, zoom, &max_width); compute_border (view, max_width, max_width, &border); if (view->dual_page) { - ev_page_cache_get_height_to_page (view->page_cache, page, zoom, NULL, &offset); + ev_page_cache_get_height_to_page (view->page_cache, page, + view->orientation, zoom, NULL, &offset); offset += (page / 2 + 1) * view->spacing + (page / 2) * (border.top + border.bottom); } else { - ev_page_cache_get_height_to_page (view->page_cache, page, zoom, &offset, NULL); + ev_page_cache_get_height_to_page (view->page_cache, page, + view->orientation, zoom, &offset, NULL); offset += (page + 1) * view->spacing + page * (border.top + border.bottom); } @@ -784,6 +788,7 @@ get_page_extents (EvView *view, /* Get the size of the page */ ev_page_cache_get_size (view->page_cache, page, + view->orientation, view->scale, &width, &height); compute_border (view, width, height, border); @@ -797,7 +802,8 @@ get_page_extents (EvView *view, gint max_width; gint x, y; - ev_page_cache_get_max_width (view->page_cache, view->scale, &max_width); + ev_page_cache_get_max_width (view->page_cache, view->scale, + view->orientation, &max_width); max_width = max_width + border->left + border->right; /* Get the location of the bounding box */ if (view->dual_page) { @@ -829,6 +835,7 @@ get_page_extents (EvView *view, if (other_page < ev_page_cache_get_n_pages (view->page_cache)) { ev_page_cache_get_size (view->page_cache, other_page, + view->orientation, view->scale, &width_2, &height_2); if (width_2 > width) @@ -1060,7 +1067,8 @@ ev_view_size_request_continuous_dual_page (EvView *view, gint n_pages; GtkBorder border; - ev_page_cache_get_max_width (view->page_cache, view->scale, &max_width); + ev_page_cache_get_max_width (view->page_cache, view->orientation, + view->scale, &max_width); compute_border (view, max_width, max_width, &border); n_pages = ev_page_cache_get_n_pages (view->page_cache) + 1; @@ -1087,7 +1095,8 @@ ev_view_size_request_continuous (EvView *view, GtkBorder border; - ev_page_cache_get_max_width (view->page_cache, view->scale, &max_width); + ev_page_cache_get_max_width (view->page_cache, view->orientation, + view->scale, &max_width); n_pages = ev_page_cache_get_n_pages (view->page_cache); compute_border (view, max_width, max_width, &border); @@ -1114,12 +1123,14 @@ ev_view_size_request_dual_page (EvView *view, /* Find the largest of the two. */ ev_page_cache_get_size (view->page_cache, view->current_page, + view->orientation, view->scale, &width, &height); if (view->current_page + 1 < ev_page_cache_get_n_pages (view->page_cache)) { gint width_2, height_2; ev_page_cache_get_size (view->page_cache, view->current_page + 1, + view->orientation, view->scale, &width_2, &height_2); if (width_2 > width) { @@ -1151,6 +1162,7 @@ ev_view_size_request_single_page (EvView *view, ev_page_cache_get_size (view->page_cache, view->current_page, + view->orientation, view->scale, &width, &height); compute_border (view, width, height, &border); @@ -1603,7 +1615,8 @@ draw_one_page (EvView *view, selection = find_selection_for_page (view, page); ev_page_cache_get_size (view->page_cache, - page, view->scale, + page, view->orientation, + view->scale, &width, &height); /* Render the document itself */ real_page_area = *page_area; @@ -2039,8 +2052,9 @@ clear_caches (EvView *view) view->pixbuf_cache = NULL; } - if (view->document) { - ev_page_cache_clear (view->document); + if (view->page_cache) { + g_object_unref (view->page_cache); + view->page_cache = NULL; } } @@ -2288,10 +2302,7 @@ static void ev_view_set_orientation (EvView *view, EvOrientation orientation) { - ev_document_set_orientation (view->document, orientation); - - clear_caches (view); - setup_caches (view); + view->orientation = orientation; gtk_widget_queue_resize (GTK_WIDGET (view)); } @@ -2299,37 +2310,37 @@ ev_view_set_orientation (EvView *view, void ev_view_rotate_right (EvView *view) { - EvOrientation orientation, new_orientation; + EvOrientation orientation; - orientation = ev_document_get_orientation (view->document); - if (orientation == EV_ORIENTATION_PORTRAIT) { - new_orientation = EV_ORIENTATION_LANDSCAPE; - } else if (orientation == EV_ORIENTATION_LANDSCAPE) { - new_orientation = EV_ORIENTATION_UPSIDEDOWN; - } else if (orientation == EV_ORIENTATION_UPSIDEDOWN) { - new_orientation = EV_ORIENTATION_SEASCAPE; + if (view->orientation == EV_ORIENTATION_PORTRAIT) { + orientation = EV_ORIENTATION_LANDSCAPE; + } else if (view->orientation == EV_ORIENTATION_LANDSCAPE) { + orientation = EV_ORIENTATION_UPSIDEDOWN; + } else if (view->orientation == EV_ORIENTATION_UPSIDEDOWN) { + orientation = EV_ORIENTATION_SEASCAPE; } else { - new_orientation = EV_ORIENTATION_PORTRAIT; + orientation = EV_ORIENTATION_PORTRAIT; } - ev_view_set_orientation (view, new_orientation); + + ev_view_set_orientation (view, orientation); } void ev_view_rotate_left (EvView *view) { - EvOrientation orientation, new_orientation; + EvOrientation orientation; - orientation = ev_document_get_orientation (view->document); - if (orientation == EV_ORIENTATION_PORTRAIT) { - new_orientation = EV_ORIENTATION_SEASCAPE; - } else if (orientation == EV_ORIENTATION_SEASCAPE) { - new_orientation = EV_ORIENTATION_UPSIDEDOWN; - } else if (orientation == EV_ORIENTATION_UPSIDEDOWN) { - new_orientation = EV_ORIENTATION_LANDSCAPE; + if (view->orientation == EV_ORIENTATION_PORTRAIT) { + orientation = EV_ORIENTATION_SEASCAPE; + } else if (view->orientation == EV_ORIENTATION_SEASCAPE) { + orientation = EV_ORIENTATION_UPSIDEDOWN; + } else if (view->orientation == EV_ORIENTATION_UPSIDEDOWN) { + orientation = EV_ORIENTATION_LANDSCAPE; } else { - new_orientation = EV_ORIENTATION_PORTRAIT; + orientation = EV_ORIENTATION_PORTRAIT; } - ev_view_set_orientation (view, new_orientation); + + ev_view_set_orientation (view, orientation); } static double @@ -2382,6 +2393,7 @@ ev_view_zoom_for_size_presentation (EvView *view, ev_page_cache_get_size (view->page_cache, view->current_page, + view->orientation, 1.0, &doc_width, &doc_height); @@ -2401,9 +2413,11 @@ ev_view_zoom_for_size_continuous_and_dual_page (EvView *view, gdouble scale; ev_page_cache_get_max_width (view->page_cache, + view->orientation, 1.0, &doc_width); ev_page_cache_get_max_height (view->page_cache, + view->orientation, 1.0, &doc_height); compute_border (view, doc_width, doc_height, &border); @@ -2437,9 +2451,11 @@ ev_view_zoom_for_size_continuous (EvView *view, gdouble scale; ev_page_cache_get_max_width (view->page_cache, + view->orientation, 1.0, &doc_width); ev_page_cache_get_max_height (view->page_cache, + view->orientation, 1.0, &doc_height); compute_border (view, doc_width, doc_height, &border); @@ -2477,6 +2493,7 @@ ev_view_zoom_for_size_dual_page (EvView *view, /* Find the largest of the two. */ ev_page_cache_get_size (view->page_cache, view->current_page, + view->orientation, 1.0, &doc_width, &doc_height); @@ -2484,6 +2501,7 @@ ev_view_zoom_for_size_dual_page (EvView *view, gint width_2, height_2; ev_page_cache_get_size (view->page_cache, other_page, + view->orientation, 1.0, &width_2, &height_2); if (width_2 > doc_width) @@ -2520,6 +2538,7 @@ ev_view_zoom_for_size_single_page (EvView *view, ev_page_cache_get_size (view->page_cache, view->current_page, + view->orientation, 1.0, &doc_width, &doc_height); @@ -2864,6 +2883,7 @@ compute_new_selection_text (EvView *view, GdkPoint *point; ev_page_cache_get_size (view->page_cache, i, + view->orientation, 1.0, &width, &height); selection = g_new0 (EvViewSelection, 1); @@ -2961,6 +2981,7 @@ ev_view_select_all (EvView *view) EvViewSelection *selection; ev_page_cache_get_size (view->page_cache, + view->orientation, i, 1.0, &width, &height); selection = g_new0 (EvViewSelection, 1);