int find_result;
int spacing;
+ int rotation;
double scale;
gboolean continuous;
ev_pixbuf_cache_set_page_range (view->pixbuf_cache,
view->start_page,
view->end_page,
+ view->rotation,
view->scale,
view->selection_info.selections);
}
}
}
-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->rotation, 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->rotation, 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->rotation, zoom, &offset, NULL);
offset += (page + 1) * view->spacing + page * (border.top + border.bottom);
}
/* Get the size of the page */
ev_page_cache_get_size (view->page_cache, page,
+ view->rotation,
view->scale,
&width, &height);
compute_border (view, width, height, border);
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->rotation, &max_width);
max_width = max_width + border->left + border->right;
/* Get the location of the bounding box */
if (view->dual_page) {
if (other_page < ev_page_cache_get_n_pages (view->page_cache)) {
ev_page_cache_get_size (view->page_cache,
other_page,
+ view->rotation,
view->scale,
&width_2, &height_2);
if (width_2 > width)
{
GdkRectangle page_area;
GtkBorder border;
+ double x, y, w, h;
int width, height;
+ ev_page_cache_get_size (view->page_cache, page,
+ view->rotation,
+ 1.0,
+ &width, &height);
+
+ if (view->rotation == 0) {
+ x = doc_rect->x1;
+ y = doc_rect->y1;
+ w = doc_rect->x2 - doc_rect->x1;
+ h = doc_rect->y2 - doc_rect->y1;
+ } else if (view->rotation == 90) {
+ x = width - doc_rect->y2;
+ y = doc_rect->x1;
+ w = doc_rect->y2 - doc_rect->y1;
+ h = doc_rect->x2 - doc_rect->x1;
+ } else if (view->rotation == 180) {
+ x = width - doc_rect->x2;
+ y = height - doc_rect->y2;
+ w = doc_rect->x2 - doc_rect->x1;
+ h = doc_rect->y2 - doc_rect->y1;
+ } else if (view->rotation == 270) {
+ x = doc_rect->y1;
+ y = height - doc_rect->x2;
+ w = doc_rect->y2 - doc_rect->y1;
+ h = doc_rect->x2 - doc_rect->x1;
+ } else {
+ g_assert_not_reached ();
+ }
+
get_page_extents (view, page, &page_area, &border);
- width = doc_rect->x2 - doc_rect->x1;
- height = doc_rect->y2 - doc_rect->y1;
- view_rect->x = floor (doc_rect->x1 * view->scale) + page_area.x;
- view_rect->y = floor (doc_rect->y1 * view->scale) + page_area.y;
- view_rect->width = ceil (width * view->scale);
- view_rect->height = ceil (height * view->scale);
+ view_rect->x = x * view->scale + page_area.x;
+ view_rect->y = y * view->scale + page_area.y;
+ view_rect->width = w * view->scale;
+ view_rect->height = h * view->scale;
}
static void
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->rotation,
+ view->scale, &max_width);
compute_border (view, max_width, max_width, &border);
n_pages = ev_page_cache_get_n_pages (view->page_cache) + 1;
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->rotation,
+ view->scale, &max_width);
n_pages = ev_page_cache_get_n_pages (view->page_cache);
compute_border (view, max_width, max_width, &border);
/* Find the largest of the two. */
ev_page_cache_get_size (view->page_cache,
view->current_page,
+ view->rotation,
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->rotation,
view->scale,
&width_2, &height_2);
if (width_2 > width) {
ev_page_cache_get_size (view->page_cache,
view->current_page,
+ view->rotation,
view->scale,
&width, &height);
compute_border (view, width, height, &border);
selection = find_selection_for_page (view, page);
ev_page_cache_get_size (view->page_cache,
- page, view->scale,
+ page, view->rotation,
+ view->scale,
&width, &height);
/* Render the document itself */
real_page_area = *page_area;
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;
}
}
}
static void
-ev_view_set_orientation (EvView *view,
- EvOrientation orientation)
+ev_view_set_rotation (EvView *view, int rotation)
{
- ev_document_set_orientation (view->document, orientation);
-
- clear_caches (view);
- setup_caches (view);
+ view->rotation = rotation;
+ ev_pixbuf_cache_clear (view->pixbuf_cache);
gtk_widget_queue_resize (GTK_WIDGET (view));
}
void
ev_view_rotate_right (EvView *view)
{
- EvOrientation orientation, new_orientation;
+ int rotation = view->rotation + 90;
- 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;
- } else {
- new_orientation = EV_ORIENTATION_PORTRAIT;
+ if (rotation >= 360) {
+ rotation -= 360;
}
- ev_view_set_orientation (view, new_orientation);
+
+ ev_view_set_rotation (view, rotation);
}
void
ev_view_rotate_left (EvView *view)
{
- EvOrientation orientation, new_orientation;
+ int rotation = view->rotation - 90;
- 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;
- } else {
- new_orientation = EV_ORIENTATION_PORTRAIT;
+ if (rotation < 0) {
+ rotation += 360;
}
- ev_view_set_orientation (view, new_orientation);
+
+ ev_view_set_rotation (view, rotation);
}
static double
ev_page_cache_get_size (view->page_cache,
view->current_page,
+ view->rotation,
1.0,
&doc_width,
&doc_height);
gdouble scale;
ev_page_cache_get_max_width (view->page_cache,
+ view->rotation,
1.0,
&doc_width);
ev_page_cache_get_max_height (view->page_cache,
+ view->rotation,
1.0,
&doc_height);
compute_border (view, doc_width, doc_height, &border);
gdouble scale;
ev_page_cache_get_max_width (view->page_cache,
+ view->rotation,
1.0,
&doc_width);
ev_page_cache_get_max_height (view->page_cache,
+ view->rotation,
1.0,
&doc_height);
compute_border (view, doc_width, doc_height, &border);
/* Find the largest of the two. */
ev_page_cache_get_size (view->page_cache,
view->current_page,
+ view->rotation,
1.0,
&doc_width, &doc_height);
gint width_2, height_2;
ev_page_cache_get_size (view->page_cache,
other_page,
+ view->rotation,
1.0,
&width_2, &height_2);
if (width_2 > doc_width)
ev_page_cache_get_size (view->page_cache,
view->current_page,
+ view->rotation,
1.0,
&doc_width,
&doc_height);
GdkPoint *point;
ev_page_cache_get_size (view->page_cache, i,
+ view->rotation,
1.0, &width, &height);
selection = g_new0 (EvViewSelection, 1);
EvViewSelection *selection;
ev_page_cache_get_size (view->page_cache,
+ view->rotation,
i, 1.0, &width, &height);
selection = g_new0 (EvViewSelection, 1);