gtk3 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -185,8 +185,13 @@
185
185
  #define GTKBORDER2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_BORDER))
186
186
  #define RVAL2GTKCSSSECTION(o) ((GtkCssSection*)RVAL2BOXED(o, GTK_TYPE_CSS_SECTION))
187
187
  #define GTKCSSSECTION2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_CSS_SECTION))
188
- #define RVAL2GTKICONINFO(o) ((GtkIconInfo*)RVAL2BOXED(o, GTK_TYPE_ICON_INFO))
189
- #define GTKICONINFO2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_ICON_INFO))
188
+ #if GTK_CHECK_VERSION(3, 8, 0)
189
+ # define RVAL2GTKICONINFO(o) (GTK_ICON_INFO(RVAL2GOBJ(o)))
190
+ # define GTKICONINFO2RVAL(o) (GOBJ2RVAL(o))
191
+ #else
192
+ # define RVAL2GTKICONINFO(o) ((GtkIconInfo *)RVAL2BOXED(o, GTK_TYPE_ICON_INFO))
193
+ # define GTKICONINFO2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_ICON_INFO))
194
+ #endif
190
195
  #define RVAL2GTKICONSET(o) ((GtkIconSet*)RVAL2BOXED(o, GTK_TYPE_ICON_SET))
191
196
  #define GTKICONSET2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_ICON_SET))
192
197
  #define RVAL2GTKICONSOURCE(o) ((GtkIconSource*)RVAL2BOXED(o, GTK_TYPE_ICON_SOURCE))
@@ -199,6 +204,8 @@
199
204
  #define GTKRECENTFILTERINFO2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_RECENT_FILTER_INFO))
200
205
  #define RVAL2GTKRECENTINFO(o) ((GtkRecentInfo*)RVAL2BOXED(o, GTK_TYPE_RECENT_INFO))
201
206
  #define GTKRECENTINFO2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_RECENT_INFO))
207
+ #define RVAL2GTKREQUISITION(o) ((GtkRequisition *)RVAL2BOXED(o, GTK_TYPE_REQUISITION))
208
+ #define GTKREQUISITION2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_REQUISITION))
202
209
  #define RVAL2GTKSELECTIONDATA(o) ((GtkSelectionData*)RVAL2BOXED(o, GTK_TYPE_SELECTION_DATA))
203
210
  #define GTKSELECTIONDATA2RVAL(o) (BOXED2RVAL(o, GTK_TYPE_SELECTION_DATA))
204
211
  #define RVAL2GTKSYMBOLICCOLOR(o) ((GtkSymbolicColor*)RVAL2BOXED(o, GTK_TYPE_SYMBOLIC_COLOR))
@@ -48,12 +48,6 @@
48
48
  # define G_VALUE_INIT { 0, { { 0 } } }
49
49
  #endif
50
50
 
51
- #if defined(HAVE_RB_CAIRO_H)
52
- # define CAIRO_AVAILABLE 1
53
- #else
54
- # define CAIRO_AVAILABLE 0
55
- #endif
56
-
57
51
  extern ID id_relative_callbacks;
58
52
  extern ID id_call;
59
53
 
@@ -157,7 +151,7 @@ G_GNUC_INTERNAL void Init_gtk_grid(VALUE mGtk);
157
151
  G_GNUC_INTERNAL void Init_gtk_handle_box(VALUE mGtk);
158
152
  G_GNUC_INTERNAL void Init_gtk_hsv(VALUE mGtk);
159
153
  G_GNUC_INTERNAL void Init_gtk_icon_factory(VALUE mGtk);
160
- G_GNUC_INTERNAL void Init_gtk_iconinfo(VALUE mGtk);
154
+ G_GNUC_INTERNAL void Init_gtk_icon_info(VALUE mGtk);
161
155
  G_GNUC_INTERNAL void Init_gtk_icon_set(VALUE mGtk);
162
156
  G_GNUC_INTERNAL void Init_gtk_icon_size(VALUE mGtk);
163
157
  G_GNUC_INTERNAL void Init_gtk_icon_source(VALUE mGtk);
@@ -120,6 +120,7 @@ module Gtk
120
120
  class BindingSet
121
121
  extend GLib::Deprecatable
122
122
  define_deprecated_method :entry_clear, :entry_remove
123
+ define_deprecated_method :add_path, :raise => "Don't use this method."
123
124
  end
124
125
 
125
126
  class Box
