gtksourceview2 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/gtksourceview2/rbgtksourcebuffer.c +99 -124
- data/ext/gtksourceview2/rbgtksourceiter.c +81 -69
- data/ext/gtksourceview2/rbgtksourcelanguage.c +47 -42
- data/ext/gtksourceview2/rbgtksourcelanguagemanager.c +57 -45
- data/ext/gtksourceview2/rbgtksourcemain.c +40 -29
- data/ext/gtksourceview2/rbgtksourcemain.h +20 -10
- data/ext/gtksourceview2/rbgtksourcemark.c +32 -24
- data/ext/gtksourceview2/rbgtksourceprintcompositor.c +54 -111
- data/ext/gtksourceview2/rbgtksourcestyle.c +25 -30
- data/ext/gtksourceview2/rbgtksourcestylescheme.c +28 -25
- data/ext/gtksourceview2/rbgtksourcestyleschememanager.c +63 -51
- data/ext/gtksourceview2/rbgtksourceview.c +56 -93
- metadata +9 -10
- data/ChangeLog +0 -76
@@ -1,16 +1,29 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2004,2005 Ruby-GNOME2 Project Team
|
5
|
+
* Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by Masao Mutoh
|
6
|
+
*
|
7
|
+
* This library is free software; you can redistribute it and/or
|
8
|
+
* modify it under the terms of the GNU Lesser General Public
|
9
|
+
* License as published by the Free Software Foundation; either
|
10
|
+
* version 2.1 of the License, or (at your option) any later version.
|
11
|
+
*
|
12
|
+
* This library is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
+
* Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public
|
18
|
+
* License along with this library; if not, write to the Free Software
|
19
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
20
|
+
* MA 02110-1301 USA
|
21
|
+
*/
|
8
22
|
|
9
|
-
Copyright (C) 2004,2005 Ruby-GNOME2 Project Team
|
10
|
-
Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by Masao Mutoh
|
11
|
-
************************************************/
|
12
23
|
#include "rbgtksourcemain.h"
|
13
24
|
|
25
|
+
#define RG_TARGET_NAMESPACE cSourceBuffer
|
26
|
+
|
14
27
|
/* Class: Gtk::SourceBuffer
|
15
28
|
* Text buffer object for Gtk::SourceView.
|
16
29
|
*/
|
@@ -33,60 +46,33 @@
|
|
33
46
|
* Returns: a newly created Gtk::SourceBuffer object.
|
34
47
|
*/
|
35
48
|
static VALUE
|
36
|
-
|
49
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
37
50
|
{
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
VALUE val;
|
52
|
+
|
53
|
+
rb_scan_args (argc, argv, "01", &val);
|
54
|
+
if (NIL_P (val)) {
|
55
|
+
G_INITIALIZE (self, gtk_source_buffer_new (NULL));
|
56
|
+
} else
|
57
|
+
if (rb_obj_is_kind_of
|
58
|
+
(val, GTYPE2CLASS (GTK_TYPE_TEXT_TAG_TABLE))) {
|
59
|
+
G_INITIALIZE (self,
|
60
|
+
gtk_source_buffer_new (GTK_TEXT_TAG_TABLE
|
61
|
+
(RVAL2GOBJ (val))));
|
62
|
+
} else
|
63
|
+
if (rb_obj_is_kind_of
|
64
|
+
(val, GTYPE2CLASS (GTK_TYPE_SOURCE_LANGUAGE))) {
|
65
|
+
G_INITIALIZE (self,
|
66
|
+
gtk_source_buffer_new_with_language
|
67
|
+
(GTK_SOURCE_LANGUAGE (RVAL2GOBJ (val))));
|
68
|
+
} else {
|
69
|
+
rb_raise (rb_eArgError,
|
70
|
+
"invalid argument %s (expect nil, Gtk::TextTagTable or Gtk::SourceLanguage)",
|
71
|
+
rb_class2name (CLASS_OF (val)));
|
72
|
+
}
|
73
|
+
return Qnil;
|
61
74
|
}
|
62
75
|
|
63
|
-
/* Defined as properties.
|
64
|
-
void gtk_source_buffer_set_highlight_syntax
|
65
|
-
(GtkSourceBuffer *buffer,
|
66
|
-
gboolean highlight);
|
67
|
-
gboolean gtk_source_buffer_get_highlight_syntax
|
68
|
-
(GtkSourceBuffer *buffer);
|
69
|
-
void gtk_source_buffer_set_language (GtkSourceBuffer *buffer,
|
70
|
-
GtkSourceLanguage *language);
|
71
|
-
GtkSourceLanguage* gtk_source_buffer_get_language (GtkSourceBuffer *buffer);
|
72
|
-
void gtk_source_buffer_set_highlight_matching_brackets
|
73
|
-
(GtkSourceBuffer *buffer,
|
74
|
-
gboolean highlight);
|
75
|
-
gboolean gtk_source_buffer_get_highlight_matching_brackets
|
76
|
-
(GtkSourceBuffer *buffer);
|
77
|
-
void gtk_source_buffer_set_style_scheme (GtkSourceBuffer *buffer,
|
78
|
-
GtkSourceStyleScheme *scheme);
|
79
|
-
GtkSourceStyleScheme* gtk_source_buffer_get_style_scheme
|
80
|
-
(GtkSourceBuffer *buffer);
|
81
|
-
gint gtk_source_buffer_get_max_undo_levels
|
82
|
-
(GtkSourceBuffer *buffer);
|
83
|
-
void gtk_source_buffer_set_max_undo_levels
|
84
|
-
(GtkSourceBuffer *buffer,
|
85
|
-
gint max_undo_levels);
|
86
|
-
gboolean gtk_source_buffer_can_redo (GtkSourceBuffer *buffer);
|
87
|
-
gboolean gtk_source_buffer_can_undo (GtkSourceBuffer *buffer);
|
88
|
-
*/
|
89
|
-
|
90
76
|
/*
|
91
77
|
* Method: redo!
|
92
78
|
*
|
@@ -96,10 +82,10 @@ gboolean gtk_source_buffer_can_undo (GtkSourceBuffer *buffer
|
|
96
82
|
* Returns: self.
|
97
83
|
*/
|
98
84
|
static VALUE
|
99
|
-
|
85
|
+
rg_redo_bang(VALUE self)
|
100
86
|
{
|
101
|
-
|
102
|
-
|
87
|
+
gtk_source_buffer_redo (_SELF (self));
|
88
|
+
return self;
|
103
89
|
}
|
104
90
|
|
105
91
|
/*
|
@@ -116,10 +102,10 @@ sourcebuffer_redo(VALUE self)
|
|
116
102
|
* Returns: self.
|
117
103
|
*/
|
118
104
|
static VALUE
|
119
|
-
|
105
|
+
rg_undo_bang(VALUE self)
|
120
106
|
{
|
121
|
-
|
122
|
-
|
107
|
+
gtk_source_buffer_undo (_SELF (self));
|
108
|
+
return self;
|
123
109
|
}
|
124
110
|
|
125
111
|
/*
|
@@ -138,14 +124,14 @@ sourcebuffer_undo(VALUE self)
|
|
138
124
|
* Returns: self
|
139
125
|
*/
|
140
126
|
static VALUE
|
141
|
-
|
127
|
+
rg_begin_not_undoable_action(VALUE self)
|
142
128
|
{
|
143
129
|
gtk_source_buffer_begin_not_undoable_action (_SELF (self));
|
144
130
|
|
145
131
|
if (rb_block_given_p()) {
|
146
|
-
|
147
|
-
|
148
|
-
|
132
|
+
VALUE block = rb_block_proc ();
|
133
|
+
rb_funcall (block, rb_intern ("call"), 0);
|
134
|
+
gtk_source_buffer_end_not_undoable_action (_SELF (self));
|
149
135
|
}
|
150
136
|
return self;
|
151
137
|
}
|
@@ -160,13 +146,12 @@ sourcebuffer_begin_not_undoable_action(VALUE self)
|
|
160
146
|
* Returns: self
|
161
147
|
*/
|
162
148
|
static VALUE
|
163
|
-
|
149
|
+
rg_end_not_undoable_action(VALUE self)
|
164
150
|
{
|
165
151
|
gtk_source_buffer_end_not_undoable_action (_SELF (self));
|
166
152
|
return self;
|
167
153
|
}
|
168
154
|
|
169
|
-
|
170
155
|
/*
|
171
156
|
* Method: not_undoable_action { ... }
|
172
157
|
*
|
@@ -182,15 +167,15 @@ sourcebuffer_end_not_undoable_action(VALUE self)
|
|
182
167
|
* Returns: the return value of the provided block.
|
183
168
|
*/
|
184
169
|
static VALUE
|
185
|
-
|
170
|
+
rg_not_undoable_action(VALUE self)
|
186
171
|
{
|
187
|
-
|
172
|
+
VALUE block, ret;
|
188
173
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
174
|
+
block = rb_block_proc ();
|
175
|
+
gtk_source_buffer_begin_not_undoable_action (_SELF (self));
|
176
|
+
ret = rb_funcall (block, rb_intern ("call"), 0);
|
177
|
+
gtk_source_buffer_end_not_undoable_action (_SELF (self));
|
178
|
+
return ret;
|
194
179
|
}
|
195
180
|
|
196
181
|
#ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE
|
@@ -224,23 +209,23 @@ sourcebuffer_not_undoable_action(VALUE self)
|
|
224
209
|
* Returns: a new Gtk::SourceMark object, owned by the buffer.
|
225
210
|
*/
|
226
211
|
static VALUE
|
227
|
-
|
212
|
+
rg_create_source_mark(int argc, VALUE *argv, VALUE self)
|
228
213
|
{
|
229
|
-
|
214
|
+
VALUE name, category, where;
|
230
215
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
216
|
+
if (argc == 2)
|
217
|
+
rb_scan_args (argc, argv, "21", &where, &category, &name);
|
218
|
+
else
|
219
|
+
rb_scan_args (argc, argv, "30", &name, &category, &where);
|
235
220
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
221
|
+
return GOBJ2RVAL (gtk_source_buffer_create_source_mark (_SELF (self),
|
222
|
+
RVAL2CSTR (name),
|
223
|
+
RVAL2CSTR (category),
|
224
|
+
RVAL2ITR (where)));
|
240
225
|
}
|
241
226
|
|
242
227
|
static VALUE
|
243
|
-
|
228
|
+
rg_get_source_marks_at_line(int argc, VALUE *argv, VALUE self)
|
244
229
|
{
|
245
230
|
GSList *list, *p;
|
246
231
|
VALUE line, category;
|
@@ -264,7 +249,7 @@ sourcebuffer_get_source_marks_at_line(int argc, VALUE *argv, VALUE self)
|
|
264
249
|
}
|
265
250
|
|
266
251
|
static VALUE
|
267
|
-
|
252
|
+
rg_get_source_marks_at_iter(int argc, VALUE *argv, VALUE self)
|
268
253
|
{
|
269
254
|
GSList *list, *p;
|
270
255
|
VALUE iter, category;
|
@@ -288,7 +273,7 @@ sourcebuffer_get_source_marks_at_iter(int argc, VALUE *argv, VALUE self)
|
|
288
273
|
}
|
289
274
|
|
290
275
|
static VALUE
|
291
|
-
|
276
|
+
rg_remove_source_marks(int argc, VALUE *argv, VALUE self)
|
292
277
|
{
|
293
278
|
VALUE start, end, category;
|
294
279
|
|
@@ -303,7 +288,7 @@ sourcebuffer_remove_source_marks(int argc, VALUE *argv, VALUE self)
|
|
303
288
|
}
|
304
289
|
|
305
290
|
static VALUE
|
306
|
-
|
291
|
+
rg_forward_iter_to_source_mark(int argc, VALUE *argv, VALUE self)
|
307
292
|
{
|
308
293
|
VALUE iter, category;
|
309
294
|
|
@@ -316,7 +301,7 @@ sourcebuffer_forward_iter_to_source_mark(int argc, VALUE *argv, VALUE self)
|
|
316
301
|
}
|
317
302
|
|
318
303
|
static VALUE
|
319
|
-
|
304
|
+
rg_backward_iter_to_source_mark(int argc, VALUE *argv, VALUE self)
|
320
305
|
{
|
321
306
|
VALUE iter, category;
|
322
307
|
|
@@ -331,7 +316,7 @@ sourcebuffer_backward_iter_to_source_mark(int argc, VALUE *argv, VALUE self)
|
|
331
316
|
#endif /* HAVE_GTK_SOURCE_MARK_GET_TYPE */
|
332
317
|
|
333
318
|
static VALUE
|
334
|
-
|
319
|
+
rg_ensure_highlight(VALUE self, VALUE start, VALUE end)
|
335
320
|
{
|
336
321
|
gtk_source_buffer_ensure_highlight (_SELF (self), RVAL2ITR (start), RVAL2ITR (end));
|
337
322
|
|
@@ -339,37 +324,27 @@ sourcebuffer_ensure_highlight(VALUE self, VALUE start, VALUE end)
|
|
339
324
|
}
|
340
325
|
|
341
326
|
void
|
342
|
-
Init_gtk_sourcebuffer ()
|
327
|
+
Init_gtk_sourcebuffer (VALUE mGtk)
|
343
328
|
{
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
rb_define_method (cbuffer, "not_undoable_action",
|
355
|
-
sourcebuffer_not_undoable_action, 0);
|
356
|
-
rb_define_alias (cbuffer, "non_undoable_action", "not_undoable_action");
|
329
|
+
VALUE RG_TARGET_NAMESPACE =
|
330
|
+
G_DEF_CLASS (GTK_TYPE_SOURCE_BUFFER, "SourceBuffer", mGtk);
|
331
|
+
|
332
|
+
RG_DEF_METHOD(initialize, -1);
|
333
|
+
RG_DEF_METHOD_BANG(redo, 0);
|
334
|
+
RG_DEF_METHOD_BANG(undo, 0);
|
335
|
+
RG_DEF_METHOD(begin_not_undoable_action, 0);
|
336
|
+
RG_DEF_METHOD(end_not_undoable_action, 0);
|
337
|
+
RG_DEF_METHOD(not_undoable_action, 0);
|
338
|
+
RG_DEF_ALIAS("non_undoable_action", "not_undoable_action");
|
357
339
|
#ifdef HAVE_GTK_SOURCE_MARK_GET_TYPE
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
rb_define_method (cbuffer, "remove_source_marks",
|
365
|
-
sourcebuffer_remove_source_marks, -1);
|
366
|
-
rb_define_method (cbuffer, "forward_iter_to_source_mark",
|
367
|
-
sourcebuffer_forward_iter_to_source_mark, -1);
|
368
|
-
rb_define_method (cbuffer, "backward_iter_to_source_mark",
|
369
|
-
sourcebuffer_backward_iter_to_source_mark, -1);
|
340
|
+
RG_DEF_METHOD(create_source_mark, -1);
|
341
|
+
RG_DEF_METHOD(get_source_marks_at_line, -1);
|
342
|
+
RG_DEF_METHOD(get_source_marks_at_iter, -1);
|
343
|
+
RG_DEF_METHOD(remove_source_marks, -1);
|
344
|
+
RG_DEF_METHOD(forward_iter_to_source_mark, -1);
|
345
|
+
RG_DEF_METHOD(backward_iter_to_source_mark, -1);
|
370
346
|
#endif
|
371
|
-
|
372
|
-
sourcebuffer_ensure_highlight, 2);
|
347
|
+
RG_DEF_METHOD(ensure_highlight, 2);
|
373
348
|
|
374
|
-
|
349
|
+
G_DEF_SETTERS (RG_TARGET_NAMESPACE);
|
375
350
|
}
|
@@ -1,15 +1,27 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2004 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
|
+
*/
|
8
21
|
|
9
|
-
Copyright (C) 2004 Ruby-GNOME2 Project Team
|
10
|
-
************************************************/
|
11
22
|
#include "rbgtksourcemain.h"
|
12
23
|
|
24
|
+
#define RG_TARGET_NAMESPACE cTextIter
|
13
25
|
#define _SELF(s) ((GtkTextIter*)RVAL2BOXED(s, GTK_TYPE_TEXT_ITER))
|
14
26
|
#define ITR2RVAL(i) (BOXED2RVAL(i, GTK_TYPE_TEXT_ITER))
|
15
27
|
|
@@ -20,35 +32,35 @@
|
|
20
32
|
* Returns: locations of start and end of match.
|
21
33
|
*/
|
22
34
|
static VALUE
|
23
|
-
|
35
|
+
rg_forward_search(int argc, VALUE *argv, VALUE self)
|
24
36
|
{
|
25
|
-
|
26
|
-
|
27
|
-
|
37
|
+
GtkTextIter m_start, m_end;
|
38
|
+
VALUE str, flags, limit;
|
39
|
+
VALUE ret = Qnil;
|
28
40
|
|
29
|
-
|
41
|
+
rb_scan_args (argc, argv, "21", &str, &flags, &limit);
|
30
42
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
43
|
+
if (rb_obj_is_kind_of
|
44
|
+
(flags, GTYPE2CLASS (GTK_TYPE_SOURCE_SEARCH_FLAGS))) {
|
45
|
+
if (gtk_source_iter_forward_search
|
46
|
+
(_SELF (self), RVAL2CSTR (str),
|
47
|
+
RVAL2GFLAGS (flags, GTK_TYPE_SOURCE_SEARCH_FLAGS),
|
48
|
+
&m_start, &m_end, NIL_P (limit) ? NULL : _SELF (limit)))
|
49
|
+
ret =
|
50
|
+
rb_ary_new3 (2, ITR2RVAL (&m_start),
|
51
|
+
ITR2RVAL (&m_end));
|
52
|
+
} else
|
53
|
+
if (rb_obj_is_kind_of
|
54
|
+
(flags, GTYPE2CLASS (GTK_TYPE_TEXT_SEARCH_FLAGS))) {
|
55
|
+
if (gtk_text_iter_forward_search
|
56
|
+
(_SELF (self), RVAL2CSTR (str),
|
57
|
+
RVAL2GFLAGS (flags, GTK_TYPE_TEXT_SEARCH_FLAGS), &m_start,
|
58
|
+
&m_end, NIL_P (limit) ? NULL : _SELF (limit)))
|
59
|
+
ret =
|
60
|
+
rb_ary_new3 (2, ITR2RVAL (&m_start),
|
61
|
+
ITR2RVAL (&m_end));
|
62
|
+
}
|
63
|
+
return ret;
|
52
64
|
}
|
53
65
|
|
54
66
|
/* Method: backward_search(str, flags, limit)
|
@@ -58,47 +70,47 @@ forward_search(int argc, VALUE *argv, VALUE self)
|
|
58
70
|
* Returns: locations of start and end of match.
|
59
71
|
*/
|
60
72
|
static VALUE
|
61
|
-
|
73
|
+
rg_backward_search(int argc, VALUE *argv, VALUE self)
|
62
74
|
{
|
63
|
-
|
64
|
-
|
65
|
-
|
75
|
+
GtkTextIter m_start, m_end;
|
76
|
+
VALUE str, flags, limit;
|
77
|
+
VALUE ret = Qnil;
|
66
78
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
79
|
+
rb_scan_args (argc, argv, "21", &str, &flags, &limit);
|
80
|
+
if (rb_obj_is_kind_of
|
81
|
+
(flags, GTYPE2CLASS (GTK_TYPE_SOURCE_SEARCH_FLAGS))) {
|
82
|
+
if (gtk_source_iter_backward_search
|
83
|
+
(_SELF (self), RVAL2CSTR (str),
|
84
|
+
RVAL2GFLAGS (flags, GTK_TYPE_SOURCE_SEARCH_FLAGS),
|
85
|
+
&m_start, &m_end, NIL_P (limit) ? NULL : _SELF (limit)))
|
86
|
+
ret =
|
87
|
+
rb_ary_new3 (2, ITR2RVAL (&m_start),
|
88
|
+
ITR2RVAL (&m_end));
|
89
|
+
} else
|
90
|
+
if (rb_obj_is_kind_of
|
91
|
+
(flags, GTYPE2CLASS (GTK_TYPE_TEXT_SEARCH_FLAGS))) {
|
92
|
+
if (gtk_text_iter_backward_search
|
93
|
+
(_SELF (self), RVAL2CSTR (str),
|
94
|
+
RVAL2GFLAGS (flags, GTK_TYPE_TEXT_SEARCH_FLAGS), &m_start,
|
95
|
+
&m_end, NIL_P (limit) ? NULL : _SELF (limit)))
|
96
|
+
ret =
|
97
|
+
rb_ary_new3 (2, ITR2RVAL (&m_start),
|
98
|
+
ITR2RVAL (&m_end));
|
99
|
+
}
|
100
|
+
return ret;
|
89
101
|
}
|
90
102
|
|
91
103
|
void
|
92
|
-
Init_gtk_sourceiter ()
|
104
|
+
Init_gtk_sourceiter (VALUE mGtk)
|
93
105
|
{
|
94
|
-
|
106
|
+
VALUE RG_TARGET_NAMESPACE = GTYPE2CLASS (GTK_TYPE_TEXT_ITER);
|
95
107
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
108
|
+
/*
|
109
|
+
* They are override original Gtk::TextIter#[for|back]ward_search
|
110
|
+
*/
|
111
|
+
RG_DEF_METHOD(forward_search, -1);
|
112
|
+
RG_DEF_METHOD(backward_search, -1);
|
101
113
|
|
102
|
-
|
103
|
-
|
114
|
+
G_DEF_CLASS(GTK_TYPE_SOURCE_SEARCH_FLAGS, "SourceSearchFlags", RG_TARGET_NAMESPACE);
|
115
|
+
G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, GTK_TYPE_SOURCE_SEARCH_FLAGS, "GTK_");
|
104
116
|
}
|
@@ -1,49 +1,54 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2004 Ruby-GNOME2 Project Team
|
5
|
+
* Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by Masao Mutoh
|
6
|
+
*
|
7
|
+
* This library is free software; you can redistribute it and/or
|
8
|
+
* modify it under the terms of the GNU Lesser General Public
|
9
|
+
* License as published by the Free Software Foundation; either
|
10
|
+
* version 2.1 of the License, or (at your option) any later version.
|
11
|
+
*
|
12
|
+
* This library is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
+
* Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public
|
18
|
+
* License along with this library; if not, write to the Free Software
|
19
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
20
|
+
* MA 02110-1301 USA
|
21
|
+
*/
|
8
22
|
|
9
|
-
Copyright (C) 2004 Ruby-GNOME2 Project Team
|
10
|
-
Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by Masao Mutoh
|
11
|
-
************************************************/
|
12
23
|
#include "rbgtksourcemain.h"
|
13
24
|
|
14
25
|
/* Class: Gtk::SourceLanguage
|
15
26
|
* Source language.
|
16
27
|
*/
|
17
28
|
|
29
|
+
#define RG_TARGET_NAMESPACE cSourceLanguage
|
18
30
|
#define _SELF(self) (GTK_SOURCE_LANGUAGE(RVAL2GOBJ(self)))
|
19
31
|
|
20
|
-
/* Defined as properties.
|
21
|
-
const gchar* gtk_source_language_get_id (GtkSourceLanguage *language);
|
22
|
-
const gchar* gtk_source_language_get_name (GtkSourceLanguage *language);
|
23
|
-
const gchar* gtk_source_language_get_section (GtkSourceLanguage *language);
|
24
|
-
gboolean gtk_source_language_get_hidden (GtkSourceLanguage *language);
|
25
|
-
*/
|
26
|
-
|
27
32
|
/* Method: get_metadata(name)
|
28
33
|
* name: the metadata property name (string)
|
29
34
|
* Returns: the localized metadata for the given name.
|
30
35
|
*/
|
31
36
|
static VALUE
|
32
|
-
|
37
|
+
rg_get_metadata(VALUE self, VALUE name)
|
33
38
|
{
|
34
|
-
|
35
|
-
|
36
|
-
|
39
|
+
return
|
40
|
+
CSTR2RVAL (gtk_source_language_get_metadata
|
41
|
+
(_SELF (self), RVAL2CSTR(name)));
|
37
42
|
}
|
38
43
|
|
39
44
|
/* Method: mime_types
|
40
45
|
* Returns: a list of mime types for the given language, as an array of strings.
|
41
46
|
*/
|
42
47
|
static VALUE
|
43
|
-
|
48
|
+
rg_mime_types(VALUE self)
|
44
49
|
{
|
45
|
-
|
46
|
-
|
50
|
+
VALUE ary;
|
51
|
+
char **types = gtk_source_language_get_mime_types (_SELF (self));
|
47
52
|
if (!types)
|
48
53
|
return Qnil;
|
49
54
|
|
@@ -59,10 +64,10 @@ sourcelanguage_get_mime_types(VALUE self)
|
|
59
64
|
* Returns: a list of globs for the given language, as an array of strings.
|
60
65
|
*/
|
61
66
|
static VALUE
|
62
|
-
|
67
|
+
rg_globs(VALUE self)
|
63
68
|
{
|
64
|
-
|
65
|
-
|
69
|
+
VALUE ary;
|
70
|
+
char **globs = gtk_source_language_get_globs (_SELF (self));
|
66
71
|
if (!globs)
|
67
72
|
return Qnil;
|
68
73
|
|
@@ -79,21 +84,21 @@ sourcelanguage_get_globs(VALUE self)
|
|
79
84
|
* Returns: the localized style name of the given id.
|
80
85
|
*/
|
81
86
|
static VALUE
|
82
|
-
|
87
|
+
rg_get_style_name(VALUE self, VALUE style_id)
|
83
88
|
{
|
84
|
-
|
85
|
-
|
86
|
-
|
89
|
+
return
|
90
|
+
CSTR2RVAL (gtk_source_language_get_style_name
|
91
|
+
(_SELF (self), RVAL2CSTR(style_id)));
|
87
92
|
}
|
88
93
|
|
89
94
|
/* Method: style_id
|
90
95
|
* Returns: the styles defined by the language.
|
91
96
|
*/
|
92
97
|
static VALUE
|
93
|
-
|
98
|
+
rg_style_ids(VALUE self)
|
94
99
|
{
|
95
|
-
|
96
|
-
|
100
|
+
VALUE ary;
|
101
|
+
gchar **ids = gtk_source_language_get_style_ids (_SELF (self));
|
97
102
|
if (!ids)
|
98
103
|
return Qnil;
|
99
104
|
|
@@ -106,16 +111,16 @@ sourcelanguage_get_style_ids(VALUE self)
|
|
106
111
|
}
|
107
112
|
|
108
113
|
void
|
109
|
-
Init_gtk_sourcelanguage ()
|
114
|
+
Init_gtk_sourcelanguage (VALUE mGtk)
|
110
115
|
{
|
111
|
-
|
112
|
-
|
116
|
+
VALUE RG_TARGET_NAMESPACE =
|
117
|
+
G_DEF_CLASS (GTK_TYPE_SOURCE_LANGUAGE, "SourceLanguage", mGtk);
|
113
118
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
+
RG_DEF_METHOD(get_metadata, 1);
|
120
|
+
RG_DEF_METHOD(mime_types, 0);
|
121
|
+
RG_DEF_METHOD(globs, 0);
|
122
|
+
RG_DEF_METHOD(get_style_name, 1);
|
123
|
+
RG_DEF_METHOD(style_ids, 0);
|
119
124
|
|
120
|
-
|
125
|
+
G_DEF_SETTERS (RG_TARGET_NAMESPACE);
|
121
126
|
}
|