poppler 2.0.2-x86-mingw32 → 2.0.3-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +7 -0
  2. data/README +1 -1
  3. data/Rakefile +69 -9
  4. data/ext/poppler/extconf.rb +5 -2
  5. data/ext/poppler/rbpoppler-action.c +242 -86
  6. data/ext/poppler/{rbpoppler-annotationcalloutline.c → rbpoppler-annotation-callout-line.c} +2 -3
  7. data/ext/poppler/{rbpoppler-annotationfreetext.c → rbpoppler-annotation-free-text.c} +2 -3
  8. data/ext/poppler/{rbpoppler-annotationmapping.c → rbpoppler-annotation-mapping.c} +2 -3
  9. data/ext/poppler/{rbpoppler-annotationmarkup.c → rbpoppler-annotation-markup.c} +5 -4
  10. data/ext/poppler/{rbpoppler-annotationtext.c → rbpoppler-annotation-text.c} +2 -7
  11. data/ext/poppler/{rbpoppler-buttonfield.c → rbpoppler-button-field.c} +0 -0
  12. data/ext/poppler/{rbpoppler-choicefield.c → rbpoppler-choice-field.c} +0 -0
  13. data/ext/poppler/{rbpoppler-fontinfo.c → rbpoppler-font-info.c} +2 -8
  14. data/ext/poppler/{rbpoppler-fontsiter.c → rbpoppler-fonts-iter.c} +5 -6
  15. data/ext/poppler/{rbpoppler-formfieldmapping.c → rbpoppler-form-field-mapping.c} +2 -3
  16. data/ext/poppler/{rbpoppler-imagemapping.c → rbpoppler-image-mapping.c} +2 -7
  17. data/ext/poppler/{rbpoppler-indexiter.c → rbpoppler-index-iter.c} +2 -3
  18. data/ext/poppler/{rbpoppler-linkmapping.c → rbpoppler-link-mapping.c} +2 -3
  19. data/ext/poppler/{rbpoppler-pagetransition.c → rbpoppler-page-transition.c} +2 -3
  20. data/ext/poppler/rbpoppler-page.c +0 -29
  21. data/ext/poppler/rbpoppler-private.h +13 -13
  22. data/ext/poppler/{rbpoppler-psfile.c → rbpoppler-ps-file.c} +2 -3
  23. data/ext/poppler/{rbpoppler-textfield.c → rbpoppler-text-field.c} +0 -0
  24. data/ext/poppler/rbpoppler.c +14 -22
  25. data/ext/poppler/rbpoppler.h +3 -6
  26. data/ext/poppler/rbpopplerconversions.h +1 -1
  27. data/lib/1.9/poppler.so +0 -0
  28. data/lib/2.0/poppler.so +0 -0
  29. data/sample/pdf2.rb +46 -10
  30. data/test/fixtures/image.png +0 -0
  31. data/test/run-test.rb +7 -4
  32. data/test/test_page.rb +1 -0
  33. data/vendor/local/bin/cjpeg.exe +0 -0
  34. data/vendor/local/bin/djpeg.exe +0 -0
  35. data/vendor/local/bin/jpegtran.exe +0 -0
  36. data/vendor/local/bin/libjpeg-9.dll +0 -0
  37. data/vendor/local/bin/libpoppler-44.dll +0 -0
  38. data/vendor/local/bin/libpoppler-glib-8.dll +0 -0
  39. data/vendor/local/bin/libsqlite3-0.dll +0 -0
  40. data/vendor/local/bin/pdfdetach.exe +0 -0
  41. data/vendor/local/bin/pdffonts.exe +0 -0
  42. data/vendor/local/bin/pdfimages.exe +0 -0
  43. data/vendor/local/bin/pdfinfo.exe +0 -0
  44. data/vendor/local/bin/pdfseparate.exe +0 -0
  45. data/vendor/local/bin/pdftocairo.exe +0 -0
  46. data/vendor/local/bin/pdftohtml.exe +0 -0
  47. data/vendor/local/bin/pdftoppm.exe +0 -0
  48. data/vendor/local/bin/pdftops.exe +0 -0
  49. data/vendor/local/bin/pdftotext.exe +0 -0
  50. data/vendor/local/bin/pdfunite.exe +0 -0
  51. data/vendor/local/bin/rdjpgcom.exe +0 -0
  52. data/vendor/local/bin/sqlite3.exe +0 -0
  53. data/vendor/local/bin/wrjpgcom.exe +0 -0
  54. data/vendor/local/include/jconfig.h +8 -0
  55. data/vendor/local/include/jerror.h +2 -2
  56. data/vendor/local/include/jmorecfg.h +28 -7
  57. data/vendor/local/include/jpeglib.h +46 -8
  58. data/vendor/local/include/poppler/glib/poppler-action.h +156 -2
  59. data/vendor/local/include/poppler/glib/poppler-annot.h +57 -1
  60. data/vendor/local/include/poppler/glib/poppler-attachment.h +17 -0
  61. data/vendor/local/include/poppler/glib/poppler-document.h +133 -26
  62. data/vendor/local/include/poppler/glib/poppler-enums.h +8 -0
  63. data/vendor/local/include/poppler/glib/poppler-features.h +58 -4
  64. data/vendor/local/include/poppler/glib/poppler-form-field.h +4 -0
  65. data/vendor/local/include/poppler/glib/poppler-media.h +73 -0
  66. data/vendor/local/include/poppler/glib/poppler-movie.h +42 -0
  67. data/vendor/local/include/poppler/glib/poppler-page.h +133 -44
  68. data/vendor/local/include/poppler/glib/poppler.h +125 -24
  69. data/vendor/local/include/sqlite3.h +7338 -0
  70. data/vendor/local/include/sqlite3ext.h +487 -0
  71. data/vendor/local/lib/girepository-1.0/Poppler-0.18.typelib +0 -0
  72. data/vendor/local/lib/libjpeg.a +0 -0
  73. data/vendor/local/lib/libjpeg.dll.a +0 -0
  74. data/vendor/local/lib/libjpeg.la +41 -0
  75. data/vendor/local/lib/libpoppler-glib.a +0 -0
  76. data/vendor/local/lib/libpoppler-glib.dll.a +0 -0
  77. data/vendor/local/lib/libpoppler-glib.la +41 -0
  78. data/vendor/local/lib/libpoppler.a +0 -0
  79. data/vendor/local/lib/libpoppler.dll.a +0 -0
  80. data/vendor/local/lib/libpoppler.la +41 -0
  81. data/vendor/local/lib/libsqlite3.a +0 -0
  82. data/vendor/local/lib/libsqlite3.dll.a +0 -0
  83. data/vendor/local/lib/libsqlite3.la +41 -0
  84. data/vendor/local/lib/pkgconfig/poppler-cairo.pc +9 -0
  85. data/vendor/local/lib/pkgconfig/poppler-glib.pc +3 -3
  86. data/vendor/local/lib/pkgconfig/poppler-splash.pc +2 -2
  87. data/vendor/local/lib/pkgconfig/poppler.pc +1 -1
  88. data/vendor/local/lib/pkgconfig/sqlite3.pc +13 -0
  89. data/vendor/local/share/gir-1.0/Poppler-0.18.gir +5452 -0
  90. data/vendor/local/share/gtk-doc/html/poppler/PopplerAnnot.html +1671 -0
  91. data/vendor/local/share/gtk-doc/html/poppler/PopplerAttachment.html +214 -0
  92. data/vendor/local/share/gtk-doc/html/poppler/PopplerDocument.html +2587 -0
  93. data/vendor/local/share/gtk-doc/html/poppler/PopplerFormField.html +1070 -0
  94. data/vendor/local/share/gtk-doc/html/poppler/PopplerLayer.html +228 -0
  95. data/vendor/local/share/gtk-doc/html/poppler/PopplerMedia.html +306 -0
  96. data/vendor/local/share/gtk-doc/html/poppler/PopplerMovie.html +156 -0
  97. data/vendor/local/share/gtk-doc/html/poppler/PopplerPage.html +2132 -0
  98. data/vendor/local/share/gtk-doc/html/poppler/annotation-glossary.html +71 -0
  99. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-12.html +128 -0
  100. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-14.html +107 -0
  101. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-16.html +185 -0
  102. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-18.html +77 -0
  103. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-20.html +42 -0
  104. data/vendor/local/share/gtk-doc/html/poppler/api-index-0-22.html +62 -0
  105. data/vendor/local/share/gtk-doc/html/poppler/api-index-deprecated.html +42 -0
  106. data/vendor/local/share/gtk-doc/html/poppler/api-index-full.html +1352 -0
  107. data/vendor/local/share/gtk-doc/html/poppler/ch01.html +21 -19
  108. data/vendor/local/share/gtk-doc/html/poppler/home.png +0 -0
  109. data/vendor/local/share/gtk-doc/html/poppler/index.html +35 -18
  110. data/vendor/local/share/gtk-doc/html/poppler/index.sgml +548 -300
  111. data/vendor/local/share/gtk-doc/html/poppler/left.png +0 -0
  112. data/vendor/local/share/gtk-doc/html/poppler/poppler-PopplerAction.html +662 -0
  113. data/vendor/local/share/gtk-doc/html/poppler/poppler-Version-and-Features-Information.html +145 -0
  114. data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler.html +319 -364
  115. data/vendor/local/share/gtk-doc/html/poppler/poppler.devhelp2 +506 -265
  116. data/vendor/local/share/gtk-doc/html/poppler/right.png +0 -0
  117. data/vendor/local/share/gtk-doc/html/poppler/style.css +153 -54
  118. data/vendor/local/share/gtk-doc/html/poppler/up.png +0 -0
  119. data/vendor/local/share/license/poppler/AUTHORS +5 -0
  120. data/vendor/local/share/license/poppler/COPYING +339 -0
  121. data/vendor/local/share/man/man1/cjpeg.1 +51 -10
  122. data/vendor/local/share/man/man1/djpeg.1 +5 -4
  123. data/vendor/local/share/man/man1/jpegtran.1 +15 -2
  124. data/vendor/local/share/man/man1/pdfdetach.1 +86 -0
  125. data/vendor/local/share/man/man1/pdffonts.1 +16 -7
  126. data/vendor/local/share/man/man1/pdfimages.1 +114 -7
  127. data/vendor/local/share/man/man1/pdfinfo.1 +16 -7
  128. data/vendor/local/share/man/man1/pdfseparate.1 +49 -0
  129. data/vendor/local/share/man/man1/pdftocairo.1 +266 -0
  130. data/vendor/local/share/man/man1/pdftohtml.1 +30 -8
  131. data/vendor/local/share/man/man1/pdftoppm.1 +42 -12
  132. data/vendor/local/share/man/man1/pdftops.1 +26 -10
  133. data/vendor/local/share/man/man1/pdftotext.1 +18 -7
  134. data/vendor/local/share/man/man1/pdfunite.1 +33 -0
  135. data/vendor/local/share/man/man1/sqlite3.1 +229 -0
  136. metadata +107 -64
  137. data/vendor/local/bin/libgcc_s_dw2-1.dll +0 -0
  138. data/vendor/local/bin/libjpeg-7.dll +0 -0
  139. data/vendor/local/bin/libpng12-0.dll +0 -0
  140. data/vendor/local/bin/libpoppler-5.dll +0 -0
  141. data/vendor/local/bin/libpoppler-glib-4.dll +0 -0
  142. data/vendor/local/include/libpng12/png.h +0 -3726
  143. data/vendor/local/include/libpng12/pngconf.h +0 -1508
  144. data/vendor/local/include/png.h +0 -3726
  145. data/vendor/local/include/pngconf.h +0 -1508
  146. data/vendor/local/lib/libpng.def +0 -366
  147. data/vendor/local/lib/libpng.lib +0 -0
  148. data/vendor/local/lib/libpng12.dll.a +0 -0
  149. data/vendor/local/lib/pkgconfig/libpng.pc +0 -11
  150. data/vendor/local/lib/pkgconfig/libpng12.pc +0 -11
  151. data/vendor/local/manifest/jpeg-dev_7-1_win32.mft +0 -18
  152. data/vendor/local/manifest/jpeg_7-1_win32.mft +0 -2
  153. data/vendor/local/manifest/libpng-dev_1.2.40-1_win32.mft +0 -15
  154. data/vendor/local/manifest/libpng_1.2.40-1_win32.mft +0 -2
  155. data/vendor/local/manifest/poppler-dev_0.12.0-1_win32.mft +0 -49
  156. data/vendor/local/manifest/poppler_0.12.0-1_win32.mft +0 -4
  157. data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-action.html +0 -386
  158. data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-annot.html +0 -854
  159. data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-attachment.html +0 -205
  160. data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-document.html +0 -1122
  161. data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-enums.html +0 -412
  162. data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-features.html +0 -143
  163. data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-form-field.html +0 -871
  164. data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-layer.html +0 -214
  165. data/vendor/local/share/gtk-doc/html/poppler/poppler-poppler-page.html +0 -1258
  166. data/vendor/local/share/gtk-doc/html/poppler/poppler.devhelp +0 -281
  167. data/vendor/local/share/man/man3/libpng.3 +0 -4349
  168. data/vendor/local/share/man/man3/libpngpf.3 +0 -790
  169. data/vendor/local/share/man/man5/png.5 +0 -74
  170. data/vendor/local/src/tml/packaging/jpeg_7-1_win32.log +0 -249
  171. data/vendor/local/src/tml/packaging/jpeg_7-1_win32.sh +0 -44
  172. data/vendor/local/src/tml/packaging/libpng_1.2.40-1_win32.log +0 -269
  173. data/vendor/local/src/tml/packaging/libpng_1.2.40-1_win32.sh +0 -63
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f471585f0cb8f03150af71229a2e95e12fcc5cac
4
+ data.tar.gz: 872efd930f6f3039deb5e74de0c0135eff987769
5
+ SHA512:
6
+ metadata.gz: 5c92bb0111b5674e4893a28b2364c991e645396eb759f69d7c90624c8c1aed57daaf8f89de53677cc36f8f089ec90e3d574e7e88f2ddfe234b1d3e78e98c43af
7
+ data.tar.gz: eaece51ea286e4400240c537120a467764eebb87b4a00cca1f0951095bb79fd9e36bdaacb46c475dd2a265614776bc95d83f85516d6fa5ea51bae21dad701879
data/README CHANGED
@@ -11,7 +11,7 @@ Requirements
11
11
  Ruby/GLib2: http://ruby-gnome2.sourceforge.net/
