mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tk/tcltklib.c: remove dangerous 'rb_jump_tag's.
* ext/tk/lib/tk.rb: add __val2ruby_optkeys and __ruby2val_optkeys to help to convert option values between ruby and tcl. * ext/tk/lib/tk/itemconfig.rb: add __item_val2ruby_optkeys and __item_ruby2val_optkeys to help to convert option values between ruby and tcl. * ext/tk/lib/tk/radiobutton.rb: use __ruby2val_optkeys for 'variable' option (for the reason of backward compatibility). * ext/tk/lib/tk/composite.rb: clarify the arguments of super(). * ext/tk/lib/tk/spinbox.rb: ditto. * ext/tk/lib/tk/text.rb: ditto. * ext/tk/lib/tk/validation.rb: ditto. * ext/tk/lib/tkextlib/*: support to treat tkvariable-type configure options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
09d57b8e0c
commit
c1566b7490
33 changed files with 490 additions and 38 deletions
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
||||||
|
Tue Aug 9 15:12:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
|
|
||||||
|
* ext/tk/tcltklib.c: remove dangerous 'rb_jump_tag's.
|
||||||
|
|
||||||
|
* ext/tk/lib/tk.rb: add __val2ruby_optkeys and __ruby2val_optkeys to
|
||||||
|
help to convert option values between ruby and tcl.
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/itemconfig.rb: add __item_val2ruby_optkeys and
|
||||||
|
__item_ruby2val_optkeys to help to convert option values between
|
||||||
|
ruby and tcl.
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/radiobutton.rb: use __ruby2val_optkeys for 'variable'
|
||||||
|
option (for the reason of backward compatibility).
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/composite.rb: clarify the arguments of super().
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/spinbox.rb: ditto.
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/text.rb: ditto.
|
||||||
|
|
||||||
|
* ext/tk/lib/tk/validation.rb: ditto.
|
||||||
|
|
||||||
|
* ext/tk/lib/tkextlib/*: support to treat tkvariable-type
|
||||||
|
configure options.
|
||||||
|
|
||||||
Tue Aug 9 08:24:05 2005 Mauricio Fernandez <mfp@acm.org>
|
Tue Aug 9 08:24:05 2005 Mauricio Fernandez <mfp@acm.org>
|
||||||
|
|
||||||
* parse.y (f_block_arg), eval.c (rb_yield_0): deal with dynamic
|
* parse.y (f_block_arg), eval.c (rb_yield_0): deal with dynamic
|
||||||
|
|
145
ext/tk/lib/tk.rb
145
ext/tk/lib/tk.rb
|
@ -2720,7 +2720,24 @@ module TkConfigMethod
|
||||||
end
|
end
|
||||||
private :__tkvariable_optkeys
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
|
def __val2ruby_optkeys # { key=>proc, ... }
|
||||||
|
# The method is used to convert a opt-value to a ruby's object.
|
||||||
|
# When get the value of the option "key", "proc.call(value)" is called.
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
private :__val2ruby_optkeys
|
||||||
|
|
||||||
|
def __ruby2val_optkeys # { key=>proc, ... }
|
||||||
|
# The method is used to convert a ruby's object to a opt-value.
|
||||||
|
# When set the value of the option "key", "proc.call(value)" is called.
|
||||||
|
# That is, "-#{key} #{proc.call(value)}".
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
private :__ruby2val_optkeys
|
||||||
|
|
||||||
def __methodcall_optkeys # { key=>method, ... }
|
def __methodcall_optkeys # { key=>method, ... }
|
||||||
|
# The method is used to both of get and set.
|
||||||
|
# Usually, the 'key' will not be a widget option.
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
private :__methodcall_optkeys
|
private :__methodcall_optkeys
|
||||||
|
@ -2775,6 +2792,16 @@ module TkConfigMethod
|
||||||
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
|
fail ArgumentError, "Invalid option `#{orig_slot.inspect}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ( method = _symbolkey2str(__val2ruby_optkeys())[slot] )
|
||||||
|
optval = tk_call_without_enc(*(__cget_cmd << "-#{slot}"))
|
||||||
|
begin
|
||||||
|
return method.call(optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
|
||||||
|
return optval
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if ( method = _symbolkey2str(__methodcall_optkeys)[slot] )
|
if ( method = _symbolkey2str(__methodcall_optkeys)[slot] )
|
||||||
return self.__send__(method)
|
return self.__send__(method)
|
||||||
end
|
end
|
||||||
|
@ -2843,6 +2870,12 @@ module TkConfigMethod
|
||||||
self.__send__(method, value) if value
|
self.__send__(method, value) if value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__ruby2val_optkeys.each{|key, method|
|
||||||
|
key = key.to_s
|
||||||
|
value = slot[key]
|
||||||
|
slot[key] = method.call(value) if value
|
||||||
|
}
|
||||||
|
|
||||||
__keyonly_optkeys.each{|defkey, undefkey|
|
__keyonly_optkeys.each{|defkey, undefkey|
|
||||||
conf = slot.find{|kk, vv| kk == defkey.to_s}
|
conf = slot.find{|kk, vv| kk == defkey.to_s}
|
||||||
if conf
|
if conf
|
||||||
|
@ -2876,6 +2909,8 @@ module TkConfigMethod
|
||||||
elsif undefkey
|
elsif undefkey
|
||||||
tk_call(*(__config_cmd << "-#{undefkey}"))
|
tk_call(*(__config_cmd << "-#{undefkey}"))
|
||||||
end
|
end
|
||||||
|
elsif ( method = _symbolkey2str(__ruby2val_optkeys)[slot] )
|
||||||
|
method.call(value)
|
||||||
elsif ( method = _symbolkey2str(__methodcall_optkeys)[slot] )
|
elsif ( method = _symbolkey2str(__methodcall_optkeys)[slot] )
|
||||||
self.__send__(method, value)
|
self.__send__(method, value)
|
||||||
elsif (slot =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
|
elsif (slot =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/)
|
||||||
|
@ -2918,6 +2953,31 @@ module TkConfigMethod
|
||||||
if slot
|
if slot
|
||||||
slot = slot.to_s
|
slot = slot.to_s
|
||||||
case slot
|
case slot
|
||||||
|
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
|
||||||
|
method = _symbolkey2str(__val2ruby_optkeys())[slot]
|
||||||
|
conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd() << "-#{slot}")), false, true)
|
||||||
|
if ( __configinfo_struct[:default_value] \
|
||||||
|
&& conf[__configinfo_struct[:default_value]] )
|
||||||
|
optval = conf[__configinfo_struct[:default_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__configinfo_struct[:default_value]] = val
|
||||||
|
end
|
||||||
|
if ( conf[__configinfo_struct[:current_value]] )
|
||||||
|
optval = conf[__configinfo_struct[:current_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__configinfo_struct[:current_value]] = val
|
||||||
|
end
|
||||||
|
|
||||||
when /^(#{__methodcall_optkeys.keys.join('|')})$/
|
when /^(#{__methodcall_optkeys.keys.join('|')})$/
|
||||||
method = _symbolkey2str(__methodcall_optkeys)[slot]
|
method = _symbolkey2str(__methodcall_optkeys)[slot]
|
||||||
return [slot, '', '', '', self.__send__(method)]
|
return [slot, '', '', '', self.__send__(method)]
|
||||||
|
@ -3059,7 +3119,32 @@ module TkConfigMethod
|
||||||
conf[__configinfo_struct[:key]] =
|
conf[__configinfo_struct[:key]] =
|
||||||
conf[__configinfo_struct[:key]][1..-1]
|
conf[__configinfo_struct[:key]][1..-1]
|
||||||
|
|
||||||
case conf[__configinfo_struct[:key]]
|
optkey = conf[__configinfo_struct[:key]]
|
||||||
|
case optkey
|
||||||
|
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
|
||||||
|
method = _symbolkey2str(__val2ruby_optkeys())[optkey]
|
||||||
|
if ( __configinfo_struct[:default_value] \
|
||||||
|
&& conf[__configinfo_struct[:default_value]] )
|
||||||
|
optval = conf[__configinfo_struct[:default_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__configinfo_struct[:default_value]] = val
|
||||||
|
end
|
||||||
|
if ( conf[__configinfo_struct[:current_value]] )
|
||||||
|
optval = conf[__configinfo_struct[:current_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__configinfo_struct[:current_value]] = val
|
||||||
|
end
|
||||||
|
|
||||||
when /^(#{__strval_optkeys.join('|')})$/
|
when /^(#{__strval_optkeys.join('|')})$/
|
||||||
# do nothing
|
# do nothing
|
||||||
|
|
||||||
|
@ -3232,6 +3317,31 @@ module TkConfigMethod
|
||||||
if slot
|
if slot
|
||||||
slot = slot.to_s
|
slot = slot.to_s
|
||||||
case slot
|
case slot
|
||||||
|
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
|
||||||
|
method = _symbolkey2str(__val2ruby_optkeys())[slot]
|
||||||
|
conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), false, true)
|
||||||
|
if ( __configinfo_struct[:default_value] \
|
||||||
|
&& conf[__configinfo_struct[:default_value]] )
|
||||||
|
optval = conf[__configinfo_struct[:default_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__configinfo_struct[:default_value]] = val
|
||||||
|
end
|
||||||
|
if ( conf[__configinfo_struct[:current_value]] )
|
||||||
|
optval = conf[__configinfo_struct[:current_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__configinfo_struct[:current_value]] = val
|
||||||
|
end
|
||||||
|
|
||||||
when /^(#{__methodcall_optkeys.keys.join('|')})$/
|
when /^(#{__methodcall_optkeys.keys.join('|')})$/
|
||||||
method = _symbolkey2str(__methodcall_optkeys)[slot]
|
method = _symbolkey2str(__methodcall_optkeys)[slot]
|
||||||
return {slot => ['', '', '', self.__send__(method)]}
|
return {slot => ['', '', '', self.__send__(method)]}
|
||||||
|
@ -3375,7 +3485,32 @@ module TkConfigMethod
|
||||||
conf[__configinfo_struct[:key]] =
|
conf[__configinfo_struct[:key]] =
|
||||||
conf[__configinfo_struct[:key]][1..-1]
|
conf[__configinfo_struct[:key]][1..-1]
|
||||||
|
|
||||||
case conf[__configinfo_struct[:key]]
|
optkey = conf[__configinfo_struct[:key]]
|
||||||
|
case optkey
|
||||||
|
when /^(#{__val2ruby_optkeys().keys.join('|')})$/
|
||||||
|
method = _symbolkey2str(__val2ruby_optkeys())[optkey]
|
||||||
|
if ( __configinfo_struct[:default_value] \
|
||||||
|
&& conf[__configinfo_struct[:default_value]] )
|
||||||
|
optval = conf[__configinfo_struct[:default_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__configinfo_struct[:default_value]] = val
|
||||||
|
end
|
||||||
|
if ( conf[__configinfo_struct[:current_value]] )
|
||||||
|
optval = conf[__configinfo_struct[:current_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__configinfo_struct[:current_value]] = val
|
||||||
|
end
|
||||||
|
|
||||||
when /^(#{__strval_optkeys.join('|')})$/
|
when /^(#{__strval_optkeys.join('|')})$/
|
||||||
# do nothing
|
# do nothing
|
||||||
|
|
||||||
|
@ -3746,6 +3881,12 @@ class TkWindow<TkObject
|
||||||
key = key.to_s
|
key = key.to_s
|
||||||
methodkeys[key] = keys.delete(key) if keys.key?(key)
|
methodkeys[key] = keys.delete(key) if keys.key?(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__ruby2val_optkeys.each{|key, method|
|
||||||
|
key = key.to_s
|
||||||
|
value = keys[key]
|
||||||
|
keys[key] = method.call(value) if value
|
||||||
|
}
|
||||||
end
|
end
|
||||||
if without_creating && keys
|
if without_creating && keys
|
||||||
#configure(keys)
|
#configure(keys)
|
||||||
|
|
|
@ -97,7 +97,7 @@ module TkComposite
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
|
|
||||||
super
|
super(slot)
|
||||||
end
|
end
|
||||||
|
|
||||||
def configure(slot, value=None)
|
def configure(slot, value=None)
|
||||||
|
@ -134,7 +134,7 @@ module TkComposite
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
|
|
||||||
super
|
super(slot, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
def configinfo(slot = nil)
|
def configinfo(slot = nil)
|
||||||
|
@ -171,10 +171,10 @@ module TkComposite
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
|
|
||||||
super
|
super(slot)
|
||||||
|
|
||||||
else # slot == nil
|
else # slot == nil
|
||||||
info_list = super
|
info_list = super(slot)
|
||||||
|
|
||||||
tbl = @delegates['DEFAULT']
|
tbl = @delegates['DEFAULT']
|
||||||
if tbl
|
if tbl
|
||||||
|
@ -250,10 +250,10 @@ module TkComposite
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
|
|
||||||
super
|
super(slot)
|
||||||
|
|
||||||
else # slot == nil
|
else # slot == nil
|
||||||
info_list = super
|
info_list = super(slot)
|
||||||
|
|
||||||
tbl = @delegates['DEFAULT']
|
tbl = @delegates['DEFAULT']
|
||||||
if tbl
|
if tbl
|
||||||
|
|
|
@ -40,12 +40,30 @@ module TkItemConfigOptkeys
|
||||||
end
|
end
|
||||||
private :__item_numlistval_optkeys
|
private :__item_numlistval_optkeys
|
||||||
|
|
||||||
def __item_tkvariable_optkeys
|
def __item_tkvariable_optkeys(id)
|
||||||
['variable']
|
['variable', 'textvariable']
|
||||||
end
|
end
|
||||||
private :__item_tkvariable_optkeys
|
private :__item_tkvariable_optkeys
|
||||||
|
|
||||||
|
def __item_val2ruby_optkeys(id) # { key=>method, ... }
|
||||||
|
# The method is used to convert a opt-value to a ruby's object.
|
||||||
|
# When get the value of the option "key", "method.call(id, val)" is called.
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
private :__item_val2ruby_optkeys
|
||||||
|
|
||||||
|
def __item_ruby2val_optkeys(id) # { key=>method, ... }
|
||||||
|
# The method is used to convert a ruby's object to a opt-value.
|
||||||
|
# When set the value of the option "key", "method.call(id, val)" is called.
|
||||||
|
# That is, "-#{key} #{method.call(id, value)}".
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
private :__item_ruby2val_optkeys
|
||||||
|
|
||||||
def __item_methodcall_optkeys(id) # { key=>method, ... }
|
def __item_methodcall_optkeys(id) # { key=>method, ... }
|
||||||
|
# Use the method for both of get and set.
|
||||||
|
# Usually, the 'key' will not be a widget option.
|
||||||
|
#
|
||||||
# maybe need to override
|
# maybe need to override
|
||||||
# {'coords'=>'coords'}
|
# {'coords'=>'coords'}
|
||||||
{}
|
{}
|
||||||
|
@ -133,6 +151,16 @@ module TkItemConfigMethod
|
||||||
fail ArgumentError, "Invalid option `#{orig_opt.inspect}'"
|
fail ArgumentError, "Invalid option `#{orig_opt.inspect}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ( method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[option] )
|
||||||
|
optval = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
|
||||||
|
begin
|
||||||
|
return method.call(tagOrId, optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
|
||||||
|
return optval
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if ( method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[option] )
|
if ( method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[option] )
|
||||||
return self.__send__(method, tagOrId)
|
return self.__send__(method, tagOrId)
|
||||||
end
|
end
|
||||||
|
@ -200,6 +228,12 @@ module TkItemConfigMethod
|
||||||
self.__send__(method, tagOrId, value) if value
|
self.__send__(method, tagOrId, value) if value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__item_ruby2val_optkeys(tagid(tagOrId)).each{|key, method|
|
||||||
|
key = key.to_s
|
||||||
|
value = slot[key]
|
||||||
|
slot[key] = method.call(tagOrId, value) if value
|
||||||
|
}
|
||||||
|
|
||||||
__item_keyonly_optkeys(tagid(tagOrId)).each{|defkey, undefkey|
|
__item_keyonly_optkeys(tagid(tagOrId)).each{|defkey, undefkey|
|
||||||
conf = slot.find{|kk, vv| kk == defkey.to_s}
|
conf = slot.find{|kk, vv| kk == defkey.to_s}
|
||||||
if conf
|
if conf
|
||||||
|
@ -233,6 +267,8 @@ module TkItemConfigMethod
|
||||||
elsif undefkey
|
elsif undefkey
|
||||||
tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{undefkey}"))
|
tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{undefkey}"))
|
||||||
end
|
end
|
||||||
|
elsif ( method = _symbolkey2str(__item_ruby2val_optkeys(tagid(tagOrId)))[slot] )
|
||||||
|
method.call(tagOrId, value)
|
||||||
elsif ( method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot] )
|
elsif ( method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot] )
|
||||||
self.__send__(method, tagOrId, value)
|
self.__send__(method, tagOrId, value)
|
||||||
elsif (slot =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
|
elsif (slot =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
|
||||||
|
@ -270,6 +306,31 @@ module TkItemConfigMethod
|
||||||
if slot
|
if slot
|
||||||
slot = slot.to_s
|
slot = slot.to_s
|
||||||
case slot
|
case slot
|
||||||
|
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
|
||||||
|
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
|
||||||
|
conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
|
||||||
|
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
|
||||||
|
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
|
||||||
|
optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(tagOrId, optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
|
||||||
|
end
|
||||||
|
if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
|
||||||
|
optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(tagOrId, optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}lcall(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
|
||||||
|
end
|
||||||
|
|
||||||
when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
|
when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
|
||||||
method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
|
method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
|
||||||
return [slot, '', '', '', self.__send__(method, tagOrId)]
|
return [slot, '', '', '', self.__send__(method, tagOrId)]
|
||||||
|
@ -411,7 +472,32 @@ module TkItemConfigMethod
|
||||||
conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
|
conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
|
||||||
conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
|
conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
|
||||||
|
|
||||||
case conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
|
optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
|
||||||
|
case optkey
|
||||||
|
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
|
||||||
|
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[optkey]
|
||||||
|
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
|
||||||
|
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
|
||||||
|
optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
|
||||||
|
begin
|
||||||
|
val = method(tagOrId, optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
|
||||||
|
end
|
||||||
|
if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
|
||||||
|
optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(tagOrId, optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
|
||||||
|
end
|
||||||
|
|
||||||
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
|
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
|
||||||
# do nothing
|
# do nothing
|
||||||
|
|
||||||
|
@ -583,6 +669,31 @@ module TkItemConfigMethod
|
||||||
if slot
|
if slot
|
||||||
slot = slot.to_s
|
slot = slot.to_s
|
||||||
case slot
|
case slot
|
||||||
|
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
|
||||||
|
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[slot]
|
||||||
|
conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), false, true)
|
||||||
|
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
|
||||||
|
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
|
||||||
|
optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(tagOrId, optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
|
||||||
|
end
|
||||||
|
if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
|
||||||
|
optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(tagOrId, optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
|
||||||
|
end
|
||||||
|
|
||||||
when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
|
when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
|
||||||
method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
|
method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
|
||||||
return {slot => ['', '', '', self.__send__(method, tagOrId)]}
|
return {slot => ['', '', '', self.__send__(method, tagOrId)]}
|
||||||
|
@ -727,7 +838,32 @@ module TkItemConfigMethod
|
||||||
conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
|
conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
|
||||||
conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
|
conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
|
||||||
|
|
||||||
case conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
|
optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
|
||||||
|
case optkey
|
||||||
|
when /^(#{__item_val2ruby_optkeys(tagid(tagOrId)).keys.join('|')})$/
|
||||||
|
method = _symbolkey2str(__item_val2ruby_optkeys(tagid(tagOrId)))[optkey]
|
||||||
|
if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
|
||||||
|
&& conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
|
||||||
|
optval = conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(tagOrId, optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = val
|
||||||
|
end
|
||||||
|
if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
|
||||||
|
optval = conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
|
||||||
|
begin
|
||||||
|
val = method.call(tagOrId, optval)
|
||||||
|
rescue => e
|
||||||
|
warn("Warning:: #{e.message} (when #{method}.call(#{tagOrId.inspect}, #{optval.inspect})") if $DEBUG
|
||||||
|
val = optval
|
||||||
|
end
|
||||||
|
conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = val
|
||||||
|
end
|
||||||
|
|
||||||
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
|
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
|
||||||
# do nothing
|
# do nothing
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,14 @@ class TkRadioButton<TkButton
|
||||||
#end
|
#end
|
||||||
#private :create_self
|
#private :create_self
|
||||||
|
|
||||||
|
def __ruby2val_optkeys # { key=>proc, ... }
|
||||||
|
{
|
||||||
|
'variable'=>proc{|v| tk_trace_variable(v)} # for backward compatibility
|
||||||
|
}
|
||||||
|
end
|
||||||
|
private :__ruby2val_optkeys
|
||||||
|
|
||||||
|
|
||||||
def deselect
|
def deselect
|
||||||
tk_send_without_enc('deselect')
|
tk_send_without_enc('deselect')
|
||||||
self
|
self
|
||||||
|
|
|
@ -51,7 +51,7 @@ class TkSpinbox<TkEntry
|
||||||
end
|
end
|
||||||
|
|
||||||
def __validation_class_list
|
def __validation_class_list
|
||||||
super << SpinCommand
|
super() << SpinCommand
|
||||||
end
|
end
|
||||||
|
|
||||||
Tk::ValidateConfigure.__def_validcmd(binding, SpinCommand)
|
Tk::ValidateConfigure.__def_validcmd(binding, SpinCommand)
|
||||||
|
|
|
@ -460,13 +460,13 @@ class TkText<TkTextWin
|
||||||
args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist
|
args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist
|
||||||
args << tags.shift if tags.size > 0 # chars
|
args << tags.shift if tags.size > 0 # chars
|
||||||
end
|
end
|
||||||
super index, *args
|
super(index, *args)
|
||||||
else
|
else
|
||||||
# single chars-taglist argument :: str, tag, tag, ...
|
# single chars-taglist argument :: str, tag, tag, ...
|
||||||
if tags.size == 0
|
if tags.size == 0
|
||||||
super index, chars
|
super(index, chars)
|
||||||
else
|
else
|
||||||
super index, chars, tags.collect{|x|_get_eval_string(x)}.join(' ')
|
super(index, chars, tags.collect{|x|_get_eval_string(x)}.join(' '))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -476,7 +476,7 @@ class TkText<TkTextWin
|
||||||
@tags.each_value do |t|
|
@tags.each_value do |t|
|
||||||
t.destroy
|
t.destroy
|
||||||
end
|
end
|
||||||
super
|
super()
|
||||||
end
|
end
|
||||||
|
|
||||||
def backspace
|
def backspace
|
||||||
|
|
|
@ -337,7 +337,7 @@ module TkValidation
|
||||||
#####################################
|
#####################################
|
||||||
|
|
||||||
def __validation_class_list
|
def __validation_class_list
|
||||||
super << ValidateCmd
|
super() << ValidateCmd
|
||||||
end
|
end
|
||||||
|
|
||||||
Tk::ValidateConfigure.__def_validcmd(binding, ValidateCmd)
|
Tk::ValidateConfigure.__def_validcmd(binding, ValidateCmd)
|
||||||
|
|
|
@ -26,6 +26,11 @@ module Tk::BLT
|
||||||
end
|
end
|
||||||
private :__strval_optkeys
|
private :__strval_optkeys
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'colormap' << 'fontmap'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
BarElement_ID = ['blt_barchart_bar'.freeze, '00000'.taint].freeze
|
BarElement_ID = ['blt_barchart_bar'.freeze, '00000'.taint].freeze
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,13 @@ module Tk::BLT
|
||||||
['dashes']
|
['dashes']
|
||||||
end
|
end
|
||||||
private :__item_numlistval_optkeys
|
private :__item_numlistval_optkeys
|
||||||
|
|
||||||
|
def __item_tkvariable_optkeys(id)
|
||||||
|
['variable', 'textvariable', 'colormap', 'fontmap']
|
||||||
end
|
end
|
||||||
|
private :__item_tkvariable_optkeys
|
||||||
|
end
|
||||||
|
|
||||||
include OptKeys
|
include OptKeys
|
||||||
|
|
||||||
def __item_cget_cmd(id)
|
def __item_cget_cmd(id)
|
||||||
|
|
|
@ -105,7 +105,7 @@ module Tk::BLT
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.__validation_class_list
|
def self.__validation_class_list
|
||||||
super << PackageCommand << SiteCommand
|
super() << PackageCommand << SiteCommand
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
|
@ -234,7 +234,7 @@ class Tk::BLT::Treeview
|
||||||
end
|
end
|
||||||
|
|
||||||
def __validation_class_list
|
def __validation_class_list
|
||||||
super << OpenCloseCommand
|
super() << OpenCloseCommand
|
||||||
end
|
end
|
||||||
|
|
||||||
Tk::ValidateConfigure.__def_validcmd(binding, OpenCloseCommand)
|
Tk::ValidateConfigure.__def_validcmd(binding, OpenCloseCommand)
|
||||||
|
|
|
@ -18,4 +18,9 @@ class Tk::BWidget::Button
|
||||||
TkCommandNames = ['Button'.freeze].freeze
|
TkCommandNames = ['Button'.freeze].freeze
|
||||||
WidgetClassName = 'Button'.freeze
|
WidgetClassName = 'Button'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'helpvar'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,11 @@ class Tk::BWidget::Entry
|
||||||
WidgetClassName = 'Entry'.freeze
|
WidgetClassName = 'Entry'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'helpvar'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
def invoke
|
def invoke
|
||||||
tk_send_without_enc('invoke')
|
tk_send_without_enc('invoke')
|
||||||
self
|
self
|
||||||
|
|
|
@ -19,6 +19,11 @@ class Tk::BWidget::Label
|
||||||
WidgetClassName = 'Label'.freeze
|
WidgetClassName = 'Label'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'helpvar'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
def set_focus
|
def set_focus
|
||||||
tk_send_without_enc('setfocus')
|
tk_send_without_enc('setfocus')
|
||||||
self
|
self
|
||||||
|
|
|
@ -23,6 +23,11 @@ class Tk::BWidget::LabelEntry
|
||||||
WidgetClassName = 'LabelEntry'.freeze
|
WidgetClassName = 'LabelEntry'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'helpvar'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
#def entrybind(*args)
|
#def entrybind(*args)
|
||||||
# _bind([path, 'bind'], *args)
|
# _bind([path, 'bind'], *args)
|
||||||
# self
|
# self
|
||||||
|
|
|
@ -19,6 +19,11 @@ class Tk::BWidget::LabelFrame
|
||||||
WidgetClassName = 'LabelFrame'.freeze
|
WidgetClassName = 'LabelFrame'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'helpvar'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
def self.align(*args)
|
def self.align(*args)
|
||||||
tk_call('LabelFrame::align', *args)
|
tk_call('LabelFrame::align', *args)
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,6 +20,11 @@ class Tk::BWidget::MainFrame
|
||||||
WidgetClassName = 'MainFrame'.freeze
|
WidgetClassName = 'MainFrame'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'progressvar'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
def add_indicator(keys={}, &b)
|
def add_indicator(keys={}, &b)
|
||||||
win = window(tk_send('addindicator', *hash_kv(keys)))
|
win = window(tk_send('addindicator', *hash_kv(keys)))
|
||||||
win.instance_eval(&b) if b
|
win.instance_eval(&b) if b
|
||||||
|
|
|
@ -19,6 +19,12 @@ class Tk::BWidget::PasswdDlg
|
||||||
WidgetClassName = 'PasswdDlg'.freeze
|
WidgetClassName = 'PasswdDlg'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'loginhelpvar' << 'logintextvariable' <<
|
||||||
|
'passwdhelpvar' << 'passwdtextvariable'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
def create
|
def create
|
||||||
login, passwd = simplelist(tk_call(self.class::TkCommandNames[0],
|
login, passwd = simplelist(tk_call(self.class::TkCommandNames[0],
|
||||||
@path, *hash_kv(@keys)))
|
@path, *hash_kv(@keys)))
|
||||||
|
|
|
@ -22,6 +22,11 @@ class Tk::BWidget::SpinBox
|
||||||
WidgetClassName = 'SpinBox'.freeze
|
WidgetClassName = 'SpinBox'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'helpvar'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
#def entrybind(*args)
|
#def entrybind(*args)
|
||||||
# _bind([path, 'bind'], *args)
|
# _bind([path, 'bind'], *args)
|
||||||
# self
|
# self
|
||||||
|
|
|
@ -32,6 +32,11 @@ class Tk::BWidget::Tree
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'helpvar'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
def tagid(tag)
|
def tagid(tag)
|
||||||
if tag.kind_of?(Tk::BWidget::Tree::Node)
|
if tag.kind_of?(Tk::BWidget::Tree::Node)
|
||||||
tag.id
|
tag.id
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Tk::Iwidgets::Calendar
|
||||||
end
|
end
|
||||||
|
|
||||||
def __validation_class_list
|
def __validation_class_list
|
||||||
super << CalendarCommand
|
super() << CalendarCommand
|
||||||
end
|
end
|
||||||
|
|
||||||
Tk::ValidateConfigure.__def_validcmd(binding, CalendarCommand)
|
Tk::ValidateConfigure.__def_validcmd(binding, CalendarCommand)
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Tk::Iwidgets::Entryfield
|
||||||
end
|
end
|
||||||
|
|
||||||
def __validation_class_list
|
def __validation_class_list
|
||||||
super << EntryfieldValidate
|
super() << EntryfieldValidate
|
||||||
end
|
end
|
||||||
|
|
||||||
Tk::ValidateConfigure.__def_validcmd(binding, EntryfieldValidate)
|
Tk::ValidateConfigure.__def_validcmd(binding, EntryfieldValidate)
|
||||||
|
|
|
@ -92,7 +92,7 @@ class Tk::Iwidgets::Hierarchy
|
||||||
end
|
end
|
||||||
|
|
||||||
def __validation_class_list
|
def __validation_class_list
|
||||||
super << QueryCommand << IndicatorCommand << IconCommand
|
super() << QueryCommand << IndicatorCommand << IconCommand
|
||||||
end
|
end
|
||||||
|
|
||||||
Tk::ValidateConfigure.__def_validcmd(binding, QueryCommand)
|
Tk::ValidateConfigure.__def_validcmd(binding, QueryCommand)
|
||||||
|
@ -237,13 +237,13 @@ class Tk::Iwidgets::Hierarchy
|
||||||
args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist
|
args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist
|
||||||
args << tags.shift if tags.size > 0 # chars
|
args << tags.shift if tags.size > 0 # chars
|
||||||
end
|
end
|
||||||
super index, *args
|
super(index, *args)
|
||||||
else
|
else
|
||||||
# single chars-taglist argument :: str, tag, tag, ...
|
# single chars-taglist argument :: str, tag, tag, ...
|
||||||
if tags.size == 0
|
if tags.size == 0
|
||||||
super index, chars
|
super(index, chars)
|
||||||
else
|
else
|
||||||
super index, chars, tags.collect{|x|_get_eval_string(x)}.join(' ')
|
super(index, chars, tags.collect{|x|_get_eval_string(x)}.join(' '))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,11 @@ class Tk::Iwidgets::Labeledframe
|
||||||
WidgetClassName = 'Labeledframe'.freeze
|
WidgetClassName = 'Labeledframe'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'labelvariable'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
def child_site
|
def child_site
|
||||||
window(tk_call(@path, 'childsite'))
|
window(tk_call(@path, 'childsite'))
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,6 +20,11 @@ class Tk::Iwidgets::Labeledwidget
|
||||||
WidgetClassName = 'Labeledwidget'.freeze
|
WidgetClassName = 'Labeledwidget'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'labelvariable'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
def self.alignlabels(*wins)
|
def self.alignlabels(*wins)
|
||||||
tk_call('::iwidgets::Labeledwidget::alignlabels', *wins)
|
tk_call('::iwidgets::Labeledwidget::alignlabels', *wins)
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,11 @@ class Tk::Iwidgets::Menubar
|
||||||
WidgetClassName = 'Menubar'.freeze
|
WidgetClassName = 'Menubar'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'helpvariable'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
|
|
||||||
include TkItemConfigMethod
|
include TkItemConfigMethod
|
||||||
|
|
|
@ -19,6 +19,11 @@ class Tk::Iwidgets::Scrolledlistbox
|
||||||
WidgetClassName = 'Scrolledlistbox'.freeze
|
WidgetClassName = 'Scrolledlistbox'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'listvariable'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
################################
|
################################
|
||||||
|
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Tk::Iwidgets::Spinner
|
||||||
end
|
end
|
||||||
|
|
||||||
def __validation_class_list
|
def __validation_class_list
|
||||||
super << EntryfieldValidate
|
super() << EntryfieldValidate
|
||||||
end
|
end
|
||||||
|
|
||||||
Tk::ValidateConfigure.__def_validcmd(binding, EntryfieldValidate)
|
Tk::ValidateConfigure.__def_validcmd(binding, EntryfieldValidate)
|
||||||
|
|
|
@ -18,6 +18,11 @@ class Tk::Iwidgets::Toolbar
|
||||||
WidgetClassName = 'Toolbar'.freeze
|
WidgetClassName = 'Toolbar'.freeze
|
||||||
WidgetClassNames[WidgetClassName] = self
|
WidgetClassNames[WidgetClassName] = self
|
||||||
|
|
||||||
|
def __tkvariable_optkeys
|
||||||
|
super() << 'helpvariable'
|
||||||
|
end
|
||||||
|
private :__tkvariable_optkeys
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
|
|
||||||
include TkItemConfigMethod
|
include TkItemConfigMethod
|
||||||
|
|
|
@ -39,6 +39,6 @@ class TkPixmapImage<TkImage
|
||||||
|
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
@type = 'pixmap'
|
@type = 'pixmap'
|
||||||
super
|
super(*args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -340,7 +340,7 @@ class Tk::TkTable
|
||||||
#################################
|
#################################
|
||||||
|
|
||||||
def __validation_class_list
|
def __validation_class_list
|
||||||
super <<
|
super() <<
|
||||||
BrowseCommand << CellCommand << SelectionCommand << ValidateCommand
|
BrowseCommand << CellCommand << SelectionCommand << ValidateCommand
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,11 @@ static VALUE eTkCallbackContinue;
|
||||||
|
|
||||||
static VALUE eLocalJumpError;
|
static VALUE eLocalJumpError;
|
||||||
|
|
||||||
|
static VALUE eTkLocalJumpError;
|
||||||
|
static VALUE eTkCallbackRetry;
|
||||||
|
static VALUE eTkCallbackRedo;
|
||||||
|
static VALUE eTkCallbackThrow;
|
||||||
|
|
||||||
static ID ID_at_enc;
|
static ID ID_at_enc;
|
||||||
static ID ID_at_interp;
|
static ID ID_at_interp;
|
||||||
|
|
||||||
|
@ -192,7 +197,7 @@ Tcl_SetVar2Ex(interp, name1, name2, newValObj, flags)
|
||||||
CONST char *name2;
|
CONST char *name2;
|
||||||
Tcl_Obj *newValObj;
|
Tcl_Obj *newValObj;
|
||||||
int flags;
|
int flags;
|
||||||
{
|
|
||||||
Tcl_Obj *nameObj1, *nameObj2 = NULL, *retObj;
|
Tcl_Obj *nameObj1, *nameObj2 = NULL, *retObj;
|
||||||
|
|
||||||
nameObj1 = Tcl_NewStringObj(name1, -1);
|
nameObj1 = Tcl_NewStringObj(name1, -1);
|
||||||
|
@ -765,6 +770,18 @@ pending_exception_check0()
|
||||||
return 1; /* pending */
|
return 1; /* pending */
|
||||||
} else {
|
} else {
|
||||||
rbtk_pending_exception = Qnil;
|
rbtk_pending_exception = Qnil;
|
||||||
|
|
||||||
|
if (rb_obj_is_kind_of(exc, eTkCallbackRetry)) {
|
||||||
|
DUMP1("pending_exception_check0: call rb_jump_tag(retry)");
|
||||||
|
rb_jump_tag(TAG_RETRY);
|
||||||
|
} else if (rb_obj_is_kind_of(exc, eTkCallbackRedo)) {
|
||||||
|
DUMP1("pending_exception_check0: call rb_jump_tag(redo)");
|
||||||
|
rb_jump_tag(TAG_REDO);
|
||||||
|
} else if (rb_obj_is_kind_of(exc, eTkCallbackThrow)) {
|
||||||
|
DUMP1("pending_exception_check0: call rb_jump_tag(throw)");
|
||||||
|
rb_jump_tag(TAG_THROW);
|
||||||
|
}
|
||||||
|
|
||||||
rb_exc_raise(exc);
|
rb_exc_raise(exc);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -794,6 +811,16 @@ pending_exception_check1(thr_crit_bup, ptr)
|
||||||
|
|
||||||
rb_thread_critical = thr_crit_bup;
|
rb_thread_critical = thr_crit_bup;
|
||||||
|
|
||||||
|
if (rb_obj_is_kind_of(exc, eTkCallbackRetry)) {
|
||||||
|
DUMP1("pending_exception_check1: call rb_jump_tag(retry)");
|
||||||
|
rb_jump_tag(TAG_RETRY);
|
||||||
|
} else if (rb_obj_is_kind_of(exc, eTkCallbackRedo)) {
|
||||||
|
DUMP1("pending_exception_check1: call rb_jump_tag(redo)");
|
||||||
|
rb_jump_tag(TAG_REDO);
|
||||||
|
} else if (rb_obj_is_kind_of(exc, eTkCallbackThrow)) {
|
||||||
|
DUMP1("pending_exception_check1: call rb_jump_tag(throw)");
|
||||||
|
rb_jump_tag(TAG_THROW);
|
||||||
|
}
|
||||||
rb_exc_raise(exc);
|
rb_exc_raise(exc);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2172,9 +2199,18 @@ tcl_protect_core(interp, proc, data) /* should not raise exception */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TAG_RETRY:
|
case TAG_RETRY:
|
||||||
|
if (NIL_P(ruby_errinfo)) {
|
||||||
|
DUMP1("rb_protect: retry");
|
||||||
|
exc = rb_exc_new2(eTkCallbackRetry, "retry jump error");
|
||||||
|
} else {
|
||||||
|
exc = ruby_errinfo;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case TAG_REDO:
|
case TAG_REDO:
|
||||||
if (NIL_P(ruby_errinfo)) {
|
if (NIL_P(ruby_errinfo)) {
|
||||||
rb_jump_tag(status); /* danger */
|
DUMP1("rb_protect: redo");
|
||||||
|
exc = rb_exc_new2(eTkCallbackRedo, "redo jump error");
|
||||||
} else {
|
} else {
|
||||||
exc = ruby_errinfo;
|
exc = ruby_errinfo;
|
||||||
}
|
}
|
||||||
|
@ -2198,7 +2234,8 @@ tcl_protect_core(interp, proc, data) /* should not raise exception */
|
||||||
|
|
||||||
case TAG_THROW:
|
case TAG_THROW:
|
||||||
if (NIL_P(ruby_errinfo)) {
|
if (NIL_P(ruby_errinfo)) {
|
||||||
rb_jump_tag(TAG_THROW); /* danger */
|
DUMP1("rb_protect: throw");
|
||||||
|
exc = rb_exc_new2(eTkCallbackThrow, "throw jump error");
|
||||||
} else {
|
} else {
|
||||||
exc = ruby_errinfo;
|
exc = ruby_errinfo;
|
||||||
}
|
}
|
||||||
|
@ -2255,6 +2292,11 @@ tcl_protect_core(interp, proc, data) /* should not raise exception */
|
||||||
return TCL_RETURN;
|
return TCL_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rb_obj_is_kind_of(exc, eTkLocalJumpError)) {
|
||||||
|
rbtk_pending_exception = exc;
|
||||||
|
return TCL_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (rb_obj_is_kind_of(exc, eLocalJumpError)) {
|
if (rb_obj_is_kind_of(exc, eLocalJumpError)) {
|
||||||
VALUE reason = rb_ivar_get(exc, ID_at_reason);
|
VALUE reason = rb_ivar_get(exc, ID_at_reason);
|
||||||
|
|
||||||
|
@ -5215,9 +5257,16 @@ get_obj_from_str(str)
|
||||||
return Tcl_NewStringObj(s, RSTRING(str)->len);
|
return Tcl_NewStringObj(s, RSTRING(str)->len);
|
||||||
#else /* TCL_VERSION >= 8.1 */
|
#else /* TCL_VERSION >= 8.1 */
|
||||||
VALUE enc = rb_attr_get(str, ID_at_enc);
|
VALUE enc = rb_attr_get(str, ID_at_enc);
|
||||||
if (!NIL_P(enc) && strcmp(StringValuePtr(enc), "binary") == 0) {
|
|
||||||
|
if (!NIL_P(enc)) {
|
||||||
|
StringValue(enc);
|
||||||
|
if (strcmp(RSTRING(enc)->ptr, "binary") == 0) {
|
||||||
/* binary string */
|
/* binary string */
|
||||||
return Tcl_NewByteArrayObj(s, RSTRING(str)->len);
|
return Tcl_NewByteArrayObj(s, RSTRING(str)->len);
|
||||||
|
} else {
|
||||||
|
/* text string */
|
||||||
|
return Tcl_NewStringObj(s, RSTRING(str)->len);
|
||||||
|
}
|
||||||
} else if (strlen(s) != RSTRING(str)->len) {
|
} else if (strlen(s) != RSTRING(str)->len) {
|
||||||
/* probably binary string */
|
/* probably binary string */
|
||||||
return Tcl_NewByteArrayObj(s, RSTRING(str)->len);
|
return Tcl_NewByteArrayObj(s, RSTRING(str)->len);
|
||||||
|
@ -6030,11 +6079,14 @@ lib_fromUTF8_core(ip_obj, src, encodename)
|
||||||
|
|
||||||
if (TYPE(str) == T_STRING) {
|
if (TYPE(str) == T_STRING) {
|
||||||
enc = rb_attr_get(str, ID_at_enc);
|
enc = rb_attr_get(str, ID_at_enc);
|
||||||
if (!NIL_P(enc) && strcmp(StringValuePtr(enc), "binary") == 0) {
|
if (!NIL_P(enc)) {
|
||||||
|
StringValue(enc);
|
||||||
|
if (strcmp(RSTRING(enc)->ptr, "binary") == 0) {
|
||||||
rb_thread_critical = thr_crit_bup;
|
rb_thread_critical = thr_crit_bup;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (NIL_P(ip_obj)) {
|
if (NIL_P(ip_obj)) {
|
||||||
encoding = (Tcl_Encoding)NULL;
|
encoding = (Tcl_Encoding)NULL;
|
||||||
|
@ -7629,6 +7681,14 @@ Init_tcltklib()
|
||||||
|
|
||||||
eLocalJumpError = rb_const_get(rb_cObject, rb_intern("LocalJumpError"));
|
eLocalJumpError = rb_const_get(rb_cObject, rb_intern("LocalJumpError"));
|
||||||
|
|
||||||
|
eTkLocalJumpError = rb_define_class("TkLocalJumpError", eLocalJumpError);
|
||||||
|
|
||||||
|
eTkCallbackRetry = rb_define_class("TkCallbackRetry", eTkLocalJumpError);
|
||||||
|
eTkCallbackRedo = rb_define_class("TkCallbackRedo", eTkLocalJumpError);
|
||||||
|
eTkCallbackThrow = rb_define_class("TkCallbackThrow", eTkLocalJumpError);
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------- */
|
||||||
|
|
||||||
ID_at_enc = rb_intern("@encoding");
|
ID_at_enc = rb_intern("@encoding");
|
||||||
ID_at_interp = rb_intern("@interp");
|
ID_at_interp = rb_intern("@interp");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue