gtksourceview2 0.90.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. data/ChangeLog +57 -0
  2. data/README +29 -0
  3. data/Rakefile +14 -0
  4. data/ext/gtksourceview2/Makefile +162 -0
  5. data/ext/gtksourceview2/depend +5 -0
  6. data/ext/gtksourceview2/extconf.rb +73 -0
  7. data/ext/gtksourceview2/gtksourceview2.def +2 -0
  8. data/ext/gtksourceview2/gtksourceview2.so +0 -0
  9. data/ext/gtksourceview2/rbgtksourcebuffer.c +401 -0
  10. data/ext/gtksourceview2/rbgtksourcebuffer.o +0 -0
  11. data/ext/gtksourceview2/rbgtksourceiter.c +110 -0
  12. data/ext/gtksourceview2/rbgtksourceiter.o +0 -0
  13. data/ext/gtksourceview2/rbgtksourcelanguage.c +126 -0
  14. data/ext/gtksourceview2/rbgtksourcelanguage.o +0 -0
  15. data/ext/gtksourceview2/rbgtksourcelanguagemanager.c +188 -0
  16. data/ext/gtksourceview2/rbgtksourcelanguagemanager.o +0 -0
  17. data/ext/gtksourceview2/rbgtksourcemain.c +38 -0
  18. data/ext/gtksourceview2/rbgtksourcemain.h +32 -0
  19. data/ext/gtksourceview2/rbgtksourcemain.o +0 -0
  20. data/ext/gtksourceview2/rbgtksourcemark.c +90 -0
  21. data/ext/gtksourceview2/rbgtksourcemark.o +0 -0
  22. data/ext/gtksourceview2/rbgtksourceprintcompositor.c +249 -0
  23. data/ext/gtksourceview2/rbgtksourceprintcompositor.o +0 -0
  24. data/ext/gtksourceview2/rbgtksourcestyle.c +48 -0
  25. data/ext/gtksourceview2/rbgtksourcestyle.o +0 -0
  26. data/ext/gtksourceview2/rbgtksourcestylescheme.c +71 -0
  27. data/ext/gtksourceview2/rbgtksourcestylescheme.o +0 -0
  28. data/ext/gtksourceview2/rbgtksourcestyleschememanager.c +211 -0
  29. data/ext/gtksourceview2/rbgtksourcestyleschememanager.o +0 -0
  30. data/ext/gtksourceview2/rbgtksourceview.c +239 -0
  31. data/ext/gtksourceview2/rbgtksourceview.o +0 -0
  32. data/ext/gtksourceview2/rbgtksourceview2version.h +25 -0
  33. data/ext/gtksourceview2/ruby-gtksourceview2.pc +3 -0
  34. data/extconf.rb +49 -0
  35. data/lib/gtksourceview2.rb +2 -0
  36. data/sample/sourcelanguagemanager.rb +21 -0
  37. data/sample/test.rb +32 -0
  38. data/test/run-test.rb +33 -0
  39. data/test/test_source_view.rb +17 -0
  40. metadata +122 -0