@@ -194,6 +195,7 @@ module Gtk
194
195
  define_deprecated_method :editing_canceled, :warn => "Use '#{self}#stop_editing'." do |_self|
195
196
  _self.stop_editing(true)
196
197
  end
198
+ define_deprecated_method :get_size, :raise => "Use Gtk::Renderer#get_preferred_size."
197
199
  end
198
200
 
199
201
  class CellRendererAccel
@@ -206,6 +208,7 @@ module Gtk
206
208
  define_deprecated_method :cell_renderers, :warn => "Use 'Gtk::CellLayout#cells'." do |_self|
207
209
  _self.cells
208
210
  end
211
+ define_deprecated_method :get_size_of_row, :raise => "Use Gtk::Renderer#get_preferred_size."
209
212
  end
210
213
 
211
214
  class ColorSelectionDialog
@@ -970,6 +973,7 @@ module Gtk
970
973
  define_deprecated_method :requisition, :raise => "Don't use this method."
971
974
  define_deprecated_method :set_requisition, :warn => "Don't use this method."
972
975
  define_deprecated_method :saved_state, :raise => "Don't use this method."
976
+ define_deprecated_method :pointer, :raise => "Use 'Gdk::Window#get_device_position'."
973
977
 
974
978
  alias :__set_allocation__ :set_allocation
975
979
  private :__set_allocation__
@@ -998,4 +1002,3 @@ module Gtk
998
1002
  define_deprecated_method :active_default, :activate_default
999
1003
  end
1000
1004
  end
1001
-
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # $Id: colorsel.rb,v 1.4 2005/02/12 23:02:43 kzys Exp $
5
5
  =begin
6
- = Color Selector
6
+ = Color Selector
7
7
 
8
8
  Gtk::ColorSelection lets the user choose a color. Gtk::ColorSelectionDialog
9
9
  is a prebuilt dialog containing a Gtk::ColorSelection.
@@ -15,11 +15,11 @@ module Demo
15
15
  def initialize
16
16
  super('Color Selection')
17
17
 
18
- @color = Gdk::Color.new(0, 0, 65535)
18
+ @color = Gdk::RGBA.new(0, 0, 1, 1)
19
19
 
20
20
  set_border_width(8)
21
-
22
- vbox = Gtk::VBox.new(false, 0)
21
+
22
+ vbox = Gtk::Box.new(:vertical, 0)
23
23
  vbox.set_border_width(8)
24
24
  add(vbox)
25
25
 
@@ -29,53 +29,51 @@ module Demo
29
29
  vbox.pack_start(@frame, :expand => true, :fill => true, :padding => 0)
30
30
 
31
31
  @da = Gtk::DrawingArea.new
32
-
33
- @da.signal_connect('expose_event') do |widget, event|
34
- if widget.window
35
- style = widget.style
36
-
37
- widget.window.draw_rectangle(style.bg_gc(Gtk::STATE_NORMAL),
38
- true,
39
- event.area.x, event.area.y,
40
- event.area.width, event.area.height)
41
- end
32
+
33
+ @da.signal_connect('draw') do |widget, event|
34
+ if widget.window
35
+ context = widget.style_context
36
+ background_color = context.get_background_color(:normal)
37
+ event.set_source_rgba(background_color.to_a)
38
+ event.paint
39
+ end
42
40
  end
43
41
 
44
42
  # set a minimum size
45
43
  @da.set_size_request(200, 200)
46
44
  # set the color
47
- @da.modify_bg(Gtk::STATE_NORMAL, @color)
45
+ @da.override_background_color(:normal, @color)
48
46
 
49
47
  @frame.add(@da)
50
48
 
51
49
  alignment = Gtk::Alignment.new(1.0, 0.5, 0.0, 0.0)
52
50
 
53
- button = Gtk::Button.new('_Change the above color', true)
51
+ button = Gtk::Button.new(:mnemonic => '_Change the above color')
54
52
  alignment.add(button)
55
53
 
56
54
  vbox.pack_start(alignment, :expand => false, :fill => false, :padding => 0)
57
55
 
58
56
  button.signal_connect('clicked') do
59
- change_color_callback
57
+ change_color_callback
60
58
  end
61
59
  end
62
60
 
63
61
  def change_color_callback
64
- dialog = Gtk::ColorSelectionDialog.new('Changing color')
62
+ dialog = Gtk::ColorSelectionDialog.new(:title => 'Changing color')
65
63
 
66
64
  dialog.set_transient_for(self)
67
65
 
68
- colorsel = dialog.colorsel
66
+ colorsel = dialog.color_selection
69
67
 
