ruby-changes:4850
From: ko1@a...
Date: Sat, 10 May 2008 13:19:34 +0900 (JST)
Subject: [ruby-changes:4850] nagai - Ruby:r16344 (ruby_1_8): * ext/tk/lib/tk/pack.rb, ext/tk/lib/tk/grid.rb: increase parameter
nagai 2008-05-10 13:19:12 +0900 (Sat, 10 May 2008) New Revision: 16344 Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/ext/tk/lib/tk/grid.rb branches/ruby_1_8/ext/tk/lib/tk/pack.rb branches/ruby_1_8/ext/tk/lib/tk.rb Log: * ext/tk/lib/tk/pack.rb, ext/tk/lib/tk/grid.rb: increase parameter patterns of configure method. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=16344&r2=16343&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk/pack.rb?r1=16344&r2=16343&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk.rb?r1=16344&r2=16343&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ext/tk/lib/tk/grid.rb?r1=16344&r2=16343&diff_format=u Index: ruby_1_8/ext/tk/lib/tk.rb =================================================================== --- ruby_1_8/ext/tk/lib/tk.rb (revision 16343) +++ ruby_1_8/ext/tk/lib/tk.rb (revision 16344) @@ -5348,7 +5348,7 @@ #Tk.freeze module Tk - RELEASE_DATE = '2008-05-09'.freeze + RELEASE_DATE = '2008-05-10'.freeze autoload :AUTO_PATH, 'tk/variable' autoload :TCL_PACKAGE_PATH, 'tk/variable' Index: ruby_1_8/ext/tk/lib/tk/pack.rb =================================================================== --- ruby_1_8/ext/tk/lib/tk/pack.rb (revision 16343) +++ ruby_1_8/ext/tk/lib/tk/pack.rb (revision 16344) @@ -9,6 +9,7 @@ TkCommandNames = ['pack'.freeze].freeze +=begin def configure(win, *args) if args[-1].kind_of?(Hash) opts = args.pop @@ -29,6 +30,22 @@ } tk_call_without_enc("pack", 'configure', *params) end +=end + def configure(*args) + if args[-1].kind_of?(Hash) + opts = args.pop + else + opts = nil + end + fail ArgumentError, 'no widget is given' if args.empty? + params = [] + args.flatten(1).each{|win| params.push(_epath(win))} + opts.each{|k, v| + params.push("-#{k}") + params.push(_epath(v)) # have to use 'epath' (hash_kv() is unavailable) + } + tk_call_without_enc("pack", 'configure', *params) + end alias pack configure def forget(*args) Index: ruby_1_8/ext/tk/lib/tk/grid.rb =================================================================== --- ruby_1_8/ext/tk/lib/tk/grid.rb (revision 16343) +++ ruby_1_8/ext/tk/lib/tk/grid.rb (revision 16344) @@ -22,6 +22,7 @@ list(tk_call_without_enc('grid', 'bbox', *args)) end +=begin def configure(win, *args) if args[-1].kind_of?(Hash) opts = args.pop @@ -53,6 +54,48 @@ tk_call_without_enc('grid', 'configure', *params) end end +=end + def configure(*args) + if args[-1].kind_of?(Hash) + opts = args.pop + else + opts = nil + end + fail ArgumentError, 'no widget is given' if args.empty? + params = [] + args.flatten(1).each{|win| + case win + when '-', ?- # RELATIVE PLACEMENT (increase columnspan) + params.push('-') + when /^-+$/ # RELATIVE PLACEMENT (increase columnspan) + params.concat(win.to_s.split(//)) + when '^', ?^ # RELATIVE PLACEMENT (increase rowspan) + params.push('^') + when /^\^+$/ # RELATIVE PLACEMENT (increase rowspan) + params.concat(win.to_s.split(//)) + when 'x', :x, ?x, nil, '' # RELATIVE PLACEMENT (empty column) + params.push('x') + when /^x+$/ # RELATIVE PLACEMENT (empty column) + params.concat(win.to_s.split(//)) + else + params.push(_epath(win)) + end + } + opts.each{|k, v| + params.push("-#{k}") + params.push(_epath(v)) # have to use 'epath' (hash_kv() is unavailable) + } + if Tk::TCL_MAJOR_VERSION < 8 || + (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION <= 3) + if params[0] == '-' || params[0] == 'x' || params[0] == '^' + tk_call_without_enc('grid', *params) + else + tk_call_without_enc('grid', 'configure', *params) + end + else + tk_call_without_enc('grid', 'configure', *params) + end + end alias grid configure def columnconfigure(master, index, args) Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 16343) +++ ruby_1_8/ChangeLog (revision 16344) @@ -1,3 +1,8 @@ +Sat May 10 13:17:56 2008 Hidetoshi NAGAI <nagai@a...> + + * ext/tk/lib/tk/pack.rb, ext/tk/lib/tk/grid.rb: increase parameter + patterns of configure method. + Sat May 10 09:16:13 2008 Yukihiro Matsumoto <matz@r...> * util.c (ruby_strtod): backported from 1.9. a patch from Satoshi -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/