From 5e6728daa9b09a76f2537f7c848123639165cd70 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 05 Apr 2005 00:40:58 +0000 Subject: Make searching work again. 2005-04-04 Kristian Høgsberg Make searching work again. * backend/ev-document.c: * backend/ev-document.h: * backend/ev-document-find.c: * backend/ev-document-find.h: Change EvDocumentIface so we no longer store the current page or zoom level in the document. The consequence is that all calls that operate on the current page now instead take the page number as an extra argument, and all coordinates are now doubles in document coordinate system. * pdf/ev-poppler.cc: * pixbuf/pixbuf-document.c: * ps/ps-document.c: Update backends accordingly. --- (limited to 'pixbuf') diff --git a/pixbuf/pixbuf-document.c b/pixbuf/pixbuf-document.c index c728ed0..b83da78 100644 --- a/pixbuf/pixbuf-document.c +++ b/pixbuf/pixbuf-document.c @@ -36,7 +36,6 @@ struct _PixbufDocument GdkPixbuf *pixbuf; GdkDrawable *target; - gdouble scale; gint x_offset, y_offset; }; @@ -94,48 +93,29 @@ pixbuf_document_get_n_pages (EvDocument *document) } static void -pixbuf_document_set_page (EvDocument *document, - int page) -{ - /* Do nothing */ -} - -static int -pixbuf_document_get_page (EvDocument *document) -{ - return 1; -} - -static void -pixbuf_document_set_scale (EvDocument *document, - double scale) -{ - PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document); - - pixbuf_document->scale = scale; -} - -static void pixbuf_document_get_page_size (EvDocument *document, int page, - int *width, - int *height) + double *width, + double *height) { PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document); if (width) - *width = gdk_pixbuf_get_width (pixbuf_document->pixbuf) * pixbuf_document->scale; + *width = gdk_pixbuf_get_width (pixbuf_document->pixbuf); if (height) - *height = gdk_pixbuf_get_height (pixbuf_document->pixbuf) * pixbuf_document->scale; + *height = gdk_pixbuf_get_height (pixbuf_document->pixbuf); + + printf ("get_page_size, page=%d, *width=%f, *height=%f\n", + page, *width, *height); } static GdkPixbuf* -pixbuf_document_render_pixbuf (EvDocument *document) +pixbuf_document_render_pixbuf (EvDocument *document, int page, double scale) { PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document); return gdk_pixbuf_scale_simple (pixbuf_document->pixbuf, - gdk_pixbuf_get_width (pixbuf_document->pixbuf) * pixbuf_document->scale, - gdk_pixbuf_get_height (pixbuf_document->pixbuf) * pixbuf_document->scale, + gdk_pixbuf_get_width (pixbuf_document->pixbuf) * scale, + gdk_pixbuf_get_height (pixbuf_document->pixbuf) * scale, GDK_INTERP_BILINEAR); } @@ -190,33 +170,20 @@ pixbuf_document_class_init (PixbufDocumentClass *klass) } static char * -pixbuf_document_get_text (EvDocument *document, GdkRectangle *rect) +pixbuf_document_get_text (EvDocument *document, int page, EvRectangle *rect) { /* FIXME this method should not be in EvDocument */ g_warning ("pixbuf_document_get_text not implemented"); return NULL; } - -static EvLink * -pixbuf_document_get_link (EvDocument *document, - int x, - int y) -{ - return NULL; -} - static void pixbuf_document_document_iface_init (EvDocumentIface *iface) { iface->load = pixbuf_document_load; iface->save = pixbuf_document_save; iface->get_text = pixbuf_document_get_text; - iface->get_link = pixbuf_document_get_link; iface->get_n_pages = pixbuf_document_get_n_pages; - iface->set_page = pixbuf_document_set_page; - iface->get_page = pixbuf_document_get_page; - iface->set_scale = pixbuf_document_set_scale; iface->get_page_size = pixbuf_document_get_page_size; iface->render_pixbuf = pixbuf_document_render_pixbuf; } @@ -269,8 +236,6 @@ pixbuf_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface static void pixbuf_document_init (PixbufDocument *pixbuf_document) { - pixbuf_document->scale = 1.0; - pixbuf_document->x_offset = 0; pixbuf_document->y_offset = 0; } -- cgit v0.9.1