70
- colorsel.set_previous_color(@color)
71
- colorsel.set_current_color(@color)
68
+ colorsel.set_previous_rgba(@color)
69
+ colorsel.set_current_rgba(@color)
72
70
  colorsel.set_has_palette(true)
73
71
 
74
72
  response = dialog.run
75
-
76
- if response == Gtk::Dialog::RESPONSE_OK
77
- @color = colorsel.current_color
78
- @da.modify_bg(Gtk::STATE_NORMAL, @color)
73
+
74
+ if response == Gtk::ResponseType::OK
75
+ @color = colorsel.current_rgba
76
+ @da.override_background_color(:normal, @color)
79
77
  end
80
78
 
81
79
  dialog.destroy
@@ -14,7 +14,7 @@ module Demo
14
14
  %w(. /usr/share/gtk-3.0/demo /usr/local/share/gtk-3.0/demo/).each do |dirname|
15
15
  path = File.join(dirname, basename)
16
16
  if File.exist?(path)
17
- return path
17
+ return path
18
18
  end
19
19
  end
20
20
 
@@ -25,7 +25,7 @@ module Demo
25
25
  def initialize(title = nil)
26
26
  super(:toplevel)
27
27
  if title
28
- set_title("#{title} in Ruby/GTK")
28
+ set_title("#{title} in Ruby/GTK")
29
29
  end
30
30
 
31
31
  signal_connect("key_press_event") do |widget, event|
@@ -38,7 +38,7 @@ module Demo
38
38
  end
39
39
 
40
40
  signal_connect("delete_event") do |widget, event|
41
- quit
41
+ quit
42
42
  end
43
43
  end
44
44
 
@@ -52,7 +52,7 @@ module Demo
52
52
 
53
53
  def initialize(title=nil)
54
54
  super
55
-
55
+
56
56
  unless Gdk.cairo_available?
57
57
  add_cairo_require_label
58
58
  return
@@ -61,9 +61,9 @@ module Demo
61
61
  drawing_area = Gtk::DrawingArea.new
62
62
  add(drawing_area)
63
63
 
64
- drawing_area.signal_connect("expose_event") do |widget, event|
64
+ drawing_area.signal_connect("draw") do |widget, event|
65
65
  cr = widget.window.create_cairo_context
66
- cr.scale(*widget.window.size)
66
+ cr.scale(widget.window.width, widget.window.height)
67
67
  cr.set_line_width(0.04)
68
68
 
69
69
  cr.save do
@@ -71,11 +71,11 @@ module Demo
71
71
  cr.gdk_rectangle(Gdk::Rectangle.new(0, 0, 1, 1))
72
72
  cr.fill
73
73
  end
74
-
74
+
75
75
  draw(cr)
76
76
  end
77
77
  end
78
-
78
+
79
79
  def add_cairo_require_label
80
80
  message = "This sample requires GTK+ 2.8.0 or later and cairo support"
81
81
  add(Gtk::Label.new(message))
