]> www.fi.muni.cz Git - evince.git/blobdiff - libview/ev-view.c
Unref document after unreffing pixbuf_cache.
[evince.git] / libview / ev-view.c
index f9c2e3a1d83b2e1e200321f96358ff3050300a15..735ad1349e48d035c55fa74618994343325c7d23 100644 (file)
@@ -35,6 +35,7 @@
 #include "ev-document-misc.h"
 #include "ev-document-transition.h"
 #include "ev-pixbuf-cache.h"
+#include "ev-page-cache.h"
 #include "ev-transition-animation.h"
 #include "ev-view-marshal.h"
 #include "ev-document-annotations.h"
 
 enum {
        PROP_0,
-       PROP_CONTINUOUS,
-       PROP_DUAL_PAGE,
-       PROP_FULLSCREEN,
        PROP_PRESENTATION,
-       PROP_SIZING_MODE,
-       PROP_ZOOM,
-       PROP_ROTATION,
-       PROP_HAS_SELECTION,
+       PROP_HAS_SELECTION
 };
 
 enum {
@@ -725,15 +720,18 @@ view_update_range_and_current_page (EvView *view)
        if (start != view->start_page || end != view->end_page) {
                gint i;
 
-               for (i = start; i < view->start_page; i++) {
+               for (i = start; i < view->start_page && start != -1; i++) {
                        hide_annotation_windows (view, i);
                }
 
-               for (i = end; i > view->end_page; i--) {
+               for (i = end; i > view->end_page && end != -1; i--) {
                        hide_annotation_windows (view, i);
                }
        }
 
+       ev_page_cache_set_page_range (view->page_cache,
+                                     view->start_page,
+                                     view->end_page);
        ev_pixbuf_cache_set_page_range (view->pixbuf_cache,
                                        view->start_page,
                                        view->end_page,
@@ -829,7 +827,7 @@ compute_scroll_increment (EvView        *view,
 
        page = scroll == GTK_SCROLL_PAGE_BACKWARD ? view->start_page : view->end_page;
 
-       text_region = ev_pixbuf_cache_get_text_mapping (view->pixbuf_cache, page);
+       text_region = ev_page_cache_get_text_mapping (view->page_cache, page);
        if (!text_region || gdk_region_empty (text_region))
                return adjustment->page_size;
 
@@ -1379,7 +1377,7 @@ location_in_text (EvView  *view,
        if (page == -1)
                return FALSE;
        
-       region = ev_pixbuf_cache_get_text_mapping (view->pixbuf_cache, page);
+       region = ev_page_cache_get_text_mapping (view->page_cache, page);
 
        if (region)
                return gdk_region_point_in (region, x_offset / view->scale, y_offset / view->scale);
@@ -1514,7 +1512,7 @@ ev_view_get_link_at_location (EvView  *view,
        if (!get_doc_point_from_location (view, x, y, &page, &x_new, &y_new))
                return NULL;
 
-       link_mapping = ev_pixbuf_cache_get_link_mapping (view->pixbuf_cache, page);
+       link_mapping = ev_page_cache_get_link_mapping (view->page_cache, page);
 
        if (link_mapping)
                return ev_mapping_list_get_data (link_mapping, x_new, y_new);
@@ -1932,7 +1930,7 @@ ev_view_get_image_at_location (EvView  *view,
        if (!get_doc_point_from_location (view, x, y, &page, &x_new, &y_new))
                return NULL;
 
-       image_mapping = ev_pixbuf_cache_get_image_mapping (view->pixbuf_cache, page);
+       image_mapping = ev_page_cache_get_image_mapping (view->page_cache, page);
 
        if (image_mapping)
                return ev_mapping_list_get_data (image_mapping, x_new, y_new);
@@ -1956,7 +1954,7 @@ ev_view_get_form_field_at_location (EvView  *view,
        if (!get_doc_point_from_location (view, x, y, &page, &x_new, &y_new))
                return NULL;
 
-       forms_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache, page);
+       forms_mapping = ev_page_cache_get_form_field_mapping (view->page_cache, page);
 
        if (forms_mapping)
                return ev_mapping_list_get_data (forms_mapping, x_new, y_new);
@@ -1971,8 +1969,8 @@ ev_view_form_field_get_region (EvView      *view,
        GdkRectangle view_area;
        GList       *forms_mapping;
 
-       forms_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
-                                                               field->page->index);
+       forms_mapping = ev_page_cache_get_form_field_mapping (view->page_cache,
+                                                             field->page->index);
        ev_view_get_area_from_mapping (view, field->page->index,
                                       forms_mapping,
                                       field, &view_area);
@@ -2023,8 +2021,8 @@ ev_view_form_field_button_create_widget (EvView      *view,
                        /* For radio buttons and checkbox buttons that are in a set
                         * we need to update also the region for the current selected item
                         */
-                       forms_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
-                                                                               field->page->index);
+                       forms_mapping = ev_page_cache_get_form_field_mapping (view->page_cache,
+                                                                             field->page->index);
                        for (l = forms_mapping; l; l = g_list_next (l)) {
                                EvFormField *button = ((EvMapping *)(l->data))->data;
                                GdkRegion   *button_region;
@@ -2407,7 +2405,8 @@ ev_view_handle_form_field (EvView      *view,
                                g_object_ref (field),
                                (GDestroyNotify)g_object_unref);
 
-       form_field_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache, field->page->index);
+       form_field_mapping = ev_page_cache_get_form_field_mapping (view->page_cache,
+                                                                  field->page->index);
        ev_view_get_area_from_mapping (view, field->page->index,
                                       form_field_mapping,
                                       field, &view_area);
@@ -2631,7 +2630,7 @@ show_annotation_windows (EvView *view,
 
        parent = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
 
-       annots = ev_pixbuf_cache_get_annots_mapping (view->pixbuf_cache, page);
+       annots = ev_page_cache_get_annot_mapping (view->page_cache, page);
 
        for (l = annots; l && l->data; l = g_list_next (l)) {
                EvAnnotation      *annot;
@@ -2696,7 +2695,7 @@ hide_annotation_windows (EvView *view,
 {
        GList *annots, *l;
 
-       annots = ev_pixbuf_cache_get_annots_mapping (view->pixbuf_cache, page);
+       annots = ev_page_cache_get_annot_mapping (view->page_cache, page);
 
        for (l = annots; l && l->data; l = g_list_next (l)) {
                EvAnnotation *annot;
@@ -2728,7 +2727,7 @@ ev_view_get_annotation_at_location (EvView  *view,
        if (!get_doc_point_from_location (view, x, y, &page, &x_new, &y_new))
                return NULL;
 
-       annotations_mapping = ev_pixbuf_cache_get_annots_mapping (view->pixbuf_cache, page);
+       annotations_mapping = ev_page_cache_get_annot_mapping (view->page_cache, page);
 
        if (annotations_mapping)
                return ev_mapping_list_get_data (annotations_mapping, x_new, y_new);
@@ -2784,25 +2783,28 @@ static void
 ev_view_size_request_continuous_dual_page (EvView         *view,
                                           GtkRequisition *requisition)
 {
-       int max_width;
        gint n_pages;
-       GtkBorder border;
-
-       ev_view_get_max_page_size (view, &max_width, NULL);
-       compute_border (view, max_width, max_width, &border);
 
        n_pages = ev_document_get_n_pages (view->document) + 1;
-
-       requisition->width = (max_width + border.left + border.right) * 2 + (view->spacing * 3);
        get_page_y_offset (view, n_pages, &requisition->height);
 
-       if (view->sizing_mode == EV_SIZING_FIT_WIDTH) {
-               requisition->width = 1;
-       } else if (view->sizing_mode == EV_SIZING_BEST_FIT) {
-               requisition->width = 1;
-               /* FIXME: This could actually be set on one page docs or docs
-                * with a strange aspect ratio. */
-               /* requisition->height = 1;*/
+       switch (view->sizing_mode) {
+               case EV_SIZING_FIT_WIDTH:
+               case EV_SIZING_BEST_FIT:
+                       requisition->width = 1;
+
+                       break;
+               case EV_SIZING_FREE: {
+                       gint max_width;
+                       GtkBorder border;
+
+                       ev_view_get_max_page_size (view, &max_width, NULL);
+                       compute_border (view, max_width, max_width, &border);
+                       requisition->width = (max_width + border.left + border.right) * 2 + (view->spacing * 3);
+               }
+                       break;
+               default:
+                       g_assert_not_reached ();
        }
 }
 
@@ -2810,24 +2812,28 @@ static void
 ev_view_size_request_continuous (EvView         *view,
                                 GtkRequisition *requisition)
 {
-       int max_width;
-       int n_pages;
-       GtkBorder border;
+       gint n_pages;
 
-       ev_view_get_max_page_size (view, &max_width, NULL);
        n_pages = ev_document_get_n_pages (view->document);
-       compute_border (view, max_width, max_width, &border);
-
-       requisition->width = max_width + (view->spacing * 2) + border.left + border.right;
        get_page_y_offset (view, n_pages, &requisition->height);
 
-       if (view->sizing_mode == EV_SIZING_FIT_WIDTH) {
-               requisition->width = 1;
-       } else if (view->sizing_mode == EV_SIZING_BEST_FIT) {
-               requisition->width = 1;
-               /* FIXME: This could actually be set on one page docs or docs
-                * with a strange aspect ratio. */
-               /* requisition->height = 1;*/
+       switch (view->sizing_mode) {
+               case EV_SIZING_FIT_WIDTH:
+               case EV_SIZING_BEST_FIT:
+                       requisition->width = 1;
+
+                       break;
+               case EV_SIZING_FREE: {
+                       gint max_width;
+                       GtkBorder border;
+
+                       ev_view_get_max_page_size (view, &max_width, NULL);
+                       compute_border (view, max_width, max_width, &border);
+                       requisition->width = max_width + (view->spacing * 2) + border.left + border.right;
+               }
+                       break;
+               default:
+                       g_assert_not_reached ();
        }
 }
 
@@ -2838,6 +2844,13 @@ ev_view_size_request_dual_page (EvView         *view,
        GtkBorder border;
        gint width, height;
 
+       if (view->sizing_mode == EV_SIZING_BEST_FIT) {
+               requisition->width = 1;
+               requisition->height = 1;
+
+               return;
+       }
+
        /* Find the largest of the two. */
        ev_view_get_page_size (view,
                               view->current_page,
@@ -2854,17 +2867,9 @@ ev_view_size_request_dual_page (EvView         *view,
        }
        compute_border (view, width, height, &border);
 
-       requisition->width = ((width + border.left + border.right) * 2) +
-               (view->spacing * 3);
-       requisition->height = (height + border.top + border.bottom) +
-               (view->spacing * 2);
-
-       if (view->sizing_mode == EV_SIZING_FIT_WIDTH) {
-               requisition->width = 1;
-       } else if (view->sizing_mode == EV_SIZING_BEST_FIT) {
-               requisition->width = 1;
-               requisition->height = 1;
-       }
+       requisition->width = view->sizing_mode == EV_SIZING_FIT_WIDTH ? 1 :
+               ((width + border.left + border.right) * 2) + (view->spacing * 3);
+       requisition->height = (height + border.top + border.bottom) + (view->spacing * 2);
 }
 
 static void
@@ -2874,19 +2879,19 @@ ev_view_size_request_single_page (EvView         *view,
        GtkBorder border;
        gint width, height;
 
+       if (view->sizing_mode == EV_SIZING_BEST_FIT) {
+               requisition->width = 1;
+               requisition->height = 1;
+
+               return;
+       }
+
        ev_view_get_page_size (view, view->current_page, &width, &height);
        compute_border (view, width, height, &border);
 
-       requisition->width = width + border.left + border.right + (2 * view->spacing);
+       requisition->width = view->sizing_mode == EV_SIZING_FIT_WIDTH ? 1 :
+               width + border.left + border.right + (2 * view->spacing);
        requisition->height = height + border.top + border.bottom + (2 * view->spacing);
-
-       if (view->sizing_mode == EV_SIZING_FIT_WIDTH) {
-               requisition->width = 1;
-               requisition->height = height + border.top + border.bottom + (2 * view->spacing);
-       } else if (view->sizing_mode == EV_SIZING_BEST_FIT) {
-               requisition->width = 1;
-               requisition->height = 1;
-       }
 }
 
 static void
@@ -2959,8 +2964,8 @@ ev_view_size_allocate (GtkWidget      *widget,
                if (!field)
                        continue;
 
-               form_field_mapping = ev_pixbuf_cache_get_form_field_mapping (view->pixbuf_cache,
-                                                                            field->page->index);
+               form_field_mapping = ev_page_cache_get_form_field_mapping (view->page_cache,
+                                                                          field->page->index);
                ev_view_get_area_from_mapping (view, field->page->index,
                                               form_field_mapping,
                                               field, &view_area);
@@ -3214,7 +3219,7 @@ ev_view_expose_event (GtkWidget      *widget,
                return FALSE;
 
        cr = gdk_cairo_create (view->layout.bin_window);
-       
+
        for (i = view->start_page; i >= 0 && i <= view->end_page; i++) {
                GdkRectangle page_area;
                GtkBorder border;
@@ -3299,7 +3304,7 @@ get_link_area (EvView       *view,
        
        find_page_at_location (view, x, y, &page, &x_offset, &y_offset);
        
-       link_mapping = ev_pixbuf_cache_get_link_mapping (view->pixbuf_cache, page);
+       link_mapping = ev_page_cache_get_link_mapping (view->page_cache, page);
        ev_view_get_area_from_mapping (view, page,
                                       link_mapping,
                                       link, area);
@@ -3312,7 +3317,7 @@ get_annot_area (EvView       *view,
               EvAnnotation *annot,
               GdkRectangle *area)
 {
-       GList *annots_mapping;
+       GList *annot_mapping;
        gint   page;
        gint   x_offset = 0, y_offset = 0;
 
@@ -3321,9 +3326,9 @@ get_annot_area (EvView       *view,
 
        find_page_at_location (view, x, y, &page, &x_offset, &y_offset);
 
-       annots_mapping = ev_pixbuf_cache_get_annots_mapping (view->pixbuf_cache, page);
+       annot_mapping = ev_page_cache_get_annot_mapping (view->page_cache, page);
        ev_view_get_area_from_mapping (view, page,
-                                      annots_mapping,
+                                      annot_mapping,
                                       annot, area);
 }
 
@@ -4549,14 +4554,19 @@ ev_view_destroy (GtkObject *object)
                view->model = NULL;
        }
 
+       if (view->pixbuf_cache) {
+               g_object_unref (view->pixbuf_cache);
+               view->pixbuf_cache = NULL;
+       }
+
        if (view->document) {
                g_object_unref (view->document);
                view->document = NULL;
        }
 
-       if (view->pixbuf_cache) {
-               g_object_unref (view->pixbuf_cache);
-               view->pixbuf_cache = NULL;
+       if (view->page_cache) {
+               g_object_unref (view->page_cache);
+               view->page_cache = NULL;
        }
 
        if (view->goto_window) {
@@ -4613,27 +4623,9 @@ ev_view_set_property (GObject      *object,
        EvView *view = EV_VIEW (object);
 
        switch (prop_id) {
-               case PROP_CONTINUOUS:
-                       ev_view_set_continuous (view, g_value_get_boolean (value));
-                       break;
-               case PROP_DUAL_PAGE:
-                       ev_view_set_dual_page (view, g_value_get_boolean (value));
-                       break;
-               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));
                        break;
-               case PROP_SIZING_MODE:
-                       ev_view_set_sizing_mode (view, g_value_get_enum (value));
-                       break;
-               case PROP_ZOOM:
-                       ev_view_set_zoom (view, g_value_get_double (value));
-                       break;
-               case PROP_ROTATION:
-                       ev_view_set_rotation (view, g_value_get_int (value));
-                       break;
                default:
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        }
@@ -4679,27 +4671,9 @@ ev_view_get_property (GObject *object,
        EvView *view = EV_VIEW (object);
 
        switch (prop_id) {
-               case PROP_CONTINUOUS:
-                       g_value_set_boolean (value, view->continuous);
-                       break;
-               case PROP_DUAL_PAGE:
-                       g_value_set_boolean (value, view->dual_page);
-                       break;
-               case PROP_FULLSCREEN:
-                       g_value_set_boolean (value, view->fullscreen);
-                       break;
                case PROP_PRESENTATION:
                        g_value_set_boolean (value, view->presentation);
                        break;
-               case PROP_SIZING_MODE:
-                       g_value_set_enum (value, view->sizing_mode);
-                       break;
-               case PROP_ZOOM:
-                       g_value_set_double (value, view->scale);
-                       break;
-               case PROP_ROTATION:
-                       g_value_set_int (value, view->rotation);
-                       break;
                case PROP_HAS_SELECTION:
                        g_value_set_boolean (value,
                                             view->selection_info.selections != NULL);
@@ -4783,28 +4757,6 @@ ev_view_class_init (EvViewClass *class)
                         G_TYPE_OBJECT);
 
 
-       g_object_class_install_property (object_class,
-                                        PROP_CONTINUOUS,
-                                        g_param_spec_boolean ("continuous",
-                                                              "Continuous",
-                                                              "Continuous scrolling mode",
-                                                              TRUE,
-                                                              G_PARAM_READWRITE));
-
-       g_object_class_install_property (object_class,
-                                        PROP_DUAL_PAGE,
-                                        g_param_spec_boolean ("dual-page",
-                                                              "Dual Page",
-                                                              "Two pages visible at once",
-                                                              FALSE,
-                                                              G_PARAM_READWRITE));
-       g_object_class_install_property (object_class,
-                                        PROP_FULLSCREEN,
-                                        g_param_spec_boolean ("fullscreen",
-                                                              "Full Screen",
-                                                              "Draw page in a fullscreen fashion",
-                                                              FALSE,
-                                                              G_PARAM_READWRITE));
        g_object_class_install_property (object_class,
                                         PROP_PRESENTATION,
                                         g_param_spec_boolean ("presentation",
@@ -4812,35 +4764,6 @@ ev_view_class_init (EvViewClass *class)
                                                               "Draw page in presentation mode",
                                                               TRUE,
                                                               G_PARAM_READWRITE));
-
-       g_object_class_install_property (object_class,
-                                        PROP_SIZING_MODE,
-                                        g_param_spec_enum ("sizing-mode",
-                                                           "Sizing Mode",
-                                                           "Sizing Mode",
-                                                           EV_TYPE_SIZING_MODE,
-                                                           EV_SIZING_FIT_WIDTH,
-                                                           G_PARAM_READWRITE));
-
-       g_object_class_install_property (object_class,
-                                        PROP_ZOOM,
-                                        g_param_spec_double ("zoom",
-                                                             "Zoom factor",
-                                                             "Zoom factor",
-                                                             0,
-                                                             G_MAXDOUBLE,
-                                                             1.0,
-                                                             G_PARAM_READWRITE));
-       g_object_class_install_property (object_class,
-                                        PROP_ROTATION,
-                                        g_param_spec_double ("rotation",
-                                                             "Rotation",
-                                                             "Rotation",
-                                                             0,
-                                                             360,
-                                                             0,
-                                                             G_PARAM_READWRITE));
-
        g_object_class_install_property (object_class,
                                         PROP_HAS_SELECTION,
                                         g_param_spec_boolean ("has-selection",
@@ -5101,6 +5024,7 @@ setup_caches (EvView *view)
 
        view->height_to_page_cache = ev_view_get_height_to_page_cache (view);
        view->pixbuf_cache = ev_pixbuf_cache_new (GTK_WIDGET (view), view->document);
+       view->page_cache = ev_page_cache_new (view->document);
        inverted_colors = ev_document_model_get_inverted_colors (view->model);
        ev_pixbuf_cache_set_inverted_colors (view->pixbuf_cache, inverted_colors);
        g_signal_connect (view->pixbuf_cache, "job-finished", G_CALLBACK (job_finished_cb), view);
@@ -5113,6 +5037,11 @@ clear_caches (EvView *view)
                g_object_unref (view->pixbuf_cache);
                view->pixbuf_cache = NULL;
        }
+
+       if (view->page_cache) {
+               g_object_unref (view->page_cache);
+               view->page_cache = NULL;
+       }
 }
 
 void
@@ -5239,7 +5168,7 @@ ev_view_rotation_changed_cb (EvDocumentModel *model,
 {
        gint rotation = ev_document_model_get_rotation (model);
 
-       ev_view_set_rotation (view, rotation);
+       view->rotation = rotation;
 
        if (view->pixbuf_cache) {
                ev_pixbuf_cache_clear (view->pixbuf_cache);
@@ -5264,7 +5193,7 @@ ev_view_inverted_colors_changed_cb (EvDocumentModel *model,
 
                inverted_colors = ev_document_model_get_inverted_colors (model);
                ev_pixbuf_cache_set_inverted_colors (view->pixbuf_cache, inverted_colors);
-               gtk_widget_queue_resize (GTK_WIDGET (view));
+               gtk_widget_queue_draw (GTK_WIDGET (view));
        }
 }
 
@@ -5275,8 +5204,7 @@ ev_view_sizing_mode_changed_cb (EvDocumentModel *model,
 {
        EvSizingMode mode = ev_document_model_get_sizing_mode (model);
 
-       ev_view_set_sizing_mode (view, mode);
-
+       view->sizing_mode = mode;
        if (mode != EV_SIZING_FREE)
                gtk_widget_queue_resize (GTK_WIDGET (view));
 }
@@ -5297,7 +5225,7 @@ ev_view_scale_changed_cb (EvDocumentModel *model,
                view->loading_text = NULL;
        }
 
-       ev_view_set_zoom (view, scale);
+       view->scale = scale;
 
        view->pending_resize = TRUE;
        if (view->sizing_mode == EV_SIZING_FREE)
@@ -5311,7 +5239,7 @@ ev_view_continuous_changed_cb (EvDocumentModel *model,
 {
        gboolean continuous = ev_document_model_get_continuous (model);
 
-       ev_view_set_continuous (view, continuous);
+       view->continuous = continuous;
        view->pending_scroll = SCROLL_TO_PAGE_POSITION;
        gtk_widget_queue_resize (GTK_WIDGET (view));
 }
@@ -5323,7 +5251,7 @@ ev_view_dual_page_changed_cb (EvDocumentModel *model,
 {
        gboolean dual_page = ev_document_model_get_dual_page (model);
 
-       ev_view_set_dual_page (view, dual_page);
+       view->dual_page = dual_page;
        view->pending_scroll = SCROLL_TO_PAGE_POSITION;
        /* FIXME: if we're keeping the pixbuf cache around, we should extend the
         * preload_cache_size to be 2 if dual_page is set.
@@ -5338,7 +5266,7 @@ ev_view_fullscreen_changed_cb (EvDocumentModel *model,
 {
        gboolean fullscreen = ev_document_model_get_fullscreen (model);
 
-       ev_view_set_fullscreen (view, fullscreen);
+       view->fullscreen = fullscreen;
        gtk_widget_queue_resize (GTK_WIDGET (view));
 }
 
@@ -5410,80 +5338,6 @@ ev_view_reload (EvView *view)
        view_update_range_and_current_page (view);
 }
 
-/*** Zoom and sizing mode ***/
-
-void
-ev_view_set_zoom (EvView   *view,
-                 double    scale)
-{
-       view->scale = scale;
-
-       g_object_notify (G_OBJECT (view), "zoom");
-}
-
-double
-ev_view_get_zoom (EvView *view)
-{
-       return view->scale;
-}
-
-gboolean
-ev_view_get_continuous (EvView *view)
-{
-       g_return_val_if_fail (EV_IS_VIEW (view), FALSE);
-
-       return view->continuous;
-}
-
-void
-ev_view_set_continuous (EvView   *view,
-                       gboolean  continuous)
-{
-       g_return_if_fail (EV_IS_VIEW (view));
-
-       view->continuous = continuous;
-
-       g_object_notify (G_OBJECT (view), "continuous");
-}
-
-gboolean
-ev_view_get_dual_page (EvView *view)
-{
-       g_return_val_if_fail (EV_IS_VIEW (view), FALSE);
-
-       return view->dual_page;
-}
-
-void
-ev_view_set_dual_page (EvView   *view,
-                      gboolean  dual_page)
-{
-       g_return_if_fail (EV_IS_VIEW (view));
-
-       view->dual_page = dual_page;
-
-       g_object_notify (G_OBJECT (view), "dual-page");
-}
-
-void
-ev_view_set_fullscreen (EvView   *view,
-                        gboolean  fullscreen)
-{
-       g_return_if_fail (EV_IS_VIEW (view));
-
-       view->fullscreen = fullscreen;
-
-       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
 ev_view_set_presentation (EvView   *view,
                          gboolean  presentation)
@@ -5579,22 +5433,7 @@ ev_view_presentation_transition_start (EvView *view)
        }
 }
 
-void
-ev_view_set_sizing_mode (EvView       *view,
-                        EvSizingMode  sizing_mode)
-{
-       view->sizing_mode = sizing_mode;
-
-       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;
-}
+/*** Zoom and sizing mode ***/
 
 gboolean
 ev_view_can_zoom_in (EvView *view)
@@ -5638,34 +5477,13 @@ ev_view_zoom_out (EvView *view)
        ev_document_model_set_scale (view->model, scale);
 }
 
-void
-ev_view_set_rotation (EvView *view, int rotation)
-{
-       view->rotation = rotation;
-
-       g_object_notify (G_OBJECT (view), "rotation");
-}
-
-int
-ev_view_get_rotation (EvView *view)
-{
-       return view->rotation;
-}
-
 static double
 zoom_for_size_fit_width (gdouble doc_width,
                         gdouble doc_height,
                         int     target_width,
                         int     target_height)
 {
-       double scale;
-
-       scale = (double)target_width / doc_width;
-
-       if (doc_height * scale > target_height)
-               scale = (double)target_width / doc_width;
-
-       return scale;
+       return (double)target_width / doc_width;
 }
 
 static double
@@ -5674,14 +5492,7 @@ zoom_for_size_fit_height (gdouble doc_width,
                          int     target_width,
                          int     target_height)
 {
-       double scale;
-
-       scale = (double)target_height / doc_height;
-
-       if (doc_width * scale > target_width)
-               scale = (double)target_height / doc_height;
-
-       return scale;
+       return (double)target_height / doc_height;
 }
 
 static double
@@ -5696,11 +5507,6 @@ zoom_for_size_best_fit (gdouble doc_width,
        w_scale = (double)target_width / doc_width;
        h_scale = (double)target_height / doc_height;
 
-       if (doc_height * w_scale > target_height)
-               w_scale = (double)target_width / doc_width;
-       if (doc_width * h_scale > target_width)
-               h_scale = (double)target_height / doc_height;
-
        return MIN (w_scale, h_scale);
 }
 
@@ -6696,7 +6502,7 @@ ev_view_previous_page (EvView *view)
        if (page >= 0) {
                ev_document_model_set_page (view->model, page);
                return TRUE;
-       } else if (ev_view_get_dual_page (view) && page == -1) {
+       } else if (view->dual_page && page == -1) {
                ev_document_model_set_page (view->model, 0);
                return TRUE;
        } else {