From 06e8fe2d26f02fd17a4dc19ea10d7ee00dc33243 Mon Sep 17 00:00:00 2001 From: Johannes Buchner Date: Fri, 27 Jul 2007 05:41:22 +0000 Subject: Reorganizes utility functions. 2007-07-27 Johannes Buchner * shell/ev-utils.c: (get_num_monitors), (get_screen_dpi): * shell/ev-utils.h: * shell/ev-view.c: (ev_view_set_zoom_for_size), (ev_view_update_view_size): * shell/ev-view.h: * shell/ev-window.c: (ev_window_update_actions), (setup_view_from_metadata), (ev_window_screen_changed), (ev_window_sizing_mode_changed_cb), (ev_window_zoom_changed_cb), (zoom_control_changed_cb): * shell/ev-window.h: Reorganizes utility functions. svn path=/trunk/; revision=2582 --- (limited to 'shell/ev-view.c') diff --git a/shell/ev-view.c b/shell/ev-view.c index 6a17aa8..6182fec 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -4685,13 +4685,14 @@ ev_view_zoom_for_size_single_page (EvView *view, ev_view_set_zoom (view, scale, FALSE); } -void +static void ev_view_set_zoom_for_size (EvView *view, int width, int height, int vsb_width, int hsb_height) { + g_return_if_fail (EV_IS_VIEW (view)); g_return_if_fail (view->sizing_mode == EV_SIZING_FIT_WIDTH || view->sizing_mode == EV_SIZING_BEST_FIT); g_return_if_fail (width >= 0); @@ -5564,3 +5565,37 @@ ev_scroll_type_get_type (void) } return etype; } + +void +ev_view_update_view_size (EvView *view, GtkScrolledWindow * scrolled_window) +{ + int width, height; + GtkRequisition vsb_requisition; + GtkRequisition hsb_requisition; + int scrollbar_spacing; + + /* Calculate the width available for the content */ + width = GTK_WIDGET (scrolled_window)->allocation.width; + height = GTK_WIDGET (scrolled_window)->allocation.height; + + if (gtk_scrolled_window_get_shadow_type (scrolled_window) == GTK_SHADOW_IN + && view) { + width -= 2 * GTK_WIDGET(view)->style->xthickness; + height -= 2 * GTK_WIDGET(view)->style->ythickness; + } + + gtk_widget_size_request (scrolled_window->vscrollbar, &vsb_requisition); + gtk_widget_size_request (scrolled_window->hscrollbar, &hsb_requisition); + gtk_widget_style_get (GTK_WIDGET (scrolled_window), + "scrollbar_spacing", + &scrollbar_spacing, + NULL); + + if (EV_IS_VIEW(view)) { + ev_view_set_zoom_for_size (EV_VIEW (view), + MAX (1, width), + MAX (1, height), + vsb_requisition.width + scrollbar_spacing, + hsb_requisition.height + scrollbar_spacing); + } +} -- cgit v0.9.1