green_shoes 1.0.331 → 1.0.337

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.331
1
+ 1.0.337
data/lib/green_shoes.rb CHANGED
@@ -32,6 +32,7 @@ module Shoes
32
32
  strikethrough: :strikethrough, strikecolor: :strikethrough_color, underline: :underline, undercolor: :underline_color}
33
33
  WRAP = {word: Pango::WRAP_WORD, char: Pango::WRAP_CHAR, trim: Pango::ELLIPSIZE_END}
34
34
  FONT_SIZE = {"xx-small" => 0.57, "x-small" => 0.64, "small" => 0.83, "medium" => 1.0, "large" => 1.2, "x-large" => 1.43, "xx-large" => 1.73}
35
+ COLORS = {}
35
36
  end
36
37
 
37
38
  class Object
data/lib/shoes/app.rb CHANGED
@@ -458,7 +458,7 @@ class Shoes
458
458
  if pat = (args[:fill] or fill)
459
459
  gp = gradient pat, args[:width], args[:height], args[:angle]
460
460
  context.set_source gp
461
- context.rounded_rectangle mx, -my, args[:width], args[:height], args[:curve]
461
+ context.rounded_rectangle sw/2.0+mx, sw/2.0-my, args[:width]-sw, args[:height]-sw, args[:curve]
462
462
  context.fill
463
463
  end
464
464
 
@@ -690,6 +690,7 @@ class Shoes
690
690
  end
691
691
 
692
692
  def background pat, args={}
693
+ pat = eval(pat) if pat.is_a? String
693
694
  args[:pattern] = pat
694
695
  args = basic_attributes args
695
696
 
@@ -785,9 +786,7 @@ class Shoes
785
786
 
786
787
  def close
787
788
  win.destroy
788
- Gtk.main_quit
789
789
  Shoes.APPS.delete app
790
- exit if Shoes.APPS.empty?
791
790
  end
792
791
 
793
792
  def window args={}, &blk
data/lib/shoes/basic.rb CHANGED
@@ -153,9 +153,9 @@ class Shoes
153
153
  def path=(name)
154
154
  @path = name
155
155
  @real.clear
156
- args = {width: @width, height: @height}
156
+ args = {width: @width, height: @height, noorder: true}
157
157
  args.merge!({hidden: true}) if @hided
158
- @real = @app.image(name, args).move(@left, @top).real
158
+ @real = @app.image(name, args).move(@left, @top).real.tap{@app.flush}
159
159
  end
160
160
 
161
161
  def rotate angle
data/lib/shoes/colors.rb CHANGED
@@ -145,6 +145,5 @@ class Shoes
145
145
  App.class_eval do
146
146
  colors.each{|color| define_method(color[0]){[color[1]/255.0, color[2]/255.0, color[3]/255.0]}}
147
147
  end
148
- App::COLORS = {}
149
- colors.each{|c, r, g, b| App::COLORS[c] = [r, g, b]}
148
+ colors.each{|c, r, g, b| COLORS[c] = [r, g, b]}
150
149
  end
data/lib/shoes/help.rb CHANGED
@@ -463,7 +463,7 @@ class Manual < Shoes
463
463
  PNUMS = mk_page_numbers DOCS
464
464
  PEND = PNUMS.length
465
465
  TOC, TOC_LIST = [], []
466
- COLORS = Shoes::App::COLORS
466
+ COLORS = Shoes::COLORS
467
467
  end
468
468
 
469
469
  Shoes.app title: 'The Green Shoes Manual', width: 720, height: 640
data/lib/shoes/main.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  class Shoes
2
- @apps = []
3
2
  $urls = {}
4
3
  APPS = []
5
4
 
@@ -16,7 +15,7 @@ class Shoes
16
15
  [:projector, :treeview].each{|x| args.delete x}
17
16
 
18
17
  app = App.new args
19
- @apps.push app
18
+ @main_app ||= app
20
19
 
21
20
  app.top_slot = Flow.new app.slot_attributes(app: app, left: 0, top: 0)
22
21
 
@@ -40,8 +39,12 @@ class Shoes
40
39
  end
41
40
 
42
41
  win.signal_connect "destroy" do
43
- app.close
44
- end if @apps.size == 1
42
+ if @main_app == app
43
+ APPS.length > 1 ? (APPS.delete app; @main_app = APPS.first) : exit
44
+ else
45
+ APPS.delete app
46
+ end
47
+ end
45
48
 
46
49
  win.signal_connect "button_press_event" do |w, e|
47
50
  app.mouse_button = e.button
@@ -72,7 +75,7 @@ class Shoes
72
75
  swin = Gtk::ScrolledWindow.new
73
76
  swin.set_policy Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC
74
77
  swin.vadjustment.step_increment = 10
75
- swin.add app.canvas
78
+ projector ? swin.add_with_viewport(app.canvas) : swin.add(app.canvas)
76
79
  win.add swin
77
80
  app.canvas.style = style
78
81
  app.win, app.swin = win, swin
@@ -101,8 +104,8 @@ class Shoes
101
104
  call_back_procs app
102
105
 
103
106
  win.show_all
104
- @apps.pop
105
- Gtk.main if @apps.empty?
107
+
108
+ Gtk.main if @main_app == app
106
109
  app
107
110
  end
108
111
  end
data/lib/shoes/ruby.rb CHANGED
@@ -104,7 +104,7 @@ class Object
104
104
  end
105
105
 
106
106
  def exit
107
- Shoes.APPS.length.times {|i| timer(0.01*i){Gtk.main_quit}}
107
+ Gtk.main_quit
108
108
  File.delete Shoes::TMP_PNG_FILE if File.exist? Shoes::TMP_PNG_FILE
109
109
  end
110
110
 
data/samples/sample41.rb CHANGED
@@ -2,7 +2,8 @@ require '../lib/green_shoes'
2
2
 
3
3
  Shoes.app do
4
4
  button 'open 3D Projector' do
5
- Shoes.app projector: './akatsukiface.png', title: 'JAXA Venus Probe, Akatsuki (PLANET-C)'
5
+ Shoes.app projector: File.join(DIR, '../samples/akatsukiface.png'),
6
+ title: 'JAXA Venus Probe, Akatsuki (PLANET-C)'
6
7
  end
7
8
  end
8
9
 
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.331
4
+ version: 1.0.337
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-27 00:00:00.000000000 Z
12
+ date: 2011-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gtk2
16
- requirement: &14122200 !ruby/object:Gem::Requirement
16
+ requirement: &10583256 !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: *14122200
24
+ version_requirements: *10583256
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: []