poppler 1.0.3-x86-mingw32 → 1.1.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,66 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2006 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbpoppler.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cFontInfo
25
+
26
+ static VALUE RG_TARGET_NAMESPACE;
27
+
28
+ #if POPPLER_CHECK_VERSION(0, 6, 0)
29
+
30
+ static ID id_valid;
31
+
32
+ static VALUE
33
+ rg_initialize(VALUE self, VALUE document)
34
+ {
35
+ G_INITIALIZE(self, poppler_font_info_new(RVAL2POPPLERDOCUMENT(document)));
36
+ return Qnil;
37
+ }
38
+
39
+ static VALUE
40
+ rg_scan(VALUE self, VALUE n_pages)
41
+ {
42
+ VALUE rb_iter = Qnil;
43
+ PopplerFontsIter *iter;
44
+
45
+ if (poppler_font_info_scan(RVAL2FONTINFO(self), NUM2INT(n_pages), &iter)) {
46
+ rb_iter = POPPLERFONTSITER2RVAL(iter);
47
+ rb_ivar_set(rb_iter, id_valid, Qtrue);
48
+ poppler_fonts_iter_free(iter);
49
+ }
50
+ return rb_iter;
51
+ }
52
+ #endif
53
+
54
+ void
55
+ Init_poppler_fontinfo(VALUE mPoppler)
56
+ {
57
+ id_valid = rb_intern("valid?");
58
+
59
+ RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FONT_INFO, "FontInfo", mPoppler);
60
+
61
+ #if POPPLER_CHECK_VERSION(0, 6, 0)
62
+ RG_DEF_METHOD(initialize, 1);
63
+ RG_DEF_METHOD(scan, 1);
64
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
65
+ #endif
66
+ }
@@ -0,0 +1,130 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2006 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbpoppler-private.h"
23
+
24
+ #define RG_TARGET_NAMESPACE cFontsIter
25
+
26
+ #define CHECK_FITER_IS_VALID(iter) do { \
27
+ if (!RVAL2CBOOL(rg_valid_p(iter))) \
28
+ return Qnil; \
29
+ } while (0)
30
+
31
+ static ID id_valid;
32
+
33
+ static VALUE
34
+ rg_valid_p(VALUE self)
35
+ {
36
+ return rb_ivar_get(self, id_valid);
37
+ }
38
+
39
+ static VALUE
40
+ rg_name(VALUE self)
41
+ {
42
+ CHECK_FITER_IS_VALID(self);
43
+ return CSTR2RVAL(poppler_fonts_iter_get_name(RVAL2POPPLERFONTSITER(self)));
44
+ }
45
+
46
+ static VALUE
47
+ rg_full_name(VALUE self)
48
+ {
49
+ CHECK_FITER_IS_VALID(self);
50
+ return CSTR2RVAL(poppler_fonts_iter_get_full_name(RVAL2POPPLERFONTSITER(self)));
51
+ }
52
+
53
+ static VALUE
54
+ rg_file_name(VALUE self)
55
+ {
56
+ CHECK_FITER_IS_VALID(self);
57
+ return CSTR2RVAL(poppler_fonts_iter_get_file_name(RVAL2POPPLERFONTSITER(self)));
58
+ }
59
+
60
+ static VALUE
61
+ rg_font_type(VALUE self)
62
+ {
63
+ CHECK_FITER_IS_VALID(self);
64
+ return POPPLERFONTTYPE2RVAL(poppler_fonts_iter_get_font_type(RVAL2POPPLERFONTSITER(self)));
65
+ }
66
+
67
+ static VALUE
68
+ rg_embedded_p(VALUE self)
69
+ {
70
+ CHECK_FITER_IS_VALID(self);
71
+ return CBOOL2RVAL(poppler_fonts_iter_is_embedded(RVAL2POPPLERFONTSITER(self)));
72
+ }
73
+
74
+ static VALUE
75
+ rg_subset_p(VALUE self)
76
+ {
77
+ CHECK_FITER_IS_VALID(self);
78
+ return CBOOL2RVAL(poppler_fonts_iter_is_subset(RVAL2POPPLERFONTSITER(self)));
79
+ }
80
+
81
+ static VALUE
82
+ rg_next(VALUE self)
83
+ {
84
+ if (poppler_fonts_iter_next(RVAL2POPPLERFONTSITER(self))) {
85
+ return Qtrue;
86
+ } else {
87
+ rb_ivar_set(self, id_valid, Qfalse);
88
+ return Qfalse;
89
+ }
90
+ }
91
+
92
+ static VALUE
93
+ rg_each(VALUE self)
94
+ {
95
+ PopplerFontsIter *iter;
96
+
97
+ CHECK_FITER_IS_VALID(self);
98
+ iter = RVAL2POPPLERFONTSITER(self);
99
+ do {
100
+ rb_yield(self);
101
+ } while (poppler_fonts_iter_next(iter));
102
+ rb_ivar_set(self, id_valid, Qfalse);
103
+
104
+ return self;
105
+ }
106
+
107
+ void
108
+ Init_poppler_fontsiter(VALUE mPoppler)
109
+ {
110
+ id_valid = rb_intern("valid?");
111
+
112
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FONTS_ITER, "FontsIter", mPoppler);
113
+
114
+ rb_include_module(RG_TARGET_NAMESPACE, rb_mEnumerable);
115
+
116
+ RG_DEF_METHOD(name, 0);
117
+ RG_DEF_METHOD(full_name, 0);
118
+ #if POPPLER_CHECK_VERSION(0, 6, 0)
119
+ RG_DEF_METHOD(file_name, 0);
120
+ #endif
121
+ RG_DEF_METHOD(font_type, 0);
122
+ RG_DEF_METHOD_P(embedded, 0);
123
+ RG_DEF_METHOD_P(subset, 0);
124
+ RG_DEF_METHOD(next, 0);
125
+
126
+ RG_DEF_METHOD_P(valid, 0);
127
+ RG_DEF_METHOD(each, 0);
128
+
129
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
130
+ }
@@ -1,27 +1,31 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /**********************************************************************
3
-
4
- rbpoppler-form-field.c -
5
-
6
- Copyright (C) 2008 Ruby-GNOME2 Project Team
7
-
8
- **********************************************************************/
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008 Ruby-GNOME2 Project Team
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
9
21
 
