summaryrefslogtreecommitdiff
path: root/print
diff options
context:
space:
mode:
authortaca <taca@pkgsrc.org>2008-06-19 15:14:15 +0000
committertaca <taca@pkgsrc.org>2008-06-19 15:14:15 +0000
commit6733cb1e5f9fbdfedb46bd018e46d119dd20ba10 (patch)
tree7e4587959c8321a775966a7c29bb5a078c0243fb /print
parentfa086e0957ffcd51839d82dacf7e24f861c4a547 (diff)
downloadpkgsrc-6733cb1e5f9fbdfedb46bd018e46d119dd20ba10.tar.gz
Update to ruby-gnome2-poppler to 0.17.0rc1 to build with newer gnome packages.
Diffstat (limited to 'print')
-rw-r--r--print/ruby-gnome2-poppler/Makefile5
-rw-r--r--print/ruby-gnome2-poppler/PLIST6
-rw-r--r--print/ruby-gnome2-poppler/distinfo7
-rw-r--r--print/ruby-gnome2-poppler/patches/patch-aa32
-rw-r--r--print/ruby-gnome2-poppler/patches/patch-ab840
5 files changed, 4 insertions, 886 deletions
diff --git a/print/ruby-gnome2-poppler/Makefile b/print/ruby-gnome2-poppler/Makefile
index 775fe288c68..e4add9ca194 100644
--- a/print/ruby-gnome2-poppler/Makefile
+++ b/print/ruby-gnome2-poppler/Makefile
@@ -1,17 +1,14 @@
-# $NetBSD: Makefile,v 1.2 2007/11/11 23:30:17 wiz Exp $
+# $NetBSD: Makefile,v 1.3 2008/06/19 15:14:15 taca Exp $
#
PKGNAME= ${RUBY_PKGPREFIX}-gnome2-poppler-${VERSION}
-PKGREVISION= 1
COMMENT= Ruby binding of poppler-glib
CATEGORIES= print
RUBY_EXTCONF_SUBDIRS= poppler
-DEPENDS+= ${RUBY_PKGPREFIX}-gnome2-glib>=${VERSION}:../../devel/ruby-gnome2-glib
DEPENDS+= ${RUBY_PKGPREFIX}-gnome2-gdkpixbuf>=${VERSION}:../../graphics/ruby-gnome2-gdkpixbuf
USE_TOOLS+= pkg-config
-DISTINFO_FILE?= ${.CURDIR}/distinfo
BUILDLINK_API_DEPENDS.poppler-glib+= poppler-glib>=0.6.0
diff --git a/print/ruby-gnome2-poppler/PLIST b/print/ruby-gnome2-poppler/PLIST
index 672c3015ac7..82e5c9e2e54 100644
--- a/print/ruby-gnome2-poppler/PLIST
+++ b/print/ruby-gnome2-poppler/PLIST
@@ -1,3 +1,3 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2007/05/27 02:00:02 obache Exp $
-${RUBY_SITELIBDIR}/poppler.rb
-${RUBY_SITEARCHLIBDIR}/poppler.${RUBY_DLEXT}
+@comment $NetBSD: PLIST,v 1.2 2008/06/19 15:14:15 taca Exp $
+${RUBY_VENDORLIB}/poppler.rb
+${RUBY_VENDORARCHLIB}/poppler.${RUBY_DLEXT}
diff --git a/print/ruby-gnome2-poppler/distinfo b/print/ruby-gnome2-poppler/distinfo
deleted file mode 100644
index a4dd168d379..00000000000
--- a/print/ruby-gnome2-poppler/distinfo
+++ /dev/null
@@ -1,7 +0,0 @@
-$NetBSD: distinfo,v 1.1 2007/11/11 23:30:17 wiz Exp $
-
-SHA1 (ruby-gnome2-all-0.16.0.tar.gz) = 488f6c1f139060e005f336c9c854c4dc5b3e6b7c
-RMD160 (ruby-gnome2-all-0.16.0.tar.gz) = c83c7cdcf633ad5cc213180f641a6c8f18002a9c
-Size (ruby-gnome2-all-0.16.0.tar.gz) = 1208856 bytes
-SHA1 (patch-aa) = e304eae9b1341db74e5bcc7e8aa51f3e6475b4fa
-SHA1 (patch-ab) = 82c0981b80df1dd5390f53561e510bf9e32575d0
diff --git a/print/ruby-gnome2-poppler/patches/patch-aa b/print/ruby-gnome2-poppler/patches/patch-aa
deleted file mode 100644
index 6a3d83700ba..00000000000
--- a/print/ruby-gnome2-poppler/patches/patch-aa
+++ /dev/null
@@ -1,32 +0,0 @@
-$NetBSD: patch-aa,v 1.1 2007/11/11 23:30:18 wiz Exp $
-
---- poppler/src/rbpoppler.h.orig 2006-12-29 14:17:28.000000000 +0100
-+++ poppler/src/rbpoppler.h
-@@ -38,16 +38,27 @@ extern GType poppler_dest_get_type (void
- #define REGION2RVAL(obj) (BOXED2RVAL(obj, GDK_TYPE_REGION))
- #define RVAL2DEST(obj) ((PopplerDest *)RVAL2BOXED(obj, POPPLER_TYPE_DEST))
- #define DEST2RVAL(obj) (BOXED2RVAL(obj, POPPLER_TYPE_DEST))
-+#define TRANS2RVAL(obj) (BOXED2RVAL(obj, POPPLER_TYPE_PAGE_TRANSITION))
-+#define RVAL2TRANS(obj) ((PopplerPageTransition *)RVAL2BOXED(obj, POPPLER_TYPE_PAGE_TRANSITION))
-+
- #define DESTTYPE2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_DEST_TYPE))
- #define ACTIONTYPE2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_ACTION_TYPE))
- #define RVAL2ACTIONTYPE(obj) (RVAL2GENUM(obj, POPPLER_TYPE_ACTION_TYPE))
-+#define SELSTYLE2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_SELECTION_STYLE))
-+#define RVAL2SELSTYLE(obj) (RVAL2GENUM(obj, POPPLER_TYPE_SELECTION_STYLE))
- #define RVAL2COLOR(obj) ((GdkColor *)RVAL2BOXED(obj, GDK_TYPE_COLOR))
-
- #define ACTION2RVAL(obj) (rb_poppler_ruby_object_from_action(obj))
- #define RVAL2ACTION(obj) (rb_poppler_action_from_ruby_object(obj))
-+#define FF2RVAL(obj) (rb_poppler_ruby_object_from_form_field(obj))
-
- extern VALUE rb_poppler_ruby_object_from_action(PopplerAction *action);
- extern PopplerAction *rb_poppler_action_from_ruby_object(VALUE action);
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+extern VALUE rb_poppler_ruby_object_from_form_field(PopplerFormField *field);
-+#endif
-+
-+#define RVAL2GDK_PIXBUF(pixbuf) (GDK_PIXBUF(RVAL2GOBJ(pixbuf)))
-
-
- extern void Init_poppler_document(VALUE mPoppler);
diff --git a/print/ruby-gnome2-poppler/patches/patch-ab b/print/ruby-gnome2-poppler/patches/patch-ab
deleted file mode 100644
index 84806fe5be7..00000000000
--- a/print/ruby-gnome2-poppler/patches/patch-ab
+++ /dev/null
@@ -1,840 +0,0 @@
-$NetBSD: patch-ab,v 1.1 2007/11/11 23:30:18 wiz Exp $
-
---- poppler/src/rbpoppler-page.c.orig 2006-12-29 14:17:28.000000000 +0100
-+++ poppler/src/rbpoppler-page.c
-@@ -12,16 +12,39 @@
-
- #include "rbpoppler.h"
-
-+#define SELF(self) (POPPLER_PAGE(RVAL2GOBJ(self)))
- #define RVAL2LM(obj) ((PopplerLinkMapping *)RVAL2BOXED(obj, POPPLER_TYPE_LINK_MAPPING))
-+#define RVAL2IM(obj) ((PopplerImageMapping *)RVAL2BOXED(obj, POPPLER_TYPE_IMAGE_MAPPING))
-+#define RVAL2FFM(obj) ((PopplerFormFieldMapping *)RVAL2BOXED(obj, POPPLER_TYPE_FORM_FIELD_MAPPING))
-+#define RVAL2FF(obj) (POPPLER_FORM_FIELD(RVAL2GOBJ(obj)))
-+#define RVAL2TF(obj) RVAL2FF(obj)
-+#define RVAL2BF(obj) RVAL2FF(obj)
-+#define RVAL2CF(obj) RVAL2FF(obj)
-+
-+#define TT2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_PAGE_TRANSITION_TYPE))
-+#define RVAL2TT(obj) (RVAL2GENUM(obj, POPPLER_TYPE_PAGE_TRANSITION_TYPE))
-+#define TA2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT))
-+#define RVAL2TA(obj) (RVAL2GENUM(obj, POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT))
-+#define TD2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_PAGE_TRANSITION_DIRECTION))
-+#define RVAL2TD(obj) (RVAL2GENUM(obj, POPPLER_TYPE_PAGE_TRANSITION_DIRECTION))
-+#define FFT2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_FORM_FIELD_TYPE))
-+#define RVAL2FFT(obj) (RVAL2GENUM(obj, POPPLER_TYPE_FORM_FIELD_TYPE))
-+#define FBT2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_FORM_BUTTON_TYPE))
-+#define FTT2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_FORM_TEXT_TYPE))
-+#define FCT2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_FORM_CHOICE_TYPE))
-
--static VALUE cPSFile;
-+static VALUE cPSFile, cRectangle;
-+
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+VALUE cUnknownField, cTextField, cButtonField, cChoiceField, cSignatureField;
-+#endif
-
- static VALUE
- page_render_to_pixbuf(VALUE self, VALUE src_x, VALUE src_y, VALUE src_width,
- VALUE src_height, VALUE scale, VALUE rotation,
- VALUE pixbuf)
- {
-- poppler_page_render_to_pixbuf(RVAL2GOBJ(self), NUM2INT(src_x),
-+ poppler_page_render_to_pixbuf(SELF(self), NUM2INT(src_x),
- NUM2INT(src_y), NUM2INT(src_width),
- NUM2INT(src_height), NUM2DBL(scale),
- NUM2INT(rotation), RVAL2GOBJ(pixbuf));
-@@ -32,7 +55,7 @@ page_render_to_pixbuf(VALUE self, VALUE
- static VALUE
- page_render(VALUE self, VALUE cairo)
- {
-- poppler_page_render(RVAL2GOBJ(self), RVAL2CRCONTEXT(cairo));
-+ poppler_page_render(SELF(self), RVAL2CRCONTEXT(cairo));
- return Qnil;
- }
- #endif
-@@ -40,7 +63,7 @@ page_render(VALUE self, VALUE cairo)
- static VALUE
- page_render_to_ps(VALUE self, VALUE ps_file)
- {
-- poppler_page_render_to_ps(RVAL2GOBJ(self), RVAL2GOBJ(ps_file));
-+ poppler_page_render_to_ps(SELF(self), RVAL2GOBJ(ps_file));
- return Qnil;
- }
-
-@@ -48,7 +71,7 @@ static VALUE
- page_render_generic(int argc, VALUE *argv, VALUE self)
- {
- if (argc == 1) {
-- if (RTEST(rb_obj_is_kind_of(argv[0], cPSFile))) {
-+ if (RVAL2CBOOL(rb_obj_is_kind_of(argv[0], cPSFile))) {
- return page_render_to_ps(self, argv[0]);
- } else {
- #ifdef RB_POPPLER_CAIRO_AVAILABLE
-@@ -70,20 +93,34 @@ static VALUE
- page_get_size(VALUE self)
- {
- double width, height;
-- poppler_page_get_size(RVAL2GOBJ(self), &width, &height);
-+ poppler_page_get_size(SELF(self), &width, &height);
- return rb_ary_new3(2, rb_float_new(width), rb_float_new(height));
- }
-
- static VALUE
- page_get_index(VALUE self)
- {
-- return INT2NUM(poppler_page_get_index(RVAL2GOBJ(self)));
-+ return INT2NUM(poppler_page_get_index(SELF(self)));
-+}
-+
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+static VALUE
-+page_get_duration(VALUE self)
-+{
-+ return rb_float_new(poppler_page_get_duration(SELF(self)));
- }
-
- static VALUE
-+page_get_transition(VALUE self)
-+{
-+ return TRANS2RVAL(poppler_page_get_transition(SELF(self)));
-+}
-+#endif
-+
-+static VALUE
- page_get_thumbnail(VALUE self)
- {
-- return GOBJ2RVAL(poppler_page_get_thumbnail(RVAL2GOBJ(self)));
-+ return GOBJ2RVAL(poppler_page_get_thumbnail(SELF(self)));
- }
-
- static VALUE
-@@ -91,7 +128,7 @@ page_get_thumbnail_size(VALUE self)
- {
- int width, height;
-
-- if (poppler_page_get_thumbnail_size(RVAL2GOBJ(self), &width, &height))
-+ if (poppler_page_get_thumbnail_size(SELF(self), &width, &height))
- return rb_ary_new3(2, INT2NUM(width), INT2NUM(height));
- else
- return Qnil;
-@@ -100,17 +137,60 @@ page_get_thumbnail_size(VALUE self)
- static VALUE
- page_find_text(VALUE self, VALUE text)
- {
-- return GLIST2ARY2F(poppler_page_find_text(RVAL2GOBJ(self), RVAL2CSTR(text)),
-+ return GLIST2ARY2F(poppler_page_find_text(SELF(self), RVAL2CSTR(text)),
- POPPLER_TYPE_RECTANGLE);
- }
-
- static VALUE
--page_get_text(VALUE self, VALUE rect)
-+page_get_text(int argc, VALUE *argv, VALUE self)
- {
- gchar *text;
-- VALUE rb_text;
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ PopplerSelectionStyle style = POPPLER_SELECTION_GLYPH;
-+#endif
-+ VALUE rb_text, arg1, arg2, rb_rect;
-+ PopplerPage *page;
-+
-+ rb_scan_args(argc, argv, "02", &arg1, &arg2);
-+
-+ page = SELF(self);
-+ if (NIL_P(arg1)) {
-+ rb_rect = arg2;
-+ } else {
-+ if (RTEST(rb_obj_is_kind_of(arg2, cRectangle))) {
-+ rb_rect = arg2;
-+ } else {
-+ rb_rect = Qnil;
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ if (!NIL_P(arg2)) {
-+ style = RVAL2SELSTYLE(arg2);
-+ }
-+#endif
-+ }
-+ }
-+
-+ if (NIL_P(rb_rect)) {
-+ PopplerRectangle rect;
-+ double width, height;
-+
-+ rect.x1 = 0;
-+ rect.y1 = 0;
-+ poppler_page_get_size(page, &width, &height);
-+ rect.x2 = width;
-+ rect.y2 = height;
-+ text = poppler_page_get_text(page,
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ style,
-+#endif
-+ &rect);
-+ } else {
-+ text = poppler_page_get_text(page,
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ style,
-+#endif
-+ RVAL2RECT(rb_rect));
-+ }
-
-- text = poppler_page_get_text(RVAL2GOBJ(self), RVAL2RECT(rect));
- rb_text = CSTR2RVAL(text);
- g_free(text);
- return rb_text;
-@@ -119,15 +199,50 @@ page_get_text(VALUE self, VALUE rect)
- static VALUE
- page_get_link_mapping(VALUE self)
- {
-- return GLIST2ARY2F(poppler_page_get_link_mapping(RVAL2GOBJ(self)),
-+ return GLIST2ARY2F(poppler_page_get_link_mapping(SELF(self)),
- POPPLER_TYPE_LINK_MAPPING);
- }
-
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+static VALUE
-+page_get_image_mapping(VALUE self)
-+{
-+ return GLIST2ARY2F(poppler_page_get_image_mapping(SELF(self)),
-+ POPPLER_TYPE_IMAGE_MAPPING);
-+}
-+
-+static VALUE
-+page_get_form_field_mapping(VALUE self)
-+{
-+ return GLIST2ARY2F(poppler_page_get_form_field_mapping(SELF(self)),
-+ POPPLER_TYPE_FORM_FIELD_MAPPING);
-+}
-+#endif
-+
- static VALUE
--page_get_selection_region(VALUE self, VALUE scale, VALUE selection)
-+page_get_selection_region(int argc, VALUE *argv, VALUE self)
- {
-- return REGION2RVAL(poppler_page_get_selection_region(RVAL2GOBJ(self),
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ PopplerSelectionStyle style = POPPLER_SELECTION_GLYPH;
-+#endif
-+ VALUE arg2, arg3, scale, selection;
-+
-+ rb_scan_args(argc, argv, "21", &scale, &arg2, &arg3);
-+
-+ if (NIL_P(arg3)) {
-+ selection = arg2;
-+ } else {
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ style = RVAL2SELSTYLE(arg2);
-+#endif
-+ selection = arg3;
-+ }
-+
-+ return REGION2RVAL(poppler_page_get_selection_region(SELF(self),
- NUM2DBL(scale),
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ style,
-+#endif
- RVAL2RECT(selection)));
- }
-
-@@ -136,15 +251,16 @@ page_get_selection_region(VALUE self, VA
- static VALUE
- page_render_selection(VALUE self, VALUE cairo,
- VALUE selection, VALUE rb_old_selection,
-- VALUE glyph_color, VALUE background_color)
-+ VALUE style, VALUE glyph_color, VALUE background_color)
- {
- PopplerRectangle *old_selection = NULL;
-
- if (!NIL_P(rb_old_selection))
- old_selection = RVAL2RECT(rb_old_selection);
-- poppler_page_render_selection(RVAL2GOBJ(self), RVAL2CRCONTEXT(cairo),
-+ poppler_page_render_selection(SELF(self), RVAL2CRCONTEXT(cairo),
- RVAL2RECT(selection),
- old_selection,
-+ RVAL2SELSTYLE(style),
- RVAL2COLOR(glyph_color),
- RVAL2COLOR(background_color));
- return Qnil;
-@@ -159,17 +275,24 @@ static VALUE
- page_render_selection_to_pixbuf(VALUE self, VALUE scale, VALUE rotation,
- VALUE pixbuf, VALUE selection,
- VALUE rb_old_selection,
-+#ifdef HAVE_POPPLER_PAGE_RENDER_SELECTION_TO_PIXBUF
-+ VALUE style,
-+#endif
- VALUE glyph_color, VALUE background_color)
- {
- PopplerRectangle *old_selection = NULL;
-
- if (!NIL_P(rb_old_selection))
- old_selection = RVAL2RECT(rb_old_selection);
-- poppler_page_render_selection_to_pixbuf(RVAL2GOBJ(self), NUM2DBL(scale),
-+ poppler_page_render_selection_to_pixbuf(SELF(self),
-+ NUM2DBL(scale),
- NUM2INT(rotation),
- RVAL2GOBJ(pixbuf),
- RVAL2RECT(selection),
- old_selection,
-+#ifdef HAVE_POPPLER_PAGE_RENDER_SELECTION_TO_PIXBUF
-+ RVAL2SELSTYLE(style),
-+#endif
- RVAL2COLOR(glyph_color),
- RVAL2COLOR(background_color));
- return Qnil;
-@@ -178,24 +301,86 @@ page_render_selection_to_pixbuf(VALUE se
- static VALUE
- page_render_selection_generic(int argc, VALUE *argv, VALUE self)
- {
-- if (argc == 5) {
-+ if (argc == 6) {
- #if defined(RB_POPPLER_CAIRO_AVAILABLE) && \
- defined(HAVE_POPPLER_PAGE_RENDER_SELECTION_TO_PIXBUF)
- return page_render_selection(self, argv[0], argv[1], argv[2],
-- argv[3], argv[4]);
-+ argv[3], argv[4], argv[5]);
- #else
- rb_raise(rb_eArgError, "cairo is not available");
- #endif
-+#ifdef HAVE_POPPLER_PAGE_RENDER_SELECTION_TO_PIXBUF
-+ } else if (argc == 8) {
-+ return page_render_selection_to_pixbuf(self, argv[0], argv[1],
-+ argv[2], argv[3], argv[4],
-+ argv[5], argv[6], argv[7]);
-+#else
- } else if (argc == 7) {
- return page_render_selection_to_pixbuf(self, argv[0], argv[1],
- argv[2], argv[3], argv[4],
- argv[5], argv[6]);
-+#endif
- } else {
- rb_raise(rb_eArgError,
-- "wrong number of arguments (%d for 5 or 7)", argc);
-+ "wrong number of arguments (%d for 5 or %d)", argc,
-+#ifdef HAVE_POPPLER_PAGE_RENDER_SELECTION_TO_PIXBUF
-+ 8
-+#else
-+ 7
-+#endif
-+ );
- }
- }
-
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+static VALUE
-+page_get_crop_box(VALUE self)
-+{
-+ PopplerRectangle rect;
-+
-+ poppler_page_get_crop_box(SELF(self), &rect);
-+ return RECT2RVAL(&rect);
-+}
-+#endif
-+
-+
-+#define DEF_READER(prefix, name, member, self_to_c, member_to_rb) \
-+static VALUE \
-+prefix ## _get_ ## name(VALUE self) \
-+{ \
-+ return member_to_rb((self_to_c(self))->member); \
-+}
-+
-+#define DEF_WRITER(prefix, name, member, self_to_c, value_to_c) \
-+static VALUE \
-+prefix ## _set_ ## name(VALUE self, VALUE value) \
-+{ \
-+ (self_to_c(self))->member = value_to_c(value); \
-+ return Qnil; \
-+}
-+
-+#define DEF_WRITER_WITH_SETTER(prefix, name, member, \
-+ self_to_c, value_setter) \
-+static VALUE \
-+prefix ## _set_ ## name(VALUE self, VALUE value) \
-+{ \
-+ value_setter((self_to_c(self))->member, value); \
-+ return Qnil; \
-+}
-+
-+#define DEF_ACCESSOR(prefix, member, self_to_c, member_to_rb, value_to_c) \
-+ DEF_READER(prefix, member, member, self_to_c, member_to_rb) \
-+ DEF_WRITER(prefix, member, member, self_to_c, value_to_c) \
-+
-+#define DEF_ACCESSOR_WITH_SETTER(prefix, member, self_to_c, \
-+ member_to_rb, value_setter) \
-+ DEF_READER(prefix, member, member, self_to_c, member_to_rb) \
-+ DEF_WRITER_WITH_SETTER(prefix, member, member, self_to_c, value_setter)
-+
-+#define DEF_ACCESSOR_WITH_NAME(prefix, name, member, self_to_c, \
-+ member_to_rb, value_to_c) \
-+ DEF_READER(prefix, name, member, self_to_c, member_to_rb) \
-+ DEF_WRITER(prefix, name, member, self_to_c, value_to_c)
-
-
- /* A rectangle on a page, with coordinates in PDF points. */
-@@ -213,107 +398,320 @@ rectangle_initialize(VALUE self, VALUE x
- return Qnil;
- }
-
-+DEF_ACCESSOR(rectangle, x1, RVAL2RECT, rb_float_new, NUM2DBL)
-+DEF_ACCESSOR(rectangle, y1, RVAL2RECT, rb_float_new, NUM2DBL)
-+DEF_ACCESSOR(rectangle, x2, RVAL2RECT, rb_float_new, NUM2DBL)
-+DEF_ACCESSOR(rectangle, y2, RVAL2RECT, rb_float_new, NUM2DBL)
-+
- static VALUE
--rectangle_get_x1(VALUE self)
-+rectangle_to_a(VALUE self)
- {
-- return rb_float_new(RVAL2RECT(self)->x1);
-+ PopplerRectangle *rectangle = RVAL2RECT(self);
-+ return rb_ary_new3(4,
-+ rb_float_new(rectangle->x1),
-+ rb_float_new(rectangle->y1),
-+ rb_float_new(rectangle->x2),
-+ rb_float_new(rectangle->y2));
- }
-
--static VALUE
--rectangle_get_y1(VALUE self)
-+
-+/* Mapping between areas on the current page and PopplerActions */
-+#define RECT_ENTITY2RVAL(rect) RECT2RVAL(&(rect))
-+#define RECT_ENTITY_SET(rect, rb_rect) rectangle_set(&(rect), rb_rect)
-+static void
-+rectangle_set(PopplerRectangle *rect, VALUE rb_rect)
- {
-- return rb_float_new(RVAL2RECT(self)->y1);
-+ *rect = *(RVAL2RECT(rb_rect));
- }
-
--static VALUE
--rectangle_get_x2(VALUE self)
-+DEF_ACCESSOR_WITH_SETTER(link_mapping, area,
-+ RVAL2LM, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
-+DEF_ACCESSOR(link_mapping, action, RVAL2LM, ACTION2RVAL, RVAL2ACTION)
-+
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+
-+/* Page Transition */
-+DEF_ACCESSOR(page_trans, type, RVAL2TRANS, RVAL2TT, TT2RVAL)
-+DEF_ACCESSOR(page_trans, alignment, RVAL2TRANS, RVAL2TA, TA2RVAL)
-+DEF_ACCESSOR(page_trans, direction, RVAL2TRANS, RVAL2TD, TD2RVAL)
-+DEF_ACCESSOR(page_trans, duration, RVAL2TRANS, NUM2INT, INT2NUM)
-+DEF_ACCESSOR(page_trans, angle, RVAL2TRANS, NUM2INT, INT2NUM)
-+DEF_ACCESSOR(page_trans, scale, RVAL2TRANS, NUM2DBL, rb_float_new)
-+DEF_ACCESSOR(page_trans, rectangular, RVAL2TRANS, RVAL2CBOOL, CBOOL2RVAL)
-+
-+
-+/* Mapping between areas on the current page and images */
-+DEF_ACCESSOR_WITH_SETTER(image_mapping, area,
-+ RVAL2IM, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
-+DEF_ACCESSOR(image_mapping, image, RVAL2IM, GOBJ2RVAL, RVAL2GDK_PIXBUF)
-+
-+
-+/* Mapping between areas on the current page and form fields */
-+VALUE
-+rb_poppler_ruby_object_from_form_field(PopplerFormField *field)
-+{
-+ VALUE obj;
-+
-+ obj = rbgobj_ruby_object_from_instance2(field, FALSE);
-+ if (NIL_P(obj)) {
-+ switch (poppler_form_field_get_field_type(field)) {
-+ case POPPLER_FORM_FIELD_UNKNOWN:
-+ obj = rbgobj_create_object(cUnknownField);
-+ break;
-+ case POPPLER_FORM_FIELD_BUTTON:
-+ obj = rbgobj_create_object(cButtonField);
-+ break;
-+ case POPPLER_FORM_FIELD_TEXT:
-+ obj = rbgobj_create_object(cTextField);
-+ break;
-+ case POPPLER_FORM_FIELD_CHOICE:
-+ obj = rbgobj_create_object(cChoiceField);
-+ break;
-+ case POPPLER_FORM_FIELD_SIGNATURE:
-+ obj = rbgobj_create_object(cSignatureField);
-+ break;
-+ }
-+ g_object_ref(field);
-+ G_INITIALIZE(obj, (gpointer)field);
-+ }
-+
-+ return obj;
-+}
-+
-+DEF_ACCESSOR_WITH_SETTER(form_field_mapping, area,
-+ RVAL2FFM, RECT_ENTITY2RVAL, RECT_ENTITY_SET)
-+DEF_ACCESSOR(form_field_mapping, field, RVAL2FFM, FF2RVAL, RVAL2FF)
-+
-+/* FormField */
-+VALUE
-+form_field_get_id(VALUE self)
- {
-- return rb_float_new(RVAL2RECT(self)->x2);
-+ return INT2NUM(poppler_form_field_get_id(RVAL2FF(self)));
- }
-
--static VALUE
--rectangle_get_y2(VALUE self)
-+VALUE
-+form_field_get_font_size(VALUE self)
-+{
-+ return rb_float_new(poppler_form_field_get_font_size(RVAL2FF(self)));
-+}
-+
-+VALUE
-+form_field_is_read_only(VALUE self)
- {
-- return rb_float_new(RVAL2RECT(self)->y2);
-+ return CBOOL2RVAL(poppler_form_field_is_read_only(RVAL2FF(self)));
- }
-
-+/* Button Field */
-+VALUE
-+button_field_get_button_type(VALUE self)
-+{
-+ return FBT2RVAL(poppler_form_field_button_get_button_type(RVAL2FF(self)));
-+}
-
--static VALUE
--rectangle_set_x1(VALUE self, VALUE x1)
-+VALUE
-+button_field_get_state(VALUE self)
- {
-- RVAL2RECT(self)->x1 = NUM2DBL(x1);
-+ return CBOOL2RVAL(poppler_form_field_button_get_state(RVAL2BF(self)));
-+}
-+
-+VALUE
-+button_field_set_state(VALUE self, VALUE state)
-+{
-+ poppler_form_field_button_set_state(RVAL2BF(self), RVAL2CBOOL(state));
- return Qnil;
- }
-
--static VALUE
--rectangle_set_y1(VALUE self, VALUE y1)
-+/* Text Field */
-+VALUE
-+text_field_get_text_type(VALUE self)
- {
-- RVAL2RECT(self)->y1 = NUM2DBL(y1);
-+ return FTT2RVAL(poppler_form_field_text_get_text_type(RVAL2TF(self)));
-+}
-+
-+VALUE
-+text_field_get_text(VALUE self)
-+{
-+ return CSTR2RVAL(poppler_form_field_text_get_text(RVAL2TF(self)));
-+}
-+
-+VALUE
-+text_field_set_text(VALUE self, VALUE text)
-+{
-+ poppler_form_field_text_set_text(RVAL2TF(self), RVAL2CSTR2(text));
- return Qnil;
- }
-
--static VALUE
--rectangle_set_x2(VALUE self, VALUE x2)
-+VALUE
-+text_field_get_max_length(VALUE self)
-+{
-+ return INT2NUM(poppler_form_field_text_get_max_len(RVAL2TF(self)));
-+}
-+
-+VALUE
-+text_field_do_spell_check(VALUE self)
-+{
-+ return CBOOL2RVAL(poppler_form_field_text_do_spell_check(RVAL2TF(self)));
-+}
-+
-+VALUE
-+text_field_do_scroll(VALUE self)
-+{
-+ return CBOOL2RVAL(poppler_form_field_text_do_scroll(RVAL2TF(self)));
-+}
-+
-+VALUE
-+text_field_is_rich_text(VALUE self)
-+{
-+ return CBOOL2RVAL(poppler_form_field_text_is_rich_text(RVAL2TF(self)));
-+}
-+
-+VALUE
-+text_field_is_password(VALUE self)
-+{
-+ return CBOOL2RVAL(poppler_form_field_text_is_password(RVAL2TF(self)));
-+}
-+
-+
-+/* Choice Field */
-+VALUE
-+choice_field_get_choice_type(VALUE self)
-+{
-+ return FCT2RVAL(poppler_form_field_choice_get_choice_type(RVAL2CF(self)));
-+}
-+
-+VALUE
-+choice_field_is_editable(VALUE self)
-+{
-+ return CBOOL2RVAL(poppler_form_field_choice_is_editable(RVAL2CF(self)));
-+}
-+
-+VALUE
-+choice_field_can_select_multiple(VALUE self)
-+{
-+ return CBOOL2RVAL(poppler_form_field_choice_can_select_multiple(RVAL2CF(self)));
-+}
-+
-+VALUE
-+choice_field_do_spell_check(VALUE self)
- {
-- RVAL2RECT(self)->x2 = NUM2DBL(x2);
-+ return CBOOL2RVAL(poppler_form_field_choice_do_spell_check(RVAL2CF(self)));
-+}
-+
-+VALUE
-+choice_field_commit_on_change(VALUE self)
-+{
-+ return CBOOL2RVAL(poppler_form_field_choice_commit_on_change(RVAL2CF(self)));
-+}
-+
-+VALUE
-+choice_field_get_n_items(VALUE self)
-+{
-+ return INT2NUM(poppler_form_field_choice_get_n_items(RVAL2CF(self)));
-+}
-+
-+VALUE
-+choice_field_get_item(VALUE self, VALUE index)
-+{
-+ return CSTR2RVAL(poppler_form_field_choice_get_item(RVAL2CF(self),
-+ NUM2INT(index)));
-+}
-+
-+VALUE
-+choice_field_is_item_selected(VALUE self, VALUE index)
-+{
-+ return CBOOL2RVAL(poppler_form_field_choice_is_item_selected(RVAL2CF(self),
-+ NUM2INT(index)));
-+}
-+
-+VALUE
-+choice_field_select_item(VALUE self, VALUE index)
-+{
-+ poppler_form_field_choice_select_item(RVAL2CF(self), NUM2INT(index));
- return Qnil;
- }
-
--static VALUE
--rectangle_set_y2(VALUE self, VALUE y2)
-+VALUE
-+choice_field_unselect_all(VALUE self)
- {
-- RVAL2RECT(self)->y2 = NUM2DBL(y2);
-+ poppler_form_field_choice_unselect_all(RVAL2CF(self));
- return Qnil;
- }
-
--static VALUE
--rectangle_to_a(VALUE self)
-+VALUE
-+choice_field_toggle_item(VALUE self, VALUE index)
- {
-- PopplerRectangle *rectangle = RVAL2RECT(self);
-- return rb_ary_new3(4,
-- rb_float_new(rectangle->x1),
-- rb_float_new(rectangle->y1),
-- rb_float_new(rectangle->x2),
-- rb_float_new(rectangle->y2));
-+ poppler_form_field_choice_toggle_item(RVAL2CF(self), NUM2INT(index));
-+ return Qnil;
- }
-
--
--/* Mapping between areas on the current page and PopplerActions */
--static VALUE
--link_mapping_get_area(VALUE self)
-+VALUE
-+choice_field_set_text(VALUE self, VALUE text)
- {
-- return RECT2RVAL(&(RVAL2LM(self)->area));
-+ poppler_form_field_choice_set_text(RVAL2CF(self), RVAL2CSTR2(text));
-+ return Qnil;
- }
-
--static VALUE
--link_mapping_get_action(VALUE self)
-+VALUE
-+choice_field_get_text(VALUE self)
- {
-- return ACTION2RVAL(RVAL2LM(self)->action);
-+ return CSTR2RVAL(poppler_form_field_choice_get_text(RVAL2CF(self)));
- }
-+#endif
-
- void
- Init_poppler_page(VALUE mPoppler)
- {
-- VALUE cPage, cRectangle, cLinkMapping;
-+ VALUE cPage, cLinkMapping;
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ VALUE cPageTransition, cImageMapping, cFormFieldMapping, cFormField;
-+#endif
-
- cPage = G_DEF_CLASS(POPPLER_TYPE_PAGE, "Page", mPoppler);
- cRectangle = G_DEF_CLASS(POPPLER_TYPE_RECTANGLE, "Rectangle", mPoppler);
- cLinkMapping = G_DEF_CLASS(POPPLER_TYPE_LINK_MAPPING, "LinkMapping",
- mPoppler);
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ cPageTransition = G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION,
-+ "PageTransition", mPoppler);
-+ cImageMapping = G_DEF_CLASS(POPPLER_TYPE_IMAGE_MAPPING,
-+ "ImageMapping", mPoppler);
-+ cFormFieldMapping = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD_MAPPING,
-+ "FormFieldMapping", mPoppler);
-+
-+ cFormField = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD, "FormField", mPoppler);
-+ cUnknownField = rb_define_class_under(mPoppler, "UnknownField", cFormField);
-+ cTextField = rb_define_class_under(mPoppler, "TextField", cFormField);
-+ cButtonField = rb_define_class_under(mPoppler, "ButtonField", cFormField);
-+ cChoiceField = rb_define_class_under(mPoppler, "ChoiceField", cFormField);
-+ cSignatureField = rb_define_class_under(mPoppler, "SignatureField",
-+ cFormField);
-+#endif
- cPSFile = rb_const_get(mPoppler, rb_intern("PSFile"));
-
- rb_define_method(cPage, "render", page_render_generic, -1);
- rb_define_method(cPage, "size", page_get_size, 0);
- rb_define_method(cPage, "index", page_get_index, 0);
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ rb_define_method(cPage, "duration", page_get_duration, 0);
-+ rb_define_method(cPage, "transition", page_get_transition, 0);
-+#endif
- rb_define_method(cPage, "thumbnail", page_get_thumbnail, 0);
- rb_define_method(cPage, "thumbnail_size", page_get_thumbnail_size, 0);
- rb_define_method(cPage, "find_text", page_find_text, 1);
-- rb_define_method(cPage, "get_text", page_get_text, 1);
-+ rb_define_method(cPage, "get_text", page_get_text, -1);
- rb_define_method(cPage, "link_mapping", page_get_link_mapping, 0);
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ rb_define_method(cPage, "image_mapping", page_get_image_mapping, 0);
-+ rb_define_method(cPage, "form_field_mapping",
-+ page_get_form_field_mapping, 0);
-+#endif
- rb_define_method(cPage, "get_selection_region",
-- page_get_selection_region, 2);
-+ page_get_selection_region, -1);
- rb_define_method(cPage, "render_selection",
- page_render_selection_generic, -1);
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+ rb_define_method(cPage, "crop_box", page_get_crop_box, 0);
-+#endif
-
- G_DEF_SETTERS(cPage);
-
-@@ -335,5 +733,102 @@ Init_poppler_page(VALUE mPoppler)
- rb_define_method(cLinkMapping, "area", link_mapping_get_area, 0);
- rb_define_method(cLinkMapping, "action", link_mapping_get_action, 0);
-
-+ rb_define_method(cLinkMapping, "set_area", link_mapping_set_area, 1);
-+ rb_define_method(cLinkMapping, "set_action", link_mapping_set_action, 1);
-+
- G_DEF_SETTERS(cLinkMapping);
-+
-+#if POPPLER_CHECK_VERSION(0, 6, 0)
-+/* Page Transition */
-+ rb_define_method(cPageTransition, "type", page_trans_get_type, 0);
-+ rb_define_method(cPageTransition, "alignment", page_trans_get_alignment, 0);
-+ rb_define_method(cPageTransition, "direction", page_trans_get_direction, 0);
-+ rb_define_method(cPageTransition, "duration", page_trans_get_duration, 0);
-+ rb_define_method(cPageTransition, "angle", page_trans_get_angle, 0);
-+ rb_define_method(cPageTransition, "scale", page_trans_get_scale, 0);
-+ rb_define_method(cPageTransition, "rectangular",
-+ page_trans_get_rectangular, 0);
-+
-+ rb_define_method(cPageTransition, "set_type", page_trans_set_type, 1);
-+ rb_define_method(cPageTransition, "set_alignment",
-+ page_trans_set_alignment, 1);
-+ rb_define_method(cPageTransition, "set_direction",
-+ page_trans_set_direction, 1);
-+ rb_define_method(cPageTransition, "set_duration",
-+ page_trans_set_duration, 1);
-+ rb_define_method(cPageTransition, "set_angle", page_trans_set_angle, 1);
-+ rb_define_method(cPageTransition, "set_scale", page_trans_set_scale, 1);
-+ rb_define_method(cPageTransition, "set_rectangular",
-+ page_trans_set_rectangular, 1);
-+
-+ G_DEF_SETTERS(cPageTransition);
-+
-+
-+/* Mapping between areas on the current page and images */
-+ rb_define_method(cImageMapping, "area", image_mapping_get_area, 0);
-+ rb_define_method(cImageMapping, "image", image_mapping_get_image, 0);
-+
-+ rb_define_method(cImageMapping, "set_area", image_mapping_set_area, 1);
-+ rb_define_method(cImageMapping, "set_image", image_mapping_set_image, 1);
-+
-+ G_DEF_SETTERS(cImageMapping);
-+
-+
-+/* Mapping between areas on the current page and form fields */
-+ rb_define_method(cFormFieldMapping, "area", form_field_mapping_get_area, 0);
-+ rb_define_method(cFormFieldMapping, "field", form_field_mapping_get_field,
-+ 0);
-+
-+ rb_define_method(cFormFieldMapping, "set_area",
-+ form_field_mapping_set_area, 1);
-+ rb_define_method(cFormFieldMapping, "set_field",
-+ form_field_mapping_set_field, 1);
-+
-+ G_DEF_SETTERS(cFormFieldMapping);
-+
-+/* FormField */
-+ rb_define_method(cFormField, "id", form_field_get_id, 0);
-+ rb_define_method(cFormField, "font_size", form_field_get_font_size, 0);
-+ rb_define_method(cFormField, "read_only?", form_field_is_read_only, 0);
-+
-+ G_DEF_SETTERS(cFormField);
-+
-+
-+ rb_define_method(cButtonField, "active?", button_field_get_state, 0);
-+ rb_define_method(cButtonField, "set_active", button_field_set_state, 1);
-+
-+ G_DEF_SETTERS(cButtonField);
-+
-+
-+ rb_define_method(cTextField, "type", text_field_get_text_type, 0);
-+ rb_define_method(cTextField, "text", text_field_get_text, 0);
-+ rb_define_method(cTextField, "set_text", text_field_set_text, 1);
-+ rb_define_method(cTextField, "max_length", text_field_get_max_length, 0);
-+ rb_define_method(cTextField, "spell_check?", text_field_do_spell_check, 0);
-+ rb_define_method(cTextField, "scroll?", text_field_do_scroll, 0);
-+ rb_define_method(cTextField, "rich_text?", text_field_is_rich_text, 0);
-+ rb_define_method(cTextField, "password?", text_field_is_password, 0);
-+
-+ G_DEF_SETTERS(cTextField);
-+
-+
-+ rb_define_method(cChoiceField, "type", choice_field_get_choice_type, 0);
-+ rb_define_method(cChoiceField, "editable?", choice_field_is_editable, 0);
-+ rb_define_method(cChoiceField, "select_multiple?",
-+ choice_field_can_select_multiple, 0);
-+ rb_define_method(cChoiceField, "spell_check?",
-+ choice_field_do_spell_check, 0);
-+ rb_define_method(cChoiceField, "commit_on_change?",
-+ choice_field_commit_on_change, 0);
-+ rb_define_method(cChoiceField, "n_items", choice_field_get_n_items, 0);
-+ rb_define_method(cChoiceField, "[]", choice_field_get_item, 1);
-+ rb_define_method(cChoiceField, "selected?",
-+ choice_field_is_item_selected, 1);
-+ rb_define_method(cChoiceField, "select", choice_field_select_item, 1);
-+ rb_define_method(cChoiceField, "unselect_all", choice_field_unselect_all, 0);
-+ rb_define_method(cChoiceField, "text", choice_field_get_text, 0);
-+ rb_define_method(cChoiceField, "set_text", choice_field_set_text, 1);
-+
-+ G_DEF_SETTERS(cChoiceField);
-+#endif
- }