]> www.fi.muni.cz Git - evince.git/commitdiff
[libview] Take into account scrollbar size to get zoom for best fit in contnuous...
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 9 May 2010 14:45:22 +0000 (16:45 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 10 May 2010 11:54:51 +0000 (13:54 +0200)
libview/ev-view.c

index 155cad7a387d183e23339820a9522b47c6e27951..2b757b85f636cef6c1b44c08819ef198e6e10676 100644 (file)
@@ -4874,6 +4874,7 @@ ev_view_zoom_for_size_continuous_and_dual_page (EvView *view,
        gdouble doc_width, doc_height;
        GtkBorder border;
        gdouble scale;
+       gint sb_size;
 
        ev_document_get_max_page_size (view->document, &doc_width, &doc_height);
        if (view->rotation == 90 || view->rotation == 270) {
@@ -4890,13 +4891,12 @@ ev_view_zoom_for_size_continuous_and_dual_page (EvView *view,
        width -= (2 * (border.left + border.right) + 3 * view->spacing);
        height -= (border.top + border.bottom + 2 * view->spacing - 1);
 
-       if (view->sizing_mode == EV_SIZING_FIT_WIDTH) {
-               gint sb_size;
+       sb_size = ev_view_get_scrollbar_size (view, GTK_ORIENTATION_VERTICAL);
 
-               sb_size = ev_view_get_scrollbar_size (view, GTK_ORIENTATION_VERTICAL);
+       if (view->sizing_mode == EV_SIZING_FIT_WIDTH) {
                scale = zoom_for_size_fit_width (doc_width, doc_height, width - sb_size, height);
        } else if (view->sizing_mode == EV_SIZING_BEST_FIT)
-               scale = zoom_for_size_best_fit (doc_width, doc_height, width, height);
+               scale = zoom_for_size_best_fit (doc_width, doc_height, width - sb_size, height);
        else
                g_assert_not_reached ();
 
@@ -4911,6 +4911,7 @@ ev_view_zoom_for_size_continuous (EvView *view,
        gdouble doc_width, doc_height;
        GtkBorder border;
        gdouble scale;
+       gint sb_size;
 
        ev_document_get_max_page_size (view->document, &doc_width, &doc_height);
        if (view->rotation == 90 || view->rotation == 270) {
@@ -4926,13 +4927,12 @@ ev_view_zoom_for_size_continuous (EvView *view,
        width -= (border.left + border.right + 2 * view->spacing);
        height -= (border.top + border.bottom + 2 * view->spacing - 1);
 
-       if (view->sizing_mode == EV_SIZING_FIT_WIDTH) {
-               gint sb_size;
+       sb_size = ev_view_get_scrollbar_size (view, GTK_ORIENTATION_VERTICAL);
 
-               sb_size = ev_view_get_scrollbar_size (view, GTK_ORIENTATION_VERTICAL);
+       if (view->sizing_mode == EV_SIZING_FIT_WIDTH) {
                scale = zoom_for_size_fit_width (doc_width, doc_height, width - sb_size, height);
        } else if (view->sizing_mode == EV_SIZING_BEST_FIT)
-               scale = zoom_for_size_best_fit (doc_width, doc_height, width, height);
+               scale = zoom_for_size_best_fit (doc_width, doc_height, width - sb_size, height);
        else
                g_assert_not_reached ();