10
22
  #include "rbpoppler-private.h"
11
23
 
12
- #define RVAL2FF(obj) RVAL2POPPLER_FORM_FIELD(obj)
13
- #define RVAL2TF(obj) RVAL2FF(obj)
14
- #define RVAL2BF(obj) RVAL2FF(obj)
15
- #define RVAL2CF(obj) RVAL2FF(obj)
16
-
17
- #define FFT2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_FORM_FIELD_TYPE))
18
- #define RVAL2FFT(obj) (RVAL2GENUM(obj, POPPLER_TYPE_FORM_FIELD_TYPE))
19
- #define FBT2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_FORM_BUTTON_TYPE))
20
- #define FTT2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_FORM_TEXT_TYPE))
21
- #define FCT2RVAL(obj) (GENUM2RVAL(obj, POPPLER_TYPE_FORM_CHOICE_TYPE))
24
+ #define RG_TARGET_NAMESPACE cFormField
25
+ #define _SELF(obj) RVAL2POPPLERFORMFIELD(obj)
22
26
 
23
- static VALUE cUnknownField, cTextField, cButtonField;
24
- static VALUE cChoiceField, cSignatureField;
27
+ static VALUE cButtonField, cTextField, cChoiceField;
28
+ static VALUE cUnknownField, cSignatureField;
25
29
 
26
30
  VALUE
27
31
  rb_poppler_ruby_object_from_form_field(PopplerFormField *field)
@@ -54,238 +58,43 @@ rb_poppler_ruby_object_from_form_field(PopplerFormField *field)
54
58
  return obj;
55
59
  }
56
60
 
57
- /* FormField */
58
- static VALUE
59
- form_field_get_id(VALUE self)
60
- {
61
- return INT2NUM(poppler_form_field_get_id(RVAL2FF(self)));
62
- }
63
-
64
- static VALUE
65
- form_field_get_font_size(VALUE self)
66
- {
67
- return rb_float_new(poppler_form_field_get_font_size(RVAL2FF(self)));
68
- }
69
-
70
- static VALUE
71
- form_field_is_read_only(VALUE self)
72
- {
73
- return CBOOL2RVAL(poppler_form_field_is_read_only(RVAL2FF(self)));
74
- }
75
-
76
- /* Button Field */
77
- static VALUE
78
- button_field_get_button_type(VALUE self)
79
- {
80
- return FBT2RVAL(poppler_form_field_button_get_button_type(RVAL2FF(self)));
81
- }
82
-
83
- static VALUE
84
- button_field_get_state(VALUE self)
85
- {
86
- return CBOOL2RVAL(poppler_form_field_button_get_state(RVAL2BF(self)));
87
- }
88
-
89
- static VALUE
90
- button_field_set_state(VALUE self, VALUE state)
91
- {
92
- poppler_form_field_button_set_state(RVAL2BF(self), RVAL2CBOOL(state));
93
- return Qnil;
94
- }
95
-
96
- /* Text Field */
97
61
  static VALUE
98
- text_field_get_text_type(VALUE self)
62
+ rg_id(VALUE self)
99
63
  {
100
- return FTT2RVAL(poppler_form_field_text_get_text_type(RVAL2TF(self)));
64
+ return INT2NUM(poppler_form_field_get_id(_SELF(self)));
101
65
  }