12
12
  cairo/rcairo: http://cairographics.org/ (optional)
13
13
 
14
- [*]: 0.8.0 or later is requried.
14
+ [*]: 0.12.0 or later is requried.
15
15
 
16
16
  Install
17
17
  -------
data/Rakefile CHANGED
@@ -1,16 +1,76 @@
1
1
  # -*- ruby -*-
2
+ #
3
+ # Copyright (C) 2010-2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2
18
 
3
19
  $LOAD_PATH.unshift("./../glib2/lib")
4
20
  require 'gnome2-raketask'
5
21
 
6
- package = GNOME2Package.new do |_package|
7
- _package.summary = "Ruby/Poppler is a Ruby binding of poppler-glib."
8
- _package.description = "Ruby/Poppler is a Ruby binding of poppler-glib."
9
- _package.dependency.gem.runtime = []
10
- _package.win32.packages = []
11
- _package.win32.dependencies = ["poppler",
12
- ["libpng", "1.2.40-1"],
13
- ["jpeg", "7-1"]]
22
+ package_task = GNOME2::Rake::PackageTask.new do |package|
23
+ package.summary = "Ruby/Poppler is a Ruby binding of poppler-glib."
24
+ package.description = "Ruby/Poppler is a Ruby binding of poppler-glib."
25
+ package.dependency.gem.runtime = [["cairo", ">= 1.12.8"], "gdk_pixbuf2"]
26
+ package.win32.packages = []
27
+ package.win32.dependencies = []
28
+ package.windows.build_dependencies = [
29
+ "glib2",
30
+ "gobject-introspection",
31
+ "pango",
32
+ "gdk_pixbuf2",
33
+ ]
34
+ package.windows.gobject_introspection_dependencies = [
35
+ "gdk_pixbuf2",
36
+ ]
37
+ package.external_packages = [
38
+ {
39
+ :name => "libjpeg",
40
+ :base_name => "jpeg-9",
41
+ :archive_base_name => "jpegsrc.v9.tar.gz",
42
+ :download_base_url => "http://www.ijg.org/files",
43
+ :label => "libjpeg",
44
+ :windows => {
45
+ :configure_args => [],
46
+ :built_file => "bin/libjpeg-9.dll",
47
+ },
48
+ },
49
+ {
50
+ :name => "sqlite-autoconf",
51
+ :download_base_url => "http://www.sqlite.org/2013",
52
+ :label => "SQLite",
53
+ :version => "3080200",
54
+ :compression_method => "gz",
55
+ :windows => {
56
+ :configure_args => [],
57
+ :built_file => "bin/libsqlite3-0.dll",
58
+ },
59
+ },
60
+ {
61
+ :name => "poppler",
62
+ :download_base_url => "http://poppler.freedesktop.org",
63
+ :label => "Poppler",
64
+ :version => "0.24.4",
65
+ :compression_method => "xz",
66
+ :windows => {
67
+ :configure_args => [
68
+ "--enable-introspection",
69
+ ],
70
+ :built_file => "bin/libpoppler-glib-8.dll",
71
+ },
72
+ },
73
+ ]
14
74
  end
