--- poppler-0.6.3/config.h.in 2007-12-13 03:52:02.000000000 +0900 +++ poppler-0.6.3_gdkopt/config.h.in 2007-12-18 01:11:37.000000000 +0900 @@ -28,6 +28,9 @@ /* Define to 1 if you have the `ftell64' function. */ #undef HAVE_FTELL64 +/* Enable gdk in the glib bindings. */ +#undef HAVE_GDK + /* Defines if gettimeofday is available on your system */ #undef HAVE_GETTIMEOFDAY --- poppler-0.6.3/configure.ac 2007-12-13 03:51:33.000000000 +0900 +++ poppler-0.6.3_gdkopt/configure.ac 2007-12-18 01:11:00.000000000 +0900 @@ -200,9 +200,9 @@ enable_poppler_glib=$enableval, enable_poppler_glib="try") if test x$enable_poppler_glib = xyes; then - PKG_CHECK_MODULES(POPPLER_GLIB, gdk-2.0 >= 2.4.0 glib-2.0 >= 2.6) + PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= 2.6 gobject-2.0 >= 2.6 gmodule-2.0 >= 2.6) elif test x$enable_poppler_glib = xtry; then - PKG_CHECK_MODULES(POPPLER_GLIB, gdk-2.0 >= 2.4.0 glib-2.0 >= 2.6, + PKG_CHECK_MODULES(POPPLER_GLIB, glib-2.0 >= 2.6 gobject-2.0 >= 2.6 gmodule-2.0 >= 2.6, [enable_poppler_glib="yes"], [enable_poppler_glib="no"]) fi @@ -211,6 +211,35 @@ fi AM_CONDITIONAL(BUILD_POPPLER_GLIB, test x$enable_poppler_glib = xyes) +AC_ARG_ENABLE(poppler-gdk, + AC_HELP_STRING([--disable-poppler-gdk], + [Don't compile poppler gdk wrapper.]), + enable_poppler_gdk=$enableval, + enable_poppler_gdk="try") +if test x$enable_poppler_gdk = xyes; then + PKG_CHECK_MODULES(POPPLER_GDK, gdk-2.0 >= 2.4.0) +elif test x$enable_poppler_glib = xtry; then + PKG_CHECK_MODULES(POPPLER_GLIB, gdk-2.0 >= 2.4.0, + [enable_poppler_gdk="yes"], + [enable_poppler_gdk="no"]) +fi + +if test x$enable_poppler_gdk = xyes; then + POPPLER_GLIB_REQ="gobject-2.0 gdk-2.0 gdk-pixbuf-2.0" +else + POPPLER_GLIB_REQ="gobject-2.0" +fi +AC_SUBST(POPPLER_GLIB_REQ) + +AH_TEMPLATE([HAVE_GDK], [Enable gdk in the glib bindings.]) +if test x$enable_poppler_gdk = xyes; then + AC_DEFINE(HAVE_GDK) + GDK_FEATURE="#define POPPLER_HAS_GDK 1" +else + GDK_FEATURE="#undef POPPLER_HAS_GDK" +fi +AC_SUBST(GDK_FEATURE) + GTK_DOC_CHECK([1.0]) AC_ARG_ENABLE(poppler-qt, @@ -354,6 +383,7 @@ echo " qt wrapper: $enable_poppler_qt" echo " qt4 wrapper: $enable_poppler_qt4" echo " glib wrapper: $enable_poppler_glib" +echo " gdk wrapper: $enable_poppler_gdk" echo " use gtk-doc: $enable_gtk_doc" echo " use libjpeg: $enable_libjpeg" echo " use zlib: $enable_zlib" --- poppler-0.6.3/glib/poppler-action.h 2007-11-05 08:11:01.000000000 +0900 +++ poppler-0.6.3_gdkopt/glib/poppler-action.h 2007-12-18 00:46:21.000000000 +0900 @@ -20,7 +20,9 @@ #define __POPPLER_ACTION_H__ #include +#ifdef POPPLER_HAS_GDK #include +#endif #include "poppler.h" G_BEGIN_DECLS --- poppler-0.6.3/glib/poppler-document.h 2007-11-05 08:11:01.000000000 +0900 +++ poppler-0.6.3_gdkopt/glib/poppler-document.h 2007-12-18 00:46:02.000000000 +0900 @@ -20,7 +20,9 @@ #define __POPPLER_DOCUMENT_H__ #include +#ifdef POPPLER_HAS_GDK #include +#endif #include "poppler.h" --- poppler-0.6.3/glib/poppler-features.h.in 2007-11-05 08:11:01.000000000 +0900 +++ poppler-0.6.3_gdkopt/glib/poppler-features.h.in 2007-12-18 00:43:31.000000000 +0900 @@ -21,4 +21,6 @@ @CAIRO_FEATURE@ +@GDK_FEATURE@ + #endif /* __POPPLER_FEATURES_H__ */ --- poppler-0.6.3/glib/poppler.h 2007-11-05 08:11:01.000000000 +0900 +++ poppler-0.6.3_gdkopt/glib/poppler.h 2007-12-18 00:46:33.000000000 +0900 @@ -20,7 +20,9 @@ #define __POPPLER_GLIB_H__ #include +#ifdef POPPLER_HAS_GDK #include +#endif G_BEGIN_DECLS --- poppler-0.6.3/glib/poppler-page.cc 2007-11-05 08:11:01.000000000 +0900 +++ poppler-0.6.3_gdkopt/glib/poppler-page.cc 2007-12-18 00:51:59.000000000 +0900 @@ -284,6 +284,7 @@ output_dev->setCairo (output_dev_data->cairo); } +#ifdef POPPLER_HAS_GDK static void copy_cairo_surface_to_pixbuf (cairo_surface_t *surface, unsigned char *data, @@ -324,7 +325,9 @@ } } } +#endif +#ifdef POPPLER_HAS_GDK static void poppler_page_copy_to_pixbuf (PopplerPage *page, GdkPixbuf *pixbuf, @@ -339,6 +342,7 @@ cairo_destroy (output_dev_data->cairo); gfree (output_dev_data->cairo_data); } +#endif #elif defined (HAVE_SPLASH) @@ -355,6 +359,7 @@ /* pft */ } +#ifdef POPPLER_HAS_GDK static void poppler_page_copy_to_pixbuf(PopplerPage *page, GdkPixbuf *pixbuf, @@ -403,6 +408,7 @@ } delete [] pixel; } +#endif #endif @@ -442,6 +448,7 @@ #endif +#ifdef POPPLER_HAS_GDK /** * poppler_page_render_to_pixbuf: * @page: the page to render from @@ -485,6 +492,7 @@ poppler_page_copy_to_pixbuf (page, pixbuf, &data); } +#endif static TextOutputDev * poppler_page_get_text_output_dev (PopplerPage *page) @@ -511,6 +519,7 @@ return page->text_dev; } +#ifdef POPPLER_HAS_GDK /** * poppler_page_get_selection_region: * @page: a #PopplerPage @@ -577,13 +586,14 @@ return region; } +#endif #if defined (HAVE_CAIRO) static void poppler_page_set_selection_alpha (PopplerPage *page, double scale, - GdkPixbuf *pixbuf, + void *pixbuf, PopplerSelectionStyle style, PopplerRectangle *selection) { @@ -592,6 +602,7 @@ #elif defined (HAVE_SPLASH) +#ifdef POPPLER_HAS_GDK static void poppler_page_set_selection_alpha (PopplerPage *page, double scale, @@ -642,8 +653,10 @@ } #endif +#endif #if defined (HAVE_CAIRO) +#ifdef POPPLER_HAS_GDK /** * poppler_page_render_selection: * @page: the #PopplerPage for which to render selection @@ -726,7 +739,9 @@ * time. */ } #endif +#endif +#ifdef POPPLER_HAS_GDK /** * poppler_page_render_selection_to_pixbuf: * @page: the #PopplerPage for which to render selection @@ -816,7 +831,7 @@ * so we don't have to use TextOutputDev and render a second * time. */ } - +#endif static void destroy_thumb_data (guchar *pixels, gpointer data) @@ -824,6 +839,7 @@ gfree (pixels); } +#ifdef POPPLER_HAS_GDK /** * poppler_page_get_thumbnail: * @page: the #PopperPage to get the thumbnail for @@ -850,6 +866,7 @@ FALSE, 8, width, height, rowstride, destroy_thumb_data, NULL); } +#endif /** * poppler_page_get_thumbnail_size: @@ -1035,6 +1052,7 @@ return page->image_dev; } +#ifdef POPPLER_HAS_GDK static GdkPixbuf * poppler_page_image_pixbuf_create (PopplerPage *page, CairoImage *image) @@ -1124,6 +1142,7 @@ g_list_foreach (list, (GFunc) (poppler_images_mapping_free), NULL); g_list_free (list); } +#endif #else @@ -1473,6 +1492,7 @@ g_free (mapping); } +#ifdef POPPLER_HAS_GDK /* Poppler Image mapping type */ GType poppler_image_mapping_get_type (void) @@ -1516,6 +1536,8 @@ g_free (mapping); } +#endif + /* Page Transition */ GType poppler_page_transition_get_type (void) --- poppler-0.6.3/glib/poppler-page.h 2007-11-05 08:11:01.000000000 +0900 +++ poppler-0.6.3_gdkopt/glib/poppler-page.h 2007-12-18 00:47:56.000000000 +0900 @@ -20,9 +20,11 @@ #define __POPPLER_PAGE_H__ #include +#ifdef POPPLER_HAS_GDK #include #include #include +#endif #ifdef POPPLER_HAS_CAIRO #include @@ -39,6 +41,7 @@ GType poppler_page_get_type (void) G_GNUC_CONST; +#ifdef POPPLER_HAS_GDK void poppler_page_render_to_pixbuf (PopplerPage *page, int src_x, int src_y, @@ -47,7 +50,7 @@ double scale, int rotation, GdkPixbuf *pixbuf); - +#endif #ifdef POPPLER_HAS_CAIRO void poppler_page_render (PopplerPage *page, cairo_t *cairo); @@ -59,7 +62,9 @@ int poppler_page_get_index (PopplerPage *page); double poppler_page_get_duration (PopplerPage *page); PopplerPageTransition *poppler_page_get_transition (PopplerPage *page); +#ifdef POPPLER_HAS_GDK GdkPixbuf *poppler_page_get_thumbnail (PopplerPage *page); +#endif gboolean poppler_page_get_thumbnail_size (PopplerPage *page, int *width, int *height); @@ -76,11 +81,14 @@ void poppler_page_free_image_mapping (GList *list); GList *poppler_page_get_form_field_mapping (PopplerPage *page); void poppler_page_free_form_field_mapping (GList *list); +#ifdef POPPLER_HAS_GDK GdkRegion *poppler_page_get_selection_region (PopplerPage *page, gdouble scale, PopplerSelectionStyle style, PopplerRectangle *selection); +#endif #ifdef POPPLER_HAS_CAIRO +#ifdef POPPLER_HAS_GDK void poppler_page_render_selection (PopplerPage *page, cairo_t *cairo, PopplerRectangle *selection, @@ -89,6 +97,8 @@ GdkColor *glyph_color, GdkColor *background_color); #endif +#endif +#ifdef POPPLER_HAS_GDK void poppler_page_render_selection_to_pixbuf ( PopplerPage *page, gdouble scale, @@ -99,7 +109,7 @@ PopplerSelectionStyle style, GdkColor *glyph_color, GdkColor *background_color); - +#endif void poppler_page_get_crop_box (PopplerPage *page, PopplerRectangle *rect); @@ -152,6 +162,7 @@ PopplerPageTransition *poppler_page_transition_copy (PopplerPageTransition *transition); void poppler_page_transition_free (PopplerPageTransition *transition); +#ifdef POPPLER_HAS_GDK /* Mapping between areas on the current page and images */ #define POPPLER_TYPE_IMAGE_MAPPING (poppler_image_mapping_get_type ()) struct _PopplerImageMapping @@ -164,6 +175,7 @@ PopplerImageMapping *poppler_image_mapping_new (void); PopplerImageMapping *poppler_image_mapping_copy (PopplerImageMapping *mapping); void poppler_image_mapping_free (PopplerImageMapping *mapping); +#endif /* Mapping between areas on the current page and form fields */ #define POPPLER_TYPE_FORM_FIELD_MAPPING (poppler_form_field_mapping_get_type ()) --- poppler-0.6.3/glib/test-poppler-glib.cc 2007-11-05 08:11:03.000000000 +0900 +++ poppler-0.6.3_gdkopt/glib/test-poppler-glib.cc 2007-12-18 00:53:47.000000000 +0900 @@ -313,7 +313,9 @@ GEnumValue *enum_value; char *label; GError *error; +#ifdef HAS_POPPLER_GDK GdkPixbuf *pixbuf, *thumb; +#endif double width, height; GList *list, *l; char *text; @@ -362,6 +364,7 @@ printf ("\tpage transition:no transition effect for page\n"); } +#ifdef HAS_POPPLER_GDK thumb = poppler_page_get_thumbnail (page); if (thumb != NULL) { gdk_pixbuf_save (thumb, "thumb.png", "png", &error, NULL); @@ -373,11 +376,13 @@ } else printf ("\tthumbnail:\tno thumbnail for page\n"); +#endif g_object_get (page, "label", &label, NULL); printf ("\tpage label:\t%s\n", label); g_free (label); +#ifdef HAS_POPPLER_GDK pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 220, 220); gdk_pixbuf_fill (pixbuf, 0x00106000); poppler_page_render_to_pixbuf (page, 100, 100, 200, 200, 1, 0, pixbuf); @@ -390,6 +395,7 @@ } g_object_unref (G_OBJECT (pixbuf)); +#endif area.x1 = 0; area.y1 = 0; @@ -418,6 +424,7 @@ printf (" (%f,%f)-(%f,%f)\n", rect->x1, rect->y1, rect->x2, rect->y2); } +#ifdef POPPLER_HAS_GDK list = poppler_page_get_image_mapping (page); num_images = g_list_length (list); printf ("\n"); @@ -437,6 +444,7 @@ mapping->area.y2); } poppler_page_free_image_mapping (list); +#endif list = poppler_page_get_form_field_mapping (page); num_forms = g_list_length (list); --- poppler-0.6.3/poppler-glib.pc.in 2007-11-05 08:11:03.000000000 +0900 +++ poppler-0.6.3_gdkopt/poppler-glib.pc.in 2007-12-18 01:10:44.000000000 +0900 @@ -6,7 +6,7 @@ Name: poppler-glib Description: GLib wrapper for poppler Version: @VERSION@ -Requires: @PC_REQUIRES@ gobject-2.0 gdk-2.0 gdk-pixbuf-2.0 @CAIRO_REQ@ +Requires: @PC_REQUIRES@ @POPPLER_GLIB_REQ@ @CAIRO_REQ@ @PC_REQUIRES_PRIVATE@ Libs: -L${libdir} -lpoppler-glib