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,124 +0,0 @@
|
|
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::SourceLanguage
|
26
|
-
* Source language.
|
27
|
-
*/
|
28
|
-
|
29
|
-
#define RG_TARGET_NAMESPACE cLanguage
|
30
|
-
#define _SELF(self) (RVAL2GTKSOURCELANGUAGE(self))
|
31
|
-
|
32
|
-
/* Method: get_metadata(name)
|
33
|
-
* name: the metadata property name (string)
|
34
|
-
* Returns: the localized metadata for the given name.
|
35
|
-
*/
|
36
|
-
static VALUE
|
37
|
-
rg_get_metadata(VALUE self, VALUE name)
|
38
|
-
{
|
39
|
-
return
|
40
|
-
CSTR2RVAL (gtk_source_language_get_metadata
|
41
|
-
(_SELF (self), RVAL2CSTR(name)));
|
42
|
-
}
|
43
|
-
|
44
|
-
/* Method: mime_types
|
45
|
-
* Returns: a list of mime types for the given language, as an array of strings.
|
46
|
-
*/
|
47
|
-
static VALUE
|
48
|
-
rg_mime_types(VALUE self)
|
49
|
-
{
|
50
|
-
VALUE ary;
|
51
|
-
char **types = gtk_source_language_get_mime_types (_SELF (self));
|
52
|
-
if (!types)
|
53
|
-
return Qnil;
|
54
|
-
|
55
|
-
ary = rb_ary_new();
|
56
|
-
while (*types){
|
57
|
-
rb_ary_push(ary, CSTR2RVAL(*types));
|
58
|
-
types++;
|
59
|
-
}
|
60
|
-
return ary;
|
61
|
-
}
|
62
|
-
|
63
|
-
/* Method: globs
|
64
|
-
* Returns: a list of globs for the given language, as an array of strings.
|
65
|
-
*/
|
66
|
-
static VALUE
|
67
|
-
rg_globs(VALUE self)
|
68
|
-
{
|
69
|
-
VALUE ary;
|
70
|
-
char **globs = gtk_source_language_get_globs (_SELF (self));
|
71
|
-
if (!globs)
|
72
|
-
return Qnil;
|
73
|
-
|
74
|
-
ary = rb_ary_new();
|
75
|
-
while (*globs){
|
76
|
-
rb_ary_push(ary, CSTR2RVAL(*globs));
|
77
|
-
globs++;
|
78
|
-
}
|
79
|
-
return ary;
|
80
|
-
}
|
81
|
-
|
82
|
-
/* Method: get_style_name(style_id)
|
83
|
-
* style_id: the style id (string)
|
84
|
-
* Returns: the localized style name of the given id.
|
85
|
-
*/
|
86
|
-
static VALUE
|
87
|
-
rg_get_style_name(VALUE self, VALUE style_id)
|
88
|
-
{
|
89
|
-
return
|
90
|
-
CSTR2RVAL (gtk_source_language_get_style_name
|
91
|
-
(_SELF (self), RVAL2CSTR(style_id)));
|
92
|
-
}
|
93
|
-
|
94
|
-
/* Method: style_id
|
95
|
-
* Returns: the styles defined by the language.
|
96
|
-
*/
|
97
|
-
static VALUE
|
98
|
-
rg_style_ids(VALUE self)
|
99
|
-
{
|
100
|
-
VALUE ary;
|
101
|
-
gchar **ids = gtk_source_language_get_style_ids (_SELF (self));
|
102
|
-
if (!ids)
|
103
|
-
return Qnil;
|
104
|
-
|
105
|
-
ary = rb_ary_new();
|
106
|
-
while (*ids){
|
107
|
-
rb_ary_push(ary, CSTR2RVAL(*ids));
|
108
|
-
ids++;
|
109
|
-
}
|
110
|
-
return ary;
|
111
|
-
}
|
112
|
-
|
113
|
-
void
|
114
|
-
Init_gtksource_language (VALUE mGtkSource)
|
115
|
-
{
|
116
|
-
VALUE RG_TARGET_NAMESPACE =
|
117
|
-
G_DEF_CLASS (GTK_SOURCE_TYPE_LANGUAGE, "Language", mGtkSource);
|
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);
|
124
|
-
}
|
@@ -1,114 +0,0 @@
|
|
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::SourceLanguageManager
|
26
|
-
* A class to manage source language.
|
27
|
-
*/
|
28
|
-
|
29
|
-
#define RG_TARGET_NAMESPACE cLanguageManager
|
30
|
-
#define _SELF(self) (RVAL2GTKSOURCELANGUAGEMANAGER(self))
|
31
|
-
|
32
|
-
static VALUE rb_mGtkSource;
|
33
|
-
|
34
|
-
/* Class method: new
|
35
|
-
* Returns: a newly created Gtk::SourceLanguageManager object.
|
36
|
-
*/
|
37
|
-
static VALUE
|
38
|
-
rg_initialize(VALUE self)
|
39
|
-
{
|
40
|
-
G_INITIALIZE (self, gtk_source_language_manager_new ());
|
41
|
-
return Qnil;
|
42
|
-
}
|
43
|
-
|
44
|
-
/* Class method: default
|
45
|
-
*
|
46
|
-
* Gets the default language manager.
|
47
|
-
*
|
48
|
-
* Returns: a Gtk::SourceLanguageManager
|
49
|
-
*/
|
50
|
-
static VALUE
|
51
|
-
rg_s_default(G_GNUC_UNUSED VALUE self)
|
52
|
-
{
|
53
|
-
GtkSourceLanguageManager* slm = gtk_source_language_manager_get_default();
|
54
|
-
GType gtype = G_TYPE_FROM_INSTANCE(slm);
|
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(slm);
|
63
|
-
}
|
64
|
-
|
65
|
-
/*
|
66
|
-
* Method: get_language(id)
|
67
|
-
* id: a language id (as a string).
|
68
|
-
*
|
69
|
-
* Gets the Gtk::SourceLanguage which is associated with the given id
|
70
|
-
* in the language manager.
|
71
|
-
*
|
72
|
-
* Returns: a Gtk::SourceLanguage, or nil if there is no language associated
|
73
|
-
* with the given id.
|
74
|
-
*/
|
75
|
-
static VALUE
|
76
|
-
rg_get_language(VALUE self, VALUE id)
|
77
|
-
{
|
78
|
-
return
|
79
|
-
GOBJ2RVAL (gtk_source_language_manager_get_language
|
80
|
-
(_SELF (self), RVAL2CSTR (id)));
|
81
|
-
}
|
82
|
-
|
83
|
-
/*
|
84
|
-
* Method: guess_language(filename, content_type)
|
85
|
-
* filename: a file name (as a string), or nil.
|
86
|
-
* content_type: content type (as a string), or nil.
|
87
|
-
*
|
88
|
-
* Guesses the Gtk::SourceLanguage for the given file name and content type.
|
89
|
-
*
|
90
|
-
* Returns: a Gtk::SourceLanguage, or nil if there is no language associated
|
91
|
-
* with the given filename or content_type.
|
92
|
-
*/
|
93
|
-
static VALUE
|
94
|
-
rg_guess_language(VALUE self, VALUE filename, VALUE content_type)
|
95
|
-
{
|
96
|
-
return GOBJ2RVAL (gtk_source_language_manager_guess_language
|
97
|
-
(_SELF (self),
|
98
|
-
RVAL2CSTR_ACCEPT_NIL (filename),
|
99
|
-
RVAL2CSTR_ACCEPT_NIL (content_type)));
|
100
|
-
}
|
101
|
-
|
102
|
-
void
|
103
|
-
Init_gtksource_languagemanager (VALUE mGtkSource)
|
104
|
-
{
|
105
|
-
rb_mGtkSource = mGtkSource;
|
106
|
-
VALUE RG_TARGET_NAMESPACE =
|
107
|
-
G_DEF_CLASS (GTK_SOURCE_TYPE_LANGUAGE_MANAGER,
|
108
|
-
"LanguageManager", mGtkSource);
|
109
|
-
|
110
|
-
RG_DEF_METHOD(initialize, 0);
|
111
|
-
RG_DEF_METHOD(get_language, 1);
|
112
|
-
RG_DEF_METHOD(guess_language, 2);
|
113
|
-
RG_DEF_SMETHOD(default, 0);
|
114
|
-
}
|
@@ -1,85 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by 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
|
-
/* Class: Gtk::SourceMark
|
25
|
-
* A source mark.
|
26
|
-
*/
|
27
|
-
|
28
|
-
#define RG_TARGET_NAMESPACE cMark
|
29
|
-
#define _SELF(self) (RVAL2GTKSOURCEMARK(self))
|
30
|
-
|
31
|
-
/* Class method: new(name, category)
|
32
|
-
* name: mark name (string)
|
33
|
-
* category: marker category (string)
|
34
|
-
*
|
35
|
-
* Returns: a newly created Gtk::SourceMark object.
|
36
|
-
*/
|
37
|
-
static VALUE
|
38
|
-
rg_initialize(VALUE self, VALUE name, VALUE category)
|
39
|
-
{
|
40
|
-
G_INITIALIZE (self,
|
41
|
-
gtk_source_mark_new (RVAL2CSTR(name), RVAL2CSTR_ACCEPT_SYMBOL(category)));
|
42
|
-
return Qnil;
|
43
|
-
}
|
44
|
-
|
45
|
-
/* Method: next(category=nil)
|
46
|
-
* category: the category (string), or nil.
|
47
|
-
*
|
48
|
-
* Returns: the next Gtk::SourceMark after the mark.
|
49
|
-
*/
|
50
|
-
static VALUE
|
51
|
-
rg_next(int argc, VALUE *argv, VALUE self)
|
52
|
-
{
|
53
|
-
VALUE category;
|
54
|
-
|
55
|
-
rb_scan_args (argc, argv, "01", &category);
|
56
|
-
|
57
|
-
return GOBJ2RVAL (gtk_source_mark_next (_SELF (self),
|
58
|
-
RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(category)));
|
59
|
-
}
|
60
|
-
|
61
|
-
/* Method: prev(category=nil)
|
62
|
-
* category: the category (string), or nil.
|
63
|
-
*
|
64
|
-
* Returns: the previous Gtk::SourceMark before the mark.
|
65
|
-
*/
|
66
|
-
static VALUE
|
67
|
-
rg_prev(int argc, VALUE *argv, VALUE self)
|
68
|
-
{
|
69
|
-
VALUE category;
|
70
|
-
|
71
|
-
rb_scan_args (argc, argv, "01", &category);
|
72
|
-
|
73
|
-
return GOBJ2RVAL (gtk_source_mark_prev (_SELF (self),
|
74
|
-
RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(category)));
|
75
|
-
}
|
76
|
-
|
77
|
-
void
|
78
|
-
Init_gtksource_mark (VALUE mGtkSource)
|
79
|
-
{
|
80
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_MARK, "Mark", mGtkSource);
|
81
|
-
|
82
|
-
RG_DEF_METHOD(initialize, 2);
|
83
|
-
RG_DEF_METHOD(next, -1);
|
84
|
-
RG_DEF_METHOD(prev, -1);
|
85
|
-
}
|
@@ -1,77 +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 cMarkAttributes
|
24
|
-
#define _SELF(self) (RVAL2GTKSOURCEMARKATTRIBUTES(self))
|
25
|
-
|
26
|
-
static VALUE
|
27
|
-
rg_initialize(VALUE self)
|
28
|
-
{
|
29
|
-
G_INITIALIZE(self, gtk_source_mark_attributes_new());
|
30
|
-
|
31
|
-
return Qnil;
|
32
|
-
}
|
33
|
-
|
34
|
-
static VALUE
|
35
|
-
rg_get_tooltip_markup(VALUE self, VALUE mark)
|
36
|
-
{
|
37
|
-
gchar *markup;
|
38
|
-
|
39
|
-
markup = gtk_source_mark_attributes_get_tooltip_markup(_SELF(self),
|
40
|
-
RVAL2GTKSOURCEMARK(mark));
|
41
|
-
|
42
|
-
return CSTR2RVAL_FREE(markup);
|
43
|
-
}
|
44
|
-
|
45
|
-
static VALUE
|
46
|
-
rg_get_tooltip_text(VALUE self, VALUE mark)
|
47
|
-
{
|
48
|
-
gchar *text;
|
49
|
-
|
50
|
-
text = gtk_source_mark_attributes_get_tooltip_text(_SELF(self),
|
51
|
-
RVAL2GTKSOURCEMARK(mark));
|
52
|
-
|
53
|
-
return CSTR2RVAL_FREE(text);
|
54
|
-
}
|
55
|
-
|
56
|
-
static VALUE
|
57
|
-
rg_render_icon(VALUE self, VALUE widget, VALUE size)
|
58
|
-
{
|
59
|
-
GdkPixbuf *icon;
|
60
|
-
|
61
|
-
icon = gtk_source_mark_attributes_render_icon(_SELF(self),
|
62
|
-
RVAL2GTKWIDGET(widget),
|
63
|
-
NUM2INT(size));
|
64
|
-
|
65
|
-
return GOBJ2RVAL(icon);
|
66
|
-
}
|
67
|
-
|
68
|
-
void
|
69
|
-
Init_gtksource_markattributes(VALUE mGtkSource)
|
70
|
-
{
|
71
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_MARK_ATTRIBUTES, "MarkAttributes", mGtkSource);
|
72
|
-
|
73
|
-
RG_DEF_METHOD(initialize, 0);
|
74
|
-
RG_DEF_METHOD(get_tooltip_markup, 1);
|
75
|
-
RG_DEF_METHOD(get_tooltip_text, 1);
|
76
|
-
RG_DEF_METHOD(render_icon, 2);
|
77
|
-
}
|
@@ -1,171 +0,0 @@
|
|
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
|
-
}
|
@@ -1,42 +0,0 @@
|
|
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
|
-
}
|
@@ -1,72 +0,0 @@
|
|
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
|
-
}
|