@@ -0,0 +1,53 @@
1
+ @import url("reset.css");
2
+
3
+ * {
4
+ transition-property: color, background-color, border-color, background-image, padding, border-width;
5
+ transition-duration: 1s;
6
+
7
+ font: Cantarell 20px;
8
+ }
9
+
10
+ GtkWindow {
11
+ background: linear-gradient(153deg, #151515, #151515 5px, transparent 5px) 0 0,
12
+ linear-gradient(333deg, #151515, #151515 5px, transparent 5px) 10px 5px,
13
+ linear-gradient(153deg, #222, #222 5px, transparent 5px) 0 5px,
14
+ linear-gradient(333deg, #222, #222 5px, transparent 5px) 10px 10px,
15
+ linear-gradient(90deg, #1b1b1b, #1b1b1b 10px, transparent 10px),
16
+ linear-gradient(#1d1d1d, #1d1d1d 25%, #1a1a1a 25%, #1a1a1a 50%, transparent 50%, transparent 75%, #242424 75%, #242424);
17
+ background-color: #131313;
18
+ background-size: 20px 20px;
19
+ }
20
+
21
+ .button {
22
+ color: black;
23
+ background-color: #bbb;
24
+ border-style: solid;
25
+ border-width: 2px 0 2px 2px;
26
+ border-color: #333;
27
+
28
+ padding: 12px 4px;
29
+ }
30
+
31
+ .button:first-child {
32
+ border-radius: 5px 0 0 5px;
33
+ }
34
+
35
+ .button:last-child {
36
+ border-radius: 0 5px 5px 0;
37
+ border-width: 2px;
38
+ }
39
+
40
+ .button:hover {
41
+ padding: 12px 48px;
42
+ background-color: #4870bc;
43
+ }
44
+
45
+ .button *:hover {
46
+ color: white;
47
+ }
48
+
49
+ .button:hover:active,
50
+ .button:active {
51
+ background-color: #993401;
52
+ }
53
+
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This sample code is a port of gtk3/demos/gtk-demo/css_accordion.c. The
4
+ # CSS files used in this sample code are copied from gtk3/demos/gtk-demo.
5
+ # They are licensed under the terms of the GNU Lesser General Public
6
+ # License, version 2.1 or (at your option) later.
7
+ #
8
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
9
+ #
10
+ # This library is free software; you can redistribute it and/or
11
+ # modify it under the terms of the GNU Lesser General Public
12
+ # License as published by the Free Software Foundation; either
13
+ # version 2.1 of the License, or (at your option) any later version.
14
+ #
15
+ # This library is distributed in the hope that it will be useful,
16
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ # Lesser General Public License for more details.
19
+ #
20
+ # You should have received a copy of the GNU Lesser General Public
21
+ # License along with this library; if not, write to the Free Software
22
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
+ =begin
24
+ = CSS Theming/CSS Accordion
25
+
26
+ A simple accordion demo written using CSS transitions and multiple backgrounds
27
+ =end
28
+
29
+ require "common"
30
+
31
+ module Demo
32
+ class CssAccordion < BasicWindow
33
+ def initialize
34
+ super("CSS Accordion")
35
+ set_default_size(600, 300)
36
+
37
+ container = Gtk::Box.new(:horizontal, 0)
38
+ container.set_halign(:center)
39
+ container.set_valign(:center)
40
+ add(container)
41
+
42
+ child = Gtk::Button.new(:label => "This")
43
+ container.add(child)
44
+
45
+ child = Gtk::Button.new(:label => "Is")
46
+ container.add(child)
47
+
48
+ child = Gtk::Button.new(:label => "A")
49
+ container.add(child)
50
+
51
+ child = Gtk::Button.new(:label => "CSS")
52
+ container.add(child)
53
+
54
+ child = Gtk::Button.new(:label => "Accordion")
55
+ container.add(child)
56
+
57
+ child = Gtk::Button.new(:label => ":-)")
58
+ container.add(child)
59
+
60
+ provider = Gtk::CssProvider.new
61
+ provider.load(:data => File.read("css_accordion.css"))
62
+
63
+ apply_css(self, provider)
64
+ end
65
+
66
+ def apply_css(widget, provider)
67
+ widget.style_context.add_provider(provider, GLib::MAXUINT)
68
+ if widget.is_a?(Gtk::Container)
69
+ widget.each_forall do |child|
70
+ apply_css(child, provider)
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -2,7 +2,7 @@
2
2
  =begin
3
3
  main.rb - Main class of gtk-demo.
4
4
 
5
- Copyright (c) 2003-2006 Ruby-GNOME2 Project Team
5
+ Copyright (c) 2003-2013 Ruby-GNOME2 Project Team
6
6
  This program is licenced under the same licence as Ruby-GNOME2.
7
7
 
8
8
  $Id: main.rb,v 1.20 2007/07/09 13:21:54 ggc Exp $
@@ -27,7 +27,7 @@ module Demo
27
27
 
28
28
  set_title('Ruby/GTK+ Code Demos')
29
29
  signal_connect('destroy') do
30
- Gtk.main_quit
30
+ Gtk.main_quit
31
31
  end
32
32
 
33
33
  signal_connect("key_press_event") do |widget, event|
@@ -52,10 +52,10 @@ module Demo
52
52
  hbox.pack_start(notebook, :expand => true, :fill => true, :padding => 0)
53
53
 
54
54
  notebook.append_page(create_text(@info_buffer, false),
55
- Gtk::Label.new('_Info', true))
55
+ Gtk::Label.new('_Info', true))
56
56
 
57
57
  notebook.append_page(create_text(@source_buffer, true),
58
- Gtk::Label.new('_Source', true))
58
+ Gtk::Label.new('_Source', true))
59
59
 
60
60
  @info_buffer.create_tag('title',
61
61
  {'font' => 'Sans 18'})
@@ -66,9 +66,9 @@ module Demo
66
66
  {'foreground' => 'ForestGreen'})
67
67
  @source_buffer.create_tag('string',
68
68
  {
69
- 'foreground' => 'RosyBrown',
69
+ 'foreground' => 'RosyBrown',
70
70
  'weight' => Pango::FontDescription::WEIGHT_BOLD
71
- })
71
+ })
72
72
  @source_buffer.create_tag('reserved',
73
73
  {'foreground' => 'purple'})
74
74
  end
@@ -96,7 +96,7 @@ module Demo
96
96
  end
97
97
 
98
98
  if not klass
99
- raise "File not found: #{path}. This script should be run from its directory."
99
+ raise "File not found: #{path}."
100
100
  end
101
101
 
102
102
  return title, klass.intern, depend
@@ -179,8 +179,8 @@ module Demo
179
179
  tree_view.append_column(column)
180
180
 
181
181
  selection.signal_connect('changed') do |selection|
182
- iter = selection.selected
183
- load_file(iter.get_value(FILENAME_COLUMN)) if iter
182
+ iter = selection.selected
183
+ load_file(iter.get_value(FILENAME_COLUMN)) if iter
184
184
  end
185
185
  tree_view.signal_connect('row_activated') do |tree_view, path, column|
186
186
  row_activated_cb(tree_view.model, path)
@@ -192,13 +192,13 @@ module Demo
192
192
 
193
193
  def append_children(model, source, parent = nil)
194
194
  source.each do |title, filename, klass, children|
195
- iter = model.append(parent)
195
+ iter = model.append(parent)
196
196
 
197
- [title, filename, klass].each_with_index do |value, i|
198
- if value
199
- iter.set_value(i, value)
200
- end
201
- end
197
+ [title, filename, klass].each_with_index do |value, i|
198
+ if value
199
+ iter.set_value(i, value)
200
+ end
201
+ end
202
202
  iter.set_value(ITALIC_COLUMN, false)
203
203
 
204
204
  if children
@@ -214,21 +214,21 @@ module Demo
214
214
  lib = iter.get_value(FILENAME_COLUMN)
215
215
  if lib
216
216
  require(lib)
217
-
217
+
218
218
  klass = Demo.const_get(iter.get_value(CLASS_COLUMN))
219
219
  window = klass.new
220
220
  window.signal_connect('destroy') do
221
221
  iter.set_value(ITALIC_COLUMN, false)
222
222
  end
223
223
  window.show_all
224
- @window = window
224
+ @window = window
225
225
  end
226
226
  end
227
227
 
228
228
  def create_text(buffer, is_source)
229
229
  scrolled_window = Gtk::ScrolledWindow.new
230
230
  scrolled_window.set_policy(:automatic,
231
- :automatic)
231
+ :automatic)
232
232
  scrolled_window.set_shadow_type(:in)
