diff options
| author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-30 08:44:19 +0000 |
|---|---|---|
| committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-30 08:44:19 +0000 |
| commit | bbcbe0b7e5d5969d6a55cc885a323107e415ce44 (patch) | |
| tree | 760e0cf10c7c7083f6f784f16b602dd562214dd6 /ext/tk/sample/tkextlib/tkHTML/hv.rb | |
| parent | 2f50816ad9df366072d9a72a590180b2a78d07c2 (diff) | |
| download | ruby-bbcbe0b7e5d5969d6a55cc885a323107e415ce44.tar.gz ruby-bbcbe0b7e5d5969d6a55cc885a323107e415ce44.tar.xz ruby-bbcbe0b7e5d5969d6a55cc885a323107e415ce44.zip | |
* ext/tk/tcltklib.c: add TclTkIp#_create_console() method to create
a Tcl/Tk's console window.
* ext/tk/lib/multi-tk.rb: support TclTkIp#_create_console() method.
* ext/tk/lib/remote-tk.rb: ditto.
* ext/tk/lib/tk/console.rb: ditto.
* ext/tk/lib/tk.rb: update RELEASE_DATE
* ext/tk/sample/demo-*/check2.rb: use 'return' in the Proc object.
* ext/tk/sample/tkextlib/**: ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@8212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/tkextlib/tkHTML/hv.rb')
| -rw-r--r-- | ext/tk/sample/tkextlib/tkHTML/hv.rb | 85 |
1 files changed, 46 insertions, 39 deletions
diff --git a/ext/tk/sample/tkextlib/tkHTML/hv.rb b/ext/tk/sample/tkextlib/tkHTML/hv.rb index d9f3ea7d7..a4d78ea5b 100644 --- a/ext/tk/sample/tkextlib/tkHTML/hv.rb +++ b/ext/tk/sample/tkextlib/tkHTML/hv.rb @@ -78,38 +78,43 @@ big_imgs = {} hotkey = {} move_big_image = proc{|b| - return unless big_imgs.key?(b) - b.copy(big_imgs[b]) - big_imgs[b].delete - big_imgs.delete(b) - Tk.update + if big_imgs.key?(b) + b.copy(big_imgs[b]) + big_imgs[b].delete + big_imgs.delete(b) + Tk.update + end } image_cmd = proc{|*args| - return smgray unless show_img.bool - fn = args[0] - if old_imgs.key?(fn) - images[fn] = old_imgs[fn] - old_imgs.delete(fn) - return images[fn] - end + if show_img.bool + smgray + else + fn = args[0] - begin - img = TkPhotoImage.new(:file=>fn) - rescue - return smgray - end + if old_imgs.key?(fn) + images[fn] = old_imgs[fn] + old_imgs.delete(fn) + images[fn] - if img.width * img.height > 20000 - b = TkPhotoImage.new(:width=>img.width, :height=>img.height) - big_imgs[b] = img - img = b - Tk.after_idle(proc{ move_big_image.call(b) }) + else + begin + img = TkPhotoImage.new(:file=>fn) + rescue + smgray + else + if img.width * img.height > 20000 + b = TkPhotoImage.new(:width=>img.width, :height=>img.height) + big_imgs[b] = img + img = b + Tk.after_idle(proc{ move_big_image.call(b) }) + end + + images[fn] = img + img + end + end end - - images[fn] = img - - img } # @@ -183,12 +188,13 @@ clear_screen = proc{ # Load a file into the HTML widget # load_file = proc{|name| - return unless (doc = read_file.call(name)) - clear_screen.call - last_file = name - html.configure(:base=>name) - html.parse(doc) - old_imgs.clear + if (doc = read_file.call(name)) + clear_screen.call + last_file = name + html.configure(:base=>name) + html.parse(doc) + old_imgs.clear + end } href_binding = proc{|x, y| @@ -196,15 +202,16 @@ href_binding = proc{|x, y| html.selection_clear priv['mark'] = "@#{x},#{y}" lst = html.href(x, y) - return if lst.size.zero? - lnk, target = lst + unless lst.size.zero? + lnk, target = lst - if lnk != "" - if lnk =~ /^#{last_file}#(.*)$/ - html.yview($1) - else - load_file.call(lnk) + if lnk != "" + if lnk =~ /^#{last_file}#(.*)$/ + html.yview($1) + else + load_file.call(lnk) + end end end } |
