1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/tk/lib/tk/itemconfig.rb: minor bug fix.

* ext/tk/lib/tkextlib/tile/treeview.rb : ditto.
* ext/tk/lib/tkextlib/blt/table.rb: fix bugs which forbade use of
  '::blt::table' command. Now, probably, it'll works properly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagai 2006-11-07 09:11:38 +00:00
parent 6f1c934bc3
commit 32c61a1b59
6 changed files with 86 additions and 33 deletions

View file

@ -1,3 +1,7 @@
Tue Nov 7 18:05:01 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk/itemconfig.rb: minor bug fix.
Tue Nov 7 17:52:08 2006 Yukihiro Matsumoto <matz@ruby-lang.org> Tue Nov 7 17:52:08 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* class.c (rb_include_module): revert duplicate inclusion of * class.c (rb_include_module): revert duplicate inclusion of

View file

@ -1,3 +1,10 @@
2006-11-07 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* lib/tkextlib/tile/treeview.rb : minor bug fix.
* lib/tkextlib/blt/table.rb: fix bugs which forbade use of
'::blt::table' command. Now, probably, it'll works properly.
2006-11-06 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp> 2006-11-06 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* lib/tkextlib/version.rb: keep release date of tkextlib on * lib/tkextlib/version.rb: keep release date of tkextlib on

View file

@ -4597,7 +4597,7 @@ end
#Tk.freeze #Tk.freeze
module Tk module Tk
RELEASE_DATE = '2006-11-06'.freeze RELEASE_DATE = '2006-11-07'.freeze
autoload :AUTO_PATH, 'tk/variable' autoload :AUTO_PATH, 'tk/variable'
autoload :TCL_PACKAGE_PATH, 'tk/variable' autoload :TCL_PACKAGE_PATH, 'tk/variable'

View file

@ -1052,7 +1052,7 @@ module TkItemConfigMethod
end end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {} ret = {}
itemconfiginfo(tagOrId, slot).each{|key, conf| __itemconfiginfo_core(tagOrId, slot).each{|key, conf|
ret[key] = conf[-1] if conf.kind_of?(Array) ret[key] = conf[-1] if conf.kind_of?(Array)
} }
ret ret

View file

