diff options
author | Peter Alfredsen <loki_val@gentoo.org> | 2008-06-04 07:15:08 +0000 |
---|---|---|
committer | Peter Alfredsen <loki_val@gentoo.org> | 2008-06-04 07:15:08 +0000 |
commit | 99e530929939b4b1bcf92ff4a6cf71cf5d548230 (patch) | |
tree | e9985dd991336c4faa057199027fe163b1655f73 /dev-ruby | |
parent | Adding ~hppa back in (doh! needed a full tree updated) (diff) | |
download | gentoo-2-99e530929939b4b1bcf92ff4a6cf71cf5d548230.tar.gz gentoo-2-99e530929939b4b1bcf92ff4a6cf71cf5d548230.tar.bz2 gentoo-2-99e530929939b4b1bcf92ff4a6cf71cf5d548230.zip |
Blah
Diffstat (limited to 'dev-ruby')
-rw-r--r-- | dev-ruby/ruby-poppler/files/ruby-poppler-0.16.0-poppler-0.6.patch | 1592 | ||||
-rw-r--r-- | dev-ruby/ruby-poppler/files/ruby-poppler-0.16.0-poppler-0.7.patch | 251 |
2 files changed, 0 insertions, 1843 deletions
diff --git a/dev-ruby/ruby-poppler/files/ruby-poppler-0.16.0-poppler-0.6.patch b/dev-ruby/ruby-poppler/files/ruby-poppler-0.16.0-poppler-0.6.patch deleted file mode 100644 index e0b741a4a309..000000000000 --- a/dev-ruby/ruby-poppler/files/ruby-poppler-0.16.0-poppler-0.6.patch +++ /dev/null @@ -1,1592 +0,0 @@ -Index: ruby-gnome2/poppler/sample/pdf2svg.rb -=================================================================== ---- ruby-gnome2/poppler/sample/pdf2svg.rb (révision 0) -+++ ruby-gnome2/poppler/sample/pdf2svg.rb (révision 2723) -@@ -0,0 +1,26 @@ -+#!/usr/bin/env ruby -+ -+require "poppler" -+ -+if ARGV.size < 1 -+ puts "usage: #{$0} input.pdf" -+ exit(-1) -+end -+ -+input, = ARGV -+ -+output = input.sub(/\..+$/, ".svg") -+output = "#{output}.svg" if input == output -+ -+doc = Poppler::Document.new(input) -+ -+width, height = doc.pages[0].size -+Cairo::SVGSurface.new(output, width, height) do |surface| -+ surface.restrict_to_version("1_2") -+ -+ context = Cairo::Context.new(surface) -+ doc.each do |page| -+ page.render(context) -+ context.show_page -+ end -+end - -Modification de propriétés sur ruby-gnome2/poppler/sample/pdf2svg.rb -___________________________________________________________________ -Nom : svn:executable - + * - -Index: ruby-gnome2/poppler/sample/pdf2text.rb -=================================================================== ---- ruby-gnome2/poppler/sample/pdf2text.rb (révision 2347) -+++ ruby-gnome2/poppler/sample/pdf2text.rb (copie de travail) -@@ -12,7 +12,5 @@ - - doc = Poppler::Document.new(input_uri) - doc.each do |page| -- width, height = page.size -- rectangle = Poppler::Rectangle.new(0, 0, width, height) -- puts page.get_text(rectangle) -+ puts page.get_text - end -Index: ruby-gnome2/poppler/sample/pdf2.rb -=================================================================== ---- ruby-gnome2/poppler/sample/pdf2.rb (révision 2347) -+++ ruby-gnome2/poppler/sample/pdf2.rb (copie de travail) -@@ -9,7 +9,6 @@ - end - - input, output, scale, rotate = ARGV --input_uri = "file://#{File.expand_path(input)}" - scale = (scale || 1.0).to_f - rotate = (rotate || 0).to_i % 360 - -@@ -95,9 +94,9 @@ - - if Poppler.cairo_available? - puts "using cairo..." -- pixbuf = to_pixbuf_with_cairo(input_uri, scale, rotate) -+ pixbuf = to_pixbuf_with_cairo(input, scale, rotate) - else -- pixbuf = to_pixbuf(input_uri, scale, rotate) -+ pixbuf = to_pixbuf(input, scale, rotate) - end - - if pixbuf.nil? -Index: ruby-gnome2/poppler/ChangeLog -=================================================================== ---- ruby-gnome2/poppler/ChangeLog (révision 2347) -+++ ruby-gnome2/poppler/ChangeLog (copie de travail) -@@ -1,3 +1,95 @@ -+2007-11-11 Kouhei Sutou <kou@cozmixng.org> -+ -+ * README: updated supported poppler-glib version: 0.5.2 - 0.6.2. -+ -+2007-10-20 Kouhei Sutou <kou@cozmixng.org> -+ -+ * sample/pdf2.rb: removed needless filename -> URI conversion. -+ -+ * sample/pdf2svg.rb: added a new example that convert PDF to SVG. -+ -+2007-10-13 Kouhei Sutou <kou@cozmixng.org> -+ -+ * src/: used POPPLER_CHECK_VERSION(0, 6, 0) not -+ POPPLER_CHECK_VERSION(0, 5, 9). -+ -+ * README: updated supported poppler-glib version: 0.5.2 - 0.6.1. -+ -+ * src/rbpoppler-document.c: -+ - used RVAL2DOC() not RVAL2GOBJ(). -+ - supported 0.6.0. -+ -+ * src/rbpoppler-attachment.c: supported 0.6.0. -+ -+2007-09-09 Kouhei Sutou <kou@cozmixng.org> -+ -+ * src/rbpoppler-page.c: supported 0.6.0. Bug 1790607. -+ -+2007-07-27 Kouhei Sutou <kou@cozmixng.org> -+ -+ * src/rbpoppler.h, src/rbpoppler-page.c: worked with poppler < -+ 0.5.9 again. -+ -+ * src/rbpoppler-document.c: used POPPLER_CHECK_VERSION(0, 5, 9) -+ instead of HAVE_POPPLER_FONT_INFO because my patch is accepted by -+ upstream. -+ -+ * src/rbpoppler.c, src/rbpoppler-page.c: don't show -+ poppler_form_field_get_field_type(). -+ -+ * src/lib/poppler.rb, src/rbpoppler.h, src/rbpoppler-page.c: -+ followed the recent poppler form API changes but not tested -+ because I don't have a PDF with form... -+ -+2007-07-13 Guillaume Cottenceau -+ -+ * src/rbpoppler-document.c, src/rbpoppler-page.c: replace RTEST -+ uses by RVAL2CBOOL -+ -+2007-07-13 Guillaume Cottenceau -+ -+ * src/rbpoppler-document.c: "? Qtrue : QFalse" => CBOOL2RVAL -+ cleanup -+ -+2007-06-23 Kouhei Sutou <kou@cozmixng.org> -+ -+ * src/rbpoppler.h, src/rbpoppler-page.c: followed new functions -+ and types in poppler-page.h. But this is not enough. We need more -+ works. -+ -+ * src/rbpoppler-document.c, src/lib/poppler.rb: supported -+ Poppler::Document.new(pdf_data). -+ -+ * src/rbpoppler.h (SELSTYLE2RVAL, RVAL2SELSTYLE): added. -+ -+ * src/rbpoppler-page.c: followed API changes of -+ poppler_page_render_selection() family at 0.5.9. -+ -+ * src/rbpoppler.c: added enum types appeared at 0.5.9. -+ -+ * src/rbpoppler-action.c, src/rbpoppler-document.c: removed -+ needless variables. -+ -+2007-04-07 Kouhei Sutou <kou@cozmixng.org> -+ -+ * src/rbpoppler-document.c (Poppler::Document#size): added a -+ convenient alias of Poppler::Document#n_pages. -+ -+ * src/rbpoppler-document.c (doc_initialize): accepted not only URI -+ but also file name. -+ -+ * src/lib/poppler.rb (Poppler::Document#ensure_uri): added. -+ -+2007-03-29 Kouhei Sutou <kou@cozmixng.org> -+ -+ * src/rbpoppler-document.c: added a convenient alias: -+ Poppler::Document#pages. -+ -+ * sample/pdf2text.rb: used default value. -+ -+ * src/rbpoppler-page.c (page_get_text): used page size rectangle -+ as default value. -+ - 2006-09-06 Kouhei Sutou <kou@cozmixng.org> - - * src/rbpoppler-action.c: -Index: ruby-gnome2/poppler/src/rbpoppler-page.c -=================================================================== ---- ruby-gnome2/poppler/src/rbpoppler-page.c (révision 2347) -+++ ruby-gnome2/poppler/src/rbpoppler-page.c (copie de travail) -@@ -4,7 +4,7 @@ - rbpoppler-page.c - - - $Author: ktou $ -- $Date: 2006/09/06 02:25:35 $ -+ $Date: 2007/10/13 05:56:39 $ - - Copyright (C) 2006 Ruby-GNOME2 Project Team - -@@ -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) - --static VALUE cPSFile; -+#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, 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 @@ - 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 @@ - 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 @@ - 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 @@ - 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 @@ - { - 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 @@ - 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; - -- text = poppler_page_get_text(RVAL2GOBJ(self), RVAL2RECT(rect)); -+ 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)); -+ } -+ - rb_text = CSTR2RVAL(text); - g_free(text); - return rb_text; -@@ -119,15 +199,50 @@ - 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_selection_region(VALUE self, VALUE scale, VALUE selection) -+page_get_image_mapping(VALUE self) - { -- return REGION2RVAL(poppler_page_get_selection_region(RVAL2GOBJ(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(int argc, VALUE *argv, VALUE 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 @@ - 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 @@ - 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,26 +301,88 @@ - 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. */ - static VALUE - rectangle_initialize(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2) -@@ -213,107 +398,320 @@ - 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) - { -- return rb_float_new(RVAL2RECT(self)->x2); -+ 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; - } - --static VALUE --rectangle_get_y2(VALUE self) -+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)->y2); -+ return INT2NUM(poppler_form_field_get_id(RVAL2FF(self))); - } - -+VALUE -+form_field_get_font_size(VALUE self) -+{ -+ return rb_float_new(poppler_form_field_get_font_size(RVAL2FF(self))); -+} - --static VALUE --rectangle_set_x1(VALUE self, VALUE x1) -+VALUE -+form_field_is_read_only(VALUE self) - { -- RVAL2RECT(self)->x1 = NUM2DBL(x1); -+ 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))); -+} -+ -+VALUE -+button_field_get_state(VALUE self) -+{ -+ 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) - { -- RVAL2RECT(self)->x2 = NUM2DBL(x2); -+ 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) -+{ -+ 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 @@ - 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 - } -Index: ruby-gnome2/poppler/src/rbpoppler-action.c -=================================================================== ---- ruby-gnome2/poppler/src/rbpoppler-action.c (révision 2347) -+++ ruby-gnome2/poppler/src/rbpoppler-action.c (copie de travail) -@@ -4,7 +4,7 @@ - rbpoppler-action.c - - - $Author: ktou $ -- $Date: 2006/09/06 13:42:01 $ -+ $Date: 2007/06/23 02:43:53 $ - - Copyright (C) 2006 Ruby-GNOME2 Project Team - -@@ -151,8 +151,7 @@ - void - Init_poppler_action(VALUE mPoppler) - { -- VALUE cActionType, cDestType, cDest; -- VALUE cAction, cActionAny, cActionGotoDest, cActionGotoRemote; -+ VALUE cDest, cAction, cActionAny, cActionGotoDest, cActionGotoRemote; - VALUE cActionLaunch, cActionUri, cActionNamed, cActionMovie; - - cAction = G_DEF_CLASS(POPPLER_TYPE_ACTION, "Action", mPoppler); -@@ -199,8 +198,8 @@ - G_DEF_SETTERS(cActionNamed); - G_DEF_SETTERS(cActionMovie); - -- cActionType = G_DEF_CLASS(POPPLER_TYPE_ACTION_TYPE, "ActionType", mPoppler); -- cDestType = G_DEF_CLASS(POPPLER_TYPE_DEST_TYPE, "DestType", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_ACTION_TYPE, "ActionType", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_DEST_TYPE, "DestType", mPoppler); - - cDest = G_DEF_CLASS(POPPLER_TYPE_DEST, "Dest", mPoppler); - -Index: ruby-gnome2/poppler/src/rbpoppler-document.c -=================================================================== ---- ruby-gnome2/poppler/src/rbpoppler-document.c (révision 2347) -+++ ruby-gnome2/poppler/src/rbpoppler-document.c (copie de travail) -@@ -4,7 +4,7 @@ - rbpoppler-document.c - - - $Author: ktou $ -- $Date: 2006/06/17 14:34:54 $ -+ $Date: 2007/10/13 05:56:39 $ - - Copyright (C) 2006 Ruby-GNOME2 Project Team - -@@ -12,18 +12,16 @@ - - #include "rbpoppler.h" - -+#define RVAL2DOC(obj) (POPPLER_DOCUMENT(RVAL2GOBJ(obj))) -+ - #define IITER2RVAL(obj) (BOXED2RVAL(obj, POPPLER_TYPE_INDEX_ITER)) - #define RVAL2IITER(obj) (RVAL2BOXED(obj, POPPLER_TYPE_INDEX_ITER)) - #define FITER2RVAL(obj) (BOXED2RVAL(obj, POPPLER_TYPE_FONTS_ITER)) - #define RVAL2FITER(obj) (RVAL2BOXED(obj, POPPLER_TYPE_FONTS_ITER)) - --#ifdef POPPLER_TYPE_FONT_INFO --# define HAVE_POPPLER_FONT_INFO 1 --#endif -- --static ID id_new, id_valid; -+static ID id_new, id_valid, id_pdf_data_p, id_ensure_uri; - static VALUE cIndexIter; --#ifdef HAVE_POPPLER_FONT_INFO -+#if POPPLER_CHECK_VERSION(0, 6, 0) - static VALUE cFontInfo; - #endif - -@@ -31,16 +29,29 @@ - static VALUE - doc_initialize(int argc, VALUE *argv, VALUE self) - { -- PopplerDocument *document; -+ PopplerDocument *document = NULL; - GError *error = NULL; -- VALUE uri, rb_password; -+ VALUE uri_or_data, rb_password; - const char *password; - -- rb_scan_args(argc, argv, "11", &uri, &rb_password); -+ rb_scan_args(argc, argv, "11", &uri_or_data, &rb_password); - - password = NIL_P(rb_password) ? NULL : RVAL2CSTR(rb_password); -- document = poppler_document_new_from_file(RVAL2CSTR(uri), password, &error); - -+#if POPPLER_CHECK_VERSION(0, 6, 0) -+ if (RVAL2CBOOL(rb_funcall(self, id_pdf_data_p, 1, uri_or_data))) { -+ document = poppler_document_new_from_data(RSTRING_PTR(uri_or_data), -+ RSTRING_LEN(uri_or_data), -+ password, &error); -+ } -+#endif -+ -+ if (!document && !error) { -+ uri_or_data = rb_funcall(self, id_ensure_uri, 1, uri_or_data); -+ document = poppler_document_new_from_file(RVAL2CSTR(uri_or_data), -+ password, &error); -+ } -+ - if (error) - RAISE_GERROR(error); - -@@ -54,7 +65,7 @@ - gboolean result; - GError *error = NULL; - -- result = poppler_document_save(RVAL2GOBJ(self), RVAL2CSTR(uri), &error); -+ result = poppler_document_save(RVAL2DOC(self), RVAL2CSTR(uri), &error); - - if (error) - RAISE_GERROR(error); -@@ -65,7 +76,7 @@ - static VALUE - doc_get_n_pages(VALUE self) - { -- return INT2NUM(poppler_document_get_n_pages(RVAL2GOBJ(self))); -+ return INT2NUM(poppler_document_get_n_pages(RVAL2DOC(self))); - } - - static VALUE -@@ -74,11 +85,11 @@ - VALUE rb_page; - PopplerPage *page; - -- if (RTEST(rb_obj_is_kind_of(index_or_label, rb_cInteger))) { -- page = poppler_document_get_page(RVAL2GOBJ(self), -+ if (RVAL2CBOOL(rb_obj_is_kind_of(index_or_label, rb_cInteger))) { -+ page = poppler_document_get_page(RVAL2DOC(self), - NUM2INT(index_or_label)); -- } else if (RTEST(rb_obj_is_kind_of(index_or_label, rb_cString))) { -- page = poppler_document_get_page_by_label(RVAL2GOBJ(self), -+ } else if (RVAL2CBOOL(rb_obj_is_kind_of(index_or_label, rb_cString))) { -+ page = poppler_document_get_page_by_label(RVAL2DOC(self), - RVAL2CSTR(index_or_label)); - } else { - VALUE inspect; -@@ -96,29 +107,38 @@ - static VALUE - doc_has_attachments(VALUE self) - { -- return CBOOL2RVAL(poppler_document_has_attachments(RVAL2GOBJ(self))); -+ return CBOOL2RVAL(poppler_document_has_attachments(RVAL2DOC(self))); - } - - static VALUE - doc_get_attachments(VALUE self) - { -- return GLIST2ARYF(poppler_document_get_attachments(RVAL2GOBJ(self))); -+ return GLIST2ARYF(poppler_document_get_attachments(RVAL2DOC(self))); - } - - static VALUE - doc_find_dest(VALUE self, VALUE link_name) - { -- return GOBJ2RVAL(poppler_document_find_dest(RVAL2GOBJ(self), -+ return GOBJ2RVAL(poppler_document_find_dest(RVAL2DOC(self), - RVAL2CSTR(link_name))); - } - -+#if POPPLER_CHECK_VERSION(0, 6, 0) - static VALUE -+doc_get_form_field(VALUE self, VALUE id) -+{ -+ return GOBJ2RVAL(poppler_document_get_form_field(RVAL2DOC(self), -+ NUM2INT(id))); -+} -+#endif -+ -+static VALUE - doc_each(VALUE self) - { - PopplerDocument *document; - int i, n_pages; - -- document = RVAL2GOBJ(self); -+ document = RVAL2DOC(self); - n_pages = poppler_document_get_n_pages(document); - for (i = 0; i < n_pages; i++) { - PopplerPage *page; -@@ -139,7 +159,7 @@ - return rb_funcall(cIndexIter, id_new, 1, self); - } - --#ifdef HAVE_POPPLER_FONT_INFO -+#if POPPLER_CHECK_VERSION(0, 6, 0) - static VALUE - doc_get_font_info(VALUE self) - { -@@ -151,7 +171,7 @@ - - /* Interface for getting the Index of a poppler_document */ - #define CHECK_IITER_IS_VALID(iter) do { \ -- if (!RTEST(index_iter_valid_p(iter))) \ -+ if (!RVAL2CBOOL(index_iter_valid_p(iter))) \ - return Qnil; \ - } while (0) - -@@ -168,7 +188,7 @@ - iter = poppler_index_iter_new(RVAL2GOBJ(document)); - G_INITIALIZE(self, iter); - poppler_index_iter_free(iter); -- rb_ivar_set(self, id_valid, iter ? Qtrue : Qfalse); -+ rb_ivar_set(self, id_valid, CBOOL2RVAL(iter)); - return Qnil; - } - -@@ -228,7 +248,7 @@ - } - - --#ifdef HAVE_POPPLER_FONT_INFO -+#if POPPLER_CHECK_VERSION(0, 6, 0) - - static VALUE - font_info_initialize(VALUE self, VALUE document) -@@ -254,7 +274,7 @@ - - - #define CHECK_FITER_IS_VALID(iter) do { \ -- if (!RTEST(fonts_iter_valid_p(iter))) \ -+ if (!RVAL2CBOOL(fonts_iter_valid_p(iter))) \ - return Qnil; \ - } while (0) - -@@ -278,7 +298,16 @@ - return CSTR2RVAL(poppler_fonts_iter_get_full_name(RVAL2FITER(self))); - } - -+#if POPPLER_CHECK_VERSION(0, 6, 0) - static VALUE -+fonts_iter_get_file_name(VALUE self) -+{ -+ CHECK_FITER_IS_VALID(self); -+ return CSTR2RVAL(poppler_fonts_iter_get_file_name(RVAL2FITER(self))); -+} -+#endif -+ -+static VALUE - fonts_iter_get_font_type(VALUE self) - { - CHECK_FITER_IS_VALID(self); -@@ -363,44 +392,49 @@ - Init_poppler_document(VALUE mPoppler) - { - VALUE cDocument, cFontsIter, cPSFile; -- VALUE cPageLayout, cPageMode, cFontType; -- VALUE cViewerPreferences, cPermissions; - - id_new = rb_intern("new"); - id_valid = rb_intern("valid?"); -+ id_pdf_data_p = rb_intern("pdf_data?"); -+ id_ensure_uri = rb_intern("ensure_uri"); - - cDocument = G_DEF_CLASS(POPPLER_TYPE_DOCUMENT, "Document", mPoppler); - cIndexIter = G_DEF_CLASS(POPPLER_TYPE_INDEX_ITER, "IndexIter", mPoppler); --#ifdef HAVE_POPPLER_FONT_INFO -+#if POPPLER_CHECK_VERSION(0, 6, 0) - cFontInfo = G_DEF_CLASS(POPPLER_TYPE_FONT_INFO, "FontInfo", mPoppler); - #endif - cFontsIter = G_DEF_CLASS(POPPLER_TYPE_FONTS_ITER, "FontsIter", mPoppler); - cPSFile = G_DEF_CLASS(POPPLER_TYPE_PS_FILE, "PSFile", mPoppler); - -- cPageLayout = G_DEF_CLASS(POPPLER_TYPE_PAGE_LAYOUT, "PageLayout", mPoppler); -- cPageMode = G_DEF_CLASS(POPPLER_TYPE_PAGE_MODE, "PageMode", mPoppler); -- cFontType = G_DEF_CLASS(POPPLER_TYPE_FONT_TYPE, "FontType", mPoppler); -- cViewerPreferences = G_DEF_CLASS(POPPLER_TYPE_VIEWER_PREFERENCES, -- "ViewerPreferences", mPoppler); -- cPermissions = G_DEF_CLASS(POPPLER_TYPE_PERMISSIONS, "Permissions", -- mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_PAGE_LAYOUT, "PageLayout", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_PAGE_MODE, "PageMode", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_FONT_TYPE, "FontType", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_VIEWER_PREFERENCES, "ViewerPreferences", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_PERMISSIONS, "Permissions", mPoppler); - - rb_include_module(cDocument, rb_mEnumerable); - - rb_define_method(cDocument, "initialize", doc_initialize, -1); - rb_define_method(cDocument, "save", doc_save, 1); - rb_define_method(cDocument, "n_pages", doc_get_n_pages, 0); -+ rb_define_alias(cDocument, "size", "n_pages"); - rb_define_method(cDocument, "get_page", doc_get_page, 1); - rb_define_alias(cDocument, "[]", "get_page"); - rb_define_method(cDocument, "has_attachments?", doc_has_attachments, 0); - rb_define_alias(cDocument, "have_attachments?", "has_attachments?"); - rb_define_method(cDocument, "attachments", doc_get_attachments, 0); - rb_define_method(cDocument, "find_dest", doc_find_dest, 1); -+ rb_define_alias(cDocument, "get_destination", "find_dest"); - -+#if POPPLER_CHECK_VERSION(0, 6, 0) -+ rb_define_method(cDocument, "get_form_field", doc_get_form_field, 1); -+#endif -+ - rb_define_method(cDocument, "each", doc_each, 0); -+ rb_define_alias(cDocument, "pages", "to_a"); - - rb_define_method(cDocument, "index_iter", doc_get_index_iter, 0); --#ifdef HAVE_POPPLER_FONT_INFO -+#if POPPLER_CHECK_VERSION(0, 6, 0) - rb_define_method(cDocument, "font_info", doc_get_font_info, 0); - #endif - -@@ -424,7 +458,7 @@ - G_DEF_SETTERS(cIndexIter); - - --#ifdef HAVE_POPPLER_FONT_INFO -+#if POPPLER_CHECK_VERSION(0, 6, 0) - rb_define_method(cFontInfo, "initialize", font_info_initialize, 1); - rb_define_method(cFontInfo, "scan", font_info_scan, 1); - G_DEF_SETTERS(cFontInfo); -@@ -434,6 +468,9 @@ - - rb_define_method(cFontsIter, "name", fonts_iter_get_name, 0); - rb_define_method(cFontsIter, "full_name", fonts_iter_get_full_name, 0); -+#if POPPLER_CHECK_VERSION(0, 6, 0) -+ rb_define_method(cFontsIter, "file_name", fonts_iter_get_file_name, 0); -+#endif - rb_define_method(cFontsIter, "font_type", fonts_iter_get_font_type, 0); - rb_define_method(cFontsIter, "embedded?", fonts_iter_is_embedded, 0); - rb_define_method(cFontsIter, "subset?", fonts_iter_is_subset, 0); -Index: ruby-gnome2/poppler/src/lib/poppler.rb -=================================================================== ---- ruby-gnome2/poppler/src/lib/poppler.rb (révision 2347) -+++ ruby-gnome2/poppler/src/lib/poppler.rb (copie de travail) -@@ -1,3 +1,4 @@ -+require "tempfile" - require "glib2" - require "gdk_pixbuf2" - begin -@@ -14,6 +15,59 @@ - LOG_DOMAIN = "Poppler" - - VERSION = version.split(".").collect {|x| x.to_i} -+ -+ class Document -+ private -+ def pdf_data?(data) -+ /\A%PDF-1\.\d/ =~ data -+ end -+ -+ def ensure_uri(uri) -+ if pdf_data?(uri) -+ @pdf = Tempfile.new("ruby-poppler-pdf") -+ @pdf.binmode -+ @pdf.print(uri) -+ @pdf.close -+ uri = @pdf.path -+ end -+ -+ if GLib.path_is_absolute?(uri) -+ GLib.filename_to_uri(uri) -+ elsif /\A[a-zA-Z][a-zA-Z\d\-+.]*:/.match(uri) -+ uri -+ else -+ GLib.filename_to_uri(File.expand_path(uri)) -+ end -+ end -+ end -+ -+ if defined?(TextField) -+ class TextField -+ def multiline? -+ type == FormTextType::MULTILINE -+ end -+ -+ def file_select? -+ type == FormTextType::FILE_SELECT -+ end -+ -+ def normal? -+ type == FormTextType::NORMAL -+ end -+ end -+ end -+ -+ if defined?(ChoiceField) -+ class ChoiceField -+ def combo? -+ type == FormChioceType::COMBO -+ end -+ -+ def list? -+ type == FormChoiceType::LIST -+ end -+ end -+ end - end - - if Poppler.cairo_available? -Index: ruby-gnome2/poppler/src/rbpoppler.c -=================================================================== ---- ruby-gnome2/poppler/src/rbpoppler.c (révision 2347) -+++ ruby-gnome2/poppler/src/rbpoppler.c (copie de travail) -@@ -4,7 +4,7 @@ - rbpoppler.c - - - $Author: ktou $ -- $Date: 2006/05/18 02:26:58 $ -+ $Date: 2007/10/13 05:56:39 $ - - Copyright (C) 2006 Ruby-GNOME2 Project Team - -@@ -38,7 +38,7 @@ - void - Init_poppler(void) - { -- VALUE mPoppler, cError, cOrientation, cBackend; -+ VALUE mPoppler; - - mPoppler = rb_define_module("Poppler"); - -@@ -48,11 +48,23 @@ - INT2FIX(POPPLER_MINOR_VERSION), - INT2FIX(POPPLER_MICRO_VERSION))); - -- cError = G_DEF_CLASS(POPPLER_TYPE_ERROR, "Error", mPoppler); -- cOrientation = G_DEF_CLASS(POPPLER_TYPE_ORIENTATION, "Orientation", -- mPoppler); -- cBackend = G_DEF_CLASS(POPPLER_TYPE_BACKEND, "Backend", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_ERROR, "Error", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_ORIENTATION, "Orientation", mPoppler); -+#if POPPLER_CHECK_VERSION(0, 6, 0) -+ G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION_TYPE, -+ "PageTransitionType", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT, -+ "PageTransitionAlignment", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION_DIRECTION, -+ "PageTransitionDirection", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_SELECTION_STYLE, "SelectionStyle", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_FORM_BUTTON_TYPE, "FormButtonType", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_FORM_TEXT_TYPE, "FormTextType", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_FORM_CHOICE_TYPE, "FormChoiceType", mPoppler); - -+#endif -+ G_DEF_CLASS(POPPLER_TYPE_BACKEND, "Backend", mPoppler); -+ - rb_define_module_function(mPoppler, "backend", get_backend, 0); - rb_define_module_function(mPoppler, "version", get_version, 0); - rb_define_module_function(mPoppler, "cairo_available?", cairo_available, 0); -Index: ruby-gnome2/poppler/src/rbpoppler.h -=================================================================== ---- ruby-gnome2/poppler/src/rbpoppler.h (révision 2347) -+++ ruby-gnome2/poppler/src/rbpoppler.h (copie de travail) -@@ -38,18 +38,29 @@ - #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); - extern void Init_poppler_page(VALUE mPoppler); - extern void Init_poppler_attachment(VALUE mPoppler); -Index: ruby-gnome2/poppler/src/rbpoppler-attachment.c -=================================================================== ---- ruby-gnome2/poppler/src/rbpoppler-attachment.c (révision 2347) -+++ ruby-gnome2/poppler/src/rbpoppler-attachment.c (copie de travail) -@@ -4,7 +4,7 @@ - rbpoppler-attachment.c - - - $Author: ktou $ -- $Date: 2006/05/17 12:51:19 $ -+ $Date: 2007/10/13 05:53:10 $ - - Copyright (C) 2006 Ruby-GNOME2 Project Team - -@@ -69,7 +69,15 @@ - return CSTR2RVAL(SELF(self)->description); - } - -+#if POPPLER_CHECK_VERSION(0, 6, 0) - static VALUE -+attachment_get_size(VALUE self) -+{ -+ return INT2NUM(SELF(self)->size); -+} -+#endif -+ -+static VALUE - attachment_get_mtime(VALUE self) - { - return rb_time_new(SELF(self)->mtime, 0); -@@ -81,6 +89,16 @@ - return rb_time_new(SELF(self)->ctime, 0); - } - -+#if POPPLER_CHECK_VERSION(0, 6, 0) -+static VALUE -+attachment_get_checksum(VALUE self) -+{ -+ GString *checksum; -+ checksum = SELF(self)->checksum; -+ return rb_str_new(checksum->str, checksum->len); -+} -+#endif -+ - void - Init_poppler_attachment(VALUE mPoppler) - { -@@ -93,8 +111,14 @@ - rb_define_method(cAttachment, "save", attachment_save, -1); - rb_define_method(cAttachment, "name", attachment_get_name, 0); - rb_define_method(cAttachment, "description", attachment_get_description, 0); -+#if POPPLER_CHECK_VERSION(0, 6, 0) -+ rb_define_method(cAttachment, "size", attachment_get_size, 0); -+#endif - rb_define_method(cAttachment, "mtime", attachment_get_mtime, 0); - rb_define_method(cAttachment, "ctime", attachment_get_ctime, 0); -+#if POPPLER_CHECK_VERSION(0, 6, 0) -+ rb_define_method(cAttachment, "checksum", attachment_get_checksum, 0); -+#endif - - G_DEF_SETTERS(cAttachment); - } - -Modification de propriétés sur ruby-gnome2/poppler/src -___________________________________________________________________ -Nom : svn:ignore - + Makefile -poppler.so -rbpopplerversion.h - - -Index: ruby-gnome2/poppler/README -=================================================================== ---- ruby-gnome2/poppler/README (révision 2347) -+++ ruby-gnome2/poppler/README (copie de travail) -@@ -12,7 +12,7 @@ - Ruby/GdkPixbuf2: http://ruby-gnome2.sourceforge.net/ - cairo/rcairo: http://cairographics.org/ (optional) - -- [*]: 0.5.2 or later is requried. -+ [*]: 0.5.2 - 0.6.2 is requried. - - Install - ------- - -Modification de propriétés sur poppler -___________________________________________________________________ -Nom : svn:ignore - + Makefile -mkmf.log - - diff --git a/dev-ruby/ruby-poppler/files/ruby-poppler-0.16.0-poppler-0.7.patch b/dev-ruby/ruby-poppler/files/ruby-poppler-0.16.0-poppler-0.7.patch deleted file mode 100644 index d78a8e4d6f7c..000000000000 --- a/dev-ruby/ruby-poppler/files/ruby-poppler-0.16.0-poppler-0.7.patch +++ /dev/null @@ -1,251 +0,0 @@ -Index: ruby-gnome2-0.16.0/poppler/ChangeLog -=================================================================== ---- ruby-gnome2-0.16.0.orig/poppler/ChangeLog 2008-05-29 17:13:17.000000000 +0200 -+++ ruby-gnome2-0.16.0/poppler/ChangeLog 2008-05-29 17:13:46.000000000 +0200 -@@ -1,3 +1,8 @@ -+2008-03-20 Kouhei Sutou <kou@cozmixng.org> -+ -+ * src/rbpoppler.[ch], src/rbpoppler-page.c: just buildable with -+ poppler-glib 0.7.3. -+ - 2007-11-11 Kouhei Sutou <kou@cozmixng.org> - - * README: updated supported poppler-glib version: 0.5.2 - 0.6.2. -Index: ruby-gnome2-0.16.0/poppler/src/rbpoppler-page.c -=================================================================== ---- ruby-gnome2-0.16.0.orig/poppler/src/rbpoppler-page.c 2008-05-29 17:13:16.000000000 +0200 -+++ ruby-gnome2-0.16.0/poppler/src/rbpoppler-page.c 2008-05-29 17:13:25.000000000 +0200 -@@ -39,6 +39,33 @@ - VALUE cUnknownField, cTextField, cButtonField, cChoiceField, cSignatureField; - #endif - -+#ifdef POPPLER_TYPE_COLOR -+extern VALUE mGdk; -+VALUE rb_cPopplerColor; -+ -+PopplerColor * -+rb_poppler_ruby_object_to_color(VALUE color) -+{ -+ static VALUE rb_cGdkColor = Qnil; -+ -+ if (NIL_P(rb_cGdkColor)) { -+ rb_cGdkColor = rb_const_get(mGdk, rb_intern("Color")); -+ } -+ -+ if (RTEST(rb_obj_is_kind_of(color, rb_cGdkColor))) { -+ GdkColor *gdk_color; -+ gdk_color = RVAL2GDKCOLOR(color); -+ color = rb_funcall(rb_cPopplerColor, rb_intern("new"), -+ 3, -+ UINT2NUM(gdk_color->red), -+ UINT2NUM(gdk_color->green), -+ UINT2NUM(gdk_color->blue)); -+ } -+ -+ return RVAL2BOXED(color, POPPLER_TYPE_COLOR); -+} -+#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, -@@ -293,8 +320,8 @@ - #ifdef HAVE_POPPLER_PAGE_RENDER_SELECTION_TO_PIXBUF - RVAL2SELSTYLE(style), - #endif -- RVAL2COLOR(glyph_color), -- RVAL2COLOR(background_color)); -+ RVAL2GDKCOLOR(glyph_color), -+ RVAL2GDKCOLOR(background_color)); - return Qnil; - } - -@@ -415,6 +442,55 @@ - } - - -+#ifdef POPPLER_TYPE_COLOR -+/* A color in RGB */ -+static VALUE -+color_initialize(VALUE self, VALUE red, VALUE green, VALUE blue) -+{ -+ PopplerColor color; -+ -+ color.red = NUM2UINT(red); -+ color.green = NUM2UINT(green); -+ color.blue = NUM2UINT(blue); -+ -+ G_INITIALIZE(self, &color); -+ return Qnil; -+} -+ -+DEF_ACCESSOR(color, red, RVAL2COLOR, UINT2NUM, NUM2UINT) -+DEF_ACCESSOR(color, green, RVAL2COLOR, UINT2NUM, NUM2UINT) -+DEF_ACCESSOR(color, blue, RVAL2COLOR, UINT2NUM, NUM2UINT) -+ -+static VALUE -+color_to_a(VALUE self) -+{ -+ PopplerColor *color; -+ color = RVAL2COLOR(self); -+ return rb_ary_new3(3, -+ UINT2NUM(color->red), -+ UINT2NUM(color->green), -+ UINT2NUM(color->blue)); -+} -+ -+static VALUE -+color_inspect(VALUE self) -+{ -+ VALUE inspected; -+ gchar *rgb; -+ PopplerColor *color; -+ -+ color = RVAL2COLOR(self); -+ inspected = rb_call_super(0, NULL); -+ rb_str_resize(inspected, RSTRING_LEN(inspected) - 1); -+ rgb = g_strdup_printf(": [%u, %u, %u]>", -+ color->red, color->green, color->blue); -+ rb_str_cat2(inspected, rgb); -+ g_free(rgb); -+ return inspected; -+} -+#endif -+ -+ - /* 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) -@@ -443,7 +519,11 @@ - /* Mapping between areas on the current page and images */ - DEF_ACCESSOR_WITH_SETTER(image_mapping, area, - RVAL2IM, RECT_ENTITY2RVAL, RECT_ENTITY_SET) -+#ifdef HAVE_ST_IMAGE_ID -+DEF_ACCESSOR(image_mapping, image_id, RVAL2IM, INT2NUM, NUM2INT) -+#else - DEF_ACCESSOR(image_mapping, image, RVAL2IM, GOBJ2RVAL, RVAL2GDK_PIXBUF) -+#endif - - - /* Mapping between areas on the current page and form fields */ -@@ -668,6 +748,9 @@ - - cPage = G_DEF_CLASS(POPPLER_TYPE_PAGE, "Page", mPoppler); - cRectangle = G_DEF_CLASS(POPPLER_TYPE_RECTANGLE, "Rectangle", mPoppler); -+#ifdef POPPLER_TYPE_COLOR -+ rb_cPopplerColor = G_DEF_CLASS(POPPLER_TYPE_COLOR, "Color", mPoppler); -+#endif - cLinkMapping = G_DEF_CLASS(POPPLER_TYPE_LINK_MAPPING, "LinkMapping", - mPoppler); - #if POPPLER_CHECK_VERSION(0, 6, 0) -@@ -729,6 +812,21 @@ - - G_DEF_SETTERS(cRectangle); - -+#ifdef POPPLER_TYPE_COLOR -+/* A color in RGB */ -+ rb_define_method(rb_cPopplerColor, "initialize", color_initialize, 3); -+ rb_define_method(rb_cPopplerColor, "red", color_get_red, 0); -+ rb_define_method(rb_cPopplerColor, "green", color_get_green, 0); -+ rb_define_method(rb_cPopplerColor, "blue", color_get_blue, 0); -+ rb_define_method(rb_cPopplerColor, "set_red", color_set_red, 1); -+ rb_define_method(rb_cPopplerColor, "set_green", color_set_green, 1); -+ rb_define_method(rb_cPopplerColor, "set_blue", color_set_blue, 1); -+ rb_define_method(rb_cPopplerColor, "to_a", color_to_a, 0); -+ rb_define_method(rb_cPopplerColor, "inspect", color_inspect, 0); -+ -+ G_DEF_SETTERS(rb_cPopplerColor); -+#endif -+ - /* Mapping between areas on the current page and PopplerActions */ - rb_define_method(cLinkMapping, "area", link_mapping_get_area, 0); - rb_define_method(cLinkMapping, "action", link_mapping_get_action, 0); -@@ -766,10 +864,19 @@ - - /* Mapping between areas on the current page and images */ - rb_define_method(cImageMapping, "area", image_mapping_get_area, 0); -+#ifdef HAVE_ST_IMAGE_ID -+ rb_define_method(cImageMapping, "image_id", image_mapping_get_image_id, 0); -+#else - rb_define_method(cImageMapping, "image", image_mapping_get_image, 0); -+#endif - - rb_define_method(cImageMapping, "set_area", image_mapping_set_area, 1); -+#ifdef HAVE_ST_IMAGE_ID -+ rb_define_method(cImageMapping, "set_image_id", -+ image_mapping_set_image_id, 1); -+#else - rb_define_method(cImageMapping, "set_image", image_mapping_set_image, 1); -+#endif - - G_DEF_SETTERS(cImageMapping); - -Index: ruby-gnome2-0.16.0/poppler/src/rbpoppler.c -=================================================================== ---- ruby-gnome2-0.16.0.orig/poppler/src/rbpoppler.c 2008-05-29 17:13:16.000000000 +0200 -+++ ruby-gnome2-0.16.0/poppler/src/rbpoppler.c 2008-05-29 17:13:25.000000000 +0200 -@@ -50,6 +50,7 @@ - - G_DEF_CLASS(POPPLER_TYPE_ERROR, "Error", mPoppler); - G_DEF_CLASS(POPPLER_TYPE_ORIENTATION, "Orientation", mPoppler); -+ - #if POPPLER_CHECK_VERSION(0, 6, 0) - G_DEF_CLASS(POPPLER_TYPE_PAGE_TRANSITION_TYPE, - "PageTransitionType", mPoppler); -@@ -61,8 +62,24 @@ - G_DEF_CLASS(POPPLER_TYPE_FORM_BUTTON_TYPE, "FormButtonType", mPoppler); - G_DEF_CLASS(POPPLER_TYPE_FORM_TEXT_TYPE, "FormTextType", mPoppler); - G_DEF_CLASS(POPPLER_TYPE_FORM_CHOICE_TYPE, "FormChoiceType", mPoppler); -+#endif - -+#if POPPLER_CHECK_VERSION(0, 7, 2) -+ G_RENAME_NICK("3D", "TYPE_3D"); -+ G_DEF_CLASS(POPPLER_TYPE_ANNOT_TYPE, "AnnotationType", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_ANNOT_FLAG, "AnnotationFlag", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_ANNOT_MARKUP_REPLY_TYPE, -+ "AnnotationMarkupReplyType", mPoppler); -+ G_RENAME_NICK("3D", "TYPE_3D"); -+ G_DEF_CLASS(POPPLER_TYPE_ANNOT_EXTERNAL_DATA_TYPE, -+ "AnnotationExternalDataType", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_ANNOT_TEXT_ICON, "AnnotationTextIcon", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_ANNOT_TEXT_STATE, "AnnotationTextState", mPoppler); -+ G_DEF_CLASS(POPPLER_TYPE_ANNOT_FREE_TEXT_QUADDING, -+ "AnnotationFreeTextQuadding", mPoppler); - #endif -+ -+ - G_DEF_CLASS(POPPLER_TYPE_BACKEND, "Backend", mPoppler); - - rb_define_module_function(mPoppler, "backend", get_backend, 0); -Index: ruby-gnome2-0.16.0/poppler/src/rbpoppler.h -=================================================================== ---- ruby-gnome2-0.16.0.orig/poppler/src/rbpoppler.h 2008-05-29 17:13:16.000000000 +0200 -+++ ruby-gnome2-0.16.0/poppler/src/rbpoppler.h 2008-05-29 17:13:25.000000000 +0200 -@@ -46,7 +46,14 @@ - #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 RVAL2GDKCOLOR(obj) ((GdkColor *)RVAL2BOXED(obj, GDK_TYPE_COLOR)) -+ -+#ifdef POPPLER_TYPE_COLOR -+extern PopplerColor *rb_poppler_ruby_object_to_color(VALUE color); -+# define RVAL2COLOR(obj) (rb_poppler_ruby_object_to_color(obj)) -+#else -+# define RVAL2COLOR(obj) (RVAL2GDKCOLOR(obj)) -+#endif - - #define ACTION2RVAL(obj) (rb_poppler_ruby_object_from_action(obj)) - #define RVAL2ACTION(obj) (rb_poppler_action_from_ruby_object(obj)) -Index: ruby-gnome2-0.16.0/poppler/extconf.rb -=================================================================== ---- ruby-gnome2-0.16.0.orig/poppler/extconf.rb 2008-05-29 17:13:17.000000000 +0200 -+++ ruby-gnome2-0.16.0/poppler/extconf.rb 2008-05-29 17:13:25.000000000 +0200 -@@ -31,6 +31,7 @@ - - make_version_header("POPPLER", PACKAGE_ID) - have_func("poppler_page_render_selection_to_pixbuf") -+have_struct_member("PopplerImageMapping", "image_id", ["poppler.h"]) - - create_makefile_at_srcdir(PACKAGE_NAME, SRCDIR, "-DRUBY_POPPLER_COMPILATION") - create_top_makefile |