15
- package.define_tasks
75
+ package_task.define
16
76
 
@@ -51,11 +51,14 @@ rcairo_source_dir_names.each do |rcairo_source_dir_name|
51
51
  break
52
52
  end
53
53
  end
54
- check_cairo(rcairo_options)
54
+
55
+ unless check_cairo(rcairo_options)
56
+ exit(false)
57
+ end
55
58
 
56
59
  setup_win32(module_name, base_dir)
57
60
 
58
- unless required_pkg_config_package([package_id, 0, 8, 0],
61
+ unless required_pkg_config_package([package_id, 0, 12, 0],
59
62
  :debian => "libpoppler-glib-dev",
60
63
  :redhat => "poppler-glib-devel",
61
64
  # :homebrew => "poppler", # need --with-glib option
@@ -1,7 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2006-2008 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2006-2013 Ruby-GNOME2 Project Team
5
4
  *
6
5
  * This library is free software; you can redistribute it and/or
7
6
  * modify it under the terms of the GNU Lesser General Public
@@ -22,39 +21,170 @@
22
21
  #include "rbpoppler-private.h"
23
22
 
24
23
  /* PopplerAction */
25
- static VALUE actions[POPPLER_ACTION_MOVIE + 1];
24
+ static VALUE rb_cPopplerAction;
25
+ static VALUE rb_cPopplerActionDest;
26
+ static VALUE rb_cPopplerActionAny;
27
+ static VALUE rb_cPopplerActionUnknown;
28
+ static VALUE rb_cPopplerActionGotoDest;
29
+ static VALUE rb_cPopplerActionGotoRemote;
30
+ static VALUE rb_cPopplerActionLaunch;
31
+ static VALUE rb_cPopplerActionURI;
32
+ static VALUE rb_cPopplerActionNamed;
33
+ static VALUE rb_cPopplerActionMovie;
34
+ static VALUE rb_cPopplerActionRendition;
35
+ static VALUE rb_cPopplerActionOCGState;
36
+ static VALUE rb_cPopplerActionJavaScript;
37
+
38
+ #define DEFINE_ACTION_TYPE(type_lower_case, type_upper_case) \
39
+ static GType \
40
+ rb_poppler_action_ ## type_lower_case ## _get_type(void) \
41
+ { \
42
+ static GType type = 0; \
43
+ if (type == 0) { \
44
+ type = g_boxed_type_register_static("PopplerAction" # type_upper_case, \
45
+ (GBoxedCopyFunc)poppler_action_copy, \
46
+ (GBoxedFreeFunc)poppler_action_free); \
47
+ } \
48
+ return type; \
49
+ }
26
50
 
27
- VALUE
28
- rb_poppler_ruby_object_from_action(PopplerAction *action)
51
+ DEFINE_ACTION_TYPE(any, Any)
52
+ DEFINE_ACTION_TYPE(unknown, Unknown)
53
+ DEFINE_ACTION_TYPE(goto_dest, GotoDest)
54
+ DEFINE_ACTION_TYPE(goto_remote, GotoRemote)
55
+ DEFINE_ACTION_TYPE(launch, Launch)
56
+ DEFINE_ACTION_TYPE(uri, URI)
57
+ DEFINE_ACTION_TYPE(named, Named)
58
+ DEFINE_ACTION_TYPE(movie, Movie)
59
+ DEFINE_ACTION_TYPE(rendition, Rendition)
60
+ DEFINE_ACTION_TYPE(ocg_state, OCGState)
61
+ DEFINE_ACTION_TYPE(javascript, JavaScript)
62
+
63
+ #define POPPLER_ACTION_TYPE_ANY (rb_poppler_action_any_get_type())
64
+ #define POPPLER_ACTION_TYPE_UNKNOWN (rb_poppler_action_unknown_get_type())
65
+ #define POPPLER_ACTION_TYPE_GOTO_DEST (rb_poppler_action_goto_dest_get_type())
66
+ #define POPPLER_ACTION_TYPE_GOTO_REMOTE (rb_poppler_action_goto_remote_get_type())
67
+ #define POPPLER_ACTION_TYPE_LAUNCH (rb_poppler_action_launch_get_type())
68
+ #define POPPLER_ACTION_TYPE_URI (rb_poppler_action_uri_get_type())
69
+ #define POPPLER_ACTION_TYPE_NAMED (rb_poppler_action_named_get_type())
70
+ #define POPPLER_ACTION_TYPE_MOVIE (rb_poppler_action_movie_get_type())
71
+ #define POPPLER_ACTION_TYPE_RENDITION (rb_poppler_action_rendition_get_type())
72
+ #define POPPLER_ACTION_TYPE_OCG_STATE (rb_poppler_action_ocg_state_get_type())
73
+ #define POPPLER_ACTION_TYPE_JAVASCRIPT (rb_poppler_action_javascript_get_type())
74
+
75
+ static GType
76
+ rb_poppler_action_type_to_gtype(PopplerActionType action_type)
29
77
  {
30
- VALUE obj;
78
+ GType gtype = POPPLER_ACTION_TYPE_ANY;
79
+
80
+ switch (action_type) {
81
+ case POPPLER_ACTION_NONE:
82
+ break;
83
+ case POPPLER_ACTION_UNKNOWN:
84
+ gtype = POPPLER_ACTION_TYPE_UNKNOWN;
85
+ break;
86
+ case POPPLER_ACTION_GOTO_DEST:
87
+ gtype = POPPLER_ACTION_TYPE_GOTO_DEST;
88
+ break;
89
+ case POPPLER_ACTION_GOTO_REMOTE:
90
+ gtype = POPPLER_ACTION_TYPE_GOTO_REMOTE;
91
+ break;
92
+ case POPPLER_ACTION_LAUNCH:
93
+ gtype = POPPLER_ACTION_TYPE_LAUNCH;
94
+ break;
95
+ case POPPLER_ACTION_URI:
96
+ gtype = POPPLER_ACTION_TYPE_URI;
97
+ break;
98
+ case POPPLER_ACTION_NAMED:
99
+ gtype = POPPLER_ACTION_TYPE_NAMED;
100
+ break;
101
+ #if POPPLER_CHECK_VERSION(0, 14, 0)
102
+ case POPPLER_ACTION_MOVIE:
103
+ gtype = POPPLER_ACTION_TYPE_MOVIE;
104
+ break;
105
+ case POPPLER_ACTION_RENDITION:
106
+ gtype = POPPLER_ACTION_TYPE_RENDITION;
107
+ break;
108
+ case POPPLER_ACTION_OCG_STATE:
109
+ gtype = POPPLER_ACTION_TYPE_OCG_STATE;
110
+ break;
111
+ #endif
112
+ #if POPPLER_CHECK_VERSION(0, 18, 0)
113
+ case POPPLER_ACTION_JAVASCRIPT:
114
+ gtype = POPPLER_ACTION_TYPE_JAVASCRIPT;
115
+ break;
116
+ #endif
117
+ default:
118
+ break;
119
+ }
31
120
 
32
- if (!action)
33
- return Qnil;
121
+ return gtype;
122
+ }
34
123
 
35
- obj = BOXED2RVAL(action, POPPLER_TYPE_ACTION);
36
- RBASIC(obj)->klass = actions[action->type];
37
- return obj;
124
+ static GType
125
+ rb_poppler_action_to_gtype(VALUE action)
126
+ {
127
+ VALUE klass;
128
+ GType type = POPPLER_ACTION_TYPE_ANY;
129
+
130
+ klass = rb_obj_class(action);
131
+ if (klass == rb_cPopplerActionAny) {
132
+ type = POPPLER_ACTION_TYPE_ANY;
133
+ } else if (klass == rb_cPopplerActionUnknown) {
134
+ type = POPPLER_ACTION_TYPE_UNKNOWN;
135
+ } else if (klass == rb_cPopplerActionGotoDest) {
136
+ type = POPPLER_ACTION_TYPE_GOTO_DEST;
137
+ } else if (klass == rb_cPopplerActionGotoRemote) {
138
+ type = POPPLER_ACTION_TYPE_GOTO_REMOTE;
139
+ } else if (klass == rb_cPopplerActionLaunch) {
140
+ type = POPPLER_ACTION_TYPE_LAUNCH;
141
+ } else if (klass == rb_cPopplerActionURI) {
142
+ type = POPPLER_ACTION_TYPE_URI;
143
+ } else if (klass == rb_cPopplerActionNamed) {
144
+ type = POPPLER_ACTION_TYPE_NAMED;
145
+ #if POPPLER_CHECK_VERSION(0, 14, 0)
146
+ } else if (klass == rb_cPopplerActionMovie) {
147
+ type = POPPLER_ACTION_TYPE_MOVIE;
148
+ } else if (klass == rb_cPopplerActionRendition) {
149
+ type = POPPLER_ACTION_TYPE_RENDITION;
150
+ } else if (klass == rb_cPopplerActionOCGState) {
151
+ type = POPPLER_ACTION_TYPE_OCG_STATE;
152
+ #endif
153
+ #if POPPLER_CHECK_VERSION(0, 18, 0)
154
+ } else if (klass == rb_cPopplerActionJavaScript) {
155
+ type = POPPLER_ACTION_TYPE_JAVASCRIPT;
156
+ #endif
157
+ } else {
158
+ rb_raise(rb_eArgError, "Not action object: %s", RBG_INSPECT(action));
159
+ }
160
+
161
+ return type;
162
+ }
163
+
164
+ VALUE
165
+ rb_poppler_ruby_object_from_action(PopplerAction *action)
166
+ {
167
+ return BOXED2RVAL(action, rb_poppler_action_type_to_gtype(action->any.type));
38
168
  }
39
169
 
40
170
  PopplerAction *
41
171
  rb_poppler_action_from_ruby_object(VALUE action)
42
172
  {
43
- return NIL_P(action) ? NULL : RVAL2BOXED(action, POPPLER_TYPE_ACTION);
173
+ return RVAL2BOXED(action, rb_poppler_action_to_gtype(action));
44
174
  }
45
175
 
46
176
  #define ACTION_ATTR_STR(type, name) \
47
177
  static VALUE \
48
178
  action_ ## type ## _ ## name (VALUE self) \
49
179
  { \
50
- return CSTR2RVAL(RVAL2POPPLERACTION(self)->type.name); \
180
+ return CSTR2RVAL(RVAL2POPPLERACTION(self)->type.name); \
51
181
  }
52
182
 
53
- #define ACTION_ATTR_DEST(type, name) \
54
- static VALUE \
55
- action_ ## type ## _ ## name (VALUE self) \
56
- { \
57
- return POPPLERDEST2RVAL(RVAL2POPPLERACTION(self)->type.name); \
183
+ #define ACTION_ATTR_DEST(type, name) \
184
+ static VALUE \
185
+ action_ ## type ## _ ## name (VALUE self) \
186
+ { \
187
+ return POPPLERDEST2RVAL(RVAL2POPPLERACTION(self)->type.name); \
58
188
  }
59
189
 
60
190
  #define DEFINE_ACCESSOR(prefix, target, name) \
@@ -82,28 +212,41 @@ ACTION_ATTR_DEST(goto_remote, dest);
82
212
  ACTION_ATTR_STR(launch, file_name);
83
213
  ACTION_ATTR_STR(launch, params);
84
214
 
85
- /* PopplerActionUri */
215
+ /* PopplerActionURI */
86
216
  ACTION_ATTR_STR(uri, uri);
87
217
 
88
218
  /* PopplerActionNamed */
89
219
  ACTION_ATTR_STR(named, named_dest);
90
220
 
221
+ #if POPPLER_CHECK_VERSION(0, 14, 0)
91
222
  /* PopplerActionMovie */
223
+ ACTION_ATTR_DEST(movie, movie);
224
+
225
+ /* PopplerActionRendition */
226
+ ACTION_ATTR_DEST(rendition, media);
92
227
 
228
+ /* PopplerActionOCGState */
229
+ ACTION_ATTR_DEST(ocg_state, state_list);
230
+ #endif
231
+
232
+ #if POPPLER_CHECK_VERSION(0, 18, 0)
233
+ /* PopplerActionJavascript */
234
+ ACTION_ATTR_STR(javascript, script);
235
+ #endif
93
236
 
94
237
  /* PopplerDest */
95
238
  #ifdef RB_POPPLER_TYPE_DEST_NOT_DEFINED
96
239
  GType
97
240
  poppler_dest_get_type (void)
98
241
  {
99
- static GType our_type = 0;
242
+ static GType our_type = 0;
100
243
 
101
- if (our_type == 0)
102
- our_type = g_boxed_type_register_static ("PopplerDest",
103
- (GBoxedCopyFunc) poppler_dest_copy,
104
- (GBoxedFreeFunc) poppler_dest_free);
244
+ if (our_type == 0)
245
+ our_type = g_boxed_type_register_static("PopplerDest",
246
+ (GBoxedCopyFunc)poppler_dest_copy,
247
+ (GBoxedFreeFunc)poppler_dest_free);
105
248
 
106
- return our_type;
249
+ return our_type;
107
250
  }
108
251
  #endif
109
252
 
@@ -113,32 +256,32 @@ dest_get_type(VALUE self)
113
256
  return POPPLERDESTTYPE2RVAL(RVAL2POPPLERDEST(self)->type);
114
257
  }
115
258
 
116
- #define DEST_ATTR_INT(name) \
117
- static VALUE \
118
- dest_ ## name (VALUE self) \
119
- { \
120
- return INT2NUM(RVAL2POPPLERDEST(self)->name); \
259
+ #define DEST_ATTR_INT(name) \
260
+ static VALUE \
261
+ dest_ ## name (VALUE self) \
262
+ { \
263
+ return INT2NUM(RVAL2POPPLERDEST(self)->name); \
121
264
  }
122
265
 
123
- #define DEST_ATTR_UINT(name) \
124
- static VALUE \
125
- dest_ ## name (VALUE self) \
126
- { \
127
- return UINT2NUM(RVAL2POPPLERDEST(self)->name); \
266
+ #define DEST_ATTR_UINT(name) \
267
+ static VALUE \
268
+ dest_ ## name (VALUE self) \
269
+ { \
270
+ return UINT2NUM(RVAL2POPPLERDEST(self)->name); \
128
271
  }
129
272
 
130
- #define DEST_ATTR_DOUBLE(name) \
131
- static VALUE \
132
- dest_ ## name (VALUE self) \
133
- { \
134
- return rb_float_new(RVAL2POPPLERDEST(self)->name); \
273
+ #define DEST_ATTR_DOUBLE(name) \
274
+ static VALUE \
275
+ dest_ ## name (VALUE self) \
276
+ { \
277
+ return rb_float_new(RVAL2POPPLERDEST(self)->name); \
135
278
  }
136
279
 
137
- #define DEST_ATTR_STR(name) \
138
- static VALUE \
139
- dest_ ## name (VALUE self) \
140
- { \
141
- return CSTR2RVAL(RVAL2POPPLERDEST(self)->name); \
280
+ #define DEST_ATTR_STR(name) \
281
+ static VALUE \
282
+ dest_ ## name (VALUE self) \
283
+ { \
284
+ return CSTR2RVAL(RVAL2POPPLERDEST(self)->name); \
142
285
  }
143
286
 
144
287
  #define DEFINE_DEST_ACCESSOR(target, name) \
@@ -159,58 +302,71 @@ DEST_ATTR_UINT(change_zoom)
159
302
  void
160
303
  Init_poppler_action(VALUE mPoppler)
161
304
  {
162
- VALUE cDest, cAction, cActionAny, cActionGotoDest, cActionGotoRemote;
163
- VALUE cActionLaunch, cActionUri, cActionNamed, cActionMovie;
305
+ rb_cPopplerAction = G_DEF_CLASS(POPPLER_TYPE_ACTION, "Action", mPoppler);
306
+
307
+ rb_cPopplerActionAny = rb_define_class_under(mPoppler, "ActionAny", rb_cPopplerAction);
308
+ rbg_define_method(rb_cPopplerActionAny, "type", action_any_type, 0);
309
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionAny, any, title);
164
310
 
165
- cAction = G_DEF_CLASS(POPPLER_TYPE_ACTION, "Action", mPoppler);
311
+ rb_cPopplerActionUnknown = rb_define_class_under(mPoppler, "ActionUnknown",
312
+ rb_cPopplerAction);
166
313
 
167
- cActionAny = rb_define_class_under(mPoppler, "ActionAny", cAction);
168
- rbg_define_method(cActionAny, "type", action_any_type, 0);
169
- DEFINE_ACTION_ACCESSOR(cActionAny, any, title);
314
+ rb_cPopplerActionGotoDest = rb_define_class_under(mPoppler, "ActionGotoDest",
315
+ rb_cPopplerActionAny);
316
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionGotoDest, goto_dest, dest);
170
317
 
171
- cActionGotoDest = rb_define_class_under(mPoppler, "ActionGotoDest",
172
- cActionAny);
173
- DEFINE_ACTION_ACCESSOR(cActionGotoDest, goto_dest, dest);
318
+ rb_cPopplerActionGotoRemote = rb_define_class_under(mPoppler, "ActionGotoRemote",
319
+ rb_cPopplerActionAny);
320
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionGotoRemote, goto_remote, file_name);
321
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionGotoRemote, goto_remote, dest);
174
322
 
175
- cActionGotoRemote = rb_define_class_under(mPoppler, "ActionGotoRemote",
176
- cActionAny);
177
- DEFINE_ACTION_ACCESSOR(cActionGotoRemote, goto_remote, file_name);
178
- DEFINE_ACTION_ACCESSOR(cActionGotoRemote, goto_remote, dest);
323
+ rb_cPopplerActionLaunch = rb_define_class_under(mPoppler, "ActionLaunch",
324
+ rb_cPopplerActionAny);
325
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionLaunch, launch, file_name);
326
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionLaunch, launch, params);
179
327
 
180
- cActionLaunch = rb_define_class_under(mPoppler, "ActionLaunch", cActionAny);
181
- DEFINE_ACTION_ACCESSOR(cActionLaunch, launch, file_name);
182
- DEFINE_ACTION_ACCESSOR(cActionLaunch, launch, params);
328
+ rb_cPopplerActionURI = rb_define_class_under(mPoppler, "ActionURI", rb_cPopplerActionAny);
329
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionURI, uri, uri);
183
330
 
