X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-view.c;h=e39f34931dc73ef779ee9b9d0af133ac63a447d8;hb=42414e4f59ef90ea80e49214ea6c50b38dd4ba2d;hp=851b5e4d42b08d8772f6974bdf999748370df2e6;hpb=1a362e7a70e9f07efdc601161cecbce3fc061ccb;p=evince.git diff --git a/shell/ev-view.c b/shell/ev-view.c index 851b5e4d..e39f3493 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -46,7 +46,7 @@ enum { PROP_FIND_STATUS, PROP_CONTINUOUS, PROP_DUAL_PAGE, - PROP_FULL_SCREEN, + PROP_FULLSCREEN, PROP_PRESENTATION, PROP_SIZING_MODE, }; @@ -121,11 +121,10 @@ struct _EvView { double scale; GtkBorder border; - gboolean show_border; gboolean continuous; gboolean dual_page; - gboolean full_screen; + gboolean fullscreen; gboolean presentation; EvSizingMode sizing_mode; }; @@ -151,6 +150,10 @@ static void get_bounding_box_size (EvView *view, int *max_height); static void view_update_range_and_current_page (EvView *view); +static void page_changed_cb (EvPageCache *page_cache, + int new_page, + EvView *view); + G_DEFINE_TYPE (EvView, ev_view, GTK_TYPE_WIDGET) @@ -224,13 +227,13 @@ view_set_adjustment_values (EvView *view, static void view_update_range_and_current_page (EvView *view) { - /* Presentation trumps all other modes */ if (view->presentation) { view->start_page = view->current_page; view->end_page = view->current_page; } else if (view->continuous) { GdkRectangle current_area, unused, page_area; + gint current_page; gboolean found = FALSE; int i; @@ -259,6 +262,7 @@ view_update_range_and_current_page (EvView *view) if (! found) { view->start_page = i; found = TRUE; + } view->end_page = i; } else if (found) { @@ -275,6 +279,14 @@ view_update_range_and_current_page (EvView *view) page_area.y += page_area.height + view->spacing; } } + + current_page = ev_page_cache_get_current_page (view->page_cache); + + if (current_page < view->start_page || current_page > view->end_page) { + g_signal_handlers_block_by_func (view->page_cache, page_changed_cb, view); + ev_page_cache_set_current_page (view->page_cache, view->start_page); + g_signal_handlers_unblock_by_func (view->page_cache, page_changed_cb, view); + } } else { if (view->dual_page) { if (view->current_page % 2 == 0) { @@ -294,7 +306,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->scale); + view->scale); } /*** Virtual function implementations ***/ @@ -331,29 +343,130 @@ ev_view_destroy (GtkObject *object) } static void -ev_view_get_offsets (EvView *view, int *x_offset, int *y_offset) +compute_border (EvView *view, int width, int height, GtkBorder *border) { - EvDocument *document = view->document; - GtkWidget *widget = GTK_WIDGET (view); - int width, height, target_width, target_height; + if (view->presentation) { + border->left = 0; + border->right = 0; + border->top = 0; + border->bottom = 0; + } else { + ev_document_misc_get_page_border_size (width, height, border); + } +} - g_return_if_fail (EV_IS_DOCUMENT (document)); +static gboolean +get_page_extents (EvView *view, + gint page, + GdkRectangle *page_area, + GtkBorder *border) +{ + GtkWidget *widget; + int width, height; - ev_page_cache_get_size (view->page_cache, - view->current_page, + 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; - *x_offset = view->spacing; - *y_offset = view->spacing; - target_width = width + view->border.left + - view->border.right + view->spacing * 2; - target_height = height + view->border.top + - view->border.bottom + view->spacing * 2; - *x_offset += MAX (0, (widget->allocation.width - target_width) / 2); - *y_offset += MAX (0, (widget->allocation.height - target_height) / 2); + 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; } +#if 0 static void view_rect_to_doc_rect (EvView *view, GdkRectangle *view_rect, EvRectangle *doc_rect) { @@ -365,30 +478,26 @@ view_rect_to_doc_rect (EvView *view, GdkRectangle *view_rect, EvRectangle *doc_r doc_rect->x2 = doc_rect->x1 + (double) view_rect->width / view->scale; doc_rect->y2 = doc_rect->y1 + (double) view_rect->height / view->scale; } +#endif static void -doc_rect_to_view_rect (EvView *view, EvRectangle *doc_rect, GdkRectangle *view_rect) +doc_rect_to_view_rect (EvView *view, + int page, + EvRectangle *doc_rect, + GdkRectangle *view_rect) { - int x_offset, y_offset; + GdkRectangle page_area; + GtkBorder border; + int width, height; - ev_view_get_offsets (view, &x_offset, &y_offset); - view_rect->x = floor (doc_rect->x1 * view->scale) + x_offset; - view_rect->y = floor (doc_rect->y1 * view->scale) + y_offset; - view_rect->width = ceil (doc_rect->x2 * view->scale) + x_offset - view_rect->x; - view_rect->height = ceil (doc_rect->y2 * view->scale) + y_offset - view_rect->y; -} + get_page_extents (view, page, &page_area, &border); -static void -compute_border (EvView *view, int width, int height, GtkBorder *border) -{ - if (view->show_border) { - ev_document_misc_get_page_border_size (width, height, border); - } else { - border->left = 0; - border->right = 0; - border->top = 0; - border->bottom = 0; - } + 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); } static void @@ -629,7 +738,10 @@ ev_view_realize (GtkWidget *widget) gdk_window_show (view->bin_window); widget->style = gtk_style_attach (widget->style, view->bin_window); - gdk_window_set_background (view->bin_window, &widget->style->mid[widget->state]); + if (view->presentation) + gdk_window_set_background (view->bin_window, &widget->style->black); + else + gdk_window_set_background (view->bin_window, &widget->style->mid [GTK_STATE_NORMAL]); if (view->document) { /* We can't get page size without a target, so we have to @@ -653,7 +765,36 @@ ev_view_unrealize (GtkWidget *widget) GTK_WIDGET_CLASS (ev_view_parent_class)->unrealize (widget); } -#if 0 +static gboolean +ev_view_scroll_event (GtkWidget *widget, GdkEventScroll *event) +{ + EvView *view = EV_VIEW (widget); + + if ((event->state & GDK_CONTROL_MASK) != 0) { + + ev_view_set_sizing_mode (view, EV_SIZING_FREE); + + if ((event->direction == GDK_SCROLL_UP || + event->direction == GDK_SCROLL_LEFT) && + ev_view_can_zoom_in (view)) { + ev_view_zoom_in (view); + } else if (ev_view_can_zoom_out (view)) { + ev_view_zoom_out (view); + } + + return TRUE; + } + + if ((event->state & GDK_SHIFT_MASK) != 0) { + if (event->direction == GDK_SCROLL_UP) + event->direction = GDK_SCROLL_LEFT; + if (event->direction == GDK_SCROLL_DOWN) + event->direction = GDK_SCROLL_RIGHT; + } + + return FALSE; +} + static guint32 ev_gdk_color_to_rgb (const GdkColor *color) { @@ -702,7 +843,7 @@ draw_rubberband (GtkWidget *widget, GdkWindow *window, static void -highlight_find_results (EvView *view) +highlight_find_results (EvView *view, int page) { EvDocumentFind *find; int i, results = 0; @@ -711,7 +852,7 @@ highlight_find_results (EvView *view) find = EV_DOCUMENT_FIND (view->document); - results = ev_document_find_get_n_results (find, view->current_page); + results = ev_document_find_get_n_results (find, page); for (i = 0; i < results; i++) { EvRectangle rectangle; @@ -719,126 +860,13 @@ highlight_find_results (EvView *view) guchar alpha; alpha = (i == view->find_result) ? 0x90 : 0x20; - ev_document_find_get_result (find, view->current_page, + ev_document_find_get_result (find, page, i, &rectangle); - doc_rect_to_view_rect (view, &rectangle, &view_rectangle); + doc_rect_to_view_rect (view, page, &rectangle, &view_rectangle); draw_rubberband (GTK_WIDGET (view), view->bin_window, &view_rectangle, alpha); } } -#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; -} static void draw_one_page (EvView *view, @@ -862,10 +890,9 @@ draw_one_page (EvView *view, page, view->scale, &width, &height); - if (view->show_border) - ev_document_misc_paint_one_page (view->bin_window, - GTK_WIDGET (view), - page_area, border); + ev_document_misc_paint_one_page (view->bin_window, + GTK_WIDGET (view), + page_area, border); /* Render the document itself */ real_page_area = *page_area; @@ -888,7 +915,6 @@ draw_one_page (EvView *view, scaled_image = gdk_pixbuf_scale_simple (current_pixbuf, width, height, GDK_INTERP_NEAREST); - if (scaled_image) { gdk_draw_pixbuf (view->bin_window, GTK_WIDGET (view)->style->fg_gc[GTK_STATE_NORMAL], @@ -918,14 +944,15 @@ ev_view_bin_expose (EvView *view, if (! get_page_extents (view, i, &page_area, &border)) continue; + draw_one_page (view, i, &page_area, &border, &(event->area)); - } -#if 0 - if (EV_IS_DOCUMENT_FIND (view->document)) { - highlight_find_results (view); + if (EV_IS_DOCUMENT_FIND (view->document)) { + highlight_find_results (view, i); + } } +#if 0 if (view->has_selection) { GdkRectangle rubberband; @@ -955,6 +982,7 @@ ev_view_expose_event (GtkWidget *widget, void ev_view_select_all (EvView *ev_view) { +#if 0 GtkWidget *widget = GTK_WIDGET (ev_view); GdkRectangle selection; int width, height; @@ -977,6 +1005,7 @@ ev_view_select_all (EvView *ev_view) view_rect_to_doc_rect (ev_view, &selection, &ev_view->selection); gtk_widget_queue_draw (widget); +#endif } void @@ -1257,7 +1286,9 @@ ev_view_motion_notify_event (GtkWidget *widget, selection.y = MIN (view->selection_start.y, event->y); selection.width = ABS (view->selection_start.x - event->x) + 1; selection.height = ABS (view->selection_start.y - event->y) + 1; +#if 0 view_rect_to_doc_rect (view, &selection, &view->selection); +#endif gtk_widget_queue_draw (widget); } else if (view->document) { @@ -1524,8 +1555,8 @@ ev_view_set_property (GObject *object, case PROP_DUAL_PAGE: ev_view_set_dual_page (view, g_value_get_boolean (value)); break; - case PROP_FULL_SCREEN: - ev_view_set_full_screen (view, g_value_get_boolean (value)); + case PROP_FULLSCREEN: + ev_view_set_fullscreen (view, g_value_get_boolean (value)); break; case PROP_PRESENTATION: ev_view_set_presentation (view, g_value_get_boolean (value)); @@ -1560,8 +1591,8 @@ ev_view_get_property (GObject *object, case PROP_DUAL_PAGE: g_value_set_boolean (value, view->dual_page); break; - case PROP_FULL_SCREEN: - g_value_set_boolean (value, view->full_screen); + case PROP_FULLSCREEN: + g_value_set_boolean (value, view->fullscreen); break; case PROP_PRESENTATION: g_value_set_boolean (value, view->presentation); @@ -1594,6 +1625,7 @@ ev_view_class_init (EvViewClass *class) widget_class->size_allocate = ev_view_size_allocate; widget_class->realize = ev_view_realize; widget_class->unrealize = ev_view_unrealize; + widget_class->scroll_event = ev_view_scroll_event; gtk_object_class->destroy = ev_view_destroy; class->set_scroll_adjustments = ev_view_set_scroll_adjustments; @@ -1651,10 +1683,10 @@ ev_view_class_init (EvViewClass *class) FALSE, G_PARAM_READWRITE)); g_object_class_install_property (object_class, - PROP_FULL_SCREEN, - g_param_spec_boolean ("full-screen", + PROP_FULLSCREEN, + g_param_spec_boolean ("fullscreen", "Full Screen", - "Draw page in a full-screen fashion", + "Draw page in a fullscreen fashion", FALSE, G_PARAM_READWRITE)); g_object_class_install_property (object_class, @@ -1698,12 +1730,11 @@ ev_view_init (EvView *view) view->current_page = 0; view->pressed_button = -1; view->cursor = EV_VIEW_CURSOR_NORMAL; - view->show_border = TRUE; view->continuous = TRUE; view->dual_page = FALSE; view->presentation = FALSE; - view->full_screen = FALSE; + view->fullscreen = FALSE; view->sizing_mode = EV_SIZING_FIT_WIDTH; } @@ -1712,15 +1743,12 @@ update_find_status_message (EvView *view) { char *message; -// ev_document_doc_mutex_lock (); if (view->current_page == view->find_page) { int results; -// ev_document_doc_mutex_lock (); results = ev_document_find_get_n_results (EV_DOCUMENT_FIND (view->document), view->current_page); -// ev_document_doc_mutex_unlock (); /* TRANS: Sometimes this could be better translated as "%d hit(s) on this page". Therefore this string contains plural cases. */ @@ -1790,18 +1818,19 @@ jump_to_find_result (EvView *view) EvRectangle rect; GdkRectangle view_rect; int n_results; + int page = view->find_page; ev_document_doc_mutex_lock (); - n_results = ev_document_find_get_n_results (find, view->current_page); + n_results = ev_document_find_get_n_results (find, page); ev_document_doc_mutex_unlock (); if (n_results > view->find_result) { ev_document_doc_mutex_lock (); ev_document_find_get_result - (find, view->current_page, view->find_result, &rect); + (find, page, view->find_result, &rect); ev_document_doc_mutex_unlock (); - doc_rect_to_view_rect (view, &rect, &view_rect); + doc_rect_to_view_rect (view, page, &rect, &view_rect); ensure_rectangle_is_visible (view, &view_rect); } } @@ -1822,7 +1851,6 @@ jump_to_find_page (EvView *view) page = page - n_pages; } - // ev_document_doc_mutex_lock (); has_results = ev_document_find_page_has_results (EV_DOCUMENT_FIND (view->document), page); if (has_results == -1) { @@ -1962,10 +1990,10 @@ ev_view_set_document (EvView *view, } #define EPSILON 0.0000001 -static void -ev_view_zoom (EvView *view, - double factor, - gboolean relative) +void +ev_view_set_zoom (EvView *view, + double factor, + gboolean relative) { double scale; @@ -1982,6 +2010,11 @@ ev_view_zoom (EvView *view, gtk_widget_queue_resize (GTK_WIDGET (view)); } +double +ev_view_get_zoom (EvView *view) +{ + return view->scale; +} void ev_view_set_continuous (EvView *view, @@ -2020,19 +2053,27 @@ ev_view_set_dual_page (EvView *view, } void -ev_view_set_full_screen (EvView *view, - gboolean full_screen) +ev_view_set_fullscreen (EvView *view, + gboolean fullscreen) { g_return_if_fail (EV_IS_VIEW (view)); - full_screen = full_screen != FALSE; + fullscreen = fullscreen != FALSE; - if (view->full_screen != full_screen) { - view->full_screen = full_screen; + if (view->fullscreen != fullscreen) { + view->fullscreen = fullscreen; gtk_widget_queue_resize (GTK_WIDGET (view)); } - g_object_notify (G_OBJECT (view), "full-screen"); + g_object_notify (G_OBJECT (view), "fullscreen"); +} + +gboolean +ev_view_get_fullscreen (EvView *view) +{ + g_return_val_if_fail (EV_IS_VIEW (view), FALSE); + + return view->fullscreen; } void @@ -2043,28 +2084,54 @@ ev_view_set_presentation (EvView *view, presentation = presentation != FALSE; - if (view->presentation != presentation) { - view->presentation = presentation; - gtk_widget_queue_resize (GTK_WIDGET (view)); + if (view->presentation == presentation) + return; + + view->presentation = presentation; + gtk_widget_queue_resize (GTK_WIDGET (view)); + if (GTK_WIDGET_REALIZED (view)) { + if (view->presentation) + gdk_window_set_background (view->bin_window, + >K_WIDGET (view)->style->black); + else + gdk_window_set_background (view->bin_window, + >K_WIDGET (view)->style->mid [GTK_STATE_NORMAL]); } + g_object_notify (G_OBJECT (view), "presentation"); } +gboolean +ev_view_get_presentation (EvView *view) +{ + g_return_val_if_fail (EV_IS_VIEW (view), FALSE); + + return view->presentation; +} + void ev_view_set_sizing_mode (EvView *view, EvSizingMode sizing_mode) { g_return_if_fail (EV_IS_VIEW (view)); - if (view->sizing_mode != sizing_mode) { - view->sizing_mode = sizing_mode; - gtk_widget_queue_resize (GTK_WIDGET (view)); - } + if (view->sizing_mode == sizing_mode) + return; + view->sizing_mode = sizing_mode; + gtk_widget_queue_resize (GTK_WIDGET (view)); + g_object_notify (G_OBJECT (view), "sizing-mode"); } +EvSizingMode +ev_view_get_sizing_mode (EvView *view) +{ + g_return_val_if_fail (EV_IS_VIEW (view), EV_SIZING_FREE); + + return view->sizing_mode; +} gboolean ev_view_can_zoom_in (EvView *view) @@ -2083,7 +2150,7 @@ ev_view_zoom_in (EvView *view) { g_return_if_fail (view->sizing_mode == EV_SIZING_FREE); - ev_view_zoom (view, ZOOM_IN_FACTOR, TRUE); + ev_view_set_zoom (view, ZOOM_IN_FACTOR, TRUE); } void @@ -2091,7 +2158,7 @@ ev_view_zoom_out (EvView *view) { g_return_if_fail (view->sizing_mode == EV_SIZING_FREE); - ev_view_zoom (view, ZOOM_OUT_FACTOR, TRUE); + ev_view_set_zoom (view, ZOOM_OUT_FACTOR, TRUE); } @@ -2135,6 +2202,24 @@ zoom_for_size_best_fit (int doc_width, return MIN (w_scale, h_scale); } + +static void +ev_view_zoom_for_size_presentation (EvView *view, + int width, + int height) +{ + int doc_width, doc_height; + gdouble scale; + + ev_page_cache_get_size (view->page_cache, + view->current_page, + 1.0, + &doc_width, + &doc_height); + scale = zoom_for_size_best_fit (doc_width, doc_height, width, height, 0, 0); + ev_view_set_zoom (view, scale, FALSE); +} + static void ev_view_zoom_for_size_continuous_and_dual_page (EvView *view, int width, @@ -2156,7 +2241,7 @@ ev_view_zoom_for_size_continuous_and_dual_page (EvView *view, doc_width = doc_width * 2; width -= (2 * (border.left + border.right) + 3 * view->spacing); - height -= (border.top + border.bottom + 2 * view->spacing); + height -= (border.top + border.bottom + 2 * view->spacing - 1); /* FIXME: We really need to calculate the overall height here, not the * page height. We assume there's always a vertical scrollbar for @@ -2168,7 +2253,7 @@ ev_view_zoom_for_size_continuous_and_dual_page (EvView *view, else g_assert_not_reached (); - ev_view_zoom (view, scale, FALSE); + ev_view_set_zoom (view, scale, FALSE); } static void @@ -2191,7 +2276,7 @@ ev_view_zoom_for_size_continuous (EvView *view, compute_border (view, doc_width, doc_height, &border); width -= (border.left + border.right + 2 * view->spacing); - height -= (border.top + border.bottom + 2 * view->spacing); + height -= (border.top + border.bottom + 2 * view->spacing - 1); /* FIXME: We really need to calculate the overall height here, not the * page height. We assume there's always a vertical scrollbar for @@ -2203,7 +2288,7 @@ ev_view_zoom_for_size_continuous (EvView *view, else g_assert_not_reached (); - ev_view_zoom (view, scale, FALSE); + ev_view_set_zoom (view, scale, FALSE); } static void @@ -2250,7 +2335,7 @@ ev_view_zoom_for_size_dual_page (EvView *view, else g_assert_not_reached (); - ev_view_zoom (view, scale, FALSE); + ev_view_set_zoom (view, scale, FALSE); } static void @@ -2282,14 +2367,14 @@ ev_view_zoom_for_size_single_page (EvView *view, else g_assert_not_reached (); - ev_view_zoom (view, scale, FALSE); + ev_view_set_zoom (view, scale, FALSE); } void ev_view_zoom_normal (EvView *view) { - ev_view_zoom (view, 1.0, FALSE); + ev_view_set_zoom (view, 1.0, FALSE); } void @@ -2307,7 +2392,9 @@ ev_view_set_zoom_for_size (EvView *view, if (view->document == NULL) return; - if (view->continuous && view->dual_page) + if (view->presentation) + ev_view_zoom_for_size_presentation (view, width, height); + else if (view->continuous && view->dual_page) ev_view_zoom_for_size_continuous_and_dual_page (view, width, height, vsb_width, hsb_height); else if (view->continuous) ev_view_zoom_for_size_continuous (view, width, height, vsb_width, hsb_height); @@ -2411,6 +2498,7 @@ ev_view_find_previous (EvView *view) gtk_widget_queue_draw (GTK_WIDGET (view)); } } + void ev_view_hide_cursor (EvView *view) {