green_shoes 1.0.322 → 1.0.331

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.322
1
+ 1.0.331
data/lib/shoes/app.rb CHANGED
@@ -93,7 +93,7 @@ class Shoes
93
93
  layout.style = @canvas.style
94
94
 
95
95
  app.canvas = layout
96
- app.top_slot = slot.new app.slot_attributes(app: app, left: args[:left], top: args[:top], width: args[:width], height: args[:height])
96
+ app.top_slot = slot.new app.slot_attributes(app: app, left: args[:left], top: args[:top], width: args[:width], height: args[:height], swin: swin)
97
97
 
98
98
  app.instance_eval &blk
99
99
 
@@ -259,14 +259,16 @@ class Shoes
259
259
  end
260
260
  end
261
261
 
262
- def edit_line args={}
262
+ def edit_line *attrs
263
+ args = attrs.last.class == Hash ? attrs.pop : {}
264
+ txt = attrs.first unless attrs.empty?
263
265
  args = basic_attributes args
264
266
  args[:width] = 200 if args[:width].zero?
265
267
  args[:height] = 28 if args[:height].zero?
266
268
  (change_proc = args[:change]; args.delete :change) if args[:change]
267
269
  el = Gtk::Entry.new
268
270
  el.visibility = false if args[:secret]
269
- el.text = args[:text].to_s
271
+ el.text = txt || args[:text].to_s
270
272
  el.set_size_request args[:width], args[:height]
271
273
  @canvas.put el, args[:left], args[:top]
272
274
  el.show_now
@@ -279,14 +281,16 @@ class Shoes
279
281
  end
280
282
  end
281
283
 
282
- def edit_box args={}
284
+ def edit_box *attrs
285
+ args = attrs.last.class == Hash ? attrs.pop : {}
286
+ txt = attrs.first unless attrs.empty?
283
287
  args = basic_attributes args
284
288
  args[:width] = 200 if args[:width].zero?
285
289
  args[:height] = 108 if args[:height].zero?
286
290
  (change_proc = args[:change]; args.delete :change) if args[:change]
287
291
  tv = Gtk::TextView.new
288
292
  tv.wrap_mode = Gtk::TextTag::WRAP_WORD
289
- tv.buffer.text = args[:text].to_s
293
+ tv.buffer.text = txt || args[:text].to_s
290
294
  tv.modify_font(Pango::FontDescription.new(args[:font])) if args[:font]
291
295
  tv.accepts_tab = args[:accepts_tab]
292
296
  args.delete :accepts_tab
@@ -767,6 +771,10 @@ class Shoes
767
771
  @swin.vscrollbar.value = n
768
772
  end
769
773
 
774
+ def gutter
775
+ @swin.vscrollbar.size_request.first
776
+ end
777
+
770
778
  def clipboard
771
779
  Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD).wait_for_text
772
780
  end
data/lib/shoes/basic.rb CHANGED
@@ -31,12 +31,13 @@ class Shoes
31
31
  [:app, :real].each{|k| args.delete k}
32
32
  @args = args
33
33
  @hovered = false
34
+ @cleared = false
34
35
  @hidden ? (@hided, @shows = true, false) : (@hided, @shows = false, true)
35
36
  @app.fronts.push self if @front
36
37
  @app.backs.push self if @back
37
38
  end
38
39
 
39
- attr_reader :args, :shows, :initials
40
+ attr_reader :args, :shows, :initials, :cleared
40
41
  attr_accessor :parent, :hided
41
42
 
42
43
  def move x, y
@@ -85,14 +86,16 @@ class Shoes
85
86
  self
86
87
  end
87
88
 
88
- def clear
89
+ def clear flag = true
89
90
  @app.delete_mouse_events self
91
+ @cleared = true if flag
90
92
  case self
91
93
  when Button, EditLine, EditBox, ListBox
92
94
  @app.cslot.contents.delete self
95
+ @app.focusables.delete self
93
96
  remove
94
97
  @real = nil
95
- else
98
+ else
96
99
  @real.clear if @real
97
100
  end
98
101
  end
@@ -166,6 +166,7 @@ class Shoes
166
166
  slot_height = 0
167
167
 
168
168
  slot.contents.each do |ele|
169
+ next if ele.is_a?(Basic) && ele.cleared
169
170
  if ele.is_a? ShapeBase