184
- cActionUri = rb_define_class_under(mPoppler, "ActionUri", cActionAny);
185
- DEFINE_ACTION_ACCESSOR(cActionUri, uri, uri);
331
+ rb_cPopplerActionNamed = rb_define_class_under(mPoppler, "ActionNamed",
332
+ rb_cPopplerActionAny);
333
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionNamed, named, named_dest);
186
334
 
187
- cActionNamed = rb_define_class_under(mPoppler, "ActionNamed", cActionAny);
188
- DEFINE_ACTION_ACCESSOR(cActionNamed, named, named_dest);
335
+ #if POPPLER_CHECK_VERSION(0, 14, 0)
336
+ rb_cPopplerActionMovie = rb_define_class_under(mPoppler, "ActionMovie",
337
+ rb_cPopplerActionAny);
338
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionMovie, movie, movie);
189
339
 
190
- cActionMovie = rb_define_class_under(mPoppler, "ActionMovie", cActionAny);
340
+ rb_cPopplerActionRendition = rb_define_class_under(mPoppler, "ActionRendtion",
341
+ rb_cPopplerActionAny);
342
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionRendition, rendition, media);
191
343
 
192
- actions[POPPLER_ACTION_UNKNOWN] = cActionAny;
193
- actions[POPPLER_ACTION_GOTO_DEST] = cActionGotoDest;
194
- actions[POPPLER_ACTION_GOTO_REMOTE] = cActionGotoRemote;
195
- actions[POPPLER_ACTION_LAUNCH] = cActionLaunch;
196
- actions[POPPLER_ACTION_URI] = cActionUri;
197
- actions[POPPLER_ACTION_NAMED] = cActionNamed;
198
- actions[POPPLER_ACTION_MOVIE] = cActionMovie;
344
+ rb_cPopplerActionOCGState = rb_define_class_under(mPoppler, "ActionOCGState",
345
+ rb_cPopplerActionAny);
346
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionOCGState, ocg_state, state_list);
347
+ #endif
348
+
349
+ #if POPPLER_CHECK_VERSION(0, 18, 0)
350
+ rb_cPopplerActionJavaScript =
351
+ rb_define_class_under(mPoppler, "ActionJavaScript",
352
+ rb_cPopplerActionAny);
353
+ DEFINE_ACTION_ACCESSOR(rb_cPopplerActionJavaScript, javascript, script);
354
+ #endif
199
355
 
