gtksourceview3 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +29 -0
- data/Rakefile +16 -0
- data/ext/gtksourceview3/depend +6 -0
- data/ext/gtksourceview3/extconf.rb +76 -0
- data/ext/gtksourceview3/gtksourceview3.def +2 -0
- data/ext/gtksourceview3/rbgtksource.c +53 -0
- data/ext/gtksourceview3/rbgtksourcebuffer.c +318 -0
- data/ext/gtksourceview3/rbgtksourcegutter.c +82 -0
- data/ext/gtksourceview3/rbgtksourcegutterrenderer.c +143 -0
- data/ext/gtksourceview3/rbgtksourcegutterrendererpixbuf.c +42 -0
- data/ext/gtksourceview3/rbgtksourcegutterrenderertext.c +64 -0
- data/ext/gtksourceview3/rbgtksourcelanguage.c +124 -0
- data/ext/gtksourceview3/rbgtksourcelanguagemanager.c +114 -0
- data/ext/gtksourceview3/rbgtksourcemark.c +85 -0
- data/ext/gtksourceview3/rbgtksourcemarkattributes.c +77 -0
- data/ext/gtksourceview3/rbgtksourceprintcompositor.c +171 -0
- data/ext/gtksourceview3/rbgtksourcestyle.c +42 -0
- data/ext/gtksourceview3/rbgtksourcestylescheme.c +72 -0
- data/ext/gtksourceview3/rbgtksourcestyleschememanager.c +140 -0
- data/ext/gtksourceview3/rbgtksourceundomanager.c +83 -0
- data/ext/gtksourceview3/rbgtksourceview.c +94 -0
- data/ext/gtksourceview3/rbgtksourceview3conversions.h +43 -0
- data/ext/gtksourceview3/rbgtksourceview3private.h +54 -0
- data/extconf.rb +49 -0
- data/lib/gtksourceview3/deprecated.rb +47 -0
- data/lib/gtksourceview3.rb +20 -0
- data/sample/sourcelanguagemanager.rb +21 -0
- data/sample/test.rb +32 -0
- data/test/run-test.rb +33 -0
- data/test/test_source_view.rb +17 -0
- metadata +111 -0
@@ -0,0 +1,171 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2005 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbgtksourceview3private.h"
|
23
|
+
|
24
|
+
/* Module: Gtk::SourcePrintCompositor
|
25
|
+
*/
|
26
|
+
|
27
|
+
#define RG_TARGET_NAMESPACE cPrintCompositor
|
28
|
+
#define _SELF(self) (RVAL2GTKSOURCEPRINTCOMPOSITOR(self))
|
29
|
+
|
30
|
+
/*
|
31
|
+
* Class method: new(buffer)
|
32
|
+
* buffer: a Gtk::SourceBuffer or Gtk::SourceView object.
|
33
|
+
*
|
34
|
+
* Creates a new print compositor to print buffer.
|
35
|
+
*
|
36
|
+
* Returns: the new print compositor object.
|
37
|
+
*/
|
38
|
+
static VALUE
|
39
|
+
rg_initialize(VALUE self, VALUE val)
|
40
|
+
{
|
41
|
+
if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_SOURCE_TYPE_BUFFER))) {
|
42
|
+
G_INITIALIZE(self,
|
43
|
+
gtk_source_print_compositor_new (RVAL2GTKSOURCEBUFFER(val)));
|
44
|
+
} else
|
45
|
+
if (rb_obj_is_kind_of (val, GTYPE2CLASS (GTK_SOURCE_TYPE_VIEW))) {
|
46
|
+
G_INITIALIZE(self,
|
47
|
+
gtk_source_print_compositor_new_from_view (RVAL2GTKSOURCEVIEW(val)));
|
48
|
+
} else {
|
49
|
+
rb_raise (rb_eArgError,
|
50
|
+
"invalid argument %s (expect Gtk::SourceBuffer or Gtk::SourceView)",
|
51
|
+
rb_class2name (CLASS_OF (val)));
|
52
|
+
}
|
53
|
+
return Qnil;
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
rg_get_top_margin(VALUE self, VALUE unit)
|
58
|
+
{
|
59
|
+
return DBL2NUM(gtk_source_print_compositor_get_top_margin(_SELF(self), RVAL2GTKUNIT (unit)));
|
60
|
+
}
|
61
|
+
|
62
|
+
static VALUE
|
63
|
+
rg_set_top_margin(VALUE self, VALUE top, VALUE unit)
|
64
|
+
{
|
65
|
+
gtk_source_print_compositor_set_top_margin(_SELF(self), NUM2DBL(top), RVAL2GTKUNIT (unit));
|
66
|
+
return self;
|
67
|
+
}
|
68
|
+
|
69
|
+
static VALUE
|
70
|
+
rg_get_bottom_margin(VALUE self, VALUE unit)
|
71
|
+
{
|
72
|
+
return DBL2NUM(gtk_source_print_compositor_get_bottom_margin(_SELF(self), RVAL2GTKUNIT (unit)));
|
73
|
+
}
|
74
|
+
|
75
|
+
static VALUE
|
76
|
+
rg_set_bottom_margin(VALUE self, VALUE bottom, VALUE unit)
|
77
|
+
{
|
78
|
+
gtk_source_print_compositor_set_bottom_margin(_SELF(self), NUM2DBL(bottom), RVAL2GTKUNIT (unit));
|
79
|
+
return self;
|
80
|
+
}
|
81
|
+
|
82
|
+
static VALUE
|
83
|
+
rg_get_left_margin(VALUE self, VALUE unit)
|
84
|
+
{
|
85
|
+
return DBL2NUM(gtk_source_print_compositor_get_left_margin(_SELF(self), RVAL2GTKUNIT (unit)));
|
86
|
+
}
|
87
|
+
|
88
|
+
static VALUE
|
89
|
+
rg_set_left_margin(VALUE self, VALUE left, VALUE unit)
|
90
|
+
{
|
91
|
+
gtk_source_print_compositor_set_left_margin(_SELF(self), NUM2DBL(left), RVAL2GTKUNIT (unit));
|
92
|
+
return self;
|
93
|
+
}
|
94
|
+
|
95
|
+
static VALUE
|
96
|
+
rg_get_right_margin(VALUE self, VALUE unit)
|
97
|
+
{
|
98
|
+
return DBL2NUM(gtk_source_print_compositor_get_right_margin(_SELF(self), RVAL2GTKUNIT (unit)));
|
99
|
+
}
|
100
|
+
|
101
|
+
static VALUE
|
102
|
+
rg_set_right_margin(VALUE self, VALUE right, VALUE unit)
|
103
|
+
{
|
104
|
+
gtk_source_print_compositor_set_right_margin(_SELF(self), NUM2DBL(right), RVAL2GTKUNIT (unit));
|
105
|
+
return self;
|
106
|
+
}
|
107
|
+
|
108
|
+
static VALUE
|
109
|
+
rg_set_header_format(VALUE self, VALUE separator, VALUE left, VALUE center, VALUE right)
|
110
|
+
{
|
111
|
+
gtk_source_print_compositor_set_header_format(_SELF(self),
|
112
|
+
RVAL2CBOOL(separator),
|
113
|
+
RVAL2CSTR(left),
|
114
|
+
RVAL2CSTR(center),
|
115
|
+
RVAL2CSTR(right));
|
116
|
+
return self;
|
117
|
+
}
|
118
|
+
|
119
|
+
static VALUE
|
120
|
+
rg_set_footer_format(VALUE self, VALUE separator, VALUE left, VALUE center, VALUE right)
|
121
|
+
{
|
122
|
+
gtk_source_print_compositor_set_footer_format(_SELF(self),
|
123
|
+
RVAL2CBOOL(separator),
|
124
|
+
RVAL2CSTR(left),
|
125
|
+
RVAL2CSTR(center),
|
126
|
+
RVAL2CSTR(right));
|
127
|
+
return self;
|
128
|
+
}
|
129
|
+
|
130
|
+
static VALUE
|
131
|
+
rg_paginate(VALUE self, VALUE context)
|
132
|
+
{
|
133
|
+
return CBOOL2RVAL (gtk_source_print_compositor_paginate (_SELF (self),
|
134
|
+
RVAL2GTKPRINTCONTEXT(context)));
|
135
|
+
}
|
136
|
+
|
137
|
+
static VALUE
|
138
|
+
rg_pagination_progress(VALUE self)
|
139
|
+
{
|
140
|
+
return DBL2NUM (gtk_source_print_compositor_get_pagination_progress (_SELF (self)));
|
141
|
+
}
|
142
|
+
|
143
|
+
static VALUE
|
144
|
+
rg_draw_page(VALUE self, VALUE context, VALUE page_nr)
|
145
|
+
{
|
146
|
+
gtk_source_print_compositor_draw_page (_SELF (self),
|
147
|
+
RVAL2GTKPRINTCONTEXT(context),
|
148
|
+
NUM2INT (page_nr));
|
149
|
+
return self;
|
150
|
+
}
|
151
|
+
|
152
|
+
void
|
153
|
+
Init_gtksource_printcompositor(VALUE mGtkSource)
|
154
|
+
{
|
155
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_PRINT_COMPOSITOR, "PrintCompositor", mGtkSource);
|
156
|
+
|
157
|
+
RG_DEF_METHOD(initialize, 1);
|
158
|
+
RG_DEF_METHOD(get_top_margin, 1);
|
159
|
+
RG_DEF_METHOD(set_top_margin, 2);
|
160
|
+
RG_DEF_METHOD(get_bottom_margin, 1);
|
161
|
+
RG_DEF_METHOD(set_bottom_margin, 2);
|
162
|
+
RG_DEF_METHOD(get_left_margin, 1);
|
163
|
+
RG_DEF_METHOD(set_left_margin, 2);
|
164
|
+
RG_DEF_METHOD(get_right_margin, 1);
|
165
|
+
RG_DEF_METHOD(set_right_margin, 2);
|
166
|
+
RG_DEF_METHOD(set_header_format, 4);
|
167
|
+
RG_DEF_METHOD(set_footer_format, 4);
|
168
|
+
RG_DEF_METHOD(paginate, 1);
|
169
|
+
RG_DEF_METHOD(pagination_progress, 0);
|
170
|
+
RG_DEF_METHOD(draw_page, 2);
|
171
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2005 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbgtksourceview3private.h"
|
23
|
+
|
24
|
+
/* Module: Gtk::SourceStyle
|
25
|
+
*/
|
26
|
+
|
27
|
+
#define RG_TARGET_NAMESPACE cStyle
|
28
|
+
#define _SELF(self) (RVAL2GTKSOURCESTYLE(self))
|
29
|
+
|
30
|
+
static VALUE
|
31
|
+
rg_copy(VALUE self)
|
32
|
+
{
|
33
|
+
return GOBJ2RVAL (gtk_source_style_copy (_SELF (self)));
|
34
|
+
}
|
35
|
+
|
36
|
+
void
|
37
|
+
Init_gtksource_style (VALUE mGtkSource)
|
38
|
+
{
|
39
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_STYLE, "Style", mGtkSource);
|
40
|
+
|
41
|
+
RG_DEF_METHOD(copy, 0);
|
42
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2005 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbgtksourceview3private.h"
|
23
|
+
|
24
|
+
/* Module: Gtk::SourceStyleScheme
|
25
|
+
*/
|
26
|
+
|
27
|
+
#define RG_TARGET_NAMESPACE cStyleScheme
|
28
|
+
#define _SELF(self) (RVAL2GTKSOURCESTYLESCHEME(self))
|
29
|
+
|
30
|
+
/* Method: authors
|
31
|
+
*
|
32
|
+
* Returns: a list of authors for the given style scheme.
|
33
|
+
*/
|
34
|
+
static VALUE
|
35
|
+
rg_authors(VALUE self)
|
36
|
+
{
|
37
|
+
VALUE ary;
|
38
|
+
const gchar * const * authors =
|
39
|
+
gtk_source_style_scheme_get_authors (_SELF (self));
|
40
|
+
if (!authors)
|
41
|
+
return Qnil;
|
42
|
+
|
43
|
+
ary = rb_ary_new();
|
44
|
+
while (*authors){
|
45
|
+
rb_ary_push(ary, CSTR2RVAL(*authors));
|
46
|
+
authors++;
|
47
|
+
}
|
48
|
+
return ary;
|
49
|
+
}
|
50
|
+
|
51
|
+
/* Method: get_style(style_id)
|
52
|
+
* style_name: the name of a style.
|
53
|
+
*
|
54
|
+
* Gets the tag associated with the given style_name in the style scheme.
|
55
|
+
*
|
56
|
+
* Returns: Gtk::SourceStyle
|
57
|
+
*/
|
58
|
+
static VALUE
|
59
|
+
rg_get_style(VALUE self, VALUE style_name)
|
60
|
+
{
|
61
|
+
return GOBJ2RVAL(gtk_source_style_scheme_get_style(_SELF(self),
|
62
|
+
RVAL2CSTR(style_name)));
|
63
|
+
}
|
64
|
+
|
65
|
+
void
|
66
|
+
Init_gtksource_stylescheme (VALUE mGtkSource)
|
67
|
+
{
|
68
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_STYLE_SCHEME, "StyleScheme", mGtkSource);
|
69
|
+
|
70
|
+
RG_DEF_METHOD(authors, 0);
|
71
|
+
RG_DEF_METHOD(get_style, 1);
|
72
|
+
}
|
@@ -0,0 +1,140 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
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
|
+
*/
|
22
|
+
|
23
|
+
#include "rbgtksourceview3private.h"
|
24
|
+
|
25
|
+
/* Class: Gtk::SourceStyleSchemeManager
|
26
|
+
* A class to manage source style scheme.
|
27
|
+
*/
|
28
|
+
|
29
|
+
#define RG_TARGET_NAMESPACE cStyleSchemeManager
|
30
|
+
#define _SELF(self) (RVAL2GTKSOURCESTYLESCHEMEMANAGER(self))
|
31
|
+
|
32
|
+
static VALUE rb_mGtkSource;
|
33
|
+
|
34
|
+
/* Class method: new
|
35
|
+
* Returns: a newly created Gtk::SourceStyleSchemeManager object.
|
36
|
+
*/
|
37
|
+
static VALUE
|
38
|
+
rg_initialize(VALUE self)
|
39
|
+
{
|
40
|
+
G_INITIALIZE (self, gtk_source_style_scheme_manager_new ());
|
41
|
+
return Qnil;
|
42
|
+
}
|
43
|
+
|
44
|
+
/* Class method: default
|
45
|
+
*
|
46
|
+
* Gets the default style scheme manager.
|
47
|
+
*
|
48
|
+
* Returns: a Gtk::SourceStyleSchemeManager
|
49
|
+
*/
|
50
|
+
static VALUE
|
51
|
+
rg_s_default(G_GNUC_UNUSED VALUE self)
|
52
|
+
{
|
53
|
+
GtkSourceStyleSchemeManager* sssm = gtk_source_style_scheme_manager_get_default();
|
54
|
+
GType gtype = G_TYPE_FROM_INSTANCE(sssm);
|
55
|
+
|
56
|
+
gchar *gtypename = (gchar *) g_type_name (gtype);
|
57
|
+
if (strncmp (gtypename, "GtkSource", 9) == 0)
|
58
|
+
gtypename += 9;
|
59
|
+
if (!rb_const_defined_at (rb_mGtkSource, rb_intern (gtypename)))
|
60
|
+
G_DEF_CLASS (gtype, gtypename, rb_mGtkSource);
|
61
|
+
|
62
|
+
return GOBJ2RVAL(sssm);
|
63
|
+
}
|
64
|
+
|
65
|
+
/* Method: append_search_path(path)
|
66
|
+
* path: additional style scheme file directory path (string)
|
67
|
+
*
|
68
|
+
* Appends the style scheme files directory for the given style scheme manager.
|
69
|
+
*
|
70
|
+
* Returns: self.
|
71
|
+
*/
|
72
|
+
static VALUE
|
73
|
+
rg_append_search_path(VALUE self, VALUE path)
|
74
|
+
{
|
75
|
+
gtk_source_style_scheme_manager_append_search_path (_SELF (self), RVAL2CSTR(path));
|
76
|
+
return self;
|
77
|
+
}
|
78
|
+
|
79
|
+
/* Method: prepend_search_path(path)
|
80
|
+
* path: additional style scheme file directory path (string)
|
81
|
+
*
|
82
|
+
* Prepend the style scheme files directory for the given style scheme manager.
|
83
|
+
*
|
84
|
+
* Returns: self.
|
85
|
+
*/
|
86
|
+
static VALUE
|
87
|
+
rg_prepend_search_path(VALUE self, VALUE path)
|
88
|
+
{
|
89
|
+
gtk_source_style_scheme_manager_prepend_search_path (_SELF (self), RVAL2CSTR(path));
|
90
|
+
return self;
|
91
|
+
}
|
92
|
+
|
93
|
+
/*
|
94
|
+
* Method: scheme(scheme_id)
|
95
|
+
* scheme_id: a style scheme id (as a string).
|
96
|
+
*
|
97
|
+
* Gets the Gtk::SourceStyleScheme which is associated with the given id
|
98
|
+
* in the style scheme manager.
|
99
|
+
*
|
100
|
+
* Returns: a Gtk::SourceStyleScheme, or nil if there is no style scheme
|
101
|
+
* associated with the given id.
|
102
|
+
*/
|
103
|
+
static VALUE
|
104
|
+
rg_get_scheme(VALUE self, VALUE scheme_id)
|
105
|
+
{
|
106
|
+
return
|
107
|
+
GOBJ2RVAL (gtk_source_style_scheme_manager_get_scheme
|
108
|
+
(_SELF (self), RVAL2CSTR (scheme_id)));
|
109
|
+
}
|
110
|
+
|
111
|
+
/*
|
112
|
+
* Method: force_rescan
|
113
|
+
*
|
114
|
+
* Forces all style schemes to be reloaded the next time the
|
115
|
+
* Gtk::SourceStyleSchemeManager is accessed.
|
116
|
+
*
|
117
|
+
* Returns: self.
|
118
|
+
*/
|
119
|
+
static VALUE
|
120
|
+
rg_force_rescan(VALUE self)
|
121
|
+
{
|
122
|
+
gtk_source_style_scheme_manager_force_rescan(_SELF (self));
|
123
|
+
return self;
|
124
|
+
}
|
125
|
+
|
126
|
+
void
|
127
|
+
Init_gtksource_styleschememanager (VALUE mGtkSource)
|
128
|
+
{
|
129
|
+
rb_mGtkSource = mGtkSource;
|
130
|
+
VALUE RG_TARGET_NAMESPACE =
|
131
|
+
G_DEF_CLASS (GTK_SOURCE_TYPE_STYLE_SCHEME_MANAGER,
|
132
|
+
"StyleSchemeManager", mGtkSource);
|
133
|
+
|
134
|
+
RG_DEF_METHOD(initialize, 0);
|
135
|
+
RG_DEF_METHOD(append_search_path, 1);
|
136
|
+
RG_DEF_METHOD(prepend_search_path, 1);
|
137
|
+
RG_DEF_METHOD(get_scheme, 1);
|
138
|
+
RG_DEF_METHOD(force_rescan, 0);
|
139
|
+
RG_DEF_SMETHOD(default, 0);
|
140
|
+
}
|
@@ -0,0 +1,83 @@
|
|
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 mUndoManager
|
24
|
+
#define _SELF(self) (RVAL2GTKSOURCEUNDOMANAGER(self))
|
25
|
+
|
26
|
+
static VALUE
|
27
|
+
rg_end_not_undoable_action(VALUE self)
|
28
|
+
{
|
29
|
+
gtk_source_undo_manager_end_not_undoable_action(_SELF(self));
|
30
|
+
|
31
|
+
return self;
|
32
|
+
}
|
33
|
+
|
34
|
+
static VALUE
|
35
|
+
rg_begin_not_undoable_action(VALUE self)
|
36
|
+
{
|
37
|
+
gtk_source_undo_manager_begin_not_undoable_action(_SELF(self));
|
38
|
+
if (rb_block_given_p())
|
39
|
+
rb_ensure(rb_yield, self, rg_end_not_undoable_action, self);
|
40
|
+
|
41
|
+
return self;
|
42
|
+
}
|
43
|
+
|
44
|
+
static VALUE
|
45
|
+
rg_can_redo_p(VALUE self)
|
46
|
+
{
|
47
|
+
return CBOOL2RVAL(gtk_source_undo_manager_can_redo(_SELF(self)));
|
48
|
+
}
|
49
|
+
|
50
|
+
static VALUE
|
51
|
+
rg_can_undo_p(VALUE self)
|
52
|
+
{
|
53
|
+
return CBOOL2RVAL(gtk_source_undo_manager_can_undo(_SELF(self)));
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
rg_redo(VALUE self)
|
58
|
+
{
|
59
|
+
gtk_source_undo_manager_redo(_SELF(self));
|
60
|
+
|
61
|
+
return self;
|
62
|
+
}
|
63
|
+
|
64
|
+
static VALUE
|
65
|
+
rg_undo(VALUE self)
|
66
|
+
{
|
67
|
+
gtk_source_undo_manager_undo(_SELF(self));
|
68
|
+
|
69
|
+
return self;
|
70
|
+
}
|
71
|
+
|
72
|
+
void
|
73
|
+
Init_gtksource_undomanager(VALUE mGtkSource)
|
74
|
+
{
|
75
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_INTERFACE(GTK_SOURCE_TYPE_UNDO_MANAGER, "UndoManager", mGtkSource);
|
76
|
+
|
77
|
+
RG_DEF_METHOD(begin_not_undoable_action, 0);
|
78
|
+
RG_DEF_METHOD_P(can_redo, 0);
|
79
|
+
RG_DEF_METHOD_P(can_undo, 0);
|
80
|
+
RG_DEF_METHOD(end_not_undoable_action, 0);
|
81
|
+
RG_DEF_METHOD(redo, 0);
|
82
|
+
RG_DEF_METHOD(undo, 0);
|
83
|
+
}
|
@@ -0,0 +1,94 @@
|
|
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::SourceView
|
26
|
+
* A view on a source.
|
27
|
+
*/
|
28
|
+
|
29
|
+
#define RG_TARGET_NAMESPACE cView
|
30
|
+
#define _SELF(self) (RVAL2GTKSOURCEVIEW(self))
|
31
|
+
|
32
|
+
/*
|
33
|
+
* Class method: new(buffer=nil)
|
34
|
+
* buffer: a Gtk::SourceBuffer object.
|
35
|
+
*
|
36
|
+
* Creates a new Gtk::SourceView. If buffer is not provided or nil, an empty
|
37
|
+
* buffer will be created for you. Note that one buffer can be shared among
|
38
|
+
* many widgets.
|
39
|
+
*
|
40
|
+
* Returns: a newly created Gtk::SourceView object.
|
41
|
+
*/
|
42
|
+
static VALUE
|
43
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
44
|
+
{
|
45
|
+
VALUE buffer;
|
46
|
+
GtkWidget *widget;
|
47
|
+
|
48
|
+
rb_scan_args(argc, argv, "01", &buffer);
|
49
|
+
|
50
|
+
if (NIL_P(buffer))
|
51
|
+
widget = gtk_source_view_new();
|
52
|
+
else
|
53
|
+
widget = gtk_source_view_new_with_buffer(RVAL2GTKSOURCEBUFFER(buffer));
|
54
|
+
|
55
|
+
RBGTK_INITIALIZE(self, widget);
|
56
|
+
return self;
|
57
|
+
}
|
58
|
+
|
59
|
+
static VALUE
|
60
|
+
rg_get_gutter(VALUE self, VALUE window_type)
|
61
|
+
{
|
62
|
+
VALUE gutter;
|
63
|
+
|
64
|
+
gutter = GOBJ2RVAL(gtk_source_view_get_gutter(_SELF(self),
|
65
|
+
RVAL2GTKTEXTWINDOWTYPE(window_type)));
|
66
|
+
G_CHILD_ADD(self, gutter);
|
67
|
+
|
68
|
+
return gutter;
|
69
|
+
}
|
70
|
+
|
71
|
+
static VALUE
|
72
|
+
rg_set_mark_attributes(VALUE self, VALUE category, VALUE attributes, VALUE priority)
|
73
|
+
{
|
74
|
+
gtk_source_view_set_mark_attributes(_SELF(self),
|
75
|
+
RVAL2CSTR_ACCEPT_SYMBOL(category),
|
76
|
+
RVAL2GTKSOURCEMARKATTRIBUTES(attributes),
|
77
|
+
NUM2INT(priority));
|
78
|
+
|
79
|
+
return self;
|
80
|
+
}
|
81
|
+
|
82
|
+
void
|
83
|
+
Init_gtksource_view (VALUE mGtkSource)
|
84
|
+
{
|
85
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_VIEW, "View", mGtkSource);
|
86
|
+
G_DEF_CLASS(GTK_SOURCE_TYPE_VIEW_GUTTER_POSITION, "GutterPosition", RG_TARGET_NAMESPACE);
|
87
|
+
|
88
|
+
RG_DEF_METHOD(initialize, -1);
|
89
|
+
RG_DEF_METHOD(get_gutter, 1);
|
90
|
+
RG_DEF_METHOD(set_mark_attributes, 3);
|
91
|
+
|
92
|
+
G_DEF_CLASS(GTK_SOURCE_TYPE_SMART_HOME_END_TYPE, "SmartHomeEndType", RG_TARGET_NAMESPACE);
|
93
|
+
G_DEF_CLASS(GTK_SOURCE_TYPE_DRAW_SPACES_FLAGS, "DrawSpacesFlags", RG_TARGET_NAMESPACE);
|
94
|
+
}
|
@@ -0,0 +1,43 @@
|
|
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
|
+
#ifndef __RBGTKSOURCEVIEW3CONVERSIONS_H__
|
22
|
+
#define __RBGTKSOURCEVIEW3CONVERSIONS_H__
|
23
|
+
|
24
|
+
#define RVAL2GTKSOURCEBUFFER(o) (GTK_SOURCE_BUFFER(RVAL2GOBJ(o)))
|
25
|
+
#define RVAL2GTKSOURCEGUTTER(o) (GTK_SOURCE_GUTTER(RVAL2GOBJ(o)))
|
26
|
+
#define RVAL2GTKSOURCEGUTTERRENDERER(o) (GTK_SOURCE_GUTTER_RENDERER(RVAL2GOBJ(o)))
|
27
|
+
#define RVAL2GTKSOURCEGUTTERRENDERERPIXBUF(o) (GTK_SOURCE_GUTTER_RENDERER_PIXBUF(RVAL2GOBJ(o)))
|
28
|
+
#define RVAL2GTKSOURCEGUTTERRENDERERTEXT(o) (GTK_SOURCE_GUTTER_RENDERER_TEXT(RVAL2GOBJ(o)))
|
29
|
+
#define RVAL2GTKSOURCELANGUAGE(o) (GTK_SOURCE_LANGUAGE(RVAL2GOBJ(o)))
|
30
|
+
#define RVAL2GTKSOURCELANGUAGEMANAGER(o) (GTK_SOURCE_LANGUAGE_MANAGER(RVAL2GOBJ(o)))
|
31
|
+
#define RVAL2GTKSOURCEMARK(o) (GTK_SOURCE_MARK(RVAL2GOBJ(o)))
|
32
|
+
#define RVAL2GTKSOURCEMARKATTRIBUTES(o) (GTK_SOURCE_MARK_ATTRIBUTES(RVAL2GOBJ(o)))
|
33
|
+
#define RVAL2GTKSOURCEPRINTCOMPOSITOR(o) (GTK_SOURCE_PRINT_COMPOSITOR(RVAL2GOBJ(o)))
|
34
|
+
#define RVAL2GTKSOURCESTYLE(o) (GTK_SOURCE_STYLE(RVAL2GOBJ(o)))
|
35
|
+
#define RVAL2GTKSOURCESTYLESCHEME(o) (GTK_SOURCE_STYLE_SCHEME(RVAL2GOBJ(o)))
|
36
|
+
#define RVAL2GTKSOURCESTYLESCHEMEMANAGER(o) (GTK_SOURCE_STYLE_SCHEME_MANAGER(RVAL2GOBJ(o)))
|
37
|
+
#define RVAL2GTKSOURCEUNDOMANAGER(o) (GTK_SOURCE_UNDO_MANAGER(RVAL2GOBJ(o)))
|
38
|
+
#define RVAL2GTKSOURCEVIEW(o) (GTK_SOURCE_VIEW(RVAL2GOBJ(o)))
|
39
|
+
|
40
|
+
#define RVAL2GTKSOURCEGUTTERRENDERERSTATE(o) (RVAL2GFLAGS(o, GTK_SOURCE_TYPE_GUTTER_RENDERER_STATE))
|
41
|
+
#define GTKSOURCEGUTTERRENDERERSTATE2RVAL(o) (GFLAGS2RVAL(o, GTK_SOURCE_TYPE_GUTTER_RENDERER_STATE))
|
42
|
+
|
43
|
+
#endif /* __RBGTKSOURCEVIEW3CONVERSIONS_H__ */
|
@@ -0,0 +1,54 @@
|
|
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
|
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
|
+
#ifndef __RBGTKSOURCEVIEW3PRIVATE_H__
|
24
|
+
#define __RBGTKSOURCEVIEW3PRIVATE_H__
|
25
|
+
|
26
|
+
#include <gtksourceview/gtksource.h>
|
27
|
+
#include <gtksourceview/gtksourceview-typebuiltins.h>
|
28
|
+
|
29
|
+
#include <ruby.h>
|
30
|
+
#include <rb_cairo.h>
|
31
|
+
#include <rbgdk3.h>
|
32
|
+
#include <rbgtk3.h>
|
33
|
+
#include "rbgtksourceview3conversions.h"
|
34
|
+
#include "rbgtksourceview3version.h"
|
35
|
+
|
36
|
+
extern void Init_gtksourceview3(void);
|
37
|
+
|
38
|
+
G_GNUC_INTERNAL void Init_gtksource_view (VALUE mGtkSource);
|
39
|
+
G_GNUC_INTERNAL void Init_gtksource_buffer (VALUE mGtkSource);
|
40
|
+
G_GNUC_INTERNAL void Init_gtksource_language (VALUE mGtkSource);
|
41
|
+
G_GNUC_INTERNAL void Init_gtksource_languagemanager (VALUE mGtkSource);
|
42
|
+
G_GNUC_INTERNAL void Init_gtksource_mark (VALUE mGtkSource);
|
43
|
+
G_GNUC_INTERNAL void Init_gtksource_printcompositor (VALUE mGtkSource);
|
44
|
+
G_GNUC_INTERNAL void Init_gtksource_style (VALUE mGtkSource);
|
45
|
+
G_GNUC_INTERNAL void Init_gtksource_stylescheme (VALUE mGtkSource);
|
46
|
+
G_GNUC_INTERNAL void Init_gtksource_styleschememanager (VALUE mGtkSource);
|
47
|
+
G_GNUC_INTERNAL void Init_gtksource_gutter(VALUE mGtkSource);
|
48
|
+
G_GNUC_INTERNAL void Init_gtksource_gutterrenderer(VALUE mGtkSource);
|
49
|
+
G_GNUC_INTERNAL void Init_gtksource_gutterrendererpixbuf(VALUE mGtkSource);
|
50
|
+
G_GNUC_INTERNAL void Init_gtksource_gutterrenderertext(VALUE mGtkSource);
|
51
|
+
G_GNUC_INTERNAL void Init_gtksource_markattributes(VALUE mGtkSource);
|
52
|
+
G_GNUC_INTERNAL void Init_gtksource_undomanager(VALUE mGtkSource);
|
53
|
+
|
54
|
+
#endif /* __RBGTKSOURCEVIEW3PRIVATE_H__ */
|