@@ -0,0 +1,188 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtksourcelanguagemanager.c -
5
+
6
+ $Author $
7
+ $Date: 2004/08/05 18:13:49 $
8
+
9
+ Copyright (C) 2004 Ruby-GNOME2 Project Team
10
+ Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by Masao Mutoh
11
+ ************************************************/
12
+ #include "rbgtksourcemain.h"
13
+
14
+ /* Class: Gtk::SourceLanguageManager
15
+ * A class to manage source language.
16
+ */
17
+
18
+ #define _SELF(self) (GTK_SOURCE_LANGUAGE_MANAGER(RVAL2GOBJ(self)))
19
+
20
+ /* Class method: new
21
+ * Returns: a newly created Gtk::SourceLanguageManager object.
22
+ */
23
+ static VALUE
24
+ slm_new (self)
25
+ VALUE self;
26
+ {
27
+ G_INITIALIZE (self, gtk_source_language_manager_new ());
28
+ return Qnil;
29
+ }
30
+
31
+ /* Class method: default
32
+ *
33
+ * Gets the default language manager.
34
+ *
35
+ * Returns: a Gtk::SourceLanguageManager
36
+ */
37
+ static VALUE
38
+ slm_get_default(self)
39
+ VALUE self;
40
+ {
41
+ GtkSourceLanguageManager* slm = gtk_source_language_manager_get_default();
42
+ GType gtype = G_TYPE_FROM_INSTANCE(slm);
43
+
44
+ gchar *gtypename = (gchar *) g_type_name (gtype);
45
+ if (strncmp (gtypename, "Gtk", 3) == 0)
46
+ gtypename += 3;
47
+ if (!rb_const_defined_at (mGtk, rb_intern (gtypename)))
48
+ G_DEF_CLASS (gtype, gtypename, mGtk);
49
+
50
+ return GOBJ2RVAL(slm);
51
+ }
52
+
53
+ /* Method: set_search_path(dirs)
54
+ * dirs: language file directory path
55
+ *
56
+ * Sets the language files directories for the given language manager.
57
+ *
58
+ * Returns: self.
59
+ */
60
+ static VALUE
61
+ slm_set_search_path (self, dirs)
62
+ VALUE self, dirs;
63
+ {
64
+ gchar** gdirs = (gchar**)NULL;
65
+ gint i;
66
+
67
+ if (! NIL_P(dirs)){
68
+ Check_Type(dirs, T_ARRAY);
69
+ i = RARRAY_LEN(dirs);
70
+ gdirs = ALLOCA_N(gchar*, i + 1);
71
+ for (i = 0; i < i; i++) {
72
+ if (TYPE(RARRAY_PTR(dirs)[i]) == T_STRING) {
73
+ gdirs[i] = RVAL2CSTR(RARRAY_PTR(dirs)[i]);
74
+ }
75
+ else {
76
+ gdirs[i] = "";
77
+ }
78
+ }
79
+ gdirs[i] = (gchar*)NULL;
80
+ }
81
+
82
+ gtk_source_language_manager_set_search_path (_SELF (self), gdirs);
83
+
84
+ return self;
85
+ }
86
+
87
+ /* Method: search_path
88
+ * Returns: a list of language files directories (strings) for the given
89
+ * language manager.
90
+ */
91
+ static VALUE
92
+ slm_get_search_path (self)
93
+ VALUE self;
94
+ {
95
+ VALUE ary;
96
+ const gchar * const * dirs =
97
+ gtk_source_language_manager_get_search_path (_SELF (self));
98
+ if (!dirs)
99
+ return Qnil;
100
+
101
+ ary = rb_ary_new();
102
+ while (*dirs){
103
+ rb_ary_push(ary, CSTR2RVAL(*dirs));
104
+ dirs++;
105
+ }
106
+ return ary;
107
+ }
108
+
109
+ /* Method: language_ids
110
+ * Returns: a list of languages ids for the given language manager
111
+ */
112
+ static VALUE
113
+ slm_get_language_ids (self)
114
+ VALUE self;
115
+ {
116
+ VALUE ary;
117
+ const gchar * const * ids =
118
+ gtk_source_language_manager_get_language_ids (_SELF (self));
119
+ if (!ids)
120
+ return Qnil;
121
+
122
+ ary = rb_ary_new();
123
+ while (*ids){
124
+ rb_ary_push(ary, CSTR2RVAL(*ids));
125
+ ids++;
126
+ }
127
+ return ary;
128
+ }
129
+
130
+ /*
131
+ * Method: get_language(id)
132
+ * id: a language id (as a string).
133
+ *
134
+ * Gets the Gtk::SourceLanguage which is associated with the given id
135
+ * in the language manager.
136
+ *
137
+ * Returns: a Gtk::SourceLanguage, or nil if there is no language associated
138
+ * with the given id.
139
+ */
140
+ static VALUE
141
+ slm_get_language (self, id)
142
+ VALUE self, id;
143
+ {
144
+ return
145
+ GOBJ2RVAL (gtk_source_language_manager_get_language
146
+ (_SELF (self), RVAL2CSTR (id)));
147
+ }
148
+
149
+ #ifdef HAVE_GTK_SOURCE_LANGUAGE_MANAGER_GUESS_LANGUAGE
150
+ /*
151
+ * Method: guess_language(filename, content_type)
152
+ * filename: a file name (as a string), or nil.
153
+ * content_type: content type (as a string), or nil.
154
+ *
155
+ * Guesses the Gtk::SourceLanguage for the given file name and content type.
156
+ *
157
+ * Returns: a Gtk::SourceLanguage, or nil if there is no language associated
158
+ * with the given filename or content_type.
159
+ */
160
+ static VALUE
161
+ slm_guess_language (self, filename, content_type)
162
+ VALUE self, filename, content_type;
163
+ {
164
+ return GOBJ2RVAL (gtk_source_language_manager_guess_language
165
+ (_SELF (self),
166
+ NIL_P(filename) ? NULL : RVAL2CSTR (filename),
167
+ NIL_P(content_type) ? NULL : RVAL2CSTR (content_type)));
168
+ }
169
+ #endif /* HAVE_GTK_SOURCE_LANGUAGE_MANAGER_GUESS_LANGUAGE */
170
+
171
+ void
172
+ Init_gtk_sourcelanguagemanager ()
173
+ {
174
+ VALUE cslm =
175
+ G_DEF_CLASS (GTK_TYPE_SOURCE_LANGUAGE_MANAGER,
176
+ "SourceLanguageManager", mGtk);
177
+
178
+ rb_define_method (cslm, "initialize", slm_new, 0);
179
+ rb_define_method (cslm, "set_search_path", slm_set_search_path, 1);
180
+ rb_define_method (cslm, "search_path", slm_get_search_path, 0);
181
+ rb_define_method (cslm, "language_ids", slm_get_language_ids, 0);
182
+ rb_define_method (cslm, "get_language", slm_get_language, 1);
183
+ #ifdef HAVE_GTK_SOURCE_LANGUAGE_MANAGER_GUESS_LANGUAGE
184
+ rb_define_method (cslm, "guess_language", slm_guess_language, 2);
185
+ #endif
186
+ rb_define_singleton_method(cslm, "default", slm_get_default, 0);
187
+ G_DEF_SETTERS (cslm);
188
+ }
@@ -0,0 +1,38 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtksourcemain.c -
5
+
6
+ $Author $
7
+ $Date: 2005/10/07 19:26:15 $
8
+
9
+ Copyright (C) 2004,2005 Ruby-GNOME2 Project Team
10
+ Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by Masao Mutoh
11
+ ************************************************/
12
+ #include "rbgtksourcemain.h"
13
+
14
+ extern void Init_gtk_sourceview (void);
15
+ extern void Init_gtk_sourcebuffer (void);
16
+ extern void Init_gtk_sourceiter (void);
17
+ extern void Init_gtk_sourcelanguage (void);
18
+ extern void Init_gtk_sourcelanguagemanager (void);
19
+ extern void Init_gtk_sourcemark (void);
20
+ extern void Init_gtk_sourceprintcompositor (void);
21
+ extern void Init_gtk_sourcestyle (void);
22
+ extern void Init_gtk_sourcestylescheme (void);
23
+ extern void Init_gtk_sourcestyleschememanager (void);
24
+
25
+ void
26
+ Init_gtksourceview2 (void)
27
+ {
28
+ Init_gtk_sourceview ();
29
+ Init_gtk_sourcebuffer ();
30
+ Init_gtk_sourceiter ();
31
+ Init_gtk_sourcelanguage ();
32
+ Init_gtk_sourcelanguagemanager ();
33
+ Init_gtk_sourcemark ();
34
+ Init_gtk_sourceprintcompositor ();
35
+ Init_gtk_sourcestyle ();
36
+ Init_gtk_sourcestylescheme ();
37
+ Init_gtk_sourcestyleschememanager ();
38
+ }
@@ -0,0 +1,32 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtksourcemain.h -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2005/10/07 19:26:15 $
8
+
9
+ Copyright (C) 2004,2005 Ruby-GNOME2 Project Team
10
+ Copyright (C) 2003 Geoff Youngs
11
+ ************************************************/
12
+
13
+ #ifndef __RBGTKSOURCEVIEWMAIN_H_
14
+ #define __RBGTKSOURCEVIEWMAIN_H_
15
+
16
+ #include <gtksourceview/gtksourcebuffer.h>
17
+ #include <gtksourceview/gtksourceiter.h>
18
+ #include <gtksourceview/gtksourcelanguage.h>
19
+ #include <gtksourceview/gtksourcelanguagemanager.h>
20
+ #include <gtksourceview/gtksourcemark.h>
21
+ #include <gtksourceview/gtksourceprintcompositor.h>
22
+ #include <gtksourceview/gtksourcestyle.h>
23
+ #include <gtksourceview/gtksourcestylescheme.h>
24
+ #include <gtksourceview/gtksourcestyleschememanager.h>
25
+ #include <gtksourceview/gtksourceview.h>
26
+ #include <gtksourceview/gtksourceview-typebuiltins.h>
27
+
28
+ #include "ruby.h"
29
+ #include "rbgtk.h"
30
+ #include "rbgtksourceview2version.h"
31
+
32
+ #endif /* __RBGTKSOURCEVIEWMAIN_H_ */
@@ -0,0 +1,90 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtksourcemark.c -
5
+
6
+ $Author $
7
+ $Date: 2004/08/05 18:13:49 $
8
+
9
+ Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by Masao Mutoh
10
+ ************************************************/
11
+ #include "rbgtksourcemain.h"
12
+
13
+ #ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE
14
+ /* Class: Gtk::SourceMark
15
+ * A source mark.
16
+ */
17
+
18
+ #define _SELF(self) (GTK_SOURCE_MARK(RVAL2GOBJ(self)))
19
+
20
+ /* Class method: new(name, category)
21
+ * name: mark name (string)
22
+ * category: marker category (string)
23
+ *
24
+ * Returns: a newly created Gtk::SourceMark object.
25
+ */
26
+ static VALUE
27
+ sourcemark_new (self, name, category)
28
+ VALUE self, name, category;
29
+ {
30
+ G_INITIALIZE (self,
31
+ gtk_source_mark_new (RVAL2CSTR(name), RVAL2CSTR(category)));
32
+ return Qnil;
33
+ }
34
+
35
+ /* Defined as properties.
36
+ const gchar* gtk_source_mark_get_category (GtkSourceMark *mark);
37
+ */
38
+
39
+ /* Method: next(category=nil)
40
+ * category: the category (string), or nil.
41
+ *
42
+ * Returns: the next Gtk::SourceMark after the mark.
43
+ */
44
+ static VALUE
45
+ sourcemark_next (argc, argv, self)
46
+ int argc;
47
+ VALUE *argv;
48
+ VALUE self;
49
+ {
50
+ VALUE category;
51
+
52
+ rb_scan_args (argc, argv, "01", &category);
53
+
54
+ return GOBJ2RVAL (gtk_source_mark_next (_SELF (self),
55
+ NIL_P (category) ? NULL : RVAL2CSTR(category)));
56
+ }
57
+
58
+ /* Method: prev(category=nil)
59
+ * category: the category (string), or nil.
60
+ *
61
+ * Returns: the previous Gtk::SourceMark before the mark.
62
+ */
63
+ static VALUE
64
+ sourcemark_prev (argc, argv, self)
65
+ int argc;
66
+ VALUE *argv;
67
+ VALUE self;
68
+ {
69
+ VALUE category;
70
+
71
+ rb_scan_args (argc, argv, "01", &category);
72
+
73
+ return GOBJ2RVAL (gtk_source_mark_prev (_SELF (self),
74
+ NIL_P (category) ? NULL : RVAL2CSTR(category)));
75
+ }
76
+ #endif /* HAVE_GTK_SOURCE_MARK_GET_TYPE */
77
+
78
+ void
79
+ Init_gtk_sourcemark ()
80
+ {
81
+ #ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE
82
+ VALUE csm = G_DEF_CLASS (GTK_TYPE_SOURCE_MARK, "SourceMark", mGtk);
83
+
84
+ rb_define_method (csm, "initialize", sourcemark_new, 2);
85
+ rb_define_method (csm, "next", sourcemark_next, -1);
86
+ rb_define_method (csm, "prev", sourcemark_prev, -1);
87
+
88
+ G_DEF_SETTERS (csm);
89
+ #endif /* HAVE_GTK_SOURCE_MARK_GET_TYPE */
90
+ }
@@ -0,0 +1,249 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtksourceprintcompositor.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:33 $
8
+
9
+ Copyright (C) 2005 Masao Mutoh
10
+ ************************************************/
11
+ #include "rbgtksourcemain.h"
12
+
13
+ #ifdef HAVE_GTK_SOURCE_PRINT_COMPOSITOR_GET_TYPE
14
+ /* Module: Gtk::SourcePrintCompositor
15
+ */
16
+ #define _SELF(self) (GTK_SOURCE_PRINT_COMPOSITOR(RVAL2GOBJ(self)))
17
+ #define RVAL2UNIT(o) (RVAL2GENUM(o, GTK_TYPE_UNIT))
18
+
19
+ /*
20
+ * Class method: new(buffer)
21
+ * buffer: a Gtk::SourceBuffer or Gtk::SourceView object.
22
+ *
23
+ * Creates a new print compositor to print buffer.
24
+ *
25
+ * Returns: the new print compositor object.
26
+ */
27
+ static VALUE
28
+ sprintcompositor_initialize (self, val)
29
+ VALUE self, val;
30
+ {
31
+ if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_TYPE_SOURCE_BUFFER))) {
32
+ G_INITIALIZE(self,
33
+ gtk_source_print_compositor_new (GTK_SOURCE_BUFFER (RVAL2GOBJ (val))));
34
+ } else
35
+ if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_TYPE_SOURCE_VIEW))) {
36
+ G_INITIALIZE(self,
37
+ gtk_source_print_compositor_new_from_view (GTK_SOURCE_VIEW (RVAL2GOBJ (val))));
38
+ } else {
39
+ rb_raise (rb_eArgError,
40
+ "invalid argument %s (expect Gtk::SourceBuffer or Gtk::SourceView)",
41
+ rb_class2name (CLASS_OF (val)));
42
+ }
43
+ return Qnil;
44
+ }
45
+
46
+ /* Defined as properties.
47
+ GtkSourceBuffer* gtk_source_print_compositor_get_buffer
48
+ (GtkSourcePrintCompositor *compositor);
49
+ void gtk_source_print_compositor_set_tab_width
50
+ (GtkSourcePrintCompositor *compositor,
51
+ guint width);
52
+ guint gtk_source_print_compositor_get_tab_width
53
+ (GtkSourcePrintCompositor *compositor);
54
+ void gtk_source_print_compositor_set_wrap_mode
55
+ (GtkSourcePrintCompositor *compositor,
56
+ GtkWrapMode wrap_mode);
57
+ GtkWrapMode gtk_source_print_compositor_get_wrap_mode
58
+ (GtkSourcePrintCompositor *compositor);
59
+ void gtk_source_print_compositor_set_highlight_syntax
60
+ (GtkSourcePrintCompositor *compositor,
61
+ gboolean highlight);
62
+ gboolean gtk_source_print_compositor_get_highlight_syntax
63
+ (GtkSourcePrintCompositor *compositor);
64
+ void gtk_source_print_compositor_set_print_line_numbers
65
+ (GtkSourcePrintCompositor *compositor,
66
+ guint interval);
67
+ guint gtk_source_print_compositor_get_print_line_numbers
68
+ (GtkSourcePrintCompositor *compositor);
69
+ void gtk_source_print_compositor_set_body_font_name
70
+ (GtkSourcePrintCompositor *compositor,
71
+ const gchar *font_name);
72
+ gchar* gtk_source_print_compositor_get_body_font_name
73
+ (GtkSourcePrintCompositor *compositor);
74
+ void gtk_source_print_compositor_set_line_numbers_font_name
75
+ (GtkSourcePrintCompositor *compositor,
76
+ const gchar *font_name);
77
+ gchar* gtk_source_print_compositor_get_line_numbers_font_name
78
+ (GtkSourcePrintCompositor *compositor);
79
+ void gtk_source_print_compositor_set_header_font_name
80
+ (GtkSourcePrintCompositor *compositor,
81
+ const gchar *font_name);
82
+ gchar* gtk_source_print_compositor_get_header_font_name
83
+ (GtkSourcePrintCompositor *compositor);
84
+ void gtk_source_print_compositor_set_footer_font_name
85
+ (GtkSourcePrintCompositor *compositor,
86
+ const gchar *font_name);
87
+ gchar* gtk_source_print_compositor_get_footer_font_name
88
+ (GtkSourcePrintCompositor *compositor);
89
+ void gtk_source_print_compositor_set_print_header
90
+ (GtkSourcePrintCompositor *compositor,
91
+ gboolean print);
92
+ gboolean gtk_source_print_compositor_get_print_header
93
+ (GtkSourcePrintCompositor *compositor);
94
+ void gtk_source_print_compositor_set_print_footer
95
+ (GtkSourcePrintCompositor *compositor,
96
+ gboolean print);
97
+ gboolean gtk_source_print_compositor_get_print_footer
98
+ (GtkSourcePrintCompositor *compositor);
99
+ gint gtk_source_print_compositor_get_n_pages
100
+ (GtkSourcePrintCompositor *compositor);
101
+ */
102
+
103
+ static VALUE
104
+ sprintcompositor_get_top_margin(self, unit)
105
+ VALUE self, unit;
106
+ {
107
+ return DBL2NUM(gtk_source_print_compositor_get_top_margin(_SELF(self), RVAL2UNIT (unit)));
108
+ }
109
+
110
+ static VALUE
111
+ sprintcompositor_set_top_margin(self, top, unit)
112
+ VALUE self, top, unit;
113
+ {
114
+ gtk_source_print_compositor_set_top_margin(_SELF(self), NUM2DBL(top), RVAL2UNIT (unit));
115
+ return self;
116
+ }
117
+
118
+ static VALUE
119
+ sprintcompositor_get_bottom_margin(self, unit)
120
+ VALUE self, unit;
121
+ {
122
+ return DBL2NUM(gtk_source_print_compositor_get_bottom_margin(_SELF(self), RVAL2UNIT (unit)));
123
+ }
124
+
125
+ static VALUE
126
+ sprintcompositor_set_bottom_margin(self, bottom, unit)
127
+ VALUE self, bottom, unit;
128
+ {
129
+ gtk_source_print_compositor_set_bottom_margin(_SELF(self), NUM2DBL(bottom), RVAL2UNIT (unit));
130
+ return self;
131
+ }
132
+
133
+ static VALUE
134
+ sprintcompositor_get_left_margin(self, unit)
135
+ VALUE self, unit;
136
+ {
137
+ return DBL2NUM(gtk_source_print_compositor_get_left_margin(_SELF(self), RVAL2UNIT (unit)));
138
+ }
139
+
140
+ static VALUE
141
+ sprintcompositor_set_left_margin(self, left, unit)
142
+ VALUE self, left, unit;
143
+ {
144
+ gtk_source_print_compositor_set_left_margin(_SELF(self), NUM2DBL(left), RVAL2UNIT (unit));
145
+ return self;
146
+ }
147
+
148
+ static VALUE
149
+ sprintcompositor_get_right_margin(self, unit)
150
+ VALUE self, unit;
151
+ {
152
+ return DBL2NUM(gtk_source_print_compositor_get_right_margin(_SELF(self), RVAL2UNIT (unit)));
153
+ }
154
+
155
+ static VALUE
156
+ sprintcompositor_set_right_margin(self, right, unit)
157
+ VALUE self, right, unit;
158
+ {
159
+ gtk_source_print_compositor_set_right_margin(_SELF(self), NUM2DBL(right), RVAL2UNIT (unit));
160
+ return self;
161
+ }
162
+
163
+ static VALUE
164
+ sprintcompositor_set_header_format(self, separator, left, center, right)
165
+ VALUE self, separator, left, center, right;
166
+ {
167
+ gtk_source_print_compositor_set_header_format(_SELF(self),
168
+ RVAL2CBOOL(separator),
169
+ RVAL2CSTR(left),
170
+ RVAL2CSTR(center),
171
+ RVAL2CSTR(right));
172
+ return self;
173
+ }
174
+
175
+ static VALUE
176
+ sprintcompositor_set_footer_format(self, separator, left, center, right)
177
+ VALUE self, separator, left, center, right;
178
+ {
179
+ gtk_source_print_compositor_set_footer_format(_SELF(self),
180
+ RVAL2CBOOL(separator),
181
+ RVAL2CSTR(left),
182
+ RVAL2CSTR(center),
183
+ RVAL2CSTR(right));
184
+ return self;
185
+ }
186
+
187
+ static VALUE
188
+ sprintcompositor_paginate (self, context)
189
+ VALUE self, context;
190
+ {
191
+ return CBOOL2RVAL (gtk_source_print_compositor_paginate (_SELF (self),
192
+ GTK_PRINT_CONTEXT (RVAL2GOBJ (context))));
193
+ }
194
+
195
+ static VALUE
196
+ sprintcompositor_get_pagination_progress (self)
197
+ VALUE self;
198
+ {
199
+ return DBL2NUM (gtk_source_print_compositor_get_pagination_progress (_SELF (self)));
200
+ }
201
+
202
+ static VALUE
203
+ sprintcompositor_draw_page (self, context, page_nr)
204
+ VALUE self, context, page_nr;
205
+ {
206
+ gtk_source_print_compositor_draw_page (_SELF (self),
207
+ GTK_PRINT_CONTEXT (RVAL2GOBJ (context)),
208
+ NUM2INT (page_nr));
209
+ return self;
210
+ }
211
+ #endif /* HAVE_GTK_SOURCE_PRINT_COMPOSITOR_GET_TYPE */
212
+
213
+ void
214
+ Init_gtk_sourceprintcompositor()
215
+ {
216
+ #ifdef HAVE_GTK_SOURCE_PRINT_COMPOSITOR_GET_TYPE
217
+ VALUE pc = G_DEF_CLASS(GTK_TYPE_SOURCE_PRINT_COMPOSITOR, "SourcePrintCompositor", mGtk);
218
+
219
+ rb_define_method(pc, "initialize", sprintcompositor_initialize, 1);
220
+ rb_define_method(pc, "get_top_margin",
221
+ sprintcompositor_get_top_margin, 1);
222
+ rb_define_method(pc, "set_top_margin",
223
+ sprintcompositor_set_top_margin, 2);
224
+ rb_define_method(pc, "get_bottom_margin",
225
+ sprintcompositor_get_bottom_margin, 1);
226
+ rb_define_method(pc, "set_bottom_margin",
227
+ sprintcompositor_set_bottom_margin, 2);
228
+ rb_define_method(pc, "get_left_margin",
229
+ sprintcompositor_get_left_margin, 1);
230
+ rb_define_method(pc, "set_left_margin",
231
+ sprintcompositor_set_left_margin, 2);
232
+ rb_define_method(pc, "get_right_margin",
233
+ sprintcompositor_get_right_margin, 1);
234
+ rb_define_method(pc, "set_right_margin",
235
+ sprintcompositor_set_right_margin, 2);
236
+ rb_define_method(pc, "set_header_format",
237
+ sprintcompositor_set_header_format, 4);
238
+ rb_define_method(pc, "set_footer_format",
239
+ sprintcompositor_set_footer_format, 4);
240
+ rb_define_method(pc, "paginate",
241
+ sprintcompositor_paginate, 1);
242
+ rb_define_method(pc, "pagination_progress",
243
+ sprintcompositor_get_pagination_progress, 0);
244
+ rb_define_method(pc, "draw_page",
245
+ sprintcompositor_draw_page, 2);
246
+
247
+ G_DEF_SETTERS(pc);
248
+ #endif /* HAVE_GTK_SOURCE_PRINT_COMPOSITOR_GET_TYPE */
249
+ }
@@ -0,0 +1,48 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtksourcestyle.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2005/10/02 18:40:34 $
8
+
9
+ Copyright (C) 2005 Masao Mutoh
10
+ ************************************************/
11
+ #include "rbgtksourcemain.h"
12
+
13
+ /* Module: Gtk::SourceStyle
14
+ */
15
+
16
+ #define _SELF(self) (GTK_SOURCE_STYLE(RVAL2GOBJ(self)))
17
+
18
+ static VALUE
19
+ sourcestyle_copy (self)
20
+ VALUE self;
21
+ {
22
+ return GOBJ2RVAL (gtk_source_style_copy (_SELF (self)));
23
+ }
24
+
25
+ /* Defined as properties.
26
+ "background" gchar* : Read / Write / Construct Only
27
+ "background-set" gboolean : Read / Write / Construct Only
28
+ "bold" gboolean : Read / Write / Construct Only
29
+ "bold-set" gboolean : Read / Write / Construct Only
30
+ "foreground" gchar* : Read / Write / Construct Only
31
+ "foreground-set" gboolean : Read / Write / Construct Only
32
+ "italic" gboolean : Read / Write / Construct Only
33
+ "italic-set" gboolean : Read / Write / Construct Only
34
+ "line-background" gchar* : Read / Write / Construct Only
35
+ "line-background-set" gboolean : Read / Write / Construct Only
36
+ "strikethrough" gboolean : Read / Write / Construct Only
37
+ "strikethrough-set" gboolean : Read / Write / Construct Only
38
+ "underline" gboolean : Read / Write / Construct Only
39
+ "underline-set" gboolean : Read / Write / Construct Only
40
+ */
41
+
42
+ void
43
+ Init_gtk_sourcestyle ()
44
+ {
45
+ VALUE style = G_DEF_CLASS (GTK_TYPE_SOURCE_STYLE, "SourceStyle", mGtk);
46
+
47
+ rb_define_method(style, "copy", sourcestyle_copy, 0);
48
+ }