170
171
  ele.hide if slot.masked
171
172
  next
@@ -178,7 +179,7 @@ class Shoes
178
179
  max, flag = ele.positioning x, y, max
179
180
  x, y = ele.left + ele.width, ele.top + ele.height
180
181
  unless max == tmp
181
- slot_height = flag ? [slot_height, y].max : slot_height + max.height
182
+ slot_height = flag && !slot_height.zero? ? y : slot_height + max.height
182
183
  end
183
184
  end
184
185
  slot_height
@@ -187,6 +188,7 @@ class Shoes
187
188
  def self.repaint_all slot
188
189
  return if slot.masked
189
190
  slot.contents.each do |ele|
191
+ next if ele.is_a?(Basic) && ele.cleared
190
192
  next if ele.is_a? ShapeBase
191
193
  ele.is_a?(Basic) ? ele.move2(ele.left + ele.margin_left, ele.top + ele.margin_top) : repaint_all(ele)
192
194
  end
@@ -222,7 +224,7 @@ class Shoes
222
224
  repaint_textcursors app
223
225
  app.canvas.set_size 0, scrollable_height unless(app.prjct or app.trvw)
224
226
  n = app.focus_ele ? app.focusables.index(app.focus_ele) : 0
225
- app.canvas.focus_chain = (app.focusables[n..-1] + app.focusables[0...n]).map(&:real) if n
227
+ app.canvas.focus_chain = (app.focusables[n..-1] + app.focusables[0...n]).map(&:real) if n and !app.canvas.is_a?(Gtk::DrawingArea)
226
228
  true
227
229
  end
228
230
 
@@ -394,9 +396,11 @@ class Shoes
394
396
  end
395
397
 
396
398
  def self.download_images_control app
399
+ flag = false
397
400
  app.dics.each do |e, d, tmpname|
398
401
  args = e.args
399
402
  if d.finished?
403
+ flag = true
400
404
  app.canvas.remove e.real
401
405
  img = Gtk::Image.new tmpname
402
406
  e.full_width, e.full_height = img.size_request
@@ -411,5 +415,6 @@ class Shoes
411
415
  File.delete tmpname
412
416
  end
413
417
  end
418
+ flag
414
419
  end
415
420
  end
data/lib/shoes/main.rb CHANGED
@@ -87,8 +87,8 @@ class Shoes
87
87
 
88
88
  Gtk.timeout_add 100 do
89
89
  unless app.win.destroyed?
90
- download_images_control app
91
- if size_allocated? app
90
+ downloaded = download_images_control app
91
+ if size_allocated?(app) or downloaded
92
92
  call_back_procs app
93
93
  app.width_pre, app.height_pre = app.width, app.height
94
94
  end
data/lib/shoes/ruby.rb CHANGED
@@ -151,8 +151,10 @@ class Array
151
151
  r + g + b > 0xAA * 3
152
152
  end
153
153
 
154
+ alias :_clear :clear
154
155
  def clear
155
- self.each &:clear
156
+ self.each{|e| e.clear if e.class.method_defined? :clear}
157
+ _clear
156
158
  end
157
159
 
158
160
  def clear_all
data/lib/shoes/slot.rb CHANGED
@@ -51,9 +51,9 @@ class Shoes
51
51
  end
52
52
 
53
53
  def positioning x, y, max
54
- @width = (parent.width * @initials[:width]).to_i if @initials[:width].is_a? Float
55
- @width = (parent.width + @initials[:width]) if @initials[:width] < 0
56
- @width -= (margin_left + margin_right)
54
+ w = (parent.width * @initials[:width]).to_i if @initials[:width].is_a? Float
55
+ w = (parent.width + @initials[:width]) if @initials[:width] < 0
56
+ @width = w - (margin_left + margin_right) if w
57
57
  if parent.is_a?(Flow) and x + @width <= parent.left + parent.width
58
58
  move3 x + parent.margin_left, max.top + parent.margin_top
59
59
  @height = Shoes.contents_alignment self
data/lib/shoes/style.rb CHANGED
@@ -47,7 +47,7 @@ class Shoes
47
47
  args[:font] ||= @args[:font]
48
48
  args[:align] ||= @args[:align]
49
49
 
