From 6559e35a6d539a482c7363710b6153173966e8f9 Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Wed, 16 Feb 2005 03:38:12 +0000 Subject: New function to canonicalize sizing/painting a border. Tue Feb 15 22:27:13 2005 Jonathan Blandford * backend/ev-document-misc.h: * backend/ev-document-misc.c: (ev_document_misc_get_page_border_size), (ev_document_misc_paint_one_page): New function to canonicalize sizing/painting a border. * shell/Makefile.am: Remove ev-page-view.c entirely as it's not used. * pdf/xpdf/pdf-document.cc: use new function * shell/ev-view.c: (ev_view_size_request), (expose_bin_window), (ev_view_init), (ev_view_set_mode), (ev_view_zoom), (ev_view_best_fit), (ev_view_fit_width): * shell/ev-view.h: * shell/ev-window.c: (update_sizing_buttons), (ev_window_setup_document), (ev_window_cmd_view_zoom_in), (ev_window_cmd_view_zoom_out), (ev_window_cmd_view_best_fit), (ev_window_cmd_view_page_width), (size_allocate_cb), (ev_window_set_sizing_mode), (ev_window_init): make the "best fit" and "fit width" values act as toggle buttons so they stay toggled. It's not 100% perfect, and it's a little slow, but it's good enough to commit I think. --- (limited to 'backend') diff --git a/backend/ev-document-misc.c b/backend/ev-document-misc.c index 4145b8a..bb5eedb 100644 --- a/backend/ev-document-misc.c +++ b/backend/ev-document-misc.c @@ -65,29 +65,60 @@ ev_document_misc_get_thumbnail_frame (int width, } void -ev_document_misc_get_page_border_size (gint page_width, - gint page_height, - gint *left_border, - gint *right_border, - gint *top_border, - gint *bottom_border) +ev_document_misc_get_page_border_size (gint page_width, + gint page_height, + GtkBorder *border) { - g_assert (left_border); - g_assert (right_border); - g_assert (top_border); - g_assert (bottom_border); + g_assert (border); - *left_border = 1; - *top_border = 1; + border->left = 1; + border->top = 1; if (page_width < 100) { - *right_border = 2; - *bottom_border = 2; + border->right = 2; + border->bottom = 2; } else if (page_width < 500) { - *right_border = 3; - *left_border = 3; + border->right = 3; + border->bottom = 3; } else { - *right_border = 4; - *bottom_border = 4; + 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); + +} diff --git a/backend/ev-document-misc.h b/backend/ev-document-misc.h index a7ed645..05d7f63 100644 --- a/backend/ev-document-misc.h +++ b/backend/ev-document-misc.h @@ -24,20 +24,21 @@ #include +#include G_BEGIN_DECLS -GdkPixbuf *ev_document_misc_get_thumbnail_frame (int width, - int height, - GdkPixbuf *source_pixbuf); - -void ev_document_misc_get_page_border_size (gint page_width, - gint page_height, - gint *left_border, - gint *right_border, - gint *top_border, - gint *bottom_border); +GdkPixbuf *ev_document_misc_get_thumbnail_frame (int width, + int height, + GdkPixbuf *source_pixbuf); +void ev_document_misc_get_page_border_size (gint page_width, + gint page_height, + GtkBorder *border); +void ev_document_misc_paint_one_page (GdkDrawable *drawable, + GtkWidget *widget, + GdkRectangle *area, + GtkBorder *border); G_END_DECLS -- cgit v0.9.1