gtksourceview3 2.2.5 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -4
- data/lib/gtksourceview3/loader.rb +46 -0
- data/lib/gtksourceview3/mark-attributes.rb +29 -0
- data/lib/gtksourceview3.rb +47 -12
- data/test/run-test.rb +2 -0
- data/test/{test_mark_attributes.rb → test-mark-attributes.rb} +1 -1
- data/test/{test_source_language_manager.rb → test-source-language-manager.rb} +6 -6
- data/test/{test_source_view.rb → test-source-view.rb} +1 -1
- metadata +25 -34
- data/ext/gtksourceview3/depend +0 -6
- data/ext/gtksourceview3/extconf.rb +0 -67
- data/ext/gtksourceview3/gtksourceview3.def +0 -2
- data/ext/gtksourceview3/rbgtksource.c +0 -53
- data/ext/gtksourceview3/rbgtksourcebuffer.c +0 -318
- data/ext/gtksourceview3/rbgtksourcegutter.c +0 -82
- data/ext/gtksourceview3/rbgtksourcegutterrenderer.c +0 -143
- data/ext/gtksourceview3/rbgtksourcegutterrendererpixbuf.c +0 -42
- data/ext/gtksourceview3/rbgtksourcegutterrenderertext.c +0 -40
- data/ext/gtksourceview3/rbgtksourcelanguage.c +0 -124
- data/ext/gtksourceview3/rbgtksourcelanguagemanager.c +0 -114
- data/ext/gtksourceview3/rbgtksourcemark.c +0 -85
- data/ext/gtksourceview3/rbgtksourcemarkattributes.c +0 -77
- data/ext/gtksourceview3/rbgtksourceprintcompositor.c +0 -171
- data/ext/gtksourceview3/rbgtksourcestyle.c +0 -42
- data/ext/gtksourceview3/rbgtksourcestylescheme.c +0 -72
- data/ext/gtksourceview3/rbgtksourcestyleschememanager.c +0 -140
- data/ext/gtksourceview3/rbgtksourceundomanager.c +0 -83
- data/ext/gtksourceview3/rbgtksourceview.c +0 -94
- data/ext/gtksourceview3/rbgtksourceview3conversions.h +0 -50
- data/ext/gtksourceview3/rbgtksourceview3private.h +0 -53
- data/extconf.rb +0 -49
- data/sample/sourcelanguagemanager.rb +0 -21
- data/sample/test.rb +0 -32
- /data/test/{test_source_gutter_renderer.rb → test-source-gutter-renderer.rb} +0 -0
@@ -1,318 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
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
|
-
*/
|
22
|
-
|
23
|
-
#include "rbgtksourceview3private.h"
|
24
|
-
|
25
|
-
/* Class: Gtk::SourceBuffer
|
26
|
-
* Text buffer object for Gtk::SourceView.
|
27
|
-
*/
|
28
|
-
|
29
|
-
#define RG_TARGET_NAMESPACE cBuffer
|
30
|
-
#define _SELF(self) (RVAL2GTKSOURCEBUFFER(self))
|
31
|
-
|
32
|
-
#define RVAL2ITER(self, position) rval2iter(self, position)
|
33
|
-
#define RVAL2STARTITER(self, iter, out) \
|
34
|
-
rval2iter_with_default(&(self), &(iter), &(out), gtk_text_buffer_get_start_iter)
|
35
|
-
#define RVAL2ENDITER(self, iter, out) \
|
36
|
-
rval2iter_with_default(&(self), &(iter), &(out), gtk_text_buffer_get_end_iter)
|
37
|
-
|
38
|
-
static GtkTextIter *
|
39
|
-
rval2iter(VALUE self, VALUE position)
|
40
|
-
{
|
41
|
-
if (!g_type_is_a(RVAL2GTYPE(position), GTK_TYPE_TEXT_ITER))
|
42
|
-
position = rb_funcall(self, rb_intern("get_iter_at"), 1, position);
|
43
|
-
return RVAL2GTKTEXTITER(position);
|
44
|
-
}
|
45
|
-
|
46
|
-
static GtkTextIter *
|
47
|
-
rval2iter_with_default(VALUE *self, VALUE *iter, GtkTextIter *out,
|
48
|
-
void (*default_func)(GtkTextBuffer *, GtkTextIter *))
|
49
|
-
{
|
50
|
-
if (NIL_P(*iter)) {
|
51
|
-
default_func(RVAL2GTKTEXTBUFFER(*self), out);
|
52
|
-
return out;
|
53
|
-
} else {
|
54
|
-
return RVAL2ITER(*self, *iter);
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
/*
|
59
|
-
* Class method: new(obj=nil)
|
60
|
-
* obj: either a Gtk::TextTagTable, a Gtk::SourceLanguage, or nil.
|
61
|
-
*
|
62
|
-
* Creates a new source buffer. If a Gtk::SourceTagTable is provided, the
|
63
|
-
* buffer will use it, otherwise it will create a new one.
|
64
|
-
*
|
65
|
-
* If a Gtk::SourceLanguage object is given, the buffer will be created
|
66
|
-
* using highlightings patterns in this language. This is equivalent to
|
67
|
-
* creating a new source buffer with the default tag table and then setting
|
68
|
-
* the 'language' property.
|
69
|
-
*
|
70
|
-
* Returns: a newly created Gtk::SourceBuffer object.
|
71
|
-
*/
|
72
|
-
static VALUE
|
73
|
-
rg_initialize(int argc, VALUE *argv, VALUE self)
|
74
|
-
{
|
75
|
-
VALUE val;
|
76
|
-
|
77
|
-
rb_scan_args (argc, argv, "01", &val);
|
78
|
-
if (NIL_P (val)) {
|
79
|
-
G_INITIALIZE (self, gtk_source_buffer_new (NULL));
|
80
|
-
} else
|
81
|
-
if (rb_obj_is_kind_of
|
82
|
-
(val, GTYPE2CLASS (GTK_TYPE_TEXT_TAG_TABLE))) {
|
83
|
-
G_INITIALIZE (self,
|
84
|
-
gtk_source_buffer_new(RVAL2GTKTEXTTAGTABLE(val)));
|
85
|
-
} else
|
86
|
-
if (rb_obj_is_kind_of
|
87
|
-
(val, GTYPE2CLASS (GTK_SOURCE_TYPE_LANGUAGE))) {
|
88
|
-
G_INITIALIZE (self,
|
89
|
-
gtk_source_buffer_new_with_language(RVAL2GTKSOURCELANGUAGE(val)));
|
90
|
-
} else {
|
91
|
-
rb_raise (rb_eArgError,
|
92
|
-
"invalid argument %s (expect nil, Gtk::TextTagTable or Gtk::SourceLanguage)",
|
93
|
-
rb_class2name (CLASS_OF (val)));
|
94
|
-
}
|
95
|
-
return Qnil;
|
96
|
-
}
|
97
|
-
|
98
|
-
/*
|
99
|
-
* Method: redo!
|
100
|
-
*
|
101
|
-
* Redoes the last undo operation. Use Gtk::SourceBuffer#can_redo? to check
|
102
|
-
* whether a call to this function will have any effect.
|
103
|
-
*
|
104
|
-
* Returns: self.
|
105
|
-
*/
|
106
|
-
static VALUE
|
107
|
-
rg_redo_bang(VALUE self)
|
108
|
-
{
|
109
|
-
gtk_source_buffer_redo (_SELF (self));
|
110
|
-
return self;
|
111
|
-
}
|
112
|
-
|
113
|
-
/*
|
114
|
-
* Method: undo!
|
115
|
-
*
|
116
|
-
* Undoes the last user action which modified the buffer.
|
117
|
-
* Use Gtk::SourceBuffer#can_undo? to check whether a call to this function
|
118
|
-
* will have any effect.
|
119
|
-
*
|
120
|
-
* Actions are defined as groups of operations between a call to
|
121
|
-
* Gtk::TextBuffer#begin_user_action and Gtk::TextBuffer#end_user_action,
|
122
|
-
* or sequences of similar edits (inserts or deletes) on the same line.
|
123
|
-
*
|
124
|
-
* Returns: self.
|
125
|
-
*/
|
126
|
-
static VALUE
|
127
|
-
rg_undo_bang(VALUE self)
|
128
|
-
{
|
129
|
-
gtk_source_buffer_undo (_SELF (self));
|
130
|
-
return self;
|
131
|
-
}
|
132
|
-
|
133
|
-
/*
|
134
|
-
* Method: begin_not_undoable_action
|
135
|
-
* Method: begin_not_undoable_action { ... }
|
136
|
-
*
|
137
|
-
* Marks the beginning of a not undoable action on the buffer, disabling the
|
138
|
-
* undo manager.
|
139
|
-
*
|
140
|
-
* If a block is given, the block is called after marking the beginning
|
141
|
-
* of a not undoable action on the buffer.
|
142
|
-
* At the end of the block, marks the end of a not undoable action on the
|
143
|
-
* buffer. When the last not undoable block is finished, the list of undo
|
144
|
-
* actions is cleared and the undo manager is re-enabled.
|
145
|
-
*
|
146
|
-
* Returns: self
|
147
|
-
*/
|
148
|
-
static VALUE
|
149
|
-
rg_begin_not_undoable_action(VALUE self)
|
150
|
-
{
|
151
|
-
gtk_source_buffer_begin_not_undoable_action (_SELF (self));
|
152
|
-
|
153
|
-
if (rb_block_given_p()) {
|
154
|
-
VALUE block = rb_block_proc ();
|
155
|
-
rb_funcall (block, rb_intern ("call"), 0);
|
156
|
-
gtk_source_buffer_end_not_undoable_action (_SELF (self));
|
157
|
-
}
|
158
|
-
return self;
|
159
|
-
}
|
160
|
-
|
161
|
-
/*
|
162
|
-
* Method: end_not_undoable_action
|
163
|
-
*
|
164
|
-
* Marks the end of a not undoable action on the buffer.
|
165
|
-
* When the last not undoable block is finished, the list of undo
|
166
|
-
* actions is cleared and the undo manager is re-enabled.
|
167
|
-
*
|
168
|
-
* Returns: self
|
169
|
-
*/
|
170
|
-
static VALUE
|
171
|
-
rg_end_not_undoable_action(VALUE self)
|
172
|
-
{
|
173
|
-
gtk_source_buffer_end_not_undoable_action (_SELF (self));
|
174
|
-
return self;
|
175
|
-
}
|
176
|
-
|
177
|
-
/*
|
178
|
-
* Method: create_source_mark(name=nil, category, where)
|
179
|
-
* name: the name of the mark.
|
180
|
-
* type: a string defining the mark type.
|
181
|
-
* where: a location to place the mark, as a Gtk::TreeIter object.
|
182
|
-
*
|
183
|
-
* Creates a mark in the buffer of the given type. A mark is semantically
|
184
|
-
* very similar to a Gtk::TextMark, except it has a type which is used by the
|
185
|
-
* Gtk::SourceView object displaying the buffer to show a pixmap on the left
|
186
|
-
* margin, at the line the mark is in. Because of this, a mark is generally
|
187
|
-
* associated to a line and not a character position. Marks are also
|
188
|
-
* accessible through a position or range in the buffer.
|
189
|
-
*
|
190
|
-
* Marks are implemented using Gtk::TextMark, so all characteristics and
|
191
|
-
* restrictions to marks apply to marks too. These includes life cycle issues
|
192
|
-
* and "mark-set" and "mark-deleted" signal emissions.
|
193
|
-
*
|
194
|
-
* Like a Gtk::TextMark, a Gtk::SourceMark can be anonymous if the passed
|
195
|
-
* name is nil.
|
196
|
-
*
|
197
|
-
* Marks always have left gravity and are moved to the beginning of the line
|
198
|
-
* when the user deletes the line they were in. Also, if the user deletes a
|
199
|
-
* region of text which contained lines with marks, those are deleted.
|
200
|
-
*
|
201
|
-
* Typical uses for a mark are bookmarks, breakpoints, current executing
|
202
|
-
* instruction indication in a source file, etc..
|
203
|
-
*
|
204
|
-
* Returns: a new Gtk::SourceMark object, owned by the buffer.
|
205
|
-
*/
|
206
|
-
static VALUE
|
207
|
-
rg_create_source_mark(int argc, VALUE *argv, VALUE self)
|
208
|
-
{
|
209
|
-
VALUE name, category, where;
|
210
|
-
|
211
|
-
if (argc == 2)
|
212
|
-
rb_scan_args (argc, argv, "21", &where, &category, &name);
|
213
|
-
else
|
214
|
-
rb_scan_args (argc, argv, "30", &name, &category, &where);
|
215
|
-
|
216
|
-
return GOBJ2RVAL (gtk_source_buffer_create_source_mark (_SELF (self),
|
217
|
-
RVAL2CSTR (name),
|
218
|
-
RVAL2CSTR_ACCEPT_SYMBOL (category),
|
219
|
-
RVAL2ITER (self, where)));
|
220
|
-
}
|
221
|
-
|
222
|
-
static VALUE
|
223
|
-
rg_get_source_marks_at_line(int argc, VALUE *argv, VALUE self)
|
224
|
-
{
|
225
|
-
VALUE line, category;
|
226
|
-
|
227
|
-
rb_scan_args (argc, argv, "11", &line, &category);
|
228
|
-
|
229
|
-
/* TODO: need free? */
|
230
|
-
return GOBJGSLIST2RVAL_FREE(gtk_source_buffer_get_source_marks_at_line(_SELF(self),
|
231
|
-
NUM2INT(line),
|
232
|
-
RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(category)),
|
233
|
-
g_slist_free, NULL);
|
234
|
-
}
|
235
|
-
|
236
|
-
static VALUE
|
237
|
-
rg_get_source_marks_at_iter(int argc, VALUE *argv, VALUE self)
|
238
|
-
{
|
239
|
-
VALUE iter, category;
|
240
|
-
|
241
|
-
rb_scan_args (argc, argv, "11", &iter, &category);
|
242
|
-
|
243
|
-
/* TODO: need free? */
|
244
|
-
return GOBJGSLIST2RVAL_FREE(gtk_source_buffer_get_source_marks_at_iter(_SELF(self),
|
245
|
-
RVAL2ITER(self, iter),
|
246
|
-
RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(category)),
|
247
|
-
g_slist_free, NULL);
|
248
|
-
}
|
249
|
-
|
250
|
-
static VALUE
|
251
|
-
rg_remove_source_marks(int argc, VALUE *argv, VALUE self)
|
252
|
-
{
|
253
|
-
VALUE start, end, category;
|
254
|
-
GtkTextIter start_iter, end_iter;
|
255
|
-
|
256
|
-
rb_scan_args (argc, argv, "03", &start, &end, &category);
|
257
|
-
|
258
|
-
gtk_source_buffer_remove_source_marks (_SELF (self),
|
259
|
-
RVAL2STARTITER(self, start, start_iter),
|
260
|
-
RVAL2ENDITER(self, end, end_iter),
|
261
|
-
RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL (category));
|
262
|
-
|
263
|
-
return self;
|
264
|
-
}
|
265
|
-
|
266
|
-
static VALUE
|
267
|
-
rg_forward_iter_to_source_mark(int argc, VALUE *argv, VALUE self)
|
268
|
-
{
|
269
|
-
VALUE iter, category;
|
270
|
-
|
271
|
-
rb_scan_args (argc, argv, "11", &iter, &category);
|
272
|
-
|
273
|
-
return
|
274
|
-
CBOOL2RVAL (gtk_source_buffer_forward_iter_to_source_mark
|
275
|
-
(_SELF (self), RVAL2ITER (self, iter),
|
276
|
-
RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL (category)));
|
277
|
-
}
|
278
|
-
|
279
|
-
static VALUE
|
280
|
-
rg_backward_iter_to_source_mark(int argc, VALUE *argv, VALUE self)
|
281
|
-
{
|
282
|
-
VALUE iter, category;
|
283
|
-
|
284
|
-
rb_scan_args (argc, argv, "11", &iter, &category);
|
285
|
-
|
286
|
-
return
|
287
|
-
CBOOL2RVAL (gtk_source_buffer_backward_iter_to_source_mark
|
288
|
-
(_SELF (self), RVAL2ITER (self, iter),
|
289
|
-
RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL (category)));
|
290
|
-
}
|
291
|
-
|
292
|
-
static VALUE
|
293
|
-
rg_ensure_highlight(VALUE self, VALUE start, VALUE end)
|
294
|
-
{
|
295
|
-
gtk_source_buffer_ensure_highlight (_SELF (self), RVAL2ITER (self, start), RVAL2ITER (self, end));
|
296
|
-
|
297
|
-
return self;
|
298
|
-
}
|
299
|
-
|
300
|
-
void
|
301
|
-
Init_gtksource_buffer (VALUE mGtkSource)
|
302
|
-
{
|
303
|
-
VALUE RG_TARGET_NAMESPACE =
|
304
|
-
G_DEF_CLASS (GTK_SOURCE_TYPE_BUFFER, "Buffer", mGtkSource);
|
305
|
-
|
306
|
-
RG_DEF_METHOD(initialize, -1);
|
307
|
-
RG_DEF_METHOD_BANG(redo, 0);
|
308
|
-
RG_DEF_METHOD_BANG(undo, 0);
|
309
|
-
RG_DEF_METHOD(begin_not_undoable_action, 0);
|
310
|
-
RG_DEF_METHOD(end_not_undoable_action, 0);
|
311
|
-
RG_DEF_METHOD(create_source_mark, -1);
|
312
|
-
RG_DEF_METHOD(get_source_marks_at_line, -1);
|
313
|
-
RG_DEF_METHOD(get_source_marks_at_iter, -1);
|
314
|
-
RG_DEF_METHOD(remove_source_marks, -1);
|
315
|
-
RG_DEF_METHOD(forward_iter_to_source_mark, -1);
|
316
|
-
RG_DEF_METHOD(backward_iter_to_source_mark, -1);
|
317
|
-
RG_DEF_METHOD(ensure_highlight, 2);
|
318
|
-
}
|
@@ -1,82 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 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,
|
18
|
-
* MA 02110-1301 USA
|
19
|
-
*/
|
20
|
-
|
21
|
-
#include "rbgtksourceview3private.h"
|
22
|
-
|
23
|
-
#define RG_TARGET_NAMESPACE cGutter
|
24
|
-
#define _SELF(self) (RVAL2GTKSOURCEGUTTER(self))
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_window(VALUE self)
|
28
|
-
{
|
29
|
-
return GOBJ2RVAL(gtk_source_gutter_get_window(_SELF(self)));
|
30
|
-
}
|
31
|
-
|
32
|
-
static VALUE
|
33
|
-
rg_insert(VALUE self, VALUE renderer, VALUE position)
|
34
|
-
{
|
35
|
-
gboolean result;
|
36
|
-
|
37
|
-
result = gtk_source_gutter_insert(_SELF(self),
|
38
|
-
RVAL2GTKSOURCEGUTTERRENDERER(renderer),
|
39
|
-
NUM2INT(position));
|
40
|
-
G_CHILD_ADD(self, renderer);
|
41
|
-
|
42
|
-
return CBOOL2RVAL(result);
|
43
|
-
}
|
44
|
-
|
45
|
-
static VALUE
|
46
|
-
rg_queue_draw(VALUE self)
|
47
|
-
{
|
48
|
-
gtk_source_gutter_queue_draw(_SELF(self));
|
49
|
-
|
50
|
-
return self;
|
51
|
-
}
|
52
|
-
|
53
|
-
static VALUE
|
54
|
-
rg_remove(VALUE self, VALUE renderer)
|
55
|
-
{
|
56
|
-
gtk_source_gutter_remove(_SELF(self), RVAL2GTKSOURCEGUTTERRENDERER(renderer));
|
57
|
-
G_CHILD_REMOVE(self, renderer);
|
58
|
-
|
59
|
-
return self;
|
60
|
-
}
|
61
|
-
|
62
|
-
static VALUE
|
63
|
-
rg_reorder(VALUE self, VALUE renderer, VALUE position)
|
64
|
-
{
|
65
|
-
gtk_source_gutter_reorder(_SELF(self),
|
66
|
-
RVAL2GTKSOURCEGUTTERRENDERER(renderer),
|
67
|
-
NUM2INT(position));
|
68
|
-
|
69
|
-
return self;
|
70
|
-
}
|
71
|
-
|
72
|
-
void
|
73
|
-
Init_gtksource_gutter(VALUE mGtkSource)
|
74
|
-
{
|
75
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER, "Gutter", mGtkSource);
|
76
|
-
|
77
|
-
RG_DEF_METHOD(window, 0);
|
78
|
-
RG_DEF_METHOD(insert, 2);
|
79
|
-
RG_DEF_METHOD(queue_draw, 0);
|
80
|
-
RG_DEF_METHOD(remove, 1);
|
81
|
-
RG_DEF_METHOD(reorder, 2);
|
82
|
-
}
|
@@ -1,143 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 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,
|
18
|
-
* MA 02110-1301 USA
|
19
|
-
*/
|
20
|
-
|
21
|
-
#include "rbgtksourceview3private.h"
|
22
|
-
|
23
|
-
#define RG_TARGET_NAMESPACE cGutterRenderer
|
24
|
-
#define _SELF(self) (RVAL2GTKSOURCEGUTTERRENDERER(self))
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_end(VALUE self)
|
28
|
-
{
|
29
|
-
gtk_source_gutter_renderer_end(_SELF(self));
|
30
|
-
|
31
|
-
return self;
|
32
|
-
}
|
33
|
-
|
34
|
-
static VALUE
|
35
|
-
rg_begin(VALUE self, VALUE cr, VALUE background_area, VALUE cell_area, VALUE start, VALUE end)
|
36
|
-
{
|
37
|
-
gtk_source_gutter_renderer_begin(_SELF(self),
|
38
|
-
RVAL2CRCONTEXT(cr),
|
39
|
-
RVAL2GDKRECTANGLE(background_area),
|
40
|
-
RVAL2GDKRECTANGLE(cell_area),
|
41
|
-
RVAL2GTKTEXTITER(start),
|
42
|
-
RVAL2GTKTEXTITER(end));
|
43
|
-
if (rb_block_given_p())
|
44
|
-
rb_ensure(rb_yield, self, rg_end, self);
|
45
|
-
|
46
|
-
return self;
|
47
|
-
}
|
48
|
-
|
49
|
-
static VALUE
|
50
|
-
rg_draw(VALUE self, VALUE cr, VALUE background_area, VALUE cell_area, VALUE start, VALUE end, VALUE state)
|
51
|
-
{
|
52
|
-
gtk_source_gutter_renderer_draw(_SELF(self),
|
53
|
-
RVAL2CRCONTEXT(cr),
|
54
|
-
RVAL2GDKRECTANGLE(background_area),
|
55
|
-
RVAL2GDKRECTANGLE(cell_area),
|
56
|
-
RVAL2GTKTEXTITER(start),
|
57
|
-
RVAL2GTKTEXTITER(end),
|
58
|
-
RVAL2GTKSOURCEGUTTERRENDERERSTATE(state));
|
59
|
-
|
60
|
-
return self;
|
61
|
-
}
|
62
|
-
|
63
|
-
static VALUE
|
64
|
-
rg_alignment(VALUE self)
|
65
|
-
{
|
66
|
-
gfloat xalign, yalign;
|
67
|
-
|
68
|
-
gtk_source_gutter_renderer_get_alignment(_SELF(self), &xalign, &yalign);
|
69
|
-
|
70
|
-
return rb_ary_new3(2, xalign, yalign);
|
71
|
-
}
|
72
|
-
|
73
|
-
static VALUE
|
74
|
-
rg_background(VALUE self)
|
75
|
-
{
|
76
|
-
GdkRGBA color;
|
77
|
-
gboolean result;
|
78
|
-
|
79
|
-
result = gtk_source_gutter_renderer_get_background(_SELF(self), &color);
|
80
|
-
|
81
|
-
return result ? GDKRGBA2RVAL(&color) : Qnil;
|
82
|
-
}
|
83
|
-
|
84
|
-
static VALUE
|
85
|
-
rg_padding(VALUE self)
|
86
|
-
{
|
87
|
-
gint xpad, ypad;
|
88
|
-
|
89
|
-
gtk_source_gutter_renderer_get_padding(_SELF(self), &xpad, &ypad);
|
90
|
-
|
91
|
-
return rb_ary_new3(2, INT2NUM(xpad), INT2NUM(ypad));
|
92
|
-
}
|
93
|
-
|
94
|
-
static VALUE
|
95
|
-
rg_queue_draw(VALUE self)
|
96
|
-
{
|
97
|
-
gtk_source_gutter_renderer_queue_draw(_SELF(self));
|
98
|
-
|
99
|
-
return self;
|
100
|
-
}
|
101
|
-
|
102
|
-
static VALUE
|
103
|
-
rg_set_alignment(VALUE self, VALUE xalign, VALUE yalign)
|
104
|
-
{
|
105
|
-
gtk_source_gutter_renderer_set_alignment(_SELF(self), NUM2DBL(xalign), NUM2DBL(yalign));
|
106
|
-
|
107
|
-
return self;
|
108
|
-
}
|
109
|
-
|
110
|
-
static VALUE
|
111
|
-
rg_set_background(VALUE self, VALUE color)
|
112
|
-
{
|
113
|
-
gtk_source_gutter_renderer_set_background(_SELF(self), RVAL2GDKRGBA(color));
|
114
|
-
|
115
|
-
return self;
|
116
|
-
}
|
117
|
-
|
118
|
-
static VALUE
|
119
|
-
rg_set_padding(VALUE self, VALUE xpad, VALUE ypad)
|
120
|
-
{
|
121
|
-
gtk_source_gutter_renderer_set_padding(_SELF(self), NUM2INT(xpad), NUM2INT(ypad));
|
122
|
-
|
123
|
-
return self;
|
124
|
-
}
|
125
|
-
|
126
|
-
void
|
127
|
-
Init_gtksource_gutterrenderer(VALUE mGtkSource)
|
128
|
-
{
|
129
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER, "GutterRenderer", mGtkSource);
|
130
|
-
G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_ALIGNMENT_MODE, "AlignmentMode", RG_TARGET_NAMESPACE);
|
131
|
-
G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_STATE, "State", RG_TARGET_NAMESPACE);
|
132
|
-
|
133
|
-
RG_DEF_METHOD(alignment, 0);
|
134
|
-
RG_DEF_METHOD(background, 0);
|
135
|
-
RG_DEF_METHOD(begin, 5);
|
136
|
-
RG_DEF_METHOD(draw, 6);
|
137
|
-
RG_DEF_METHOD(end, 0);
|
138
|
-
RG_DEF_METHOD(padding, 0);
|
139
|
-
RG_DEF_METHOD(queue_draw, 0);
|
140
|
-
RG_DEF_METHOD(set_alignment, 2);
|
141
|
-
RG_DEF_METHOD(set_background, 1);
|
142
|
-
RG_DEF_METHOD(set_padding, 2);
|
143
|
-
}
|
@@ -1,42 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 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,
|
18
|
-
* MA 02110-1301 USA
|
19
|
-
*/
|
20
|
-
|
21
|
-
#include "rbgtksourceview3private.h"
|
22
|
-
|
23
|
-
#define RG_TARGET_NAMESPACE cGutterRendererPixbuf
|
24
|
-
#define _SELF(self) (RVAL2GTKSOURCEGUTTERRENDERERPIXBUF(self))
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_initialize(VALUE self)
|
28
|
-
{
|
29
|
-
G_INITIALIZE(self, gtk_source_gutter_renderer_pixbuf_new());
|
30
|
-
|
31
|
-
return Qnil;
|
32
|
-
}
|
33
|
-
|
34
|
-
void
|
35
|
-
Init_gtksource_gutterrendererpixbuf(VALUE mGtkSource)
|
36
|
-
{
|
37
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_PIXBUF, "GutterRendererPixbuf", mGtkSource);
|
38
|
-
|
39
|
-
RG_DEF_METHOD(initialize, 0);
|
40
|
-
|
41
|
-
RG_REG_GLIBID_SETTER("stock-id");
|
42
|
-
}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011-2014 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,
|
18
|
-
* MA 02110-1301 USA
|
19
|
-
*/
|
20
|
-
|
21
|
-
#include "rbgtksourceview3private.h"
|
22
|
-
|
23
|
-
#define RG_TARGET_NAMESPACE cGutterRendererText
|
24
|
-
#define _SELF(self) (RVAL2GTKSOURCEGUTTERRENDERERTEXT(self))
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_initialize(VALUE self)
|
28
|
-
{
|
29
|
-
G_INITIALIZE(self, gtk_source_gutter_renderer_text_new());
|
30
|
-
|
31
|
-
return Qnil;
|
32
|
-
}
|
33
|
-
|
34
|
-
void
|
35
|
-
Init_gtksource_gutterrenderertext(VALUE mGtkSource)
|
36
|
-
{
|
37
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_TEXT, "GutterRendererText", mGtkSource);
|
38
|
-
|
39
|
-
RG_DEF_METHOD(initialize, 0);
|
40
|
-
}
|