102
66
 
103
67
  static VALUE
104
- text_field_get_text(VALUE self)
68
+ rg_font_size(VALUE self)
105
69
  {
106
- return CSTR2RVAL(poppler_form_field_text_get_text(RVAL2TF(self)));
70
+ return rb_float_new(poppler_form_field_get_font_size(_SELF(self)));
107
71
  }
108
72
 
109
73
  static VALUE
110
- text_field_set_text(VALUE self, VALUE text)
74
+ rg_read_only_p(VALUE self)
111
75
  {
112
- poppler_form_field_text_set_text(RVAL2TF(self), RVAL2CSTR_ACCEPT_NIL(text));
113
- return Qnil;
114
- }
115
-
116
- static VALUE
117
- text_field_get_max_length(VALUE self)
118
- {
119
- return INT2NUM(poppler_form_field_text_get_max_len(RVAL2TF(self)));
120
- }
121
-
122
- static VALUE
123
- text_field_do_spell_check(VALUE self)
124
- {
125
- return CBOOL2RVAL(poppler_form_field_text_do_spell_check(RVAL2TF(self)));
126
- }
127
-
128
- static VALUE
129
- text_field_do_scroll(VALUE self)
130
- {
131
- return CBOOL2RVAL(poppler_form_field_text_do_scroll(RVAL2TF(self)));
132
- }
133
-
134
- static VALUE
135
- text_field_is_rich_text(VALUE self)
136
- {
137
- return CBOOL2RVAL(poppler_form_field_text_is_rich_text(RVAL2TF(self)));
138
- }
139
-
140
- static VALUE
141
- text_field_is_password(VALUE self)
142
- {
143
- return CBOOL2RVAL(poppler_form_field_text_is_password(RVAL2TF(self)));
144
- }
145
-
146
-
147
- /* Choice Field */
148
- static VALUE
149
- choice_field_get_choice_type(VALUE self)
150
- {
151
- return FCT2RVAL(poppler_form_field_choice_get_choice_type(RVAL2CF(self)));
152
- }
153
-
154
- static VALUE
155
- choice_field_is_editable(VALUE self)
156
- {
157
- return CBOOL2RVAL(poppler_form_field_choice_is_editable(RVAL2CF(self)));
158
- }
159
-
160
- static VALUE
161
- choice_field_can_select_multiple(VALUE self)
162
- {
163
- return CBOOL2RVAL(poppler_form_field_choice_can_select_multiple(RVAL2CF(self)));
164
- }
165
-
166
- static VALUE
167
- choice_field_do_spell_check(VALUE self)
168
- {
169
- return CBOOL2RVAL(poppler_form_field_choice_do_spell_check(RVAL2CF(self)));
170
- }
171
-
172
- static VALUE
173
- choice_field_commit_on_change(VALUE self)
174
- {
175
- return CBOOL2RVAL(poppler_form_field_choice_commit_on_change(RVAL2CF(self)));
176
- }
177
-
178
- static VALUE
179
- choice_field_get_n_items(VALUE self)
180
- {
181
- return INT2NUM(poppler_form_field_choice_get_n_items(RVAL2CF(self)));
182
- }
183
-
184
- static VALUE
185
- choice_field_get_item(VALUE self, VALUE index)
186
- {
187
- return CSTR2RVAL(poppler_form_field_choice_get_item(RVAL2CF(self),
188
- NUM2INT(index)));
189
- }
190
-
191
- static VALUE
192
- choice_field_is_item_selected(VALUE self, VALUE index)
193
- {
194
- return CBOOL2RVAL(poppler_form_field_choice_is_item_selected(RVAL2CF(self),
195
- NUM2INT(index)));
196
- }
197
-
198
- static VALUE
199
- choice_field_select_item(VALUE self, VALUE index)
200
- {
201
- poppler_form_field_choice_select_item(RVAL2CF(self), NUM2INT(index));
202
- return Qnil;
203
- }
204
-
205
- static VALUE
206
- choice_field_unselect_all(VALUE self)
207
- {
208
- poppler_form_field_choice_unselect_all(RVAL2CF(self));
209
- return Qnil;
210
- }
211
-
212
- static VALUE
213
- choice_field_toggle_item(VALUE self, VALUE index)
214
- {
215
- poppler_form_field_choice_toggle_item(RVAL2CF(self), NUM2INT(index));
216
- return Qnil;
217
- }
218
-
219
- static VALUE
220
- choice_field_set_text(VALUE self, VALUE text)
221
- {
222
- poppler_form_field_choice_set_text(RVAL2CF(self), RVAL2CSTR_ACCEPT_NIL(text));
223
- return Qnil;
224
- }
225
-
226
- static VALUE
227
- choice_field_get_text(VALUE self)
228
- {
229
- return CSTR2RVAL(poppler_form_field_choice_get_text(RVAL2CF(self)));
76
+ return CBOOL2RVAL(poppler_form_field_is_read_only(_SELF(self)));
230
77
  }