@ -17,97 +17,97 @@ module Tk::BLT
module TableContainer module TableContainer
def blt_table_add(*args) def blt_table_add(*args)
Tk::BLT::Table.add(@path, *args) Tk::BLT::Table.add(self, *args)
self self
end end
def blt_table_arrange() def blt_table_arrange()
Tk::BLT::Table.arrange(@path) Tk::BLT::Table.arrange(self)
self self
end end
def blt_table_cget(*args) def blt_table_cget(*args)
Tk::BLT::Table.cget(@path, *args) Tk::BLT::Table.cget(self, *args)
end end
def blt_table_configure(*args) def blt_table_configure(*args)
Tk::BLT::Table.configure(@path, *args) Tk::BLT::Table.configure(self, *args)
self self
end end
def blt_table_configinfo(*args) def blt_table_configinfo(*args)
Tk::BLT::Table.configinfo(@path, *args) Tk::BLT::Table.configinfo(self, *args)
end end
def blt_table_current_configinfo(*args) def blt_table_current_configinfo(*args)
Tk::BLT::Table.current_configinfo(@path, *args) Tk::BLT::Table.current_configinfo(self, *args)
end end
def blt_table_locate(x, y) def blt_table_locate(x, y)
Tk::BLT::Table.locate(@path, x, y) Tk::BLT::Table.locate(self, x, y)
end end
def blt_table_delete(*args) def blt_table_delete(*args)
Tk::BLT::Table.delete(@path, *args) Tk::BLT::Table.delete(self, *args)
self self
end end
def blt_table_extents(item) def blt_table_extents(item)
Tk::BLT::Table.extents(@path, item) Tk::BLT::Table.extents(self, item)
end end
def blt_table_insert(*args) def blt_table_insert(*args)
Tk::BLT::Table.insert(@path, *args) Tk::BLT::Table.insert(self, *args)
self self
end end
def blt_table_insert_before(*args) def blt_table_insert_before(*args)
Tk::BLT::Table.insert_before(@path, *args) Tk::BLT::Table.insert_before(self, *args)
self self
end end
def blt_table_insert_after(*args) def blt_table_insert_after(*args)
Tk::BLT::Table.insert_after(@path, *args) Tk::BLT::Table.insert_after(self, *args)
self self
end end
def blt_table_join(first, last) def blt_table_join(first, last)
Tk::BLT::Table.join(@path, first, last) Tk::BLT::Table.join(self, first, last)
self self
end end
def blt_table_save() def blt_table_save()
Tk::BLT::Table.save(@path) Tk::BLT::Table.save(self)
end end
def blt_table_search(*args) def blt_table_search(*args)
Tk::BLT::Table.search(@path, *args) Tk::BLT::Table.search(self, *args)
end end
def blt_table_split(*args) def blt_table_split(*args)
Tk::BLT::Table.split(@path, *args) Tk::BLT::Table.split(self, *args)
self self
end end
def blt_table_itemcget(*args) def blt_table_itemcget(*args)
Tk::BLT::Table.itemcget(@path, *args) Tk::BLT::Table.itemcget(self, *args)
end end
def blt_table_itemconfigure(*args) def blt_table_itemconfigure(*args)
Tk::BLT::Table.itemconfigure(@path, *args) Tk::BLT::Table.itemconfigure(self, *args)
self self
end end
def blt_table_itemconfiginfo(*args) def blt_table_itemconfiginfo(*args)
Tk::BLT::Table.itemconfiginfo(@path, *args) Tk::BLT::Table.itemconfiginfo(self, *args)
end end
def blt_table_current_itemconfiginfo(*args) def blt_table_current_itemconfiginfo(*args)
Tk::BLT::Table.current_itemconfiginfo(@path, *args) Tk::BLT::Table.current_itemconfiginfo(self, *args)
end end
def blt_table_iteminfo(item) def blt_table_iteminfo(item)
Tk::BLT::Table.iteminfo(@path, item) Tk::BLT::Table.iteminfo(self, item)
end end
end end
end end
@ -117,18 +117,21 @@ end
############################################ ############################################
class << Tk::BLT::Table class << Tk::BLT::Table
def __item_cget_cmd(id) # id := [ container, item ] def __item_cget_cmd(id) # id := [ container, item ]
['::blt::table', 'cget', id[0].path, id[1]] win = (id[0].kind_of?(TkWindow))? id[0].path: id[0].to_s
['::blt::table', 'cget', win, id[1]]
end end
private :__item_cget_cmd private :__item_cget_cmd
def __item_config_cmd(id) # id := [ container, item, ... ] def __item_config_cmd(id) # id := [ container, item, ... ]
container, *items = id container, *items = id
['::blt::table', 'configure', container.path, *items] win = (container.kind_of?(TkWindow))? container.path: container.to_s
['::blt::table', 'configure', win, *items]
end end
private :__item_config_cmd private :__item_config_cmd
def __item_pathname(id) def __item_pathname(id)
id[0].path + ';' win = (id[0].kind_of?(TkWindow))? id[0].path: id[0].to_s
win + ';'
end end
private :__item_pathname private :__item_pathname
@ -194,6 +197,7 @@ class << Tk::BLT::Table
if args[-1].kind_of?(Hash) if args[-1].kind_of?(Hash)
# container, item, item, ... , hash_optkeys # container, item, item, ... , hash_optkeys
keys = args.pop keys = args.pop
fail ArgumentError, 'no item is given' if args.empty?
id = [container] id = [container]
args.each{|item| id << tagid(item)} args.each{|item| id << tagid(item)}
__itemconfigure(id, keys) __itemconfigure(id, keys)
@ -201,10 +205,12 @@ class << Tk::BLT::Table
# container, item, item, ... , option, value # container, item, item, ... , option, value
val = args.pop val = args.pop
opt = args.pop opt = args.pop
fail ArgumentError, 'no item is given' if args.empty?
id = [container] id = [container]
args.each{|item| id << tagid(item)} args.each{|item| id << tagid(item)}
__itemconfigure(id, opt, val) __itemconfigure(id, opt, val)
end end
container
end end
def itemconfiginfo(container, *args) def itemconfiginfo(container, *args)
@ -222,11 +228,35 @@ class << Tk::BLT::Table
slot = nil slot = nil
end end
fail ArgumentError, 'no item is given' if args.empty?
id = [container] id = [container]
args.each{|item| id << tagid(item)} args.each{|item| id << tagid(item)}
__itemconfiginfo(id, slot) __itemconfiginfo(id, slot)
end end
def current_itemconfiginfo(container, *args)
slot = args[-1]
if slot.kind_of?(String) || slot.kind_of?(Symbol)
slot = slot.to_s
if slot[0] == ?. || slot =~ /^\d+,\d+$/ || slot =~ /^(c|C|r|R)(\*|\d+)/
# widget || row,col || Ci or Ri
slot = nil
else
# option
slot = args.pop
end
else
slot = nil
end
fail ArgumentError, 'no item is given' if args.empty?
id = [container]
args.each{|item| id << tagid(item)}
__current_itemconfiginfo(id, slot)
end
def info(container) def info(container)
ret = {} ret = {}
inf = list(tk_call('::blt::table', 'info', container)) inf = list(tk_call('::blt::table', 'info', container))
@ -238,12 +268,22 @@ class << Tk::BLT::Table
end end
def iteminfo(container, item) def iteminfo(container, item)
ret = {} inf = list(tk_call('::blt::table', 'info', container, tagid(item)).chomp)
inf = list(tk_call('::blt::table', 'info', container, tagid(item)))
until inf.empty? ret = []
opt = inf.slice!(0..1) until inf.empty? || (inf[0].kind_of?(String) && inf[0] =~ /^-/)
ret[opt[1..-1]] = opt[1] ret << inf.shift
end end
if inf.length > 1
keys = {}
while inf.length > 1
opt = inf.slice!(0..1)
keys[opt[0][1..-1]] = opt[1]
end
ret << keys
end
ret ret
end end
@ -253,7 +293,7 @@ class << Tk::BLT::Table
tk_call('::blt::table', container) tk_call('::blt::table', container)
begin begin
class << container class << container
include Tk::BLT::TABLE::TableContainer include Tk::BLT::Table::TableContainer
end end
rescue rescue
warn('fail to include TableContainer methods (frozen object?)') warn('fail to include TableContainer methods (frozen object?)')
@ -276,10 +316,12 @@ class << Tk::BLT::Table
} }
tk_call('::blt::table', container, *args) tk_call('::blt::table', container, *args)
end end
container
end end
def arrange(container) def arrange(container)
tk_call('::blt::table', 'arrange', container) tk_call('::blt::table', 'arrange', container)
container
end end
def delete(container, *args) def delete(container, *args)

View file

@ -497,7 +497,7 @@ module Tk::Tile::TreeviewConfig
end end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {} ret = {}
itemconfiginfo(tagOrId, slot).each{|key, conf| __itemconfiginfo_core(tagOrId, slot).each{|key, conf|
ret[key] = conf[-1] if conf.kind_of?(Array) ret[key] = conf[-1] if conf.kind_of?(Array)
} }
ret ret