]> www.fi.muni.cz Git - evince.git/commitdiff
Abbrev)--L1743--C75--54%--------------------------------------------------------...
authorJonathan Blandford <jrb@src.gnome.org>
Fri, 2 Sep 2005 05:00:39 +0000 (05:00 +0000)
committerJonathan Blandford <jrb@src.gnome.org>
Fri, 2 Sep 2005 05:00:39 +0000 (05:00 +0000)
        * shell/ev-view.c (draw_loading_text): Draw loading text.

ChangeLog
shell/ev-view.c

index 7164e19b0954fdbdc399c102c919265dacf9b0be..e553b1d7b92ca63950b8630a5be6004b1aea40e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Sep  2 00:59:55 2005  Jonathan Blandford  <jrb@redhat.com>
+
+       * shell/ev-view.c (draw_loading_text): Draw loading text.
+
 2005-09-02  Dan Damian  <dand@gnome.ro>
 
        * configure.in: Added "ro" to ALL_LINGUAS.
index 34760b5215c473325558a4e80a4c2e7cc358f3cf..815f69d99ddd76437be1bb185203039b12506c24 100644 (file)
@@ -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) {