231
78
 
232
79
  void
233
80
  Init_poppler_form_field(VALUE mPoppler)
234
81
  {
235
- VALUE cFormField;
236
-
237
- cFormField = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD, "FormField", mPoppler);
238
- cUnknownField = rb_define_class_under(mPoppler, "UnknownField", cFormField);
239
- cTextField = rb_define_class_under(mPoppler, "TextField", cFormField);
240
- cButtonField = rb_define_class_under(mPoppler, "ButtonField", cFormField);
241
- cChoiceField = rb_define_class_under(mPoppler, "ChoiceField", cFormField);
82
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(POPPLER_TYPE_FORM_FIELD, "FormField", mPoppler);
83
+ cUnknownField = rb_define_class_under(mPoppler, "UnknownField", RG_TARGET_NAMESPACE);
242
84
  cSignatureField = rb_define_class_under(mPoppler, "SignatureField",
243
- cFormField);
244
-
245
- /* FormField */
246
- rb_define_method(cFormField, "id", form_field_get_id, 0);
247
- rb_define_method(cFormField, "font_size", form_field_get_font_size, 0);
248
- rb_define_method(cFormField, "read_only?", form_field_is_read_only, 0);
249
-
250
- G_DEF_SETTERS(cFormField);
251
-
252
-
253
- rb_define_method(cButtonField, "type", button_field_get_button_type, 0);
254
- rb_define_method(cButtonField, "active?", button_field_get_state, 0);
255
- rb_define_method(cButtonField, "set_active", button_field_set_state, 1);
256
-
257
- G_DEF_SETTERS(cButtonField);
258
-
259
-
260
- rb_define_method(cTextField, "type", text_field_get_text_type, 0);
261
- rb_define_method(cTextField, "text", text_field_get_text, 0);
262
- rb_define_method(cTextField, "set_text", text_field_set_text, 1);
263
- rb_define_method(cTextField, "max_length", text_field_get_max_length, 0);
264
- rb_define_method(cTextField, "spell_check?", text_field_do_spell_check, 0);
265
- rb_define_method(cTextField, "scroll?", text_field_do_scroll, 0);
266
- rb_define_method(cTextField, "rich_text?", text_field_is_rich_text, 0);
267
- rb_define_method(cTextField, "password?", text_field_is_password, 0);
85
+ RG_TARGET_NAMESPACE);
268
86
 
269
- G_DEF_SETTERS(cTextField);
87
+ RG_DEF_METHOD(id, 0);
88
+ RG_DEF_METHOD(font_size, 0);
89
+ RG_DEF_METHOD_P(read_only, 0);
270
90
 
91
+ G_DEF_SETTERS(RG_TARGET_NAMESPACE);
271
92
 
272
- rb_define_method(cChoiceField, "type", choice_field_get_choice_type, 0);
273
- rb_define_method(cChoiceField, "editable?", choice_field_is_editable, 0);
274
- rb_define_method(cChoiceField, "select_multiple?",
275
- choice_field_can_select_multiple, 0);
276
- rb_define_method(cChoiceField, "spell_check?",
277
- choice_field_do_spell_check, 0);
278
- rb_define_method(cChoiceField, "commit_on_change?",
279
- choice_field_commit_on_change, 0);
280
- rb_define_method(cChoiceField, "n_items", choice_field_get_n_items, 0);
281
- rb_define_method(cChoiceField, "[]", choice_field_get_item, 1);
282
- rb_define_method(cChoiceField, "selected?",
283
- choice_field_is_item_selected, 1);
284
- rb_define_method(cChoiceField, "select", choice_field_select_item, 1);
285
- rb_define_method(cChoiceField, "unselect_all", choice_field_unselect_all, 0);
286
- rb_define_method(cChoiceField, "toggle", choice_field_toggle_item, 1);
287
- rb_define_method(cChoiceField, "text", choice_field_get_text, 0);
288
- rb_define_method(cChoiceField, "set_text", choice_field_set_text, 1);
93
+ Init_poppler_button_field(mPoppler, RG_TARGET_NAMESPACE);
94
+ Init_poppler_text_field(mPoppler, RG_TARGET_NAMESPACE);
95
+ Init_poppler_choice_field(mPoppler, RG_TARGET_NAMESPACE);
289
96
 
290
- G_DEF_SETTERS(cChoiceField);
97
+ cButtonField = rb_const_get(mPoppler, rb_intern("ButtonField"));
98
+ cTextField = rb_const_get(mPoppler, rb_intern("TextField"));
99
+ cChoiceField = rb_const_get(mPoppler, rb_intern("ChoiceField"));
291
100
  }