From cca6f560c79ff1a30b23c08b9918a77876b69d13 Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Fri, 2 Sep 2005 05:00:39 +0000 Subject: [PATCH] Abbrev)--L1743--C75--54%---------------------------------------------------------------Fri Sep 2 00:59:55 2005 Jonathan Blandford * shell/ev-view.c (draw_loading_text): Draw loading text. --- ChangeLog | 4 ++++ shell/ev-view.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7164e19b..e553b1d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Sep 2 00:59:55 2005 Jonathan Blandford + + * shell/ev-view.c (draw_loading_text): Draw loading text. + 2005-09-02 Dan Damian * configure.in: Added "ro" to ALL_LINGUAS. diff --git a/shell/ev-view.c b/shell/ev-view.c index 34760b52..815f69d9 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -1702,6 +1702,51 @@ highlight_find_results (EvView *view, int page) } } +static void +draw_loading_text (EvView *view, + GdkRectangle *page_area, + GdkRectangle *expose_area) +{ + PangoLayout *layout; + PangoFontDescription *font_desc; + PangoRectangle logical_rect; + double real_scale; + int target_width; + + const char *loading_text = _("Loading..."); + + layout = gtk_widget_create_pango_layout (GTK_WIDGET (view), loading_text); + + font_desc = pango_font_description_new (); + + + /* We set the font to be 10 points, get the size, and scale appropriately */ + pango_font_description_set_size (font_desc, 10 * PANGO_SCALE); + pango_layout_set_font_description (layout, font_desc); + pango_layout_get_pixel_extents (layout, NULL, &logical_rect); + + /* Make sure we fit the middle of the page */ + target_width = MAX (page_area->width / 2, 1); + real_scale = ((double)target_width / (double) logical_rect.width) * (PANGO_SCALE * 10); + pango_font_description_set_size (font_desc, (int)real_scale); + pango_layout_set_font_description (layout, font_desc); + pango_layout_get_pixel_extents (layout, NULL, &logical_rect); + + gtk_paint_layout (GTK_WIDGET (view)->style, + GTK_WIDGET (view)->window, + GTK_WIDGET_STATE (view), + FALSE, + page_area, + GTK_WIDGET (view), + NULL, + page_area->x + (target_width/2), + page_area->y + (page_area->height - logical_rect.height) / 2, + layout); + + pango_font_description_free (font_desc); + g_object_unref (layout); +} + static void draw_one_page (EvView *view, gint page, @@ -1785,6 +1830,10 @@ draw_one_page (EvView *view, GDK_RGB_DITHER_NORMAL, 0, 0); g_object_unref (scaled_image); + } else { + draw_loading_text (view, + &real_page_area, + expose_area); } if (scaled_selection) { -- 2.43.5