X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=inline;f=backend%2Fev-document-misc.c;h=0626e1372567de9cf71fba781a1dc001661907d3;hb=65c06150e05948eb7b056b0ec5cb9c364b652cfe;hp=d7d4beb9285aad0b209b058e4b86d6e5d92777b0;hpb=2aadab6feb778de1be1a92f20ba60e44de571199;p=evince.git diff --git a/backend/ev-document-misc.c b/backend/ev-document-misc.c index d7d4beb9..0626e137 100644 --- a/backend/ev-document-misc.c +++ b/backend/ev-document-misc.c @@ -1,6 +1,7 @@ #include "ev-document-misc.h" #include +#include /* Returns a new GdkPixbuf that is suitable for placing in the thumbnail view. * It is four pixels wider and taller than the source. If source_pixbuf is not @@ -27,7 +28,7 @@ ev_document_misc_get_thumbnail_frame (int width, } /* make sure no one is passing us garbage */ - g_assert (width > 0 && height > 0); + g_assert (width >= 0 && height >= 0); retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, @@ -62,3 +63,62 @@ ev_document_misc_get_thumbnail_frame (int width, return retval; } + +void +ev_document_misc_get_page_border_size (gint page_width, + gint page_height, + GtkBorder *border) +{ + g_assert (border); + + border->left = 1; + border->top = 1; + if (page_width < 100) { + border->right = 2; + border->bottom = 2; + } else if (page_width < 500) { + border->right = 3; + border->bottom = 3; + } else { + border->right = 4; + border->bottom = 4; + } +} + + +void +ev_document_misc_paint_one_page (GdkDrawable *drawable, + GtkWidget *widget, + GdkRectangle *area, + GtkBorder *border) +{ + gdk_draw_rectangle (drawable, + widget->style->black_gc, + TRUE, + area->x, + area->y, + area->width, + area->height); + gdk_draw_rectangle (drawable, + widget->style->white_gc, + TRUE, + area->x + border->left, + area->y + border->top, + area->width - (border->left + border->right), + area->height - (border->top + border->bottom)); + gdk_draw_rectangle (drawable, + widget->style->mid_gc[widget->state], + TRUE, + area->x, + area->y + area->height - (border->bottom - border->top), + border->bottom - border->top, + border->bottom - border->top); + gdk_draw_rectangle (drawable, + widget->style->mid_gc[widget->state], + TRUE, + area->x + area->width - (border->right - border->left), + area->y, + border->right - border->left, + border->right - border->left); + +}