50
- clear if @real
50
+ clear false if @real
51
51
  @width = (@left + parent.width <= @app.width) ? parent.width : @app.width - @left
52
52
  @width = initials[:width] unless initials[:width].zero?
53
53
  @height = 20 if @height.zero?
data/samples/sample30.rb CHANGED
@@ -6,7 +6,7 @@ class Answer < Shoes::Widget
6
6
  attr_reader :mark
7
7
  def initialize word
8
8
  flow do
9
- flow(width: 70){para word}
9
+ para word, width: 70
10
10
  @mark = image('./loogink.png', width: 20, height: 20).hide
11
11
  end
12
12
  end
data/static/manual-en.txt CHANGED
@@ -2582,7 +2582,7 @@ numbers.
2582
2582
 
2583
2583
  === gutter() » a number ===
2584
2584
 
2585
- The size of the scrollbar area. When Shoes needs to show a scrollbar, the
2585
+ The size of the scrollbar area. When Green Shoes needs to show a scrollbar, the
2586
2586
  scrollbar may end up covering up some elements that touch the edge of the
2587
2587
  window. The `gutter` tells you how many pixels to expect the scrollbar to
2588
2588
  cover.
@@ -2590,18 +2590,14 @@ cover.
2590
2590
  This is commonly used to pad elements on the right, like so:
2591
2591
 
2592
2592
  {{{
2593
- #!ruby
2594
- # Not yet available
2595
2593
  Shoes.app do
2596
- stack :margin_right => 20 + gutter do
2594
+ stack margin_right: 20 + gutter do
2597
2595
  para "Insert fat and ratified ",
2598
2596
  "declaration of independence here..."
2599
2597
  end
2600
2598
  end
2601
2599
  }}}
2602
2600
 
2603
- '''Note:''' Green Shoes doesn't support `gutter` method.
2604
-
2605
2601
  === height() » a number ===
2606
2602
 
2607
2603
  The vertical size of the viewable slot in pixels. So, if this is a scrolling
data/static/manual-ja.txt CHANGED
@@ -2506,25 +2506,21 @@ topとleftの座標から差し引くには、負数を利用してください
2506
2506
 
2507
2507
  === gutter() » a number ===
2508
2508
 
2509
- スクロールバーエリアの大きさです。Shoesがスクロールバーを表示する必要があるとき、
2509
+ スクロールバーエリアの大きさです。Green Shoesがスクロールバーを表示する必要があるとき、
2510
2510
  スクロールバーがウィンドウの端にふれているいくつかの要素を隠してしまうかもしれません。
2511
2511
  `gutter`はどのくらいのピクセルをスクロールバーが隠すことを期待するかを教えます。
2512
2512
 
2513
2513
  これは一般的には、次のように右側に詰め物の要素として利用します:
2514
2514
 
2515
2515
  {{{
2516
- #!ruby
2517
- # Not yet available
2518
2516
  Shoes.app do
2519
- stack :margin_right => 20 + gutter do
2517
+ stack margin_right: 20 + gutter do
2520
2518
  para "Insert fat and ratified ",
2521
2519
  "declaration of independence here..."
2522
2520
  end
2523
2521
  end
2524
2522
  }}}
2525
2523
 
2526
- '''注意:''' Green Shoesは`gutter`メソッドをサポートしていません。
2527
-
2528
2524
  === height() » a number ===
2529
2525
 
2530
2526
  スロットの目に見えるピクセルでの垂直の大きさです。そして、スクロールするスロットの場合は、
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: green_shoes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.322
4
+ version: 1.0.331
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-02 00:00:00.000000000Z
12
+ date: 2011-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gtk2
16
- requirement: &17004048 !ruby/object:Gem::Requirement
16
+ requirement: &14122200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *17004048
24
+ version_requirements: *14122200
25
25
  description: Green Shoes is one of colorful Shoes, written in pure Ruby with Ruby/GTK2.
26
26
  email: ashbbb@gmail.com
27
27
  executables: []
@@ -326,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
326
  version: '0'
327
327
  requirements: []
328
328
  rubyforge_project:
329
- rubygems_version: 1.8.10
329
+ rubygems_version: 1.8.11
330
330
  signing_key:
331
331
  specification_version: 3
332
332
  summary: Green Shoes