233
233
 
234
234
  text_view = Gtk::TextView.new
@@ -240,35 +240,35 @@ module Demo
240
240
  scrolled_window.add(text_view)
241
241
 
242
242
  if is_source
243
- font_desc = Pango::FontDescription.new('Monospace 12')
244
- text_view.override_font(font_desc)
243
+ font_desc = Pango::FontDescription.new('Monospace 12')
244
+ text_view.override_font(font_desc)
245
245
 
246
- text_view.set_wrap_mode(:none)
246
+ text_view.set_wrap_mode(:none)
247
247
  else
248
- text_view.set_wrap_mode(:word)
249
- text_view.set_pixels_above_lines(2)
250
- text_view.set_pixels_below_lines(2)
248
+ text_view.set_wrap_mode(:word)
249
+ text_view.set_pixels_above_lines(2)
250
+ text_view.set_pixels_below_lines(2)
251
251
  end
252
252
 
253
253
  return scrolled_window
254
254
  end
255
255
 
256
256
  def fontify(start_iter = @source_buffer.start_iter,
257
- end_iter = @source_buffer.end_iter)
257
+ end_iter = @source_buffer.end_iter)
258
258
  str = @source_buffer.get_text(start_iter, end_iter, true)
259
259
 
260
260
  tokenizer = RubyTokonizer.new
261
261
  tokenizer.tokenize(str, start_iter.offset) do |tag, start, last|
262
- @source_buffer.apply_tag(tag.to_s,
263
- @source_buffer.get_iter_at(:offset => start),
264
- @source_buffer.get_iter_at(:offset => last))
262
+ @source_buffer.apply_tag(tag.to_s,
263
+ @source_buffer.get_iter_at(:offset => start),
264
+ @source_buffer.get_iter_at(:offset => last))
265
265
  end
