gtksourceview2 0.90.6

Sign up to get free protection for your applications and to get access to all the features.
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,71 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtksourcestylescheme.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::SourceStyleScheme
14
+ */
15
+
16
+ #define _SELF(self) (GTK_SOURCE_STYLE_SCHEME(RVAL2GOBJ(self)))
17
+
18
+ /* Defined as properties.
19
+ const gchar* gtk_source_style_scheme_get_id (GtkSourceStyleScheme *scheme);
20
+ const gchar* gtk_source_style_scheme_get_name (GtkSourceStyleScheme *scheme);
21
+ const gchar* gtk_source_style_scheme_get_description
22
+ (GtkSourceStyleScheme *scheme);
23
+ const gchar* gtk_source_style_scheme_get_filename
24
+ (GtkSourceStyleScheme *scheme);
25
+ */
26
+
27
+ /* Method: authors
28
+ *
29
+ * Returns: a list of authors for the given style scheme.
30
+ */
31
+ static VALUE
32
+ scheme_get_authors (self)
33
+ VALUE self;
34
+ {
35
+ VALUE ary;
36
+ const gchar * const * authors =
37
+ gtk_source_style_scheme_get_authors (_SELF (self));
38
+ if (!authors)
39
+ return Qnil;
40
+
41
+ ary = rb_ary_new();
42
+ while (*authors){
43
+ rb_ary_push(ary, CSTR2RVAL(*authors));
44
+ authors++;
45
+ }
46
+ return ary;
47
+ }
48
+
49
+ /* Method: get_style(style_id)
50
+ * style_name: the name of a style.
51
+ *
52
+ * Gets the tag associated with the given style_name in the style scheme.
53
+ *
54
+ * Returns: Gtk::SourceStyle
55
+ */
56
+ static VALUE
57
+ scheme_get_style(self, style_name)
58
+ VALUE self, style_name;
59
+ {
60
+ return GOBJ2RVAL(gtk_source_style_scheme_get_style(_SELF(self),
61
+ RVAL2CSTR(style_name)));
62
+ }
63
+
64
+ void
65
+ Init_gtk_sourcestylescheme ()
66
+ {
67
+ VALUE scheme = G_DEF_CLASS (GTK_TYPE_SOURCE_STYLE_SCHEME, "SourceStyleScheme", mGtk);
68
+
69
+ rb_define_method(scheme, "authors", scheme_get_authors, 0);
70
+ rb_define_method(scheme, "get_style", scheme_get_style, 1);
71
+ }
@@ -0,0 +1,211 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtksourcestyleschememanager.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::SourceStyleSchemeManager
15
+ * A class to manage source style scheme.
16
+ */
17
+
18
+ #define _SELF(self) (GTK_SOURCE_STYLE_SCHEME_MANAGER(RVAL2GOBJ(self)))
19
+
20
+ /* Class method: new
21
+ * Returns: a newly created Gtk::SourceStyleSchemeManager object.
22
+ */
23
+ static VALUE
24
+ sssm_new (self)
25
+ VALUE self;
26
+ {
27
+ G_INITIALIZE (self, gtk_source_style_scheme_manager_new ());
28
+ return Qnil;
29
+ }
30
+
31
+ /* Class method: default
32
+ *
33
+ * Gets the default style scheme manager.
34
+ *
35
+ * Returns: a Gtk::SourceStyleSchemeManager
36
+ */
37
+ static VALUE
38
+ sssm_get_default(self)
39
+ VALUE self;
40
+ {
41
+ GtkSourceStyleSchemeManager* sssm = gtk_source_style_scheme_manager_get_default();
42
+ GType gtype = G_TYPE_FROM_INSTANCE(sssm);
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(sssm);
51
+ }
52
+
53
+ /* Method: set_search_path(dirs)
54
+ * dirs: style scheme file directory path
55
+ *
56
+ * Sets the style scheme files directories for the given style scheme manager.
57
+ *
58
+ * Returns: self.
59
+ */
60
+ static VALUE
61
+ sssm_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_style_scheme_manager_set_search_path (_SELF (self), gdirs);
83
+ return self;
84
+ }
85
+
86
+ /* Method: append_search_path(path)
87
+ * path: additional style scheme file directory path (string)
88
+ *
89
+ * Appends the style scheme files directory for the given style scheme manager.
90
+ *
91
+ * Returns: self.
92
+ */
93
+ static VALUE
94
+ sssm_append_search_path (self, path)
95
+ VALUE self, path;
96
+ {
97
+ gtk_source_style_scheme_manager_append_search_path (_SELF (self), RVAL2CSTR(path));
98
+ return self;
99
+ }
100
+
101
+ /* Method: prepend_search_path(path)
102
+ * path: additional style scheme file directory path (string)
103
+ *
104
+ * Prepend the style scheme files directory for the given style scheme manager.
105
+ *
106
+ * Returns: self.
107
+ */
108
+ static VALUE
109
+ sssm_prepend_search_path (self, path)
110
+ VALUE self, path;
111
+ {
112
+ gtk_source_style_scheme_manager_prepend_search_path (_SELF (self), RVAL2CSTR(path));
113
+ return self;
114
+ }
115
+
116
+ /* Method: get_search_path
117
+ * Returns: a list of style scheme files directories (strings) for the given
118
+ * style scheme manager.
119
+ */
120
+ static VALUE
121
+ sssm_get_search_path (self)
122
+ VALUE self;
123
+ {
124
+ VALUE ary;
125
+ const gchar * const * dirs =
126
+ gtk_source_style_scheme_manager_get_search_path (_SELF (self));
127
+ if (!dirs)
128
+ return Qnil;
129
+
130
+ ary = rb_ary_new();
131
+ while (*dirs){
132
+ rb_ary_push(ary, CSTR2RVAL(*dirs));
133
+ dirs++;
134
+ }
135
+ return ary;
136
+ }
137
+
138
+ /* Method: scheme_ids
139
+ * Returns: a list of style scheme ids for the given style scheme manager
140
+ */
141
+ static VALUE
142
+ sssm_get_scheme_ids (self)
143
+ VALUE self;
144
+ {
145
+ VALUE ary;
146
+ const gchar * const * ids =
147
+ gtk_source_style_scheme_manager_get_scheme_ids (_SELF (self));
148
+ if (!ids)
149
+ return Qnil;
150
+
151
+ ary = rb_ary_new();
152
+ while (*ids){
153
+ rb_ary_push(ary, CSTR2RVAL(*ids));
154
+ ids++;
155
+ }
156
+ return ary;
157
+ }
158
+
159
+ /*
160
+ * Method: scheme(scheme_id)
161
+ * scheme_id: a style scheme id (as a string).
162
+ *
163
+ * Gets the Gtk::SourceStyleScheme which is associated with the given id
164
+ * in the style scheme manager.
165
+ *
166
+ * Returns: a Gtk::SourceStyleScheme, or nil if there is no style scheme
167
+ * associated with the given id.
168
+ */
169
+ static VALUE
170
+ sssm_get_scheme (self, scheme_id)
171
+ VALUE self, scheme_id;
172
+ {
173
+ return
174
+ GOBJ2RVAL (gtk_source_style_scheme_manager_get_scheme
175
+ (_SELF (self), RVAL2CSTR (scheme_id)));
176
+ }
177
+
178
+ /*
179
+ * Method: force_rescan
180
+ *
181
+ * Forces all style schemes to be reloaded the next time the
182
+ * Gtk::SourceStyleSchemeManager is accessed.
183
+ *
184
+ * Returns: self.
185
+ */
186
+ static VALUE
187
+ sssm_force_rescan (self)
188
+ VALUE self;
189
+ {
190
+ gtk_source_style_scheme_manager_force_rescan(_SELF (self));
191
+ return self;
192
+ }
193
+
194
+ void
195
+ Init_gtk_sourcestyleschememanager ()
196
+ {
197
+ VALUE csssm =
198
+ G_DEF_CLASS (GTK_TYPE_SOURCE_STYLE_SCHEME_MANAGER,
199
+ "SourceStyleSchemeManager", mGtk);
200
+
201
+ rb_define_method (csssm, "initialize", sssm_new, 0);
202
+ rb_define_method (csssm, "set_search_path", sssm_set_search_path, 1);
203
+ rb_define_method (csssm, "append_search_path", sssm_append_search_path, 1);
204
+ rb_define_method (csssm, "prepend_search_path", sssm_prepend_search_path, 1);
205
+ rb_define_method (csssm, "search_path", sssm_get_search_path, 0);
206
+ rb_define_method (csssm, "scheme_ids", sssm_get_scheme_ids, 0);
207
+ rb_define_method (csssm, "get_scheme", sssm_get_scheme, 1);
208
+ rb_define_method (csssm, "force_rescan", sssm_force_rescan, 0);
209
+ rb_define_singleton_method(csssm, "default", sssm_get_default, 0);
210
+ G_DEF_SETTERS (csssm);
211
+ }
@@ -0,0 +1,239 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtksourceview.c -
5
+
6
+ $Author: mutoh $
7
+ $Date: 2006/12/17 16:15:28 $
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
+ /* Class: Gtk::SourceView
15
+ * A view on a source.
16
+ */
17
+ #define _SELF(self) (GTK_SOURCE_VIEW(RVAL2GOBJ(self)))
18
+
19
+ /*
20
+ * Class method: new(buffer=nil)
21
+ * buffer: a Gtk::SourceBuffer object.
22
+ *
23
+ * Creates a new Gtk::SourceView. If buffer is not provided or nil, an empty
24
+ * buffer will be created for you. Note that one buffer can be shared among
25
+ * many widgets.
26
+ *
27
+ * Returns: a newly created Gtk::SourceView object.
28
+ */
29
+ static VALUE
30
+ sourceview_initialize(int argc, VALUE *argv, VALUE self)
31
+ {
32
+ VALUE buffer;
33
+ GtkWidget *widget;
34
+
35
+ rb_scan_args(argc, argv, "01", &buffer);
36
+
37
+ if (NIL_P(buffer))
38
+ widget = gtk_source_view_new();
39
+ else
40
+ widget = gtk_source_view_new_with_buffer(RVAL2GOBJ(buffer));
41
+
42
+ RBGTK_INITIALIZE(self, widget);
43
+ return self;
44
+ }
45
+
46
+ /* Defined as properties.
47
+ void gtk_source_view_set_auto_indent (GtkSourceView *view,
48
+ gboolean enable)
49
+ gboolean gtk_source_view_get_auto_indent (GtkSourceView *view)
50
+ void gtk_source_view_set_indent_on_tab (GtkSourceView *view,
51
+ gboolean enable)
52
+ gboolean gtk_source_view_get_indent_on_tab (GtkSourceView *view)
53
+ void gtk_source_view_set_indent_width (GtkSourceView *view,
54
+ gint width)
55
+ gint gtk_source_view_get_indent_width (GtkSourceView *view)
56
+ void gtk_source_view_set_insert_spaces_instead_of_tabs
57
+ (GtkSourceView *view,
58
+ gboolean enable)
59
+ gboolean gtk_source_view_get_insert_spaces_instead_of_tabs
60
+ (GtkSourceView *view)
61
+ void gtk_source_view_set_smart_home_end (GtkSourceView *view,
62
+ GtkSourceSmartHomeEndType smart_he)
63
+ GtkSourceSmartHomeEndType gtk_source_view_get_smart_home_end
64
+ (GtkSourceView *view)
65
+ */
66
+
67
+ #ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE
68
+ /*
69
+ * Method: set_mark_category_pixbuf(category, pixbuf)
70
+ * category: a category (as a string).
71
+ * pixbuf: a Gdk::Pixbuf object.
72
+ *
73
+ * Associates a given pixbuf with a given category.
74
+ *
75
+ * Returns: self.
76
+ */
77
+ static VALUE
78
+ sourceview_set_mark_category_pixbuf(VALUE self, VALUE category, VALUE pixbuf)
79
+ {
80
+ gtk_source_view_set_mark_category_pixbuf(_SELF(self),
81
+ RVAL2CSTR(category),
82
+ GDK_PIXBUF(RVAL2GOBJ(pixbuf)));
83
+ return self;
84
+ }
85
+
86
+ /*
87
+ * Method: get_mark_category_pixbuf(category)
88
+ * category: a category (as a string).
89
+ *
90
+ * Gets the pixbuf which is associated with the given category.
91
+ *
92
+ * Returns: a Gdk::Pixbuf object if found, or nil if not found.
93
+ */
94
+ static VALUE
95
+ sourceview_get_mark_category_pixbuf(VALUE self, VALUE category)
96
+ {
97
+ GdkPixbuf *pixbuf;
98
+
99
+ pixbuf = gtk_source_view_get_mark_category_pixbuf(_SELF(self),
100
+ RVAL2CSTR(category));
101
+ return GOBJ2RVAL(pixbuf);
102
+ }
103
+
104
+ /*
105
+ * Method: set_mark_category_priority(category, priority)
106
+ * category: a category (as a string).
107
+ * priority: a priority (int).
108
+ *
109
+ * Associates a given priority with a given category.
110
+ *
111
+ * Returns: self.
112
+ */
113
+ static VALUE
114
+ sourceview_set_mark_category_priority(VALUE self, VALUE category, VALUE priority)
115
+ {
116
+ gtk_source_view_set_mark_category_priority(_SELF (self),
117
+ RVAL2CSTR(category),
118
+ NUM2INT(priority));
119
+ return self;
120
+ }
121
+
122
+ /*
123
+ * Method: get_mark_category_priority(category)
124
+ * category: a category (as a string).
125
+ *
126
+ * Gets the priority which is associated with the given category.
127
+ *
128
+ * Returns: the priority if found, or 0 if not found.
129
+ */
130
+ static VALUE
131
+ sourceview_get_mark_category_priority(VALUE self, VALUE category)
132
+ {
133
+ gint priority;
134
+
135
+ priority = gtk_source_view_get_mark_category_priority(_SELF(self),
136
+ RVAL2CSTR(category));
137
+ return INT2NUM(priority);
138
+ }
139
+ #endif /* HAVE_GTK_SOURCE_MARK_GET_TYPE */
140
+
141
+ #ifdef HAVE_GTK_SOURCE_VIEW_GET_MARK_CATEGORY_BACKGROUND
142
+ /*
143
+ * Method: get_mark_category_background(category)
144
+ * category: a category (as a string).
145
+ *
146
+ * Gets the background color which is associated with the given category.
147
+ *
148
+ * Returns: a Gdk::Color object if found, or nil if not found.
149
+ */
150
+ static VALUE
151
+ sourceview_get_mark_category_background(VALUE self, VALUE category)
152
+ {
153
+ GdkColor color;
154
+ gtk_source_view_get_mark_category_background(_SELF (self),
155
+ RVAL2CSTR(category),
156
+ &color);
157
+ return GDKCOLOR2RVAL(&color);
158
+ }
159
+
160
+ /*
161
+ * Method: set_mark_category_background(category, color)
162
+ * category: a category (as a string).
163
+ * color: a Gdk::Color.
164
+ *
165
+ * Sets given background color for mark category. If color is NULL,
166
+ * the background color is unset.
167
+ *
168
+ * Returns: self.
169
+ */
170
+ static VALUE
171
+ sourceview_set_mark_category_background(VALUE self, VALUE category, VALUE color)
172
+ {
173
+ gtk_source_view_set_mark_category_background(_SELF (self),
174
+ RVAL2CSTR (category),
175
+ RVAL2GDKCOLOR((color)));
176
+ return self;
177
+ }
178
+ # endif /* HAVE_GTK_SOURCE_VIEW_GET_MARK_CATEGORY_BACKGROUND */
179
+
180
+ /* Defined as properties.
181
+ void gtk_source_view_set_highlight_current_line
182
+ (GtkSourceView *view,
183
+ gboolean show)
184
+ gboolean gtk_source_view_get_highlight_current_line
185
+ (GtkSourceView *view)
186
+ void gtk_source_view_set_show_line_marks (GtkSourceView *view,
187
+ gboolean show);
188
+ gboolean gtk_source_view_get_show_line_marks (GtkSourceView *view)
189
+ void gtk_source_view_set_show_line_numbers
190
+ (GtkSourceView *view,
191
+ gboolean show)
192
+ gboolean gtk_source_view_get_show_line_numbers
193
+ (GtkSourceView *view)
194
+ void gtk_source_view_set_show_right_margin
195
+ (GtkSourceView *view,
196
+ gboolean show)
197
+ gboolean gtk_source_view_get_show_right_margin
198
+ (GtkSourceView *view)
199
+ void gtk_source_view_set_right_margin_position
200
+ (GtkSourceView *view,
201
+ guint pos)
202
+ guint gtk_source_view_get_right_margin_position
203
+ (GtkSourceView *view)
204
+ void gtk_source_view_set_tab_width (GtkSourceView *view,
205
+ guint width)
206
+ guint gtk_source_view_get_tab_width (GtkSourceView *view)
207
+ */
208
+
209
+ void
210
+ Init_gtk_sourceview ()
211
+ {
212
+ VALUE cSourceView = G_DEF_CLASS (GTK_TYPE_SOURCE_VIEW, "SourceView", mGtk);
213
+
214
+ rb_define_const(cSourceView, "BUILD_VERSION",
215
+ rb_ary_new3(3,
216
+ INT2FIX(GTKSOURCEVIEW2_MAJOR_VERSION),
217
+ INT2FIX(GTKSOURCEVIEW2_MINOR_VERSION),
218
+ INT2FIX(GTKSOURCEVIEW2_MICRO_VERSION)));
219
+
220
+ rb_define_method(cSourceView, "initialize", sourceview_initialize, -1);
221
+ #ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE
222
+ rb_define_method(cSourceView, "get_mark_category_pixbuf", sourceview_get_mark_category_pixbuf, 1);
223
+ rb_define_method(cSourceView, "set_mark_category_pixbuf", sourceview_set_mark_category_pixbuf, 2);
224
+ rb_define_method(cSourceView, "get_mark_category_priority", sourceview_get_mark_category_priority, 1);
225
+ rb_define_method(cSourceView, "set_mark_category_priority", sourceview_set_mark_category_priority, 2);
226
+ #endif
227
+ #ifdef HAVE_GTK_SOURCE_VIEW_GET_MARK_CATEGORY_BACKGROUND
228
+ rb_define_method(cSourceView, "get_mark_category_background", sourceview_get_mark_category_background, 1);
229
+ rb_define_method(cSourceView, "set_mark_category_background", sourceview_set_mark_category_background, 2);
230
+ #endif
231
+ G_DEF_SETTERS (cSourceView);
232
+
233
+ G_DEF_CLASS(GTK_TYPE_SOURCE_SMART_HOME_END_TYPE, "SmartHomeEndType", cSourceView);
234
+ G_DEF_CONSTANTS(cSourceView, GTK_TYPE_SOURCE_SMART_HOME_END_TYPE, "GTK_SOURCE_");
235
+ #ifdef HAVE_GTK_SOURCE_VIEW_GET_MARK_CATEGORY_BACKGROUND
236
+ G_DEF_CLASS(GTK_TYPE_SOURCE_DRAW_SPACES_FLAGS, "DrawSpacesFlags", cSourceView);
237
+ G_DEF_CONSTANTS(cSourceView, GTK_TYPE_SOURCE_DRAW_SPACES_FLAGS, "GTK_SOURCE_");
238
+ #endif
239
+ }
@@ -0,0 +1,25 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /************************************************
3
+
4
+ rbgtksourceview2version.h -
5
+
6
+ This file was generated by mkmf-gnome2.rb.
7
+
8
+ ************************************************/
9
+
10
+ #ifndef __RBGTKSOURCEVIEW2_VERSION_H__
11
+ #define __RBGTKSOURCEVIEW2_VERSION_H__
12
+
13
+ #define GTKSOURCEVIEW2_MAJOR_VERSION (2)
14
+ #define GTKSOURCEVIEW2_MINOR_VERSION (0)
15
+ #define GTKSOURCEVIEW2_MICRO_VERSION (0)
16
+ #define GTKSOURCEVIEW2_TAG_VERSION (b7)
17
+
18
+ #define GTKSOURCEVIEW2_CHECK_VERSION(major,minor,micro) \
19
+ (GTKSOURCEVIEW2_MAJOR_VERSION > (major) || \
20
+ (GTKSOURCEVIEW2_MAJOR_VERSION == (major) && GTKSOURCEVIEW2_MINOR_VERSION > (minor)) || \
21
+ (GTKSOURCEVIEW2_MAJOR_VERSION == (major) && GTKSOURCEVIEW2_MINOR_VERSION == (minor) && \
22
+ GTKSOURCEVIEW2_MICRO_VERSION >= (micro)))
23
+
24
+
25
+ #endif /* __RBGTKSOURCEVIEW2_VERSION_H__ */
@@ -0,0 +1,3 @@
1
+ Name: Ruby/GtkSourceView2
2
+ Description: Ruby bindings for GTK+ 2.0 Source Editing Widget
3
+ Version: 0.90.6
data/extconf.rb ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'mkmf'
5
+ require 'rbconfig'
6
+ require 'fileutils'
7
+
8
+ package = "gtksourceview2"
9
+
10
+ base_dir = Pathname(__FILE__).dirname.expand_path
11
+ ext_dir = base_dir + "ext" + package
12
+ mkmf_gnome2_dir = base_dir + 'lib'
13
+
14
+ ruby = File.join(RbConfig::CONFIG['bindir'],
15
+ RbConfig::CONFIG['ruby_install_name'] +
16
+ RbConfig::CONFIG["EXEEXT"])
17
+
18
+ build_dir = Pathname("ext") + package
19
+ FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist?
20
+ extconf_rb_path = ext_dir + "extconf.rb"
21
+ system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false)
22
+
23
+ create_makefile(package)
24
+ FileUtils.mv("Makefile", "Makefile.lib")
25
+
26
+ File.open("Makefile", "w") do |makefile|
27
+ makefile.puts(<<-EOM)
28
+ all:
29
+ (cd ext/#{package} && $(MAKE))
30
+ $(MAKE) -f Makefile.lib
31
+
32
+ install:
33
+ (cd ext/#{package} && $(MAKE) install)
34
+ $(MAKE) -f Makefile.lib install
35
+
36
+ site-install:
37
+ (cd ext/#{package} && $(MAKE) site-install)
38
+ $(MAKE) -f Makefile.lib site-install
39
+
40
+ clean:
41
+ (cd ext/#{package} && $(MAKE) clean)
42
+ $(MAKE) -f Makefile.lib clean
43
+
44
+ distclean:
45
+ (cd ext/#{package} && $(MAKE) distclean)
46
+ $(MAKE) -f Makefile.lib distclean
47
+ @rm -f Makefile.lib
48
+ EOM
49
+ end
@@ -0,0 +1,2 @@
1
+ require 'gtk2'
2
+ require 'gtksourceview2.so'
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ =begin
3
+ sourcelanguagesmanager.rb - Ruby/GtkSourceView sample script.
4
+
5
+ Copyright (c) 2006 Ruby-GNOME2 Project Team
6
+ This program is licenced under the same licence as Ruby-GNOME2.
7
+
8
+ $Id: sourcelanguagesmanager.rb,v 1.3 2007/06/03 02:11:07 mutoh Exp $
9
+ =end
10
+
11
+ require 'gtksourceview2'
12
+
13
+ s = Gtk::SourceLanguageManager.new
14
+ s.language_ids.each do |v|
15
+ puts v
16
+ end
17
+ s.search_path.each do |v|
18
+ puts v
19
+ end
20
+ puts s.get_language("html").name
21
+
data/sample/test.rb ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ =begin
3
+ test.rb - Ruby/GtkSourceView2 sample script.
4
+
5
+ Copyright (c) 2006 Ruby-GNOME2 Project Team
6
+ This program is licenced under the same licence as Ruby-GNOME2.
7
+
8
+ $Id: test.rb,v 1.4 2007/06/03 02:11:07 mutoh Exp $
9
+ =end
10
+
11
+ require 'gtksourceview2'
12
+
13
+ w = Gtk::Window.new
14
+ w.signal_connect("delete-event"){Gtk::main_quit}
15
+
16
+ view = Gtk::SourceView.new
17
+ w.add(Gtk::ScrolledWindow.new.add(view))
18
+ view.show_line_numbers = true
19
+ view.insert_spaces_instead_of_tabs = true
20
+ view.indent_width = 4
21
+ view.show_right_margin = true
22
+ view.right_margin_position = 80
23
+
24
+ lang = Gtk::SourceLanguageManager.new.get_language('ruby')
25
+ view.buffer.language = lang
26
+ view.buffer.highlight_syntax = true
27
+ view.buffer.highlight_matching_brackets = true
28
+
29
+ w.set_default_size(450,300)
30
+ w.show_all
31
+
32
+ Gtk.main
data/test/run-test.rb ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..")
4
+ ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
5
+
6
+ glib_base = File.join(ruby_gnome2_base, "glib2")
7
+ atk_base = File.join(ruby_gnome2_base, "atk")
8
+ pango_base = File.join(ruby_gnome2_base, "pango")
9
+ gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
10
+ gtk_base = File.join(ruby_gnome2_base, "gtk2")
11
+ gtk_source_view2_base = File.join(ruby_gnome2_base, "gtksourceview2")
12
+
13
+ $LOAD_PATH.unshift(glib_base)
14
+ require 'test/glib-test-init'
15
+
16
+ [glib_base, atk_base, pango_base, gdk_pixbuf_base, gtk_base,
17
+ gtk_source_view2_base].each do |target|
18
+ if system("which make > /dev/null")
19
+ `make -C #{target.dump} > /dev/null` or exit(1)
20
+ end
21
+ $LOAD_PATH.unshift(File.join(target, "ext", File.basename(target)))
22
+ $LOAD_PATH.unshift(File.join(target, "src"))
23
+ $LOAD_PATH.unshift(File.join(target, "src", "lib"))
24
+ $LOAD_PATH.unshift(File.join(target))
25
+ $LOAD_PATH.unshift(File.join(target, "lib"))
26
+ end
27
+
28
+ $LOAD_PATH.unshift(File.join(gtk_base, "test"))
29
+ require 'gtk-test-utils'
30
+
31
+ require 'gtksourceview2'
32
+
33
+ exit Test::Unit::AutoRunner.run(true)