200
356
  G_DEF_CLASS(POPPLER_TYPE_ACTION_TYPE, "ActionType", mPoppler);
201
357
  G_DEF_CLASS(POPPLER_TYPE_DEST_TYPE, "DestType", mPoppler);
202
358
 
203
- cDest = G_DEF_CLASS(POPPLER_TYPE_DEST, "Dest", mPoppler);
204
-
205
- rbg_define_method(cDest, "type", dest_get_type, 0);
206
- DEFINE_DEST_ACCESSOR(cDest, page_num);
207
- DEFINE_DEST_ACCESSOR(cDest, left);
208
- DEFINE_DEST_ACCESSOR(cDest, bottom);
209
- DEFINE_DEST_ACCESSOR(cDest, right);
210
- DEFINE_DEST_ACCESSOR(cDest, top);
211
- DEFINE_DEST_ACCESSOR(cDest, zoom);
212
- DEFINE_DEST_ACCESSOR(cDest, named_dest);
213
- DEFINE_DEST_ACCESSOR(cDest, change_left);
214
- DEFINE_DEST_ACCESSOR(cDest, change_top);
215
- DEFINE_DEST_ACCESSOR(cDest, change_zoom);
359
+ rb_cPopplerActionDest = G_DEF_CLASS(POPPLER_TYPE_DEST, "Dest", mPoppler);
360
+
361
+ rbg_define_method(rb_cPopplerActionDest, "type", dest_get_type, 0);
362
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, page_num);
363
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, left);
364
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, bottom);
365
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, right);
366
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, top);
367
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, zoom);
368
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, named_dest);
369
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, change_left);
370
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, change_top);
371
+ DEFINE_DEST_ACCESSOR(rb_cPopplerActionDest, change_zoom);
216
372
  }