gtk2 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +66 -1
- data/ext/gtk2/extconf.rb +0 -96
- data/ext/gtk2/global.h +274 -13
- data/ext/gtk2/gtk2.def +5 -3
- data/ext/gtk2/init.c +263 -19
- data/ext/gtk2/rbgdk.c +245 -89
- data/ext/gtk2/rbgdk.h +32 -6
- data/ext/gtk2/rbgdkatom.c +38 -28
- data/ext/gtk2/rbgdkcairo.c +32 -42
- data/ext/gtk2/rbgdkcolor.c +52 -42
- data/ext/gtk2/rbgdkcolormap.c +42 -37
- data/ext/gtk2/rbgdkconst.c +23 -13
- data/ext/gtk2/rbgdkconversions.h +19 -6
- data/ext/gtk2/rbgdkcursor.c +37 -25
- data/ext/gtk2/rbgdkdevice.c +77 -67
- data/ext/gtk2/rbgdkdisplay.c +158 -150
- data/ext/gtk2/rbgdkdisplaymanager.c +27 -15
- data/ext/gtk2/rbgdkdragcontext.c +121 -70
- data/ext/gtk2/rbgdkdraw.c +252 -160
- data/ext/gtk2/rbgdkevent.c +30 -20
- data/ext/gtk2/rbgdkgc.c +123 -116
- data/ext/gtk2/rbgdkgeometry.c +77 -68
- data/ext/gtk2/rbgdkimage.c +58 -47
- data/ext/gtk2/rbgdkinput.c +33 -26
- data/ext/gtk2/rbgdkkeymap.c +38 -27
- data/ext/gtk2/rbgdkkeyval.c +44 -32
- data/ext/gtk2/rbgdkpango.c +66 -39
- data/ext/gtk2/rbgdkpangorenderer.c +63 -35
- data/ext/gtk2/rbgdkpixbuf.c +36 -25
- data/ext/gtk2/rbgdkpixmap.c +65 -49
- data/ext/gtk2/rbgdkproperty.c +66 -60
- data/ext/gtk2/rbgdkrectangle.c +54 -46
- data/ext/gtk2/rbgdkregion.c +144 -79
- data/ext/gtk2/rbgdkrgb.c +74 -58
- data/ext/gtk2/rbgdkscreen.c +103 -97
- data/ext/gtk2/rbgdkselection.c +49 -39
- data/ext/gtk2/rbgdkthreads.c +32 -19
- data/ext/gtk2/rbgdktimecoord.c +60 -38
- data/ext/gtk2/rbgdkvisual.c +79 -71
- data/ext/gtk2/rbgdkwindow.c +284 -305
- data/ext/gtk2/rbgdkwindowattr.c +69 -58
- data/ext/gtk2/rbgdkx11.c +41 -28
- data/ext/gtk2/rbgtk.c +498 -19
- data/ext/gtk2/rbgtk.h +35 -20
- data/ext/gtk2/rbgtkaboutdialog.c +33 -80
- data/ext/gtk2/rbgtkaccelerator.c +36 -23
- data/ext/gtk2/rbgtkaccelgroup.c +50 -40
- data/ext/gtk2/rbgtkaccelgroupentry.c +32 -20
- data/ext/gtk2/rbgtkaccelkey.c +40 -28
- data/ext/gtk2/rbgtkaccellabel.c +30 -18
- data/ext/gtk2/rbgtkaccelmap.c +55 -42
- data/ext/gtk2/rbgtkaccessible.c +25 -14
- data/ext/gtk2/rbgtkaction.c +68 -68
- data/ext/gtk2/rbgtkactiongroup.c +317 -195
- data/ext/gtk2/rbgtkadjustment.c +33 -46
- data/ext/gtk2/rbgtkalignment.c +36 -24
- data/ext/gtk2/rbgtkallocation.c +53 -42
- data/ext/gtk2/rbgtkarrow.c +34 -22
- data/ext/gtk2/rbgtkaspectframe.c +32 -20
- data/ext/gtk2/rbgtkassistant.c +81 -61
- data/ext/gtk2/rbgtkbbox.c +32 -20
- data/ext/gtk2/rbgtkbin.c +28 -16
- data/ext/gtk2/rbgtkbindingset.c +42 -35
- data/ext/gtk2/rbgtkborder.c +34 -23
- data/ext/gtk2/rbgtkbox.c +40 -29
- data/ext/gtk2/rbgtkbuildable.c +57 -45
- data/ext/gtk2/rbgtkbuilder.c +53 -38
- data/ext/gtk2/rbgtkbutton.c +41 -55
- data/ext/gtk2/rbgtkcalendar.c +51 -40
- data/ext/gtk2/rbgtkcelleditable.c +28 -17
- data/ext/gtk2/rbgtkcelllayout.c +41 -30
- data/ext/gtk2/rbgtkcellrenderer.c +43 -32
- data/ext/gtk2/rbgtkcellrendereraccel.c +26 -18
- data/ext/gtk2/rbgtkcellrenderercombo.c +25 -17
- data/ext/gtk2/rbgtkcellrendererpixbuf.c +24 -17
- data/ext/gtk2/rbgtkcellrendererprogress.c +25 -17
- data/ext/gtk2/rbgtkcellrendererspin.c +24 -16
- data/ext/gtk2/rbgtkcellrendererspinner.c +23 -11
- data/ext/gtk2/rbgtkcellrenderertext.c +28 -21
- data/ext/gtk2/rbgtkcellrenderertoggle.c +24 -16
- data/ext/gtk2/rbgtkcellview.c +34 -33
- data/ext/gtk2/rbgtkcheckbutton.c +28 -16
- data/ext/gtk2/rbgtkcheckmenuitem.c +31 -19
- data/ext/gtk2/rbgtkclipboard.c +123 -77
- data/ext/gtk2/rbgtkcolorbutton.c +26 -31
- data/ext/gtk2/rbgtkcolorsel.c +109 -55
- data/ext/gtk2/rbgtkcolorselectiondialog.c +28 -19
- data/ext/gtk2/rbgtkcombo.c +43 -32
- data/ext/gtk2/rbgtkcombobox.c +44 -83
- data/ext/gtk2/rbgtkcomboboxentry.c +26 -21
- data/ext/gtk2/rbgtkconst.c +23 -13
- data/ext/gtk2/rbgtkcontainer.c +153 -100
- data/ext/gtk2/rbgtkconversions.h +19 -6
- data/ext/gtk2/rbgtkcurve.c +46 -36
- data/ext/gtk2/rbgtkdialog.c +104 -70
- data/ext/gtk2/rbgtkdrag.c +173 -121
- data/ext/gtk2/rbgtkdrawingarea.c +28 -16
- data/ext/gtk2/rbgtkeditable.c +63 -51
- data/ext/gtk2/rbgtkentry.c +48 -85
- data/ext/gtk2/rbgtkentrycompletion.c +42 -55
- data/ext/gtk2/rbgtkeventbox.c +28 -16
- data/ext/gtk2/rbgtkexpander.c +26 -35
- data/ext/gtk2/rbgtkfilechooser.c +87 -143
- data/ext/gtk2/rbgtkfilechooserbutton.c +26 -32
- data/ext/gtk2/rbgtkfilechooserdialog.c +25 -15
- data/ext/gtk2/rbgtkfilechooserwidget.c +26 -15
- data/ext/gtk2/rbgtkfilefilter.c +45 -35
- data/ext/gtk2/rbgtkfilesel.c +54 -43
- data/ext/gtk2/rbgtkfilesystemerror.c +51 -0
- data/ext/gtk2/rbgtkfixed.c +36 -25
- data/ext/gtk2/rbgtkfontbutton.c +26 -37
- data/ext/gtk2/rbgtkfontselection.c +27 -15
- data/ext/gtk2/rbgtkfontselectiondialog.c +43 -32
- data/ext/gtk2/rbgtkframe.c +39 -28
- data/ext/gtk2/rbgtkgamma.c +32 -20
- data/ext/gtk2/rbgtkhandlebox.c +31 -19
- data/ext/gtk2/rbgtkhbbox.c +28 -16
- data/ext/gtk2/rbgtkhbox.c +29 -17
- data/ext/gtk2/rbgtkhpaned.c +28 -16
- data/ext/gtk2/rbgtkhruler.c +28 -16
- data/ext/gtk2/rbgtkhscale.c +28 -16
- data/ext/gtk2/rbgtkhscrollbar.c +28 -16
- data/ext/gtk2/rbgtkhseparator.c +28 -16
- data/ext/gtk2/rbgtkiconfactory.c +35 -23
- data/ext/gtk2/rbgtkiconinfo.c +42 -30
- data/ext/gtk2/rbgtkiconset.c +31 -19
- data/ext/gtk2/rbgtkiconsize.c +38 -25
- data/ext/gtk2/rbgtkiconsource.c +62 -50
- data/ext/gtk2/rbgtkicontheme.c +95 -95
- data/ext/gtk2/rbgtkiconview.c +87 -121
- data/ext/gtk2/rbgtkimage.c +31 -40
- data/ext/gtk2/rbgtkimagemenuitem.c +26 -14
- data/ext/gtk2/rbgtkimcontext.c +46 -34
- data/ext/gtk2/rbgtkimcontextsimple.c +47 -24
- data/ext/gtk2/rbgtkimmulticontext.c +26 -14
- data/ext/gtk2/rbgtkinputdialog.c +28 -16
- data/ext/gtk2/rbgtkinvisible.c +24 -18
- data/ext/gtk2/rbgtkitem.c +32 -20
- data/ext/gtk2/rbgtkitemfactory.c +65 -57
- data/ext/gtk2/rbgtklabel.c +46 -57
- data/ext/gtk2/rbgtklayout.c +40 -29
- data/ext/gtk2/rbgtklinkbutton.c +26 -15
- data/ext/gtk2/rbgtkliststore.c +145 -102
- data/ext/gtk2/rbgtkmacros.h +19 -6
- data/ext/gtk2/rbgtkmenu.c +47 -59
- data/ext/gtk2/rbgtkmenubar.c +30 -30
- data/ext/gtk2/rbgtkmenuitem.c +34 -41
- data/ext/gtk2/rbgtkmenushell.c +43 -42
- data/ext/gtk2/rbgtkmenutoolbutton.c +27 -16
- data/ext/gtk2/rbgtkmessagedialog.c +31 -25
- data/ext/gtk2/rbgtkmisc.c +33 -22
- data/ext/gtk2/rbgtknotebook.c +98 -134
- data/ext/gtk2/rbgtkobject.c +46 -81
- data/ext/gtk2/rbgtkoptionmenu.c +35 -23
- data/ext/gtk2/rbgtkpagesetup.c +64 -54
- data/ext/gtk2/rbgtkpagesetupunixdialog.c +34 -27
- data/ext/gtk2/rbgtkpaned.c +46 -36
- data/ext/gtk2/rbgtkpapersize.c +60 -54
- data/ext/gtk2/rbgtkplug.c +32 -20
- data/ext/gtk2/rbgtkprintcontext.c +43 -35
- data/ext/gtk2/rbgtkprinter.c +36 -37
- data/ext/gtk2/rbgtkprintjob.c +36 -37
- data/ext/gtk2/rbgtkprintoperation.c +44 -33
- data/ext/gtk2/rbgtkprintoperationpreview.c +30 -18
- data/ext/gtk2/rbgtkprintsettings.c +248 -192
- data/ext/gtk2/rbgtkprintunixdialog.c +33 -45
- data/ext/gtk2/rbgtkprogress.c +23 -13
- data/ext/gtk2/rbgtkprogressbar.c +47 -46
- data/ext/gtk2/rbgtkradioaction.c +84 -39
- data/ext/gtk2/rbgtkradiobutton.c +33 -21
- data/ext/gtk2/rbgtkradiomenuitem.c +86 -45
- data/ext/gtk2/rbgtkradiotoolbutton.c +99 -53
- data/ext/gtk2/rbgtkrange.c +36 -56
- data/ext/gtk2/rbgtkrc.c +61 -49
- data/ext/gtk2/rbgtkrcstyle.c +59 -48
- data/ext/gtk2/rbgtkrecentaction.c +28 -16
- data/ext/gtk2/rbgtkrecentchooser.c +58 -92
- data/ext/gtk2/rbgtkrecentchooserdialog.c +29 -18
- data/ext/gtk2/rbgtkrecentchoosermenu.c +25 -21
- data/ext/gtk2/rbgtkrecentchooserwidget.c +24 -13
- data/ext/gtk2/rbgtkrecentdata.c +47 -36
- data/ext/gtk2/rbgtkrecentfilter.c +55 -46
- data/ext/gtk2/rbgtkrecentfilterinfo.c +51 -40
- data/ext/gtk2/rbgtkrecentinfo.c +66 -56
- data/ext/gtk2/rbgtkrecentmanager.c +47 -43
- data/ext/gtk2/rbgtkruler.c +35 -30
- data/ext/gtk2/rbgtkscale.c +29 -18
- data/ext/gtk2/rbgtkscalebutton.c +27 -27
- data/ext/gtk2/rbgtkscrollbar.c +23 -13
- data/ext/gtk2/rbgtkscrolledwindow.c +44 -60
- data/ext/gtk2/rbgtkselection.c +87 -67
- data/ext/gtk2/rbgtkselectiondata.c +74 -65
- data/ext/gtk2/rbgtkseparator.c +23 -13
- data/ext/gtk2/rbgtkseparatormenuitem.c +25 -13
- data/ext/gtk2/rbgtkseparatortoolitem.c +26 -21
- data/ext/gtk2/rbgtksettings.c +123 -103
- data/ext/gtk2/rbgtksizegroup.c +33 -30
- data/ext/gtk2/rbgtksocket.c +32 -20
- data/ext/gtk2/rbgtkspinbutton.c +48 -38
- data/ext/gtk2/rbgtkspinner.c +27 -14
- data/ext/gtk2/rbgtkstatusbar.c +36 -31
- data/ext/gtk2/rbgtkstatusicon.c +31 -44
- data/ext/gtk2/rbgtkstock.c +137 -125
- data/ext/gtk2/rbgtkstyle.c +177 -161
- data/ext/gtk2/rbgtktable.c +58 -47
- data/ext/gtk2/rbgtktargetlist.c +56 -36
- data/ext/gtk2/rbgtktearoffmenuitem.c +28 -16
- data/ext/gtk2/rbgtktextappearance.c +44 -34
- data/ext/gtk2/rbgtktextattributes.c +54 -42
- data/ext/gtk2/rbgtktextbuffer.c +188 -191
- data/ext/gtk2/rbgtktextchild.c +29 -18
- data/ext/gtk2/rbgtktextiter.c +153 -145
- data/ext/gtk2/rbgtktextmark.c +33 -30
- data/ext/gtk2/rbgtktexttag.c +34 -22
- data/ext/gtk2/rbgtktexttagtable.c +36 -25
- data/ext/gtk2/rbgtktextview.c +85 -73
- data/ext/gtk2/rbgtktoggleaction.c +27 -22
- data/ext/gtk2/rbgtktogglebutton.c +37 -26
- data/ext/gtk2/rbgtktoggletoolbutton.c +26 -20
- data/ext/gtk2/rbgtktoolbar.c +66 -69
- data/ext/gtk2/rbgtktoolbutton.c +27 -40
- data/ext/gtk2/rbgtktoolitem.c +60 -62
- data/ext/gtk2/rbgtktooltip.c +36 -25
- data/ext/gtk2/rbgtktooltips.c +42 -34
- data/ext/gtk2/rbgtktreedragdest.c +20 -11
- data/ext/gtk2/rbgtktreedragsource.c +20 -11
- data/ext/gtk2/rbgtktreeiter.c +58 -47
- data/ext/gtk2/rbgtktreemodel.c +83 -65
- data/ext/gtk2/rbgtktreemodelfilter.c +47 -35
- data/ext/gtk2/rbgtktreemodelsort.c +38 -27
- data/ext/gtk2/rbgtktreepath.c +55 -44
- data/ext/gtk2/rbgtktreerowreference.c +60 -42
- data/ext/gtk2/rbgtktreeselection.c +61 -52
- data/ext/gtk2/rbgtktreesortable.c +52 -42
- data/ext/gtk2/rbgtktreestore.c +88 -67
- data/ext/gtk2/rbgtktreeview.c +157 -185
- data/ext/gtk2/rbgtktreeviewcolumn.c +57 -62
- data/ext/gtk2/rbgtkuimanager.c +61 -61
- data/ext/gtk2/rbgtkvbbox.c +28 -16
- data/ext/gtk2/rbgtkvbox.c +29 -17
- data/ext/gtk2/rbgtkviewport.c +28 -16
- data/ext/gtk2/rbgtkvolumebutton.c +28 -16
- data/ext/gtk2/rbgtkvpaned.c +28 -16
- data/ext/gtk2/rbgtkvruler.c +28 -16
- data/ext/gtk2/rbgtkvscale.c +28 -16
- data/ext/gtk2/rbgtkvscrollbar.c +28 -16
- data/ext/gtk2/rbgtkvseparator.c +28 -16
- data/ext/gtk2/rbgtkwidget.c +284 -296
- data/ext/gtk2/rbgtkwindow.c +156 -214
- data/ext/gtk2/rbgtkwindowgroup.c +35 -24
- data/sample/testgtk/labels.rb +1 -0
- data/sample/testgtk/testgtk.rb +2 -0
- metadata +16 -17
- data/ChangeLog +0 -6902
- data/ext/gtk2/rbgtkmain.c +0 -493
@@ -1,16 +1,28 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
5
|
+
* Copyright (C) 2002,2003 OGASAWARA, Takeshi
|
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
|
+
*/
|
3
22
|
|
4
|
-
rbgtktextattributes.c -
|
5
|
-
|
6
|
-
$Author: ggc $
|
7
|
-
$Date: 2007/07/13 16:07:32 $
|
8
|
-
|
9
|
-
Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
10
|
-
Copyright (C) 2002,2003 OGASAWARA, Takeshi
|
11
|
-
************************************************/
|
12
23
|
#include "global.h"
|
13
24
|
|
25
|
+
#define RG_TARGET_NAMESPACE cTextAttributes
|
14
26
|
#define _SELF(s) ((GtkTextAttributes*)RVAL2BOXED(s, GTK_TYPE_TEXT_ATTRIBUTES))
|
15
27
|
|
16
28
|
/***********************************************/
|
@@ -139,7 +151,7 @@ ATTR_BOOL(realized);
|
|
139
151
|
/***********************************************/
|
140
152
|
|
141
153
|
static VALUE
|
142
|
-
|
154
|
+
rg_initialize(VALUE self)
|
143
155
|
{
|
144
156
|
GtkTextAttributes *attr;
|
145
157
|
|
@@ -149,43 +161,43 @@ txt_attr_initialize(VALUE self)
|
|
149
161
|
}
|
150
162
|
|
151
163
|
static VALUE
|
152
|
-
|
164
|
+
rg_copy_values(VALUE self, VALUE dest)
|
153
165
|
{
|
154
166
|
gtk_text_attributes_copy_values(_SELF(self), _SELF(dest));
|
155
167
|
return self;
|
156
168
|
}
|
157
169
|
|
158
170
|
void
|
159
|
-
|
171
|
+
Init_gtk_text_attributes(VALUE mGtk)
|
160
172
|
{
|
161
|
-
VALUE
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
DEFINE_ACCESSOR(
|
167
|
-
DEFINE_ACCESSOR(
|
168
|
-
DEFINE_ACCESSOR(
|
169
|
-
DEFINE_ACCESSOR(
|
170
|
-
DEFINE_ACCESSOR(
|
171
|
-
DEFINE_ACCESSOR(
|
172
|
-
DEFINE_ACCESSOR(
|
173
|
-
DEFINE_ACCESSOR(
|
174
|
-
DEFINE_ACCESSOR(
|
175
|
-
DEFINE_ACCESSOR(
|
176
|
-
DEFINE_ACCESSOR(
|
177
|
-
DEFINE_ACCESSOR(
|
178
|
-
DEFINE_ACCESSOR(
|
179
|
-
DEFINE_ACCESSOR(
|
180
|
-
|
181
|
-
rb_define_method(
|
182
|
-
rb_define_method(
|
183
|
-
rb_define_method(
|
184
|
-
rb_define_method(
|
185
|
-
rb_define_method(
|
186
|
-
rb_define_method(
|
187
|
-
rb_define_method(
|
188
|
-
rb_define_method(
|
189
|
-
|
190
|
-
G_DEF_SETTERS(
|
173
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_ATTRIBUTES, "TextAttributes", mGtk);
|
174
|
+
|
175
|
+
RG_DEF_METHOD(initialize, 0);
|
176
|
+
RG_DEF_METHOD(copy_values, 1);
|
177
|
+
|
178
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, boxed, appearance);
|
179
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, enums, justification);
|
180
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, enums, direction);
|
181
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, boxed, font);
|
182
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, double, font_scale);
|
183
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, left_margin);
|
184
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, indent);
|
185
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, right_margin);
|
186
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, pixels_above_lines);
|
187
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, pixels_below_lines);
|
188
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, int, pixels_inside_wrap);
|
189
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, boxed, tabs);
|
190
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, enums, wrap_mode);
|
191
|
+
DEFINE_ACCESSOR(RG_TARGET_NAMESPACE, boxed, language);
|
192
|
+
|
193
|
+
rb_define_method(RG_TARGET_NAMESPACE, "invisible?", txt_attr_bool_invisible, 0);
|
194
|
+
rb_define_method(RG_TARGET_NAMESPACE, "set_invisible", txt_attr_bool_set_invisible, 1);
|
195
|
+
rb_define_method(RG_TARGET_NAMESPACE, "bg_full_height?", txt_attr_bool_bg_full_height, 0);
|
196
|
+
rb_define_method(RG_TARGET_NAMESPACE, "set_bg_full_height", txt_attr_bool_set_bg_full_height, 1);
|
197
|
+
rb_define_method(RG_TARGET_NAMESPACE, "editable?", txt_attr_bool_editable, 0);
|
198
|
+
rb_define_method(RG_TARGET_NAMESPACE, "set_editable", txt_attr_bool_set_editable, 1);
|
199
|
+
rb_define_method(RG_TARGET_NAMESPACE, "realized?", txt_attr_bool_realized, 0);
|
200
|
+
rb_define_method(RG_TARGET_NAMESPACE, "set_realized", txt_attr_bool_set_realized, 1);
|
201
|
+
|
202
|
+
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
191
203
|
}
|
data/ext/gtk2/rbgtktextbuffer.c
CHANGED
@@ -1,17 +1,28 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2002-2005 Ruby-GNOME2 Project Team
|
5
|
+
* Copyright (C) 2002,2003 Masahiro Sakai
|
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
|
+
*/
|
12
22
|
|
13
23
|
#include "global.h"
|
14
24
|
|
25
|
+
#define RG_TARGET_NAMESPACE cTextBuffer
|
15
26
|
#define _SELF(s) (GTK_TEXT_BUFFER(RVAL2GOBJ(s)))
|
16
27
|
#define RVAL2ITR(i) (GtkTextIter*)RVAL2BOXED(i, GTK_TYPE_TEXT_ITER)
|
17
28
|
#define ITR2RVAL(i) (BOXED2RVAL(i, GTK_TYPE_TEXT_ITER))
|
@@ -24,7 +35,7 @@
|
|
24
35
|
static ID id_tagtable;
|
25
36
|
|
26
37
|
static VALUE
|
27
|
-
|
38
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
28
39
|
{
|
29
40
|
VALUE table;
|
30
41
|
rb_scan_args(argc, argv, "01", &table);
|
@@ -38,21 +49,17 @@ txt_initialize(int argc, VALUE *argv, VALUE self)
|
|
38
49
|
}
|
39
50
|
|
40
51
|
static VALUE
|
41
|
-
|
52
|
+
rg_line_count(VALUE self)
|
42
53
|
{
|
43
54
|
return INT2NUM(gtk_text_buffer_get_line_count(_SELF(self)));
|
44
55
|
}
|
45
56
|
|
46
57
|
static VALUE
|
47
|
-
|
58
|
+
rg_char_count(VALUE self)
|
48
59
|
{
|
49
60
|
return INT2NUM(gtk_text_buffer_get_char_count(_SELF(self)));
|
50
61
|
}
|
51
62
|
|
52
|
-
/* Defined as Properties:
|
53
|
-
GtkTextTagTable * gtk_text_buffer_get_tag_table (GtkTextBuffer *buffer);
|
54
|
-
*/
|
55
|
-
|
56
63
|
static VALUE
|
57
64
|
txt_set_text(VALUE self, VALUE text)
|
58
65
|
{
|
@@ -63,7 +70,7 @@ txt_set_text(VALUE self, VALUE text)
|
|
63
70
|
|
64
71
|
#if GTK_CHECK_VERSION(2,6,0)
|
65
72
|
static VALUE
|
66
|
-
|
73
|
+
rg_backspace(VALUE self, VALUE iter, VALUE interactive, VALUE default_editable)
|
67
74
|
{
|
68
75
|
return CBOOL2RVAL(gtk_text_buffer_backspace(_SELF(self), RVAL2ITR(iter),
|
69
76
|
RVAL2CBOOL(interactive),
|
@@ -72,7 +79,7 @@ txt_backspace(VALUE self, VALUE iter, VALUE interactive, VALUE default_editable)
|
|
72
79
|
#endif
|
73
80
|
|
74
81
|
static VALUE
|
75
|
-
|
82
|
+
rg_insert_at_cursor(VALUE self, VALUE text)
|
76
83
|
{
|
77
84
|
StringValue(text);
|
78
85
|
gtk_text_buffer_insert_at_cursor(_SELF(self), RSTRING_PTR(text), RSTRING_LEN(text));
|
@@ -80,7 +87,7 @@ txt_insert_at_cursor(VALUE self, VALUE text)
|
|
80
87
|
}
|
81
88
|
|
82
89
|
static VALUE
|
83
|
-
|
90
|
+
rg_insert_interactive(VALUE self, VALUE iter, VALUE text, VALUE editable)
|
84
91
|
{
|
85
92
|
StringValue(text);
|
86
93
|
|
@@ -92,7 +99,7 @@ txt_insert_interactive(VALUE self, VALUE iter, VALUE text, VALUE editable)
|
|
92
99
|
}
|
93
100
|
|
94
101
|
static VALUE
|
95
|
-
|
102
|
+
rg_insert_interactive_at_cursor(VALUE self, VALUE text, VALUE editable)
|
96
103
|
{
|
97
104
|
StringValue(text);
|
98
105
|
|
@@ -103,7 +110,7 @@ txt_insert_interactive_at_cursor(VALUE self, VALUE text, VALUE editable)
|
|
103
110
|
}
|
104
111
|
|
105
112
|
static VALUE
|
106
|
-
|
113
|
+
rg_insert_range(VALUE self, VALUE iter, VALUE start, VALUE end)
|
107
114
|
{
|
108
115
|
gtk_text_buffer_insert_range(_SELF(self), RVAL2ITR(iter),
|
109
116
|
RVAL2ITR(start), RVAL2ITR(end));
|
@@ -111,7 +118,7 @@ txt_insert_range(VALUE self, VALUE iter, VALUE start, VALUE end)
|
|
111
118
|
}
|
112
119
|
|
113
120
|
static VALUE
|
114
|
-
|
121
|
+
rg_insert_range_interactive(VALUE self, VALUE iter, VALUE start, VALUE end, VALUE editable)
|
115
122
|
{
|
116
123
|
return CBOOL2RVAL(gtk_text_buffer_insert_range_interactive(_SELF(self),
|
117
124
|
RVAL2ITR(iter),
|
@@ -121,7 +128,7 @@ txt_insert_range_interactive(VALUE self, VALUE iter, VALUE start, VALUE end, VAL
|
|
121
128
|
}
|
122
129
|
|
123
130
|
static VALUE
|
124
|
-
|
131
|
+
rg_delete(VALUE self, VALUE start, VALUE end)
|
125
132
|
{
|
126
133
|
gtk_text_buffer_delete(GTK_TEXT_BUFFER(RVAL2GOBJ(self)),
|
127
134
|
RVAL2ITR(start), RVAL2ITR(end));
|
@@ -129,7 +136,7 @@ txt_delete(VALUE self, VALUE start, VALUE end)
|
|
129
136
|
}
|
130
137
|
|
131
138
|
static VALUE
|
132
|
-
|
139
|
+
rg_delete_interactive(VALUE self, VALUE start, VALUE end, VALUE editable)
|
133
140
|
{
|
134
141
|
return CBOOL2RVAL(gtk_text_buffer_delete_interactive(_SELF(self),
|
135
142
|
RVAL2ITR(start),
|
@@ -138,7 +145,7 @@ txt_delete_interactive(VALUE self, VALUE start, VALUE end, VALUE editable)
|
|
138
145
|
}
|
139
146
|
|
140
147
|
static VALUE
|
141
|
-
|
148
|
+
rg_get_text(int argc, VALUE *argv, VALUE self)
|
142
149
|
{
|
143
150
|
VALUE start, end, include_hidden_chars;
|
144
151
|
GtkTextIter start_iter, end_iter;
|
@@ -166,11 +173,11 @@ txt_get_text(int argc, VALUE *argv, VALUE self)
|
|
166
173
|
static VALUE
|
167
174
|
txt_get_text_all(VALUE self)
|
168
175
|
{
|
169
|
-
return
|
176
|
+
return rg_get_text(0, NULL, self);
|
170
177
|
}
|
171
178
|
|
172
179
|
static VALUE
|
173
|
-
|
180
|
+
rg_get_slice(int argc, VALUE *argv, VALUE self)
|
174
181
|
{
|
175
182
|
VALUE start, end, include_hidden_chars;
|
176
183
|
GtkTextIter start_iter, end_iter;
|
@@ -196,13 +203,13 @@ txt_get_slice(int argc, VALUE *argv, VALUE self)
|
|
196
203
|
}
|
197
204
|
|
198
205
|
static VALUE
|
199
|
-
|
206
|
+
rg_slice(VALUE self)
|
200
207
|
{
|
201
|
-
return
|
208
|
+
return rg_get_slice(0, NULL, self);
|
202
209
|
}
|
203
210
|
|
204
211
|
static VALUE
|
205
|
-
|
212
|
+
rg_insert_pixbuf(VALUE self, VALUE iter, VALUE pixbuf)
|
206
213
|
{
|
207
214
|
G_CHILD_ADD(self, iter);
|
208
215
|
G_CHILD_ADD(iter, pixbuf);
|
@@ -215,7 +222,7 @@ txt_insert_pixbuf(VALUE self, VALUE iter, VALUE pixbuf)
|
|
215
222
|
}
|
216
223
|
|
217
224
|
static VALUE
|
218
|
-
|
225
|
+
rg_insert_child_anchor(VALUE self, VALUE iter, VALUE anchor)
|
219
226
|
{
|
220
227
|
G_CHILD_ADD(self, iter);
|
221
228
|
G_CHILD_ADD(iter, anchor);
|
@@ -227,7 +234,7 @@ txt_insert_child_anchor(VALUE self, VALUE iter, VALUE anchor)
|
|
227
234
|
}
|
228
235
|
|
229
236
|
static VALUE
|
230
|
-
|
237
|
+
rg_create_child_anchor(VALUE self, VALUE iter)
|
231
238
|
{
|
232
239
|
VALUE ret = GOBJ2RVAL(gtk_text_buffer_create_child_anchor(_SELF(self), RVAL2ITR(iter)));
|
233
240
|
G_CHILD_ADD(self, ret);
|
@@ -235,7 +242,7 @@ txt_create_child_anchor(VALUE self, VALUE iter)
|
|
235
242
|
}
|
236
243
|
|
237
244
|
static VALUE
|
238
|
-
|
245
|
+
rg_create_mark(VALUE self, VALUE name, VALUE where, VALUE left_gravity)
|
239
246
|
{
|
240
247
|
VALUE ret = GOBJ2RVAL(gtk_text_buffer_create_mark(_SELF(self),
|
241
248
|
NIL_P(name) ? NULL : RVAL2CSTR(name),
|
@@ -247,7 +254,7 @@ txt_create_mark(VALUE self, VALUE name, VALUE where, VALUE left_gravity)
|
|
247
254
|
|
248
255
|
#if GTK_CHECK_VERSION(2,12,0)
|
249
256
|
static VALUE
|
250
|
-
|
257
|
+
rg_add_mark(VALUE self, VALUE mark, VALUE where)
|
251
258
|
{
|
252
259
|
gtk_text_buffer_add_mark(_SELF(self), RVAL2MARK(mark), RVAL2ITR(where));
|
253
260
|
return self;
|
@@ -255,7 +262,7 @@ txt_add_mark(VALUE self, VALUE mark, VALUE where)
|
|
255
262
|
#endif
|
256
263
|
|
257
264
|
static VALUE
|
258
|
-
|
265
|
+
rg_delete_mark(VALUE self, VALUE mark)
|
259
266
|
{
|
260
267
|
if (rb_obj_is_kind_of(mark, GTYPE2CLASS(GTK_TYPE_TEXT_MARK))){
|
261
268
|
G_CHILD_REMOVE(self, mark);
|
@@ -268,27 +275,27 @@ txt_delete_mark(VALUE self, VALUE mark)
|
|
268
275
|
}
|
269
276
|
|
270
277
|
static VALUE
|
271
|
-
|
278
|
+
rg_get_mark(VALUE self, VALUE name)
|
272
279
|
{
|
273
280
|
return GOBJ2RVAL(gtk_text_buffer_get_mark(_SELF(self), RVAL2CSTR(name)));
|
274
281
|
}
|
275
282
|
|
276
283
|
/*
|
277
284
|
static VALUE
|
278
|
-
|
285
|
+
rg_get_insert(VALUE self)
|
279
286
|
{
|
280
287
|
return GOBJ2RVAL(gtk_text_buffer_get_insert(_SELF(self)));
|
281
288
|
}
|
282
289
|
*/
|
283
290
|
|
284
291
|
static VALUE
|
285
|
-
|
292
|
+
rg_selection_bound(VALUE self)
|
286
293
|
{
|
287
294
|
return GOBJ2RVAL(gtk_text_buffer_get_selection_bound(_SELF(self)));
|
288
295
|
}
|
289
296
|
|
290
297
|
static VALUE
|
291
|
-
|
298
|
+
rg_place_cursor(VALUE self, VALUE where)
|
292
299
|
{
|
293
300
|
gtk_text_buffer_place_cursor(_SELF(self), RVAL2ITR(where));
|
294
301
|
return self;
|
@@ -296,7 +303,7 @@ txt_place_cursor(VALUE self, VALUE where)
|
|
296
303
|
|
297
304
|
#if GTK_CHECK_VERSION(2,4,0)
|
298
305
|
static VALUE
|
299
|
-
|
306
|
+
rg_select_range(VALUE self, VALUE ins, VALUE bound)
|
300
307
|
{
|
301
308
|
gtk_text_buffer_select_range(_SELF(self), RVAL2ITR(ins), RVAL2ITR(bound));
|
302
309
|
return self;
|
@@ -304,7 +311,7 @@ txt_select_range(VALUE self, VALUE ins, VALUE bound)
|
|
304
311
|
#endif
|
305
312
|
|
306
313
|
static VALUE
|
307
|
-
|
314
|
+
rg_get_iter_at_child_anchor(VALUE self, VALUE anchor)
|
308
315
|
{
|
309
316
|
GtkTextIter iter;
|
310
317
|
gtk_text_buffer_get_iter_at_child_anchor(_SELF(self), &iter, RVAL2ANCHOR(anchor));
|
@@ -312,20 +319,20 @@ txt_get_iter_at_child_anchor(VALUE self, VALUE anchor)
|
|
312
319
|
}
|
313
320
|
|
314
321
|
static VALUE
|
315
|
-
|
322
|
+
rg_modified_p(VALUE self)
|
316
323
|
{
|
317
324
|
return CBOOL2RVAL(gtk_text_buffer_get_modified(_SELF(self)));
|
318
325
|
}
|
319
326
|
|
320
327
|
static VALUE
|
321
|
-
|
328
|
+
rg_set_modified(VALUE self, VALUE setting)
|
322
329
|
{
|
323
330
|
gtk_text_buffer_set_modified(_SELF(self), RVAL2CBOOL(setting));
|
324
331
|
return setting;
|
325
332
|
}
|
326
333
|
|
327
334
|
static VALUE
|
328
|
-
|
335
|
+
rg_add_selection_clipboard(VALUE self, VALUE clipboard)
|
329
336
|
{
|
330
337
|
G_CHILD_ADD(self, clipboard);
|
331
338
|
gtk_text_buffer_add_selection_clipboard(_SELF(self), RVAL2CLIPBOARD(clipboard));
|
@@ -333,7 +340,7 @@ txt_add_selection_clipboard(VALUE self, VALUE clipboard)
|
|
333
340
|
}
|
334
341
|
|
335
342
|
static VALUE
|
336
|
-
|
343
|
+
rg_remove_selection_clipboard(VALUE self, VALUE clipboard)
|
337
344
|
{
|
338
345
|
G_CHILD_REMOVE(self, clipboard);
|
339
346
|
gtk_text_buffer_remove_selection_clipboard(_SELF(self), RVAL2CLIPBOARD(clipboard));
|
@@ -342,13 +349,12 @@ txt_remove_selection_clipboard(VALUE self, VALUE clipboard)
|
|
342
349
|
|
343
350
|
#if GTK_CHECK_VERSION(2,10,0)
|
344
351
|
static VALUE
|
345
|
-
|
352
|
+
rg_deserialize(VALUE self, VALUE content_buffer, VALUE format, VALUE iter, VALUE data)
|
346
353
|
{
|
347
354
|
GError* error = NULL;
|
348
355
|
gboolean ret;
|
349
356
|
|
350
|
-
|
351
|
-
Check_Type(data, T_STRING);
|
357
|
+
StringValue(data);
|
352
358
|
ret = gtk_text_buffer_deserialize(_SELF(self), _SELF(content_buffer),
|
353
359
|
RVAL2ATOM(format),
|
354
360
|
RVAL2ITR(iter),
|
@@ -360,7 +366,7 @@ txt_deserialize(VALUE self, VALUE content_buffer, VALUE format, VALUE iter, VALU
|
|
360
366
|
}
|
361
367
|
|
362
368
|
static VALUE
|
363
|
-
|
369
|
+
rg_deserialize_can_create_tags_p(VALUE self, VALUE format)
|
364
370
|
{
|
365
371
|
return CBOOL2RVAL(gtk_text_buffer_deserialize_get_can_create_tags(_SELF(self),
|
366
372
|
RVAL2ATOM(format)));
|
@@ -368,7 +374,7 @@ txt_deserialize_get_can_create_tags(VALUE self, VALUE format)
|
|
368
374
|
}
|
369
375
|
|
370
376
|
static VALUE
|
371
|
-
|
377
|
+
rg_deserialize_set_can_create_tags(VALUE self, VALUE format, VALUE can_create_tags)
|
372
378
|
{
|
373
379
|
gtk_text_buffer_deserialize_set_can_create_tags(_SELF(self),
|
374
380
|
RVAL2ATOM(format),
|
@@ -376,13 +382,8 @@ txt_deserialize_set_can_create_tags(VALUE self, VALUE format, VALUE can_create_t
|
|
376
382
|
return self;
|
377
383
|
}
|
378
384
|
|
379
|
-
/* Defined as Properties
|
380
|
-
GtkTargetList* gtk_text_buffer_get_copy_target_list
|
381
|
-
(GtkTextBuffer *buffer);
|
382
|
-
*/
|
383
|
-
|
384
385
|
static VALUE
|
385
|
-
|
386
|
+
rg_deserialize_formats(VALUE self)
|
386
387
|
{
|
387
388
|
gint i;
|
388
389
|
gint n_formats;
|
@@ -395,13 +396,8 @@ txt_get_deserialize_formats(VALUE self)
|
|
395
396
|
return ary;
|
396
397
|
}
|
397
398
|
|
398
|
-
/* Defined as Properties
|
399
|
-
GtkTargetList* gtk_text_buffer_get_paste_target_list
|
400
|
-
(GtkTextBuffer *buffer);
|
401
|
-
*/
|
402
|
-
|
403
399
|
static VALUE
|
404
|
-
|
400
|
+
rg_serialize_formats(VALUE self)
|
405
401
|
{
|
406
402
|
gint i;
|
407
403
|
gint n_formats;
|
@@ -430,7 +426,14 @@ invoke_callback(VALUE data)
|
|
430
426
|
}
|
431
427
|
|
432
428
|
static gboolean
|
433
|
-
deserialize_func(GtkTextBuffer *register_buffer,
|
429
|
+
deserialize_func(GtkTextBuffer *register_buffer,
|
430
|
+
GtkTextBuffer *content_buffer,
|
431
|
+
GtkTextIter *iter,
|
432
|
+
const guint8 *data,
|
433
|
+
gsize length,
|
434
|
+
gboolean create_tags,
|
435
|
+
gpointer func,
|
436
|
+
G_GNUC_UNUSED GError **error)
|
434
437
|
{
|
435
438
|
VALUE result;
|
436
439
|
VALUE argv[5];
|
@@ -457,7 +460,7 @@ remove_callback_reference(gpointer callback)
|
|
457
460
|
}
|
458
461
|
|
459
462
|
static VALUE
|
460
|
-
|
463
|
+
rg_register_deserialize_format(VALUE self, VALUE mime_type)
|
461
464
|
{
|
462
465
|
VALUE block = rb_block_proc();
|
463
466
|
GdkAtom atom;
|
@@ -471,7 +474,7 @@ txt_register_deserialize_format(VALUE self, VALUE mime_type)
|
|
471
474
|
}
|
472
475
|
|
473
476
|
static VALUE
|
474
|
-
|
477
|
+
rg_register_deserialize_target(VALUE self, VALUE tagset_name)
|
475
478
|
{
|
476
479
|
return ATOM2RVAL(gtk_text_buffer_register_deserialize_tagset(_SELF(self),
|
477
480
|
(const gchar*)(NIL_P(tagset_name) ? NULL : RVAL2CSTR(tagset_name))));
|
@@ -495,14 +498,13 @@ serialize_func(GtkTextBuffer *register_buffer, GtkTextBuffer *content_buffer, Gt
|
|
495
498
|
|
496
499
|
/* This should return data as String */
|
497
500
|
result = G_PROTECT_CALLBACK(invoke_callback, &arg);
|
498
|
-
|
499
|
-
Check_Type(result, T_STRING);
|
501
|
+
StringValue(result);
|
500
502
|
*length = RSTRING_LEN(result);
|
501
503
|
return (guint8*)(NIL_P(rb_errinfo()) ? RSTRING_PTR(result) : NULL);
|
502
504
|
}
|
503
505
|
|
504
506
|
static VALUE
|
505
|
-
|
507
|
+
rg_register_serialize_format(VALUE self, VALUE mime_type)
|
506
508
|
{
|
507
509
|
VALUE block = rb_block_proc();
|
508
510
|
GdkAtom atom;
|
@@ -516,17 +518,17 @@ txt_register_serialize_format(VALUE self, VALUE mime_type)
|
|
516
518
|
}
|
517
519
|
|
518
520
|
static VALUE
|
519
|
-
|
521
|
+
rg_register_serialize_target(VALUE self, VALUE tagset_name)
|
520
522
|
{
|
521
523
|
return ATOM2RVAL(gtk_text_buffer_register_serialize_tagset(_SELF(self),
|
522
524
|
NIL_P(tagset_name) ? NULL : RVAL2CSTR(tagset_name)));
|
523
525
|
}
|
524
526
|
|
525
527
|
static VALUE
|
526
|
-
|
528
|
+
rg_serialize(VALUE self, VALUE content_buffer, VALUE format, VALUE start, VALUE end)
|
527
529
|
{
|
528
530
|
gsize length;
|
529
|
-
guint8* ret = gtk_text_buffer_serialize(_SELF(self), _SELF(
|
531
|
+
guint8* ret = gtk_text_buffer_serialize(_SELF(self), _SELF(content_buffer),
|
530
532
|
RVAL2ATOM(format),
|
531
533
|
RVAL2ITR(start), RVAL2ITR(end),
|
532
534
|
&length);
|
@@ -534,14 +536,14 @@ txt_serialize(VALUE self, VALUE content_buffer, VALUE format, VALUE start, VALUE
|
|
534
536
|
}
|
535
537
|
|
536
538
|
static VALUE
|
537
|
-
|
539
|
+
rg_unregister_deserialize_format(VALUE self, VALUE format)
|
538
540
|
{
|
539
541
|
gtk_text_buffer_unregister_deserialize_format(_SELF(self), RVAL2ATOM(format));
|
540
542
|
return self;
|
541
543
|
}
|
542
544
|
|
543
545
|
static VALUE
|
544
|
-
|
546
|
+
rg_unregister_serialize_format(VALUE self, VALUE format)
|
545
547
|
{
|
546
548
|
gtk_text_buffer_unregister_serialize_format(_SELF(self), RVAL2ATOM(format));
|
547
549
|
return self;
|
@@ -549,7 +551,7 @@ txt_unregister_serialize_format(VALUE self, VALUE format)
|
|
549
551
|
#endif
|
550
552
|
|
551
553
|
static VALUE
|
552
|
-
|
554
|
+
rg_cut_clipboard(VALUE self, VALUE clipboard, VALUE default_editable)
|
553
555
|
{
|
554
556
|
G_CHILD_ADD(self, clipboard);
|
555
557
|
gtk_text_buffer_cut_clipboard(_SELF(self), RVAL2CLIPBOARD(clipboard), RVAL2CBOOL(default_editable));
|
@@ -557,7 +559,7 @@ txt_cut_clipboard(VALUE self, VALUE clipboard, VALUE default_editable)
|
|
557
559
|
}
|
558
560
|
|
559
561
|
static VALUE
|
560
|
-
|
562
|
+
rg_copy_clipboard(VALUE self, VALUE clipboard)
|
561
563
|
{
|
562
564
|
G_CHILD_ADD(self, clipboard);
|
563
565
|
gtk_text_buffer_copy_clipboard(_SELF(self), RVAL2CLIPBOARD(clipboard));
|
@@ -565,7 +567,7 @@ txt_copy_clipboard(VALUE self, VALUE clipboard)
|
|
565
567
|
}
|
566
568
|
|
567
569
|
static VALUE
|
568
|
-
|
570
|
+
rg_paste_clipboard(VALUE self, VALUE clipboard, VALUE location, VALUE default_editable)
|
569
571
|
{
|
570
572
|
G_CHILD_ADD(self, clipboard);
|
571
573
|
gtk_text_buffer_paste_clipboard(_SELF(self), RVAL2CLIPBOARD(clipboard),
|
@@ -575,21 +577,16 @@ txt_paste_clipboard(VALUE self, VALUE clipboard, VALUE location, VALUE default_e
|
|
575
577
|
}
|
576
578
|
|
577
579
|
static VALUE
|
578
|
-
|
580
|
+
rg_selection_bounds(VALUE self)
|
579
581
|
{
|
580
582
|
GtkTextIter start, end;
|
581
|
-
|
583
|
+
|
582
584
|
gboolean ret = gtk_text_buffer_get_selection_bounds(_SELF(self), &start, &end);
|
583
585
|
return rb_ary_new3(3, ITR2RVAL(&start), ITR2RVAL(&end), CBOOL2RVAL(ret));
|
584
586
|
}
|
585
587
|
|
586
|
-
/* Defined as a proprety
|
587
|
-
gboolean gtk_text_buffer_get_has_selection
|
588
|
-
(GtkTextBuffer *buffer);
|
589
|
-
*/
|
590
|
-
|
591
588
|
static VALUE
|
592
|
-
|
589
|
+
rg_delete_selection(int argc, VALUE *argv, VALUE self)
|
593
590
|
{
|
594
591
|
VALUE interactive, default_editable;
|
595
592
|
rb_scan_args(argc, argv, "20", &interactive, &default_editable);
|
@@ -598,23 +595,23 @@ txt_delete_selection(int argc, VALUE *argv, VALUE self)
|
|
598
595
|
}
|
599
596
|
|
600
597
|
static VALUE
|
601
|
-
|
598
|
+
rg_end_user_action(VALUE self)
|
602
599
|
{
|
603
600
|
gtk_text_buffer_end_user_action(_SELF(self));
|
604
601
|
return self;
|
605
602
|
}
|
606
603
|
|
607
604
|
static VALUE
|
608
|
-
|
605
|
+
rg_begin_user_action(VALUE self)
|
609
606
|
{
|
610
607
|
gtk_text_buffer_begin_user_action(_SELF(self));
|
611
608
|
if (rb_block_given_p())
|
612
|
-
rb_ensure(rb_yield, self,
|
609
|
+
rb_ensure(rb_yield, self, rg_end_user_action, self);
|
613
610
|
return self;
|
614
611
|
}
|
615
612
|
|
616
613
|
static VALUE
|
617
|
-
|
614
|
+
rg_start_iter(VALUE self)
|
618
615
|
{
|
619
616
|
GtkTextIter iter;
|
620
617
|
gtk_text_buffer_get_start_iter(_SELF(self), &iter);
|
@@ -622,7 +619,7 @@ txt_get_start_iter(VALUE self)
|
|
622
619
|
}
|
623
620
|
|
624
621
|
static VALUE
|
625
|
-
|
622
|
+
rg_end_iter(VALUE self)
|
626
623
|
{
|
627
624
|
GtkTextIter iter;
|
628
625
|
gtk_text_buffer_get_end_iter(_SELF(self), &iter);
|
@@ -630,7 +627,7 @@ txt_get_end_iter(VALUE self)
|
|
630
627
|
}
|
631
628
|
|
632
629
|
static VALUE
|
633
|
-
|
630
|
+
rg_move_mark(VALUE self, VALUE mark, VALUE where)
|
634
631
|
{
|
635
632
|
if (rb_obj_is_kind_of(mark, GTYPE2CLASS(GTK_TYPE_TEXT_MARK)))
|
636
633
|
gtk_text_buffer_move_mark(_SELF(self), RVAL2MARK(mark), RVAL2ITR(where));
|
@@ -640,7 +637,7 @@ txt_move_mark(VALUE self, VALUE mark, VALUE where)
|
|
640
637
|
}
|
641
638
|
|
642
639
|
static VALUE
|
643
|
-
|
640
|
+
rg_create_tag(VALUE self, VALUE tag_name, VALUE properties)
|
644
641
|
{
|
645
642
|
GtkTextTag *tag;
|
646
643
|
VALUE ret;
|
@@ -649,7 +646,7 @@ txt_create_tag(VALUE self, VALUE tag_name, VALUE properties)
|
|
649
646
|
gtk_text_tag_table_add (gtk_text_buffer_get_tag_table(_SELF(self)), tag);
|
650
647
|
|
651
648
|
G_SET_PROPERTIES(GOBJ2RVAL(tag), properties);
|
652
|
-
|
649
|
+
|
653
650
|
ret = GOBJ2RVAL(tag);
|
654
651
|
|
655
652
|
G_CHILD_ADD(self, ret);
|
@@ -658,7 +655,7 @@ txt_create_tag(VALUE self, VALUE tag_name, VALUE properties)
|
|
658
655
|
}
|
659
656
|
|
660
657
|
static VALUE
|
661
|
-
|
658
|
+
rg_insert(int argc, VALUE *argv, VALUE self)
|
662
659
|
{
|
663
660
|
VALUE where, value, tags;
|
664
661
|
gint start_offset;
|
@@ -680,25 +677,27 @@ txt_insert(int argc, VALUE *argv, VALUE self)
|
|
680
677
|
StringValue(value);
|
681
678
|
gtk_text_buffer_insert(_SELF(self), RVAL2ITR(where),
|
682
679
|
RSTRING_PTR(value), RSTRING_LEN(value));
|
683
|
-
|
680
|
+
|
684
681
|
if (RARRAY_LEN(tags) == 0)
|
685
682
|
return self;
|
686
683
|
|
684
|
+
/* TODO: Do we really want to do this before we know that everything
|
685
|
+
* below passed without any errors? */
|
687
686
|
G_CHILD_ADD(self, tags);
|
688
|
-
|
687
|
+
|
689
688
|
gtk_text_buffer_get_iter_at_offset(_SELF(self), &start, start_offset);
|
690
|
-
|
689
|
+
|
691
690
|
for(i = 0; i < RARRAY_LEN(tags); i++) {
|
692
691
|
GtkTextTag *tag;
|
693
|
-
|
692
|
+
|
694
693
|
if (rb_obj_is_kind_of(RARRAY_PTR(tags)[i], GTYPE2CLASS(GTK_TYPE_TEXT_TAG))) {
|
695
694
|
tag = RVAL2GOBJ(RARRAY_PTR(tags)[i]);
|
696
695
|
} else {
|
697
696
|
tag = gtk_text_tag_table_lookup(_SELF(self)->tag_table,
|
698
|
-
|
697
|
+
RVAL2CSTR(RARRAY_PTR(tags)[i]));
|
699
698
|
if (tag == NULL) {
|
700
699
|
g_warning ("%s: no tag with name '%s'!",
|
701
|
-
|
700
|
+
G_STRLOC, RVAL2CSTR(RARRAY_PTR(tags)[i]));
|
702
701
|
return self;
|
703
702
|
}
|
704
703
|
}
|
@@ -709,16 +708,16 @@ txt_insert(int argc, VALUE *argv, VALUE self)
|
|
709
708
|
}
|
710
709
|
|
711
710
|
static VALUE
|
712
|
-
|
711
|
+
rg_insert_with_tags(int argc, VALUE *argv, VALUE self)
|
713
712
|
{
|
714
713
|
if (RVAL2CBOOL(ruby_debug))
|
715
714
|
rb_warning("Gtk::TextBuffer#insert_with_tags is deprecated. Use Gtk::TextBuffer#insert instead.");
|
716
|
-
|
715
|
+
rg_insert(argc, argv, self);
|
717
716
|
return self;
|
718
717
|
}
|
719
718
|
|
720
719
|
static VALUE
|
721
|
-
|
720
|
+
rg_apply_tag(VALUE self, VALUE tag, VALUE start, VALUE end)
|
722
721
|
{
|
723
722
|
if (rb_obj_is_kind_of(tag, GTYPE2CLASS(GTK_TYPE_TEXT_TAG)))
|
724
723
|
gtk_text_buffer_apply_tag(_SELF(self), RVAL2TAG(tag), RVAL2ITR(start), RVAL2ITR(end));
|
@@ -729,7 +728,7 @@ txt_apply_tag(VALUE self, VALUE tag, VALUE start, VALUE end)
|
|
729
728
|
}
|
730
729
|
|
731
730
|
static VALUE
|
732
|
-
|
731
|
+
rg_remove_tag(VALUE self, VALUE tag, VALUE start, VALUE end)
|
733
732
|
{
|
734
733
|
if (rb_obj_is_kind_of(tag, GTYPE2CLASS(GTK_TYPE_TEXT_TAG)))
|
735
734
|
gtk_text_buffer_remove_tag(_SELF(self), RVAL2TAG(tag), RVAL2ITR(start), RVAL2ITR(end));
|
@@ -740,14 +739,14 @@ txt_remove_tag(VALUE self, VALUE tag, VALUE start, VALUE end)
|
|
740
739
|
}
|
741
740
|
|
742
741
|
static VALUE
|
743
|
-
|
742
|
+
rg_remove_all_tags(VALUE self, VALUE start, VALUE end)
|
744
743
|
{
|
745
744
|
gtk_text_buffer_remove_all_tags(_SELF(self), RVAL2ITR(start), RVAL2ITR(end));
|
746
745
|
return self;
|
747
746
|
}
|
748
747
|
|
749
748
|
static VALUE
|
750
|
-
|
749
|
+
rg_get_iter_at_line_offset(VALUE self, VALUE line_number, VALUE char_offset)
|
751
750
|
{
|
752
751
|
GtkTextIter iter;
|
753
752
|
gtk_text_buffer_get_iter_at_line_offset(_SELF(self), &iter, NUM2INT(line_number), NUM2INT(char_offset));
|
@@ -755,7 +754,7 @@ txt_get_iter_at_line_offset(VALUE self, VALUE line_number, VALUE char_offset)
|
|
755
754
|
}
|
756
755
|
|
757
756
|
static VALUE
|
758
|
-
|
757
|
+
rg_get_iter_at_line_index(VALUE self, VALUE line_number, VALUE byte_index)
|
759
758
|
{
|
760
759
|
GtkTextIter iter;
|
761
760
|
gtk_text_buffer_get_iter_at_line_index(_SELF(self), &iter, NUM2INT(line_number), NUM2INT(byte_index));
|
@@ -763,7 +762,7 @@ txt_get_iter_at_line_index(VALUE self, VALUE line_number, VALUE byte_index)
|
|
763
762
|
}
|
764
763
|
|
765
764
|
static VALUE
|
766
|
-
|
765
|
+
rg_get_iter_at_offset(VALUE self, VALUE char_offset)
|
767
766
|
{
|
768
767
|
GtkTextIter iter;
|
769
768
|
gtk_text_buffer_get_iter_at_offset(_SELF(self), &iter, NUM2INT(char_offset));
|
@@ -771,7 +770,7 @@ txt_get_iter_at_offset(VALUE self, VALUE char_offset)
|
|
771
770
|
}
|
772
771
|
|
773
772
|
static VALUE
|
774
|
-
|
773
|
+
rg_get_iter_at_line(VALUE self, VALUE line_number)
|
775
774
|
{
|
776
775
|
GtkTextIter iter;
|
777
776
|
gtk_text_buffer_get_iter_at_line(_SELF(self), &iter, NUM2INT(line_number));
|
@@ -779,11 +778,11 @@ txt_get_iter_at_line(VALUE self, VALUE line_number)
|
|
779
778
|
}
|
780
779
|
|
781
780
|
static VALUE
|
782
|
-
|
781
|
+
rg_bounds(VALUE self)
|
783
782
|
{
|
784
783
|
GtkTextIter start, end;
|
785
784
|
VALUE result;
|
786
|
-
|
785
|
+
|
787
786
|
gtk_text_buffer_get_bounds(_SELF(self), &start, &end);
|
788
787
|
result = rb_ary_new();
|
789
788
|
rb_ary_push(result, ITR2RVAL(&start));
|
@@ -793,109 +792,107 @@ txt_get_bounds(VALUE self)
|
|
793
792
|
}
|
794
793
|
|
795
794
|
static VALUE
|
796
|
-
|
795
|
+
rg_get_iter_at_mark(VALUE self, VALUE mark)
|
797
796
|
{
|
798
797
|
GtkTextIter iter;
|
799
798
|
gtk_text_buffer_get_iter_at_mark(_SELF(self), &iter, RVAL2MARK(mark));
|
800
799
|
return ITR2RVAL(&iter);
|
801
800
|
}
|
802
801
|
|
803
|
-
|
804
802
|
void
|
805
|
-
Init_gtk_textbuffer()
|
803
|
+
Init_gtk_textbuffer(VALUE mGtk)
|
806
804
|
{
|
807
|
-
VALUE
|
805
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_TEXT_BUFFER, "TextBuffer", mGtk);
|
808
806
|
|
809
807
|
id_tagtable = rb_intern("tagtable");
|
810
808
|
|
811
|
-
|
812
|
-
|
813
|
-
|
809
|
+
RG_DEF_METHOD(initialize, -1);
|
810
|
+
RG_DEF_METHOD(line_count, 0);
|
811
|
+
RG_DEF_METHOD(char_count, 0);
|
814
812
|
|
815
|
-
G_REPLACE_SET_PROPERTY(
|
816
|
-
|
817
|
-
|
813
|
+
G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "text", txt_set_text, 1);
|
814
|
+
RG_DEF_METHOD(insert, -1);
|
815
|
+
RG_DEF_METHOD(insert_with_tags, -1);
|
818
816
|
#if GTK_CHECK_VERSION(2,6,0)
|
819
|
-
|
817
|
+
RG_DEF_METHOD(backspace, 3);
|
820
818
|
#endif
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
G_REPLACE_GET_PROPERTY(
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
819
|
+
RG_DEF_METHOD(insert_at_cursor, 1);
|
820
|
+
RG_DEF_METHOD(insert_interactive, 3);
|
821
|
+
RG_DEF_METHOD(insert_interactive_at_cursor, 2);
|
822
|
+
RG_DEF_METHOD(insert_range, 3);
|
823
|
+
RG_DEF_METHOD(insert_range_interactive, 4);
|
824
|
+
|
825
|
+
RG_DEF_METHOD(delete, 2);
|
826
|
+
RG_DEF_METHOD(delete_interactive, 3);
|
827
|
+
|
828
|
+
RG_DEF_METHOD(get_text, -1);
|
829
|
+
G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "text", txt_get_text_all, 0);
|
830
|
+
RG_DEF_METHOD(get_slice, -1);
|
831
|
+
RG_DEF_METHOD(slice, 0);
|
832
|
+
|
833
|
+
RG_DEF_METHOD(insert_pixbuf, 2);
|
834
|
+
RG_DEF_METHOD(insert_child_anchor, 2);
|
835
|
+
RG_DEF_METHOD(create_child_anchor, 1);
|
836
|
+
|
837
|
+
RG_DEF_METHOD(create_mark, 3);
|
840
838
|
#if GTK_CHECK_VERSION(2,12,0)
|
841
|
-
|
839
|
+
RG_DEF_METHOD(add_mark, 2);
|
842
840
|
#endif
|
843
|
-
|
841
|
+
RG_DEF_METHOD(delete_mark, 1);
|
844
842
|
|
845
|
-
|
843
|
+
RG_DEF_METHOD(get_mark, 1);
|
846
844
|
/* Comment out because this method's name is very bad.
|
847
845
|
Use Gtk::TextBuffer#get_mark("insert") instead.
|
848
|
-
|
846
|
+
RG_DEF_METHOD(get_insert, 0);
|
849
847
|
*/
|
850
|
-
|
851
|
-
|
848
|
+
RG_DEF_METHOD(selection_bound, 0);
|
849
|
+
RG_DEF_METHOD(place_cursor, 1);
|
852
850
|
#if GTK_CHECK_VERSION(2,4,0)
|
853
|
-
|
851
|
+
RG_DEF_METHOD(select_range, 2);
|
854
852
|
#endif
|
855
|
-
|
856
|
-
|
857
|
-
G_DEF_SETTER(
|
853
|
+
RG_DEF_METHOD_P(modified, 0);
|
854
|
+
RG_DEF_METHOD(set_modified, 1);
|
855
|
+
G_DEF_SETTER(RG_TARGET_NAMESPACE, "modified");
|
858
856
|
|
859
|
-
|
860
|
-
|
857
|
+
RG_DEF_METHOD(add_selection_clipboard, 1);
|
858
|
+
RG_DEF_METHOD(remove_selection_clipboard, 1);
|
861
859
|
#if GTK_CHECK_VERSION(2,10,0)
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
860
|
+
RG_DEF_METHOD(deserialize, 4);
|
861
|
+
RG_DEF_METHOD_P(deserialize_can_create_tags, 1);
|
862
|
+
RG_DEF_METHOD(deserialize_set_can_create_tags, 2);
|
863
|
+
RG_DEF_METHOD(deserialize_formats, 0);
|
864
|
+
RG_DEF_METHOD(serialize_formats, 0);
|
865
|
+
RG_DEF_METHOD(register_deserialize_format, 1);
|
866
|
+
RG_DEF_METHOD(register_deserialize_target, 1);
|
867
|
+
RG_DEF_METHOD(register_serialize_format, 1);
|
868
|
+
RG_DEF_METHOD(register_serialize_target, 1);
|
869
|
+
RG_DEF_METHOD(serialize, 4);
|
870
|
+
RG_DEF_METHOD(unregister_deserialize_format, 1);
|
871
|
+
RG_DEF_METHOD(unregister_serialize_format, 1);
|
874
872
|
#endif
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
873
|
+
RG_DEF_METHOD(cut_clipboard, 2);
|
874
|
+
RG_DEF_METHOD(copy_clipboard, 1);
|
875
|
+
RG_DEF_METHOD(paste_clipboard, 3);
|
876
|
+
|
877
|
+
RG_DEF_METHOD(selection_bounds, 0);
|
878
|
+
RG_DEF_METHOD(delete_selection, -1);
|
879
|
+
|
880
|
+
RG_DEF_METHOD(begin_user_action, 0);
|
881
|
+
RG_DEF_METHOD(end_user_action, 0);
|
882
|
+
|
883
|
+
RG_DEF_METHOD(start_iter, 0);
|
884
|
+
RG_DEF_METHOD(end_iter, 0);
|
885
|
+
RG_DEF_METHOD(get_iter_at_line_offset, 2);
|
886
|
+
RG_DEF_METHOD(get_iter_at_line_index, 2);
|
887
|
+
RG_DEF_METHOD(get_iter_at_offset, 1);
|
888
|
+
RG_DEF_METHOD(get_iter_at_line, 1);
|
889
|
+
RG_DEF_METHOD(bounds, 0);
|
890
|
+
RG_DEF_METHOD(get_iter_at_mark, 1);
|
891
|
+
RG_DEF_METHOD(move_mark, 2);
|
892
|
+
RG_DEF_METHOD(get_iter_at_child_anchor, 1);
|
893
|
+
|
894
|
+
RG_DEF_METHOD(create_tag, 2);
|
895
|
+
RG_DEF_METHOD(apply_tag, 3);
|
896
|
+
RG_DEF_METHOD(remove_tag, 3);
|
897
|
+
RG_DEF_METHOD(remove_all_tags, 2);
|
900
898
|
}
|
901
|
-
|