266
266
  end
267
267
 
268
268
 
269
269
  def load_file(filename)
270
270
  if filename == @current_file
271
- return
271
+ return
272
272
  end
273
273
 
274
274
  @info_buffer.delete(*@info_buffer.bounds)
@@ -276,43 +276,43 @@ module Demo
276
276
  @source_buffer.delete(*@source_buffer.bounds)
277
277
 
278
278
  file = begin
279
- File.open(filename)
280
- rescue
281
- $stderr.puts "Cannot open: #{$!}" if $DEBUG
282
- return
283
- end
279
+ File.open(filename)
280
+ rescue
281
+ $stderr.puts "Cannot open: #{$!}" if $DEBUG
282
+ return
283
+ end
284
284
  start = @info_buffer.get_iter_at(:offset => 0)
285
285
  state = :before_header
286
286
 
287
287
  file.each do |line|
288
- case state
289
- when :before_header
290
- if line =~ /^=begin$/
291
- state = :in_header
292
- end
293
- when :in_header
294
- if line =~ /^=end$/
295
- state = :body
296
- start = @source_buffer.get_iter_at(:offset => 0)
297
- elsif line =~ /^=\s+(.*)$/
298
- title = $1
288
+ case state
289
+ when :before_header
290
+ if line =~ /^=begin$/
291
+ state = :in_header
292
+ end
293
+ when :in_header
294
+ if line =~ /^=end$/
295
+ state = :body
296
+ start = @source_buffer.get_iter_at(:offset => 0)
297
+ elsif line =~ /^=\s+(.*)$/
298
+ title = $1
299
299
  title.gsub!(/\s*\(.*\)$/, '') # Delete depend field
300
300
 
301
- last = start
301
+ last = start
302
302
 
303
- @info_buffer.insert(last, title)
304
- start = last.clone
303
+ @info_buffer.insert(last, title)
304
+ start = last.clone
305
305
 
306
- start.backward_chars(title.length)
307
- @info_buffer.apply_tag('title', start, last)
306
+ start.backward_chars(title.length)
307
+ @info_buffer.apply_tag('title', start, last)
308
308
 
309
- start = last
310
- else
311
- @info_buffer.insert(start, line)
312
- end
313
- when :body # Reading program body
314
- @source_buffer.insert(start, line)
315
- end
309
+ start = last
310
+ else
311
+ @info_buffer.insert(start, line)
312
+ end
313
+ when :body # Reading program body
314
+ @source_buffer.insert(start, line)
315
+ end
316
316
  end
317
317
 
318
318
  fontify
@@ -327,30 +327,30 @@ module Demo
327
327
 
328
328
  def tokenize(str, index = 0)
329
329
  until str.empty?
330
- tag = nil
331
-
332
- case str
333
- when /".+?"/, /'.+?'/
334
- tag = :string
335
- when /#.*$/
336
- tag = :comment
337
- when RESERVED_WORDS_PATTERN
338
- tag = :reserved
339
- when /[A-Z][A-Za-z0-9_]+/
340
- tag = :const
341
- end
342
-
343
- if tag
344
- tokenize($~.pre_match, index) do |*args|
330
+ tag = nil
331
+
332
+ case str
333
+ when /".+?"/, /'.+?'/
334
+ tag = :string
335
+ when /#.*$/
336
+ tag = :comment
337
+ when RESERVED_WORDS_PATTERN
338
+ tag = :reserved
339
+ when /[A-Z][A-Za-z0-9_]+/
340
+ tag = :const
341
+ end
342
+
343
+ if tag
344
+ tokenize($~.pre_match, index) do |*args|
345
345
  yield(*args)
346
- end
347
- yield(tag, index + $~.begin(0), index + $~.end(0))
348
- index += (str.length - $~.post_match.length)
349
- str = $~.post_match
350
- else
351
- index += str.length
352
- str = ''
353
- end
346
+ end
347
+ yield(tag, index + $~.begin(0), index + $~.end(0))
348
+ index += (str.length - $~.post_match.length)
349
+ str = $~.post_match
350
+ else
351
+ index += str.length
352
+ str = ''
353
+ end
354
354
  end
355
355
  end
356
356
  end
@@ -367,9 +367,9 @@ if target
367
367
  window.show_all
368
368
 
369
369
  class << window
370
- def quit
371
- Gtk.main_quit
372
- end
370
+ def quit
371
+ Gtk.main_quit
372
+ end
373
373
  end
374
374
 
375
375
  break