diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-11 04:51:21 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-11 04:51:21 +0000 |
commit | 3514110b89bee5c37e308b4ca887e66dfe841456 (patch) | |
tree | d280d8542cc44d1cd1a75e8ec87b1f9d231561b7 /ext/tk/lib/tkextlib | |
parent | 05f5928c9d0f094d1e7e21a9bd9d8a8fc2f1a805 (diff) | |
download | ruby-3514110b89bee5c37e308b4ca887e66dfe841456.tar.gz |
* ext/tk/lib/tk/*: untabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkextlib')
58 files changed, 1207 insertions, 1207 deletions
diff --git a/ext/tk/lib/tkextlib/ICONS/icons.rb b/ext/tk/lib/tkextlib/ICONS/icons.rb index 275903f302..20d706df65 100644 --- a/ext/tk/lib/tkextlib/ICONS/icons.rb +++ b/ext/tk/lib/tkextlib/ICONS/icons.rb @@ -20,20 +20,20 @@ module Tk def self.package_version begin - TkPackage.require('icons') + TkPackage.require('icons') rescue - '' + '' end end def self.create(*args) # icon, icon, ..., ?option=>value, ...? if args[-1].kind_of?(Hash) - keys = args.pop - icons = simplelist(tk_call('::icons::icons', 'create', - *(hash_kv(keys) << (args.flatten)))) + keys = args.pop + icons = simplelist(tk_call('::icons::icons', 'create', + *(hash_kv(keys) << (args.flatten)))) else - icons = simplelist(tk_call('::icons::icons', 'create', - args.flatten)) + icons = simplelist(tk_call('::icons::icons', 'create', + args.flatten)) end icons.collect{|icon| self.new(icon, :without_creating=>true)} @@ -43,28 +43,28 @@ module Tk icons = icons.flatten return if icons.empty? icons.map!{|icon| - if icon.kind_of?(Tk::ICONS) - Tk_IMGTBL.delete(icon.path) - icon.name - elsif icon.to_s =~ /^::icon::(.*)/ - name = $1 - Tk_IMGTBL.delete(icon) - name - else - Tk_IMGTBL.delete("::icon::#{icon}") - icon - end + if icon.kind_of?(Tk::ICONS) + Tk_IMGTBL.delete(icon.path) + icon.name + elsif icon.to_s =~ /^::icon::(.*)/ + name = $1 + Tk_IMGTBL.delete(icon) + name + else + Tk_IMGTBL.delete("::icon::#{icon}") + icon + end } tk_call('::icons::icons', 'delete', icons) end def self.query(*args) # icon, icon, ..., ?option=>value, ...? if args[-1].kind_of?(Hash) - keys = args.pop - simplelist(tk_call('::icons::icons', 'query', - *(hash_kv(keys) << (args.flatten)))) + keys = args.pop + simplelist(tk_call('::icons::icons', 'query', + *(hash_kv(keys) << (args.flatten)))) else - simplelist(tk_call('::icons::icons', 'query', args.flatten)) + simplelist(tk_call('::icons::icons', 'query', args.flatten)) end . map{|inf| list(inf) } end @@ -76,15 +76,15 @@ module Tk def initialize(name, keys=nil) if name.kind_of?(String) && name =~ /^::icon::(.+)$/ - @name = $1 - @path = name + @name = $1 + @path = name else - @name = name.to_s - @path = "::icon::#{@name}" + @name = name.to_s + @path = "::icon::#{@name}" end keys = _symbolkey2str(keys) unless keys.delete('without_creating') - tk_call('::icons::icons', 'create', *(hash_kv(keys) << @name)) + tk_call('::icons::icons', 'create', *(hash_kv(keys) << @name)) end Tk_IMGTBL[@path] = self end @@ -101,8 +101,8 @@ module Tk def query(keys={}) list(simplelist(tk_call('::icons::icons', 'query', - *(hash_kv(keys) << @name)) - )[0]) + *(hash_kv(keys) << @name)) + )[0]) end end end diff --git a/ext/tk/lib/tkextlib/bwidget.rb b/ext/tk/lib/tkextlib/bwidget.rb index 2fe0089765..56009f4694 100644 --- a/ext/tk/lib/tkextlib/bwidget.rb +++ b/ext/tk/lib/tkextlib/bwidget.rb @@ -25,16 +25,16 @@ module Tk def self.package_version begin - TkPackage.require('BWidget') + TkPackage.require('BWidget') rescue - '' + '' end end def self.XLFDfont(cmd, *args) if args[-1].kind_of?(Hash) - keys = args.pop - args.concat(hash_kv(keys)) + keys = args.pop + args.concat(hash_kv(keys)) end tk_call('BWidget::XLFDfont', cmd, *args) end @@ -93,8 +93,8 @@ module Tk def self.place(path, w, h, *args) if args[-1].kind_of?(Hash) - keys = args.pop - args.concat(hash_kv(keys)) + keys = args.pop + args.concat(hash_kv(keys)) end tk_call('BWidget::place', path, w, h, *(args.flatten)) end diff --git a/ext/tk/lib/tkextlib/bwidget/dialog.rb b/ext/tk/lib/tkextlib/bwidget/dialog.rb index 4a60a7ceb4..d175a2d8bb 100644 --- a/ext/tk/lib/tkextlib/bwidget/dialog.rb +++ b/ext/tk/lib/tkextlib/bwidget/dialog.rb @@ -43,7 +43,7 @@ class Tk::BWidget::Dialog cmd = self.class::TkCommandNames[0] if keys and keys != None tk_call_without_enc(cmd, @path, '-parent', @relative, - *hash_kv(keys, true)) + *hash_kv(keys, true)) else tk_call_without_enc(cmd, @path, '-parent', @relative) end @@ -64,9 +64,9 @@ class Tk::BWidget::Dialog super(slot) else if slot.to_s == 'relative' - super('parent', value) + super('parent', value) else - super(slot, value) + super(slot, value) end end end @@ -74,16 +74,16 @@ class Tk::BWidget::Dialog def configinfo(slot=nil) if slot if slot.to_s == 'relative' - super('parent') + super('parent') else - super(slot) + super(slot) end else ret = super() if TkComm::GET_CONFIGINFO_AS_ARRAY - ret << ['relative', 'parent'] + ret << ['relative', 'parent'] else - ret['relative'] = 'parent' + ret['relative'] = 'parent' end end end diff --git a/ext/tk/lib/tkextlib/bwidget/listbox.rb b/ext/tk/lib/tkextlib/bwidget/listbox.rb index 102be9a5fa..9f505703f2 100644 --- a/ext/tk/lib/tkextlib/bwidget/listbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/listbox.rb @@ -30,7 +30,7 @@ class Tk::BWidget::ListBox class Event_for_Items < TkEvent::Event def self._get_extra_args_tbl [ - TkComm.method(:string) # item idenfier + TkComm.method(:string) # item idenfier ] end end @@ -135,19 +135,19 @@ class Tk::BWidget::ListBox def selection_set(*args) tk_send_without_enc('selection', 'set', - *(args.collect{|item| tagid(item)})) + *(args.collect{|item| tagid(item)})) self end def selection_add(*args) tk_send_without_enc('selection', 'add', - *(args.collect{|item| tagid(item)})) + *(args.collect{|item| tagid(item)})) self end def selection_remove(*args) tk_send_without_enc('selection', 'remove', - *(args.collect{|item| tagid(item)})) + *(args.collect{|item| tagid(item)})) self end @@ -177,7 +177,7 @@ class Tk::BWidget::ListBox::Item @listbox = lbox else fail RuntimeError, - "expect Tk::BWidget::ListBox or Tk::BWidget::ListBox::Item for 1st argument" + "expect Tk::BWidget::ListBox or Tk::BWidget::ListBox::Item for 1st argument" end if args[-1].kind_of?(Hash) diff --git a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb index 55cc4ba0de..d7b2bbc32b 100644 --- a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb @@ -65,22 +65,22 @@ class Tk::BWidget::MessageDlg @keys.update(slot) if @info - # update @info - slot.each{|k, v| - if TkComm::GET_CONFIGINFO_AS_ARRAY - if (inf = @info.assoc(k)) - inf[-1] = v - else - @info << [k, '', '', '', v] - end - else - if (inf = @info[k]) - inf[-1] = v - else - @info[k] = ['', '', '', v] - end - end - } + # update @info + slot.each{|k, v| + if TkComm::GET_CONFIGINFO_AS_ARRAY + if (inf = @info.assoc(k)) + inf[-1] = v + else + @info << [k, '', '', '', v] + end + else + if (inf = @info[k]) + inf[-1] = v + else + @info[k] = ['', '', '', v] + end + end + } end else # ! Hash @@ -89,20 +89,20 @@ class Tk::BWidget::MessageDlg @keys[slot] = value if @info - # update @info - if TkComm::GET_CONFIGINFO_AS_ARRAY - if (inf = @info.assoc(slot)) - inf[-1] = value - else - @info << [slot, '', '', '', value] - end - else - if (inf = @info[slot]) - inf[-1] = value - else - @info[slot] = ['', '', '', value] - end - end + # update @info + if TkComm::GET_CONFIGINFO_AS_ARRAY + if (inf = @info.assoc(slot)) + inf[-1] = value + else + @info << [slot, '', '', '', value] + end + else + if (inf = @info[slot]) + inf[-1] = value + else + @info[slot] = ['', '', '', value] + end + end end end @@ -113,50 +113,50 @@ class Tk::BWidget::MessageDlg if winfo_exist? @info = super() if TkComm::GET_CONFIGINFO_AS_ARRAY - @info << ['relative', 'parent'] + @info << ['relative', 'parent'] else - @info['relative'] = 'parent' + @info['relative'] = 'parent' end end if TkComm::GET_CONFIGINFO_AS_ARRAY if @info - if winfo_exist? - # update @keys - @info.each{|inf| @keys[inf[0]] = inf[-1] if inf.size > 2 } - end + if winfo_exist? + # update @keys + @info.each{|inf| @keys[inf[0]] = inf[-1] if inf.size > 2 } + end else - @info = [] - @keys.each{|k, v| - @info << [k, '', '', '', v] - } - @info << ['relative', 'parent'] + @info = [] + @keys.each{|k, v| + @info << [k, '', '', '', v] + } + @info << ['relative', 'parent'] end if slot - @info.asoc(slot.to_s).dup + @info.asoc(slot.to_s).dup else - @info.dup + @info.dup end else # ! TkComm::GET_CONFIGINFO_AS_ARRAY if @info - if winfo_exist? - # update @keys - @info.each{|k, inf| @keys[k] = inf[-1] if inf.size > 2 } - end + if winfo_exist? + # update @keys + @info.each{|k, inf| @keys[k] = inf[-1] if inf.size > 2 } + end else - @info = {} - @keys.each{|k, v| - @info[k] = ['', '', '', v] - } - @info['relative'] = 'parent' + @info = {} + @keys.each{|k, v| + @info[k] = ['', '', '', v] + } + @info['relative'] = 'parent' end if slot - @info[slot.to_s].dup + @info[slot.to_s].dup else - @info.dup + @info.dup end end end diff --git a/ext/tk/lib/tkextlib/bwidget/notebook.rb b/ext/tk/lib/tkextlib/bwidget/notebook.rb index 26c11ac0dd..e0cc04d30e 100644 --- a/ext/tk/lib/tkextlib/bwidget/notebook.rb +++ b/ext/tk/lib/tkextlib/bwidget/notebook.rb @@ -24,7 +24,7 @@ class Tk::BWidget::NoteBook class Event_for_Tabs < TkEvent::Event def self._get_extra_args_tbl [ - TkComm.method(:string) # page idenfier + TkComm.method(:string) # page idenfier ] end end diff --git a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb index 399353367c..7136ae8d72 100644 --- a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb @@ -21,7 +21,7 @@ class Tk::BWidget::PasswdDlg def create login, passwd = simplelist(tk_call(self.class::TkCommandNames[0], - @path, *hash_kv(@keys))) + @path, *hash_kv(@keys))) [login, passwd] end end diff --git a/ext/tk/lib/tkextlib/bwidget/tree.rb b/ext/tk/lib/tkextlib/bwidget/tree.rb index f657e7148e..9a49a96bb7 100644 --- a/ext/tk/lib/tkextlib/bwidget/tree.rb +++ b/ext/tk/lib/tkextlib/bwidget/tree.rb @@ -27,7 +27,7 @@ class Tk::BWidget::Tree class Event_for_Items < TkEvent::Event def self._get_extra_args_tbl [ - TkComm.method(:string) # item idenfier + TkComm.method(:string) # item idenfier ] end end @@ -147,7 +147,7 @@ class Tk::BWidget::Tree def selection_add(*args) tk_send_without_enc('selection', 'add', - *(args.collect{|node| tagid(node)})) + *(args.collect{|node| tagid(node)})) self end @@ -162,30 +162,30 @@ class Tk::BWidget::Tree def selection_include?(*args) bool(tk_send_without_enc('selection', 'get', - *(args.collect{|node| tagid(node)}))) + *(args.collect{|node| tagid(node)}))) end def selection_range(*args) tk_send_without_enc('selection', 'range', - *(args.collect{|node| tagid(node)})) + *(args.collect{|node| tagid(node)})) self end def selection_remove(*args) tk_send_without_enc('selection', 'remove', - *(args.collect{|node| tagid(node)})) + *(args.collect{|node| tagid(node)})) self end def selection_set(*args) tk_send_without_enc('selection', 'set', - *(args.collect{|node| tagid(node)})) + *(args.collect{|node| tagid(node)})) self end def selection_toggle(*args) tk_send_without_enc('selection', 'toggle', - *(args.collect{|node| tagid(node)})) + *(args.collect{|node| tagid(node)})) self end @@ -218,16 +218,16 @@ class Tk::BWidget::Tree::Node @tree = tree parent = args.shift if parent.kind_of?(Tk::BWidget::Tree::Node) - if parent.tree.path != @tree.path - fail RuntimeError, 'tree of parent node is not match' - end + if parent.tree.path != @tree.path + fail RuntimeError, 'tree of parent node is not match' + end end elsif tree.kind_of?(Tk::BWidget::Tree::Node) @tree = tree.tree parent = tree.parent else fail RuntimeError, - "expect Tk::BWidget::Tree or Tk::BWidget::Tree::Node for 1st argument" + "expect Tk::BWidget::Tree or Tk::BWidget::Tree::Node for 1st argument" end if args[-1].kind_of?(Hash) diff --git a/ext/tk/lib/tkextlib/itcl/incr_tcl.rb b/ext/tk/lib/tkextlib/itcl/incr_tcl.rb index 9e53a9be8b..c03f3c36cb 100644 --- a/ext/tk/lib/tkextlib/itcl/incr_tcl.rb +++ b/ext/tk/lib/tkextlib/itcl/incr_tcl.rb @@ -24,9 +24,9 @@ module Tk def self.package_version begin - TkPackage.require('Itcl') + TkPackage.require('Itcl') rescue - '' + '' end end @@ -39,59 +39,59 @@ module Tk ITCL_OBJ_TBL = {}.taint def initialize(*args) - if (@klass = self.class::ITCL_CLASSNAME).empty? - fail RuntimeError, 'unknown itcl class (abstract class?)' - end - @id = Tk::Itcl::ItclObject::TCL_OBJ_ID.join(TkCore::INTERP._ip_id_) - @path = @id - Tk::Itcl::ItclObject::ITCL_OBJ_ID[1].succ! + if (@klass = self.class::ITCL_CLASSNAME).empty? + fail RuntimeError, 'unknown itcl class (abstract class?)' + end + @id = Tk::Itcl::ItclObject::TCL_OBJ_ID.join(TkCore::INTERP._ip_id_) + @path = @id + Tk::Itcl::ItclObject::ITCL_OBJ_ID[1].succ! end def self.call_proc(name, *args) - tk_call("#{ITCL_CLASSNAME}::#{cmd}", *args) + tk_call("#{ITCL_CLASSNAME}::#{cmd}", *args) end def call_method(name, *args) - tk_call(@path, name, *args) + tk_call(@path, name, *args) end def isa(klass) - bool(tk_call(@path, 'isa', klass)) + bool(tk_call(@path, 'isa', klass)) end alias itcl_kind_of? isa def info_class - tk_call(@path, 'info', 'class') + tk_call(@path, 'info', 'class') end def info_inherit - simplelist(tk_call(@path, 'info', 'inherit')) + simplelist(tk_call(@path, 'info', 'inherit')) end def info_heritage - list(tk_call(@path, 'info', 'heritage')) + list(tk_call(@path, 'info', 'heritage')) end def info_function(*args) - if args[-1].kind_of?(Array) - params = args.pop - params.each{|param| - param = param.to_s - args << ( (param[0] == ?-)? param: "-#{param}" ) - } - end - list(tk_call(@path, 'info', 'function', *args)) + if args[-1].kind_of?(Array) + params = args.pop + params.each{|param| + param = param.to_s + args << ( (param[0] == ?-)? param: "-#{param}" ) + } + end + list(tk_call(@path, 'info', 'function', *args)) end def info_variable(*args) - if args[-1].kind_of?(Array) - params = args.pop - params.each{|param| - param = param.to_s - args << ( (param[0] == ?-)? param: "-#{param}" ) - } - end - list(tk_call(@path, 'info', 'variable', *args)) + if args[-1].kind_of?(Array) + params = args.pop + params.each{|param| + param = param.to_s + args << ( (param[0] == ?-)? param: "-#{param}" ) + } + end + list(tk_call(@path, 'info', 'variable', *args)) end end diff --git a/ext/tk/lib/tkextlib/itk/incr_tk.rb b/ext/tk/lib/tkextlib/itk/incr_tk.rb index 84143a3ea3..a52c43e518 100644 --- a/ext/tk/lib/tkextlib/itk/incr_tk.rb +++ b/ext/tk/lib/tkextlib/itk/incr_tk.rb @@ -22,9 +22,9 @@ module Tk def self.package_version begin - TkPackage.require('Itk') + TkPackage.require('Itk') rescue - '' + '' end end @@ -44,59 +44,59 @@ module Tk # WidgetClassNames[WidgetClassName] = self def self.to_eval - '::itk::' << self::WidgetClassName + '::itk::' << self::WidgetClassName end def __destroy_hook__ - Tk::Itk::Component::ComponentID_TBL.delete(self.path) + Tk::Itk::Component::ComponentID_TBL.delete(self.path) end #### [incr Tk] public methods def component - simplelist(tk_send('component')) + simplelist(tk_send('component')) end def component_path(name) - window(tk_send('component', name)) + window(tk_send('component', name)) end alias component_widget component_path def component_invoke(name, cmd, *args) - window(tk_send('component', name, cmd, *args)) + window(tk_send('component', name, cmd, *args)) end def component_obj(*names) - names = component if names.empty? - names.collect{|name| Tk::Itk::Component.new(self.path, name) } + names = component if names.empty? + names.collect{|name| Tk::Itk::Component.new(self.path, name) } end #### [incr Tk] protected methods =begin def itk_component_add(visibility, name, create_cmds, option_cmds=None) - args = [] - visibility.each{|v| v = v.to_s; args << ( (v[0] == ?-)? v: "-#{v}" )} - args << '--' << name << create_cmd << option_cmds - tk_call('itk_component', 'add', *args) + args = [] + visibility.each{|v| v = v.to_s; args << ( (v[0] == ?-)? v: "-#{v}" )} + args << '--' << name << create_cmd << option_cmds + tk_call('itk_component', 'add', *args) end def itk_component_delete(*names) - tk_call('itk_component', 'delete', *names) + tk_call('itk_component', 'delete', *names) end def itk_initialize(keys={}) - tk_call('itk_initialize', keys) + tk_call('itk_initialize', keys) end def itk_option_add(*args) - tk_call('itk_option', 'add', *args) + tk_call('itk_option', 'add', *args) end def itk_option_define(name, resource, klass, init, config=None) - tk_call('itk_option', 'define', name, resource, klass, init, config) + tk_call('itk_option', 'define', name, resource, klass, init, config) end def itk_option_remove(*args) - tk_call('itk_option', 'remove', *args) + tk_call('itk_option', 'remove', *args) end =end end @@ -125,11 +125,11 @@ module Tk class Component < TkObject def __cget_cmd - [self.master, 'component', self.name, 'cget'] + [self.master, 'component', self.name, 'cget'] end def __config_cmd - [self.master, 'component', self.name, 'configure'] + [self.master, 'component', self.name, 'configure'] end ComponentID_TBL = TkCore::INTERP.create_table @@ -138,242 +138,242 @@ module Tk TkCore::INTERP.init_ip_env{ ComponentID_TBL.clear } def self.id2obj(master, id) - if master.kind_of?(TkObject) - master = master.path - else - master = master.to_s - end - return id unless ComponentID_TBL.key?(master) - (ComponentID_TBL.key?(id))? ComponentID_TBL[master][id]: id + if master.kind_of?(TkObject) + master = master.path + else + master = master.to_s + end + return id unless ComponentID_TBL.key?(master) + (ComponentID_TBL.key?(id))? ComponentID_TBL[master][id]: id end def self.new(master, component=nil) - if master.kind_of?(TkObject) - master = master.path - else - master = master.to_s - end - - if component.kind_of?(Tk::Itk::Component) - component = component.name - elsif component - component = component.to_s - else - component = Itk_Component_ID.join(TkCore::INTERP._ip_id_) - Itk_Component_ID[1].succ! - end - - if ComponentID_TBL.key?(master) - if ComponentID_TBL[master].key?(component) - return ComponentID_TBL[master][component] - end - else - ComponentID_TBL[master] = {} - end - - super(master, component) + if master.kind_of?(TkObject) + master = master.path + else + master = master.to_s + end + + if component.kind_of?(Tk::Itk::Component) + component = component.name + elsif component + component = component.to_s + else + component = Itk_Component_ID.join(TkCore::INTERP._ip_id_) + Itk_Component_ID[1].succ! + end + + if ComponentID_TBL.key?(master) + if ComponentID_TBL[master].key?(component) + return ComponentID_TBL[master][component] + end + else + ComponentID_TBL[master] = {} + end + + super(master, component) end def initialize(master, component) - @master = master - @component = component + @master = master + @component = component - ComponentID_TBL[@master][@component] = self + ComponentID_TBL[@master][@component] = self - begin - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - rescue - @widget = nil - @path = nil - end + begin + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + rescue + @widget = nil + @path = nil + end end def path - unless @path - begin - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - rescue - fail RuntimeError, 'component is not assigned to a widget' - end - end - @path + unless @path + begin + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + rescue + fail RuntimeError, 'component is not assigned to a widget' + end + end + @path end def epath - path() + path() end def to_eval - path() + path() end def master - @master + @master end def name - @component + @component end def widget - unless @widget - begin - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - rescue - fail RuntimeError, 'component is not assigned to a widget' - end - end - @widget + unless @widget + begin + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + rescue + fail RuntimeError, 'component is not assigned to a widget' + end + end + @widget end def widget_class - unless @widget - begin - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - @widget.classname - rescue - nil - end - end + unless @widget + begin + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + @widget.classname + rescue + nil + end + end end def method_missing(id, *args) - name = id.id2name - - # try 1 : component command - begin - return tk_call(@master, 'component', @component, name, *args) - rescue - end - - # try 2 : component configure - len = args.length - begin - case len - when 1 - if name[-1] == ?= - return configure(name[0..-2], args[0]) - else - return configure(name, args[0]) - end - when 0 - return cget(name) - end - rescue - end - - # try 3 : widget method or widget configure - begin - unless @widget - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - end - @widget.__send__(id, *args) - rescue - end - - # unknown method - fail RuntimeError, "unknown method '#{name}' for #{self.inspect}" + name = id.id2name + + # try 1 : component command + begin + return tk_call(@master, 'component', @component, name, *args) + rescue + end + + # try 2 : component configure + len = args.length + begin + case len + when 1 + if name[-1] == ?= + return configure(name[0..-2], args[0]) + else + return configure(name, args[0]) + end + when 0 + return cget(name) + end + rescue + end + + # try 3 : widget method or widget configure + begin + unless @widget + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + end + @widget.__send__(id, *args) + rescue + end + + # unknown method + fail RuntimeError, "unknown method '#{name}' for #{self.inspect}" end def tk_send(cmd, *rest) - begin - tk_call(@master, 'component', @component, cmd, *rest) - rescue - unless @path - begin - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - rescue - fail RuntimeError, 'component is not assigned to a widget' - end - end - tk_call(@path, cmd, *rest) - end + begin + tk_call(@master, 'component', @component, cmd, *rest) + rescue + unless @path + begin + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + rescue + fail RuntimeError, 'component is not assigned to a widget' + end + end + tk_call(@path, cmd, *rest) + end end def tk_send_without_enc(cmd, *rest) - begin - tk_call_without_enc(@master, 'component', @component, cmd, *rest) - rescue - unless @path - begin - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - rescue - fail RuntimeError, 'component is not assigned to a widget' - end - end - tk_call_without_enc(@path, cmd, *rest) - end + begin + tk_call_without_enc(@master, 'component', @component, cmd, *rest) + rescue + unless @path + begin + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + rescue + fail RuntimeError, 'component is not assigned to a widget' + end + end + tk_call_without_enc(@path, cmd, *rest) + end end def tk_send_with_enc(cmd, *rest) - begin - tk_call_with_enc(@master, 'component', @component, cmd, *rest) - rescue - unless @path - begin - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - rescue - fail RuntimeError, 'component is not assigned to a widget' - end - end - tk_call_with_enc(@path, cmd, *rest) - end + begin + tk_call_with_enc(@master, 'component', @component, cmd, *rest) + rescue + unless @path + begin + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + rescue + fail RuntimeError, 'component is not assigned to a widget' + end + end + tk_call_with_enc(@path, cmd, *rest) + end end def bind(*args) - unless @widget - begin - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - rescue - fail RuntimeError, 'component is not assigned to a widget' - end - end - @widget.bind(*args) + unless @widget + begin + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + rescue + fail RuntimeError, 'component is not assigned to a widget' + end + end + @widget.bind(*args) end def bind_append(*args) - unless @widget - begin - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - rescue - fail RuntimeError, 'component is not assigned to a widget' - end - end - @widget.bind_append(*args) + unless @widget + begin + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + rescue + fail RuntimeError, 'component is not assigned to a widget' + end + end + @widget.bind_append(*args) end def bind_remove(*args) - unless @widget - begin - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - rescue - fail RuntimeError, 'component is not assigned to a widget' - end - end - @widget.bind_remove(*args) + unless @widget + begin + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + rescue + fail RuntimeError, 'component is not assigned to a widget' + end + end + @widget.bind_remove(*args) end def bindinfo(*args) - unless @widget - begin - @widget = window(tk_call(@master, 'component', @component)) - @path = @widget.path - rescue - fail RuntimeError, 'component is not assigned to a widget' - end - end - @widget.bindinfo(*args) + unless @widget + begin + @widget = window(tk_call(@master, 'component', @component)) + @path = @widget.path + rescue + fail RuntimeError, 'component is not assigned to a widget' + end + end + @widget.bindinfo(*args) end end diff --git a/ext/tk/lib/tkextlib/iwidgets.rb b/ext/tk/lib/tkextlib/iwidgets.rb index b76fb79cc1..5ef82f68ca 100644 --- a/ext/tk/lib/tkextlib/iwidgets.rb +++ b/ext/tk/lib/tkextlib/iwidgets.rb @@ -25,9 +25,9 @@ module Tk def self.package_version begin - TkPackage.require('Iwidgets') + TkPackage.require('Iwidgets') rescue - '' + '' end end diff --git a/ext/tk/lib/tkextlib/iwidgets/calendar.rb b/ext/tk/lib/tkextlib/iwidgets/calendar.rb index dab10b118b..f382cfd143 100644 --- a/ext/tk/lib/tkextlib/iwidgets/calendar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/calendar.rb @@ -30,7 +30,7 @@ class Tk::Iwidgets::Calendar _setup_subst_table(KEY_TBL, PROC_TBL); def self.ret_val(val) - val + val end end diff --git a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb index 300573bcec..ae7d63f3f3 100644 --- a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb +++ b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb @@ -26,16 +26,16 @@ class Tk::Iwidgets::Entryfield #class CalCmdArgs < TkUtil::CallbackSubst class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?s, :char ], - [ ?P, ?s, :post ], - [ ?S, ?s, :current ], - [ ?W, ?w, :widget ], - nil + [ ?c, ?s, :char ], + [ ?P, ?s, :post ], + [ ?S, ?s, :current ], + [ ?W, ?w, :widget ], + nil ] PROC_TBL = [ - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], - nil + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], + nil ] _setup_subst_table(KEY_TBL, PROC_TBL); end diff --git a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb index a7024356ac..077d84c7a4 100644 --- a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb +++ b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb @@ -33,7 +33,7 @@ class Tk::Iwidgets::Hierarchy _setup_subst_table(KEY_TBL, PROC_TBL); def self.ret_val(val) - val + val end end @@ -46,21 +46,21 @@ class Tk::Iwidgets::Hierarchy class IndicatorCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?n, ?s, :node ], - [ ?s, ?b, :status ], - nil + [ ?n, ?s, :node ], + [ ?s, ?b, :status ], + nil ] PROC_TBL = [ - [ ?s, TkComm.method(:string) ], - [ ?b, TkComm.method(:bool) ], - nil + [ ?s, TkComm.method(:string) ], + [ ?b, TkComm.method(:bool) ], + nil ] _setup_subst_table(KEY_TBL, PROC_TBL); def self.ret_val(val) - val + val end end @@ -73,15 +73,15 @@ class Tk::Iwidgets::Hierarchy class IconCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?n, ?s, :node ], - [ ?i, ?s, :icon ], - nil + [ ?n, ?s, :node ], + [ ?i, ?s, :icon ], + nil ] PROC_TBL = [ [ ?s, TkComm.method(:string) ], nil ] _setup_subst_table(KEY_TBL, PROC_TBL); def self.ret_val(val) - val + val end end @@ -200,7 +200,7 @@ class Tk::Iwidgets::Hierarchy def compare(idx1, op, idx2) bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), - op, _get_eval_enc_str(idx2))) + op, _get_eval_enc_str(idx2))) end def debug @@ -234,16 +234,16 @@ class Tk::Iwidgets::Hierarchy # multiple chars-taglist argument :: str, [tag,...], str, [tag,...], ... args = [chars] while tags.size > 0 - args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist - args << tags.shift if tags.size > 0 # chars + args << tags.shift.collect{|x|_get_eval_string(x)}.join(' ') # taglist + args << tags.shift if tags.size > 0 # chars end super index, *args else # single chars-taglist argument :: str, tag, tag, ... if tags.size == 0 - super index, chars + super index, chars 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 diff --git a/ext/tk/lib/tkextlib/iwidgets/menubar.rb b/ext/tk/lib/tkextlib/iwidgets/menubar.rb index b4c94ff564..b60349be17 100644 --- a/ext/tk/lib/tkextlib/iwidgets/menubar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/menubar.rb @@ -70,41 +70,41 @@ class Tk::Iwidgets::Menubar next unless spec if spec.kind_of?(Hash) - args = [spec] - type = 'options' + args = [spec] + type = 'options' else - type, *args = spec + type, *args = spec end type = type.to_s case type when 'options' - keys = args[0] - ary = [type] - ary.concat(hash_kv(keys)) - ret << array2tk_list(ary) << "\n" + keys = args[0] + ary = [type] + ary.concat(hash_kv(keys)) + ret << array2tk_list(ary) << "\n" when 'menubutton', 'cascade' - name, keys = args - if keys - ary = [type, name] - keys = _symbolkey2str(keys) - keys['menu'] = _parse_menu_spec(keys['menu']) if keys.key?('menu') - ary.concat(hash_kv(keys)) - ret << array2tk_list(ary) << "\n" - else - ret << array2tk_list([type, name]) << "\n" - end + name, keys = args + if keys + ary = [type, name] + keys = _symbolkey2str(keys) + keys['menu'] = _parse_menu_spec(keys['menu']) if keys.key?('menu') + ary.concat(hash_kv(keys)) + ret << array2tk_list(ary) << "\n" + else + ret << array2tk_list([type, name]) << "\n" + end else - name, keys = args - if keys - ary = [type, name] - ary.concat(hash_kv(keys)) - ret << array2tk_list(ary) << "\n" - else - ret << array2tk_list([type, name]) << "\n" - end + name, keys = args + if keys + ary = [type, name] + ary.concat(hash_kv(keys)) + ret << array2tk_list(ary) << "\n" + else + ret << array2tk_list([type, name]) << "\n" + end end } ret diff --git a/ext/tk/lib/tkextlib/iwidgets/notebook.rb b/ext/tk/lib/tkextlib/iwidgets/notebook.rb index 511ee3dff3..d9abf1b02b 100644 --- a/ext/tk/lib/tkextlib/iwidgets/notebook.rb +++ b/ext/tk/lib/tkextlib/iwidgets/notebook.rb @@ -72,7 +72,7 @@ class Tk::Iwidgets::Notebook end if idx2 if (new_idx2 = self.index(idx2)) < 0 - new_idx2 = tagid(idx2) + new_idx2 = tagid(idx2) end tk_call(@path, 'delete', new_idx1, new_idx2) else diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb index c5ed19c1f1..c26eda1586 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb @@ -94,7 +94,7 @@ class Tk::Iwidgets::Scrolledcanvas def bbox(tagOrId, *tags) list(tk_send_without_enc('bbox', tagid(tagOrId), - *tags.collect{|t| tagid(t)})) + *tags.collect{|t| tagid(t)})) end def itembind(tag, context, cmd=Proc.new, args=nil) @@ -136,14 +136,14 @@ class Tk::Iwidgets::Scrolledcanvas def dchars(tag, first, last=None) tk_send_without_enc('dchars', tagid(tag), - _get_eval_enc_str(first), _get_eval_enc_str(last)) + _get_eval_enc_str(first), _get_eval_enc_str(last)) self end def delete(*args) if TkcItem::CItemID_TBL[self.path] find('withtag', *args).each{|item| - TkcItem::CItemID_TBL[self.path].delete(item.id) + TkcItem::CItemID_TBL[self.path].delete(item.id) } end tk_send_without_enc('delete', *args.collect{|t| tagid(t)}) @@ -190,9 +190,9 @@ class Tk::Iwidgets::Scrolledcanvas else ret = tk_send_without_enc('focus') if ret == "" - nil + nil else - TkcItem.id2obj(self, ret) + TkcItem.id2obj(self, ret) end end end @@ -214,7 +214,7 @@ class Tk::Iwidgets::Scrolledcanvas def insert(tagOrId, index, string) tk_send_without_enc('insert', tagid(tagOrId), index, - _get_eval_enc_str(string)) + _get_eval_enc_str(string)) self end diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb index 95d1034f16..39a9ed63c8 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb @@ -77,7 +77,7 @@ class Tk::Iwidgets::Scrolledtext end def compare(idx1, op, idx2) bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), - op, _get_eval_enc_str(idx2))) + op, _get_eval_enc_str(idx2))) end def debug @@ -110,24 +110,24 @@ class Tk::Iwidgets::Scrolledtext case slot.to_s when 'text', 'label', 'show', 'data', 'file' _fromUTF8(tk_send_without_enc('image', 'cget', - _get_eval_enc_str(index), "-#{slot}")) + _get_eval_enc_str(index), "-#{slot}")) else tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget', - _get_eval_enc_str(index), - "-#{slot}"))) + _get_eval_enc_str(index), + "-#{slot}"))) end end def image_configure(index, slot, value=None) if slot.kind_of? Hash _fromUTF8(tk_send_without_enc('image', 'configure', - _get_eval_enc_str(index), - *hash_kv(slot, true))) + _get_eval_enc_str(index), + *hash_kv(slot, true))) else _fromUTF8(tk_send_without_enc('image', 'configure', - _get_eval_enc_str(index), - "-#{slot}", - _get_eval_enc_str(value))) + _get_eval_enc_str(index), + "-#{slot}", + _get_eval_enc_str(value))) end self end @@ -135,80 +135,80 @@ class Tk::Iwidgets::Scrolledtext def image_configinfo(index, slot = nil) if TkComm::GET_CONFIGINFO_AS_ARRAY if slot - case slot.to_s - when 'text', 'label', 'show', 'data', 'file' - conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) - else - conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) - end - conf[0] = conf[0][1..-1] - conf + case slot.to_s + when 'text', 'label', 'show', 'data', 'file' + conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) + else + conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) + end + conf[0] = conf[0][1..-1] + conf else - tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).collect{|conflist| - conf = tk_split_simplelist(conflist) - conf[0] = conf[0][1..-1] - case conf[0] - when 'text', 'label', 'show', 'data', 'file' - else - if conf[3] - if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) - else - conf[3] = tk_tcl2ruby(conf[3]) - end - end - if conf[4] - if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) - else - conf[4] = tk_tcl2ruby(conf[4]) - end - end - end - conf[1] = conf[1][1..-1] if conf.size == 2 # alias info - conf - } + tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).collect{|conflist| + conf = tk_split_simplelist(conflist) + conf[0] = conf[0][1..-1] + case conf[0] + when 'text', 'label', 'show', 'data', 'file' + else + if conf[3] + if conf[3].index('{') + conf[3] = tk_split_list(conf[3]) + else + conf[3] = tk_tcl2ruby(conf[3]) + end + end + if conf[4] + if conf[4].index('{') + conf[4] = tk_split_list(conf[4]) + else + conf[4] = tk_tcl2ruby(conf[4]) + end + end + end + conf[1] = conf[1][1..-1] if conf.size == 2 # alias info + conf + } end else # ! TkComm::GET_CONFIGINFO_AS_ARRAY if slot - case slot.to_s - when 'text', 'label', 'show', 'data', 'file' - conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) - else - conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) - end - key = conf.shift[1..-1] - { key => conf } + case slot.to_s + when 'text', 'label', 'show', 'data', 'file' + conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) + else + conf = tk_split_list(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index), "-#{slot}"))) + end + key = conf.shift[1..-1] + { key => conf } else - ret = {} - tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).each{|conflist| - conf = tk_split_simplelist(conflist) - key = conf.shift[1..-1] - case key - when 'text', 'label', 'show', 'data', 'file' - else - if conf[2] - if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) - else - conf[2] = tk_tcl2ruby(conf[2]) - end - end - if conf[3] - if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) - else - conf[3] = tk_tcl2ruby(conf[3]) - end - end - end - if conf.size == 1 - ret[key] = conf[0][1..-1] # alias info - else - ret[key] = conf - end - } - ret + ret = {} + tk_split_simplelist(_fromUTF8(tk_send_without_enc('image', 'configure', _get_eval_enc_str(index)))).each{|conflist| + conf = tk_split_simplelist(conflist) + key = conf.shift[1..-1] + case key + when 'text', 'label', 'show', 'data', 'file' + else + if conf[2] + if conf[2].index('{') + conf[2] = tk_split_list(conf[2]) + else + conf[2] = tk_tcl2ruby(conf[2]) + end + end + if conf[3] + if conf[3].index('{') + conf[3] = tk_split_list(conf[3]) + else + conf[3] = tk_tcl2ruby(conf[3]) + end + end + end + if conf.size == 1 + ret[key] = conf[0][1..-1] # alias info + else + ret[key] = conf + end + } + ret end end end @@ -216,19 +216,19 @@ class Tk::Iwidgets::Scrolledtext def current_image_configinfo(index, slot = nil) if TkComm::GET_CONFIGINFO_AS_ARRAY if slot - conf = image_configinfo(index, slot) - {conf[0] => conf[4]} + conf = image_configinfo(index, slot) + {conf[0] => conf[4]} else - ret = {} - image_configinfo(index).each{|conf| - ret[conf[0]] = conf[4] if conf.size > 2 - } - ret + ret = {} + image_configinfo(index).each{|conf| + ret[conf[0]] = conf[4] if conf.size > 2 + } + ret end else # ! TkComm::GET_CONFIGINFO_AS_ARRAY ret = {} image_configinfo(index, slot).each{|k, conf| - ret[k] = conf[-1] if conf.kind_of?(Array) + ret[k] = conf[-1] if conf.kind_of?(Array) } ret end @@ -258,7 +258,7 @@ class Tk::Iwidgets::Scrolledtext def mark_gravity(mark, direction=nil) if direction tk_send_without_enc('mark', 'gravity', - _get_eval_enc_str(mark), direction) + _get_eval_enc_str(mark), direction) self else tk_send_without_enc('mark', 'gravity', _get_eval_enc_str(mark)) @@ -267,27 +267,27 @@ class Tk::Iwidgets::Scrolledtext def mark_set(mark, index) tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark), - _get_eval_enc_str(index)) + _get_eval_enc_str(index)) self end alias set_mark mark_set def mark_unset(*marks) tk_send_without_enc('mark', 'unset', - *(marks.collect{|mark| _get_eval_enc_str(mark)})) + *(marks.collect{|mark| _get_eval_enc_str(mark)})) self end alias unset_mark mark_unset def mark_next(index) tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'next', - _get_eval_enc_str(index)))) + _get_eval_enc_str(index)))) end alias next_mark mark_next def mark_previous(index) tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous', - _get_eval_enc_str(index)))) + _get_eval_enc_str(index)))) end alias previous_mark mark_previous @@ -309,14 +309,14 @@ class Tk::Iwidgets::Scrolledtext # $KCODE == 'NONE' if JAPANIZED_TK tk_call_without_enc('kstring', 'length', - _get_eval_enc_str(txt)).to_i + _get_eval_enc_str(txt)).to_i else begin - tk_call_without_enc('encoding', 'convertto', 'ascii', - _get_eval_enc_str(txt)).length + tk_call_without_enc('encoding', 'convertto', 'ascii', + _get_eval_enc_str(txt)).length rescue StandardError, NameError - # sorry, I have no plan - txt.length + # sorry, I have no plan + txt.length end end end @@ -368,53 +368,53 @@ class Tk::Iwidgets::Scrolledtext return ["", 0] if compare(start,'>=',stop) txt = get(start,stop) if (pos = txt.index(pat)) - match = $& - #pos = txt[0..(pos-1)].split('').length if pos > 0 - pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 - if pat.kind_of? String - #return [index(start + " + #{pos} chars"), pat.split('').length] - return [index(start + " + #{pos} chars"), - _ktext_length(pat), pat.dup] - else - #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), - _ktext_length(match), match] - end + match = $& + #pos = txt[0..(pos-1)].split('').length if pos > 0 + pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 + if pat.kind_of? String + #return [index(start + " + #{pos} chars"), pat.split('').length] + return [index(start + " + #{pos} chars"), + _ktext_length(pat), pat.dup] + else + #return [index(start + " + #{pos} chars"), $&.split('').length] + return [index(start + " + #{pos} chars"), + _ktext_length(match), match] + end else - return ["", 0] + return ["", 0] end else txt = get(start,'end - 1 char') if (pos = txt.index(pat)) - match = $& - #pos = txt[0..(pos-1)].split('').length if pos > 0 - pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 - if pat.kind_of? String - #return [index(start + " + #{pos} chars"), pat.split('').length] - return [index(start + " + #{pos} chars"), - _ktext_length(pat), pat.dup] - else - #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), - _ktext_length(match), match] - end + match = $& + #pos = txt[0..(pos-1)].split('').length if pos > 0 + pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 + if pat.kind_of? String + #return [index(start + " + #{pos} chars"), pat.split('').length] + return [index(start + " + #{pos} chars"), + _ktext_length(pat), pat.dup] + else + #return [index(start + " + #{pos} chars"), $&.split('').length] + return [index(start + " + #{pos} chars"), + _ktext_length(match), match] + end else - txt = get('1.0','end - 1 char') - if (pos = txt.index(pat)) - match = $& - #pos = txt[0..(pos-1)].split('').length if pos > 0 - pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 - if pat.kind_of? String - #return [index("1.0 + #{pos} chars"), pat.split('').length] - return [index("1.0 + #{pos} chars"), - _ktext_length(pat), pat.dup] - else - #return [index("1.0 + #{pos} chars"), $&.split('').length] - return [index("1.0 + #{pos} chars"), _ktext_length(match), match] - end - else - return ["", 0] - end + txt = get('1.0','end - 1 char') + if (pos = txt.index(pat)) + match = $& + #pos = txt[0..(pos-1)].split('').length if pos > 0 + pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 + if pat.kind_of? String + #return [index("1.0 + #{pos} chars"), pat.split('').length] + return [index("1.0 + #{pos} chars"), + _ktext_length(pat), pat.dup] + else + #return [index("1.0 + #{pos} chars"), $&.split('').length] + return [index("1.0 + #{pos} chars"), _ktext_length(match), match] + end + else + return ["", 0] + end end end end @@ -429,48 +429,48 @@ class Tk::Iwidgets::Scrolledtext return ["", 0] if compare(start,'<=',stop) txt = get(stop,start) if (pos = txt.rindex(pat)) - match = $& - #pos = txt[0..(pos-1)].split('').length if pos > 0 - pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 - if pat.kind_of? String - #return [index(stop + " + #{pos} chars"), pat.split('').length] - return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup] - else - #return [index(stop + " + #{pos} chars"), $&.split('').length] - return [index(stop + " + #{pos} chars"), _ktext_length(match), match] - end + match = $& + #pos = txt[0..(pos-1)].split('').length if pos > 0 + pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 + if pat.kind_of? String + #return [index(stop + " + #{pos} chars"), pat.split('').length] + return [index(stop + " + #{pos} chars"), _ktext_length(pat), pat.dup] + else + #return [index(stop + " + #{pos} chars"), $&.split('').length] + return [index(stop + " + #{pos} chars"), _ktext_length(match), match] + end else - return ["", 0] + return ["", 0] end else txt = get('1.0',start) if (pos = txt.rindex(pat)) - match = $& - #pos = txt[0..(pos-1)].split('').length if pos > 0 - pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 - if pat.kind_of? String - #return [index("1.0 + #{pos} chars"), pat.split('').length] - return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup] - else - #return [index("1.0 + #{pos} chars"), $&.split('').length] - return [index("1.0 + #{pos} chars"), _ktext_length(match), match] - end + match = $& + #pos = txt[0..(pos-1)].split('').length if pos > 0 + pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 + if pat.kind_of? String + #return [index("1.0 + #{pos} chars"), pat.split('').length] + return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup] + else + #return [index("1.0 + #{pos} chars"), $&.split('').length] + return [index("1.0 + #{pos} chars"), _ktext_length(match), match] + end else - txt = get('1.0','end - 1 char') - if (pos = txt.rindex(pat)) - match = $& - #pos = txt[0..(pos-1)].split('').length if pos > 0 - pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 - if pat.kind_of? String - #return [index("1.0 + #{pos} chars"), pat.split('').length] - return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup] - else - #return [index("1.0 + #{pos} chars"), $&.split('').length] - return [index("1.0 + #{pos} chars"), _ktext_length(match), match] - end - else - return ["", 0] - end + txt = get('1.0','end - 1 char') + if (pos = txt.rindex(pat)) + match = $& + #pos = txt[0..(pos-1)].split('').length if pos > 0 + pos = _ktext_length(txt[0..(pos-1)]) if pos > 0 + if pat.kind_of? String + #return [index("1.0 + #{pos} chars"), pat.split('').length] + return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup] + else + #return [index("1.0 + #{pos} chars"), $&.split('').length] + return [index("1.0 + #{pos} chars"), _ktext_length(match), match] + end + else + return ["", 0] + end end end end diff --git a/ext/tk/lib/tkextlib/iwidgets/spinner.rb b/ext/tk/lib/tkextlib/iwidgets/spinner.rb index f4f0eb46c8..b5c72b4df8 100644 --- a/ext/tk/lib/tkextlib/iwidgets/spinner.rb +++ b/ext/tk/lib/tkextlib/iwidgets/spinner.rb @@ -26,16 +26,16 @@ class Tk::Iwidgets::Spinner #class CalCmdArgs < TkUtil::CallbackSubst class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?s, :char ], - [ ?P, ?s, :post ], - [ ?S, ?s, :current ], - [ ?W, ?w, :widget ], - nil + [ ?c, ?s, :char ], + [ ?P, ?s, :post ], + [ ?S, ?s, :current ], + [ ?W, ?w, :widget ], + nil ] PROC_TBL = [ - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], - nil + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], + nil ] _setup_subst_table(KEY_TBL, PROC_TBL); end diff --git a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb index fffd5b388c..a2a7f31627 100644 --- a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb @@ -81,7 +81,7 @@ class Tk::Iwidgets::Toolbar tag = Tk::Itk::Component.new(self) end window(tk_call(@path, 'insert', index(idx), type, - tagid(tag), *hash_kv(keys))) + tagid(tag), *hash_kv(keys))) tag end end diff --git a/ext/tk/lib/tkextlib/pkg_checker.rb b/ext/tk/lib/tkextlib/pkg_checker.rb index 5ebf675189..5002ed7ff8 100755 --- a/ext/tk/lib/tkextlib/pkg_checker.rb +++ b/ext/tk/lib/tkextlib/pkg_checker.rb @@ -100,29 +100,29 @@ def check_pkg(file, verbose=false) begin case type when :package - ver = TkPackage.require(name) - success_list[name] = ver - error_list.delete_if{|n, t| n == name} + ver = TkPackage.require(name) + success_list[name] = ver + error_list.delete_if{|n, t| n == name} when :library - Tk.load_tcllibrary(name) - success_list[name] = :library - error_list.delete_if{|n, t| n == name} + Tk.load_tcllibrary(name) + success_list[name] = :library + error_list.delete_if{|n, t| n == name} when :script - Tk.load_tclscript(name) - success_list[name] = :script - error_list.delete_if{|n, t| n == name} + Tk.load_tclscript(name) + success_list[name] = :script + error_list.delete_if{|n, t| n == name} when :require_ruby_lib - require name + require name end rescue => e if verbose - error_list << [name, type, e.message] + error_list << [name, type, e.message] else - error_list << [name, type] + error_list << [name, type] end end } @@ -130,8 +130,8 @@ def check_pkg(file, verbose=false) success_list.dup.each{|name, ver| unless ver.kind_of?(String) begin - ver = TkPackage.require(name) - sccess_list[name] = ver + ver = TkPackage.require(name) + sccess_list[name] = ver rescue end end @@ -149,10 +149,10 @@ def subdir_check(dir, verbose=false) path = File.join(dir, f) suc, err = check_pkg(path, verbose) if err.empty? - print 'Ready : ', path, ' : require->', suc.inspect, "\n" + print 'Ready : ', path, ' : require->', suc.inspect, "\n" else - print '*LACK : ', path, ' : require->', suc.inspect, - ' FAIL->', err.inspect, "\n" + print '*LACK : ', path, ' : require->', suc.inspect, + ' FAIL->', err.inspect, "\n" end end } diff --git a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb index d0cb2812cb..34e34046c6 100644 --- a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb +++ b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb @@ -32,23 +32,23 @@ module Tk module Tcllib module Autoscroll def self.package_version - begin - TkPackage.require('autoscroll') - rescue - '' - end + begin + TkPackage.require('autoscroll') + rescue + '' + end end def self.not_available - fail RuntimeError, "'tkextlib/tcllib/autoscroll' extension is not available on your current environment." + fail RuntimeError, "'tkextlib/tcllib/autoscroll' extension is not available on your current environment." end def self.autoscroll(win) - Tk::Tcllib::Autoscroll.not_available + Tk::Tcllib::Autoscroll.not_available end def self.unautoscroll(win) - Tk::Tcllib::Autoscroll.not_available + Tk::Tcllib::Autoscroll.not_available end end end @@ -59,44 +59,44 @@ module Tk def autoscroll(mode = nil) case mode when :x, 'x' - if @xscrollbar - Tk::Tcllib::Autoscroll.autoscroll(@xscrollbar) - end + if @xscrollbar + Tk::Tcllib::Autoscroll.autoscroll(@xscrollbar) + end when :y, 'y' - if @yscrollbar - Tk::Tcllib::Autoscroll.autoscroll(@yscrollbar) - end + if @yscrollbar + Tk::Tcllib::Autoscroll.autoscroll(@yscrollbar) + end when nil, :both, 'both' - if @xscrollbar - Tk::Tcllib::Autoscroll.autoscroll(@xscrollbar) - end - if @yscrollbar - Tk::Tcllib::Autoscroll.autoscroll(@yscrollbar) - end + if @xscrollbar + Tk::Tcllib::Autoscroll.autoscroll(@xscrollbar) + end + if @yscrollbar + Tk::Tcllib::Autoscroll.autoscroll(@yscrollbar) + end else - fail ArgumentError, "'x', 'y' or 'both' (String or Symbol) is expected" + fail ArgumentError, "'x', 'y' or 'both' (String or Symbol) is expected" end self end def unautoscroll(mode = nil) case mode when :x, 'x' - if @xscrollbar - Tk::Tcllib::Autoscroll.unautoscroll(@xscrollbar) - end + if @xscrollbar + Tk::Tcllib::Autoscroll.unautoscroll(@xscrollbar) + end when :y, 'y' - if @yscrollbar - Tk::Tcllib::Autoscroll.unautoscroll(@yscrollbar) - end + if @yscrollbar + Tk::Tcllib::Autoscroll.unautoscroll(@yscrollbar) + end when nil, :both, 'both' - if @xscrollbar - Tk::Tcllib::Autoscroll.unautoscroll(@xscrollbar) - end - if @yscrollbar - Tk::Tcllib::Autoscroll.unautoscroll(@yscrollbar) - end + if @xscrollbar + Tk::Tcllib::Autoscroll.unautoscroll(@xscrollbar) + end + if @yscrollbar + Tk::Tcllib::Autoscroll.unautoscroll(@yscrollbar) + end else - fail ArgumentError, "'x', 'y' or 'both' (String or Symbol) is expected" + fail ArgumentError, "'x', 'y' or 'both' (String or Symbol) is expected" end self end @@ -130,11 +130,11 @@ module Tk module Autoscroll def self.autoscroll(win) - tk_call_without_enc('::autoscroll::autoscroll', win.path) + tk_call_without_enc('::autoscroll::autoscroll', win.path) end def self.unautoscroll(win) - tk_call_without_enc('::autoscroll::unautoscroll', win.path) + tk_call_without_enc('::autoscroll::unautoscroll', win.path) end end end diff --git a/ext/tk/lib/tkextlib/tcllib/ctext.rb b/ext/tk/lib/tkextlib/tcllib/ctext.rb index 0a043b1730..89bfeff0f3 100644 --- a/ext/tk/lib/tkextlib/tcllib/ctext.rb +++ b/ext/tk/lib/tkextlib/tcllib/ctext.rb @@ -17,11 +17,11 @@ module Tk module Tcllib class CText < TkText def self.package_version - begin - TkPackage.require('ctext') - rescue - '' - end + begin + TkPackage.require('ctext') + rescue + '' + end end end end @@ -80,19 +80,19 @@ class Tk::Tcllib::CText def add_highlight_class_for_special_chars(klass, col, *chrs) tk_call('ctext::addHighlightClassForSpecialChars', - @path, klass, col, chrs.join('')) + @path, klass, col, chrs.join('')) self end def add_highlight_class_for_regexp(klass, col, tcl_regexp) tk_call('ctext::addHighlightClassForRegexp', - @path, klass, col, tcl_regexp) + @path, klass, col, tcl_regexp) self end def add_highlight_class_with_only_char_start(klass, col, chr) tk_call('ctext::addHighlightClassWithOnlyCharStart', - @path, klass, col, chr) + @path, klass, col, chr) self end diff --git a/ext/tk/lib/tkextlib/tcllib/cursor.rb b/ext/tk/lib/tkextlib/tcllib/cursor.rb index 8813aa05dd..cbe1e2f1be 100644 --- a/ext/tk/lib/tkextlib/tcllib/cursor.rb +++ b/ext/tk/lib/tkextlib/tcllib/cursor.rb @@ -13,27 +13,27 @@ module Tk module Tcllib module Cursor def self.package_version - begin - TkPackage.require('cursor') - rescue - '' - end + begin + TkPackage.require('cursor') + rescue + '' + end end def self.not_available - fail RuntimeError, "'tkextlib/tcllib/cursor' extension is not available on your current environment." + fail RuntimeError, "'tkextlib/tcllib/cursor' extension is not available on your current environment." end def self.cursor_display(win=None) - Tk::Tcllib::Cursor.not_available + Tk::Tcllib::Cursor.not_available end def self.cursor_propagate(win, cursor) - Tk::Tcllib::Cursor.not_available + Tk::Tcllib::Cursor.not_available end def self.cursor_restore(win, cursor = None) - Tk::Tcllib::Cursor.not_available + Tk::Tcllib::Cursor.not_available end end end @@ -74,15 +74,15 @@ module Tk module Cursor def self.cursor_display(win=None) - tk_call_without_enc('::cursor::display', win) + tk_call_without_enc('::cursor::display', win) end def self.cursor_propagate(win, cursor) - tk_call_without_enc('::cursor::propagate', win.path, cursor) + tk_call_without_enc('::cursor::propagate', win.path, cursor) end def self.cursor_restore(win, cursor = None) - tk_call_without_enc('::cursor::restore', win.path, cursor) + tk_call_without_enc('::cursor::restore', win.path, cursor) end end end diff --git a/ext/tk/lib/tkextlib/tcllib/datefield.rb b/ext/tk/lib/tkextlib/tcllib/datefield.rb index 4d80b06866..1d029e4569 100644 --- a/ext/tk/lib/tkextlib/tcllib/datefield.rb +++ b/ext/tk/lib/tkextlib/tcllib/datefield.rb @@ -26,11 +26,11 @@ module Tk module Tcllib class Datefield < TkEntry def self.package_version - begin - TkPackage.require('datefield') - rescue - '' - end + begin + TkPackage.require('datefield') + rescue + '' + end end end DateField = Datefield @@ -43,7 +43,7 @@ class Tk::Tcllib::Datefield def create_self(keys) if keys and keys != None tk_call_without_enc('::datefield::datefield', @path, - *hash_kv(keys, true)) + *hash_kv(keys, true)) else tk_call_without_enc('::datefield::datefield', @path) end diff --git a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb index 977ef4e5c8..da9f1eb3a8 100644 --- a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb +++ b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb @@ -20,11 +20,11 @@ module Tk module Tcllib class IP_Entry < TkEntry def self.package_version - begin - TkPackage.require('ipentry') - rescue - '' - end + begin + TkPackage.require('ipentry') + rescue + '' + end end end IPEntry = IP_Entry diff --git a/ext/tk/lib/tkextlib/tcllib/plotchart.rb b/ext/tk/lib/tkextlib/tcllib/plotchart.rb index 65451a27a9..86327ceff0 100644 --- a/ext/tk/lib/tkextlib/tcllib/plotchart.rb +++ b/ext/tk/lib/tkextlib/tcllib/plotchart.rb @@ -67,11 +67,11 @@ module Tk module Tcllib module Plotchart def self.package_version - begin - TkPackage.require('Plotchart') - rescue - '' - end + begin + TkPackage.require('Plotchart') + rescue + '' + end end end end @@ -85,13 +85,13 @@ module Tk::Tcllib::Plotchart def self.world_coordinates(w, *args) # args := xmin, ymin, xmax, ymax tk_call_without_enc('::Plotchart::worldCoordinates', - w.path, *(args.flatten)) + w.path, *(args.flatten)) end def self.world_3D_coordinates(w, *args) # args := xmin, ymin, zmin, xmax, ymax, zmax tk_call_without_enc('::Plotchart::world3DCoordinates', - w.path, *(args.flatten)) + w.path, *(args.flatten)) end def self.coords_to_pixel(w, x, y) @@ -148,20 +148,20 @@ module Tk::Tcllib::Plotchart def xconfig(key, value=None) if key.kind_of?(Hash) - tk_call_without_enc(@chart, 'xconfig', *hash_kv(key, true)) + tk_call_without_enc(@chart, 'xconfig', *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'xconfig', - "-#{key}", _get_eval_enc_str(value)) + tk_call_without_enc(@chart, 'xconfig', + "-#{key}", _get_eval_enc_str(value)) end self end def yconfig(key, value=None) if key.kind_of?(Hash) - tk_call_without_enc(@chart, 'yconfig', *hash_kv(key, true)) + tk_call_without_enc(@chart, 'yconfig', *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'yconfig', - "-#{key}", _get_eval_enc_str(value)) + tk_call_without_enc(@chart, 'yconfig', + "-#{key}", _get_eval_enc_str(value)) end self end @@ -174,14 +174,14 @@ module Tk::Tcllib::Plotchart def world_coordinates(*args) # args := xmin, ymin, xmax, ymax tk_call_without_enc('::Plotchart::worldCoordinates', - @path, *(args.flatten)) + @path, *(args.flatten)) self end def world_3D_coordinates(*args) # args := xmin, ymin, zmin, xmax, ymax, zmax tk_call_without_enc('::Plotchart::world3DCoordinates', - @path, *(args.flatten)) + @path, *(args.flatten)) self end @@ -230,21 +230,21 @@ module Tk::Tcllib::Plotchart # xaxis := Array of [minimum, maximum, stepsize] # yaxis := Array of [minimum, maximum, stepsize] if args[0].kind_of?(Array) - @xaxis = args.shift - @yaxis = args.shift + @xaxis = args.shift + @yaxis = args.shift - super(*args) # create canvas widget + super(*args) # create canvas widget else - parent = args.shift + parent = args.shift - @xaxis = args.shift - @yaxis = args.shift + @xaxis = args.shift + @yaxis = args.shift - if parent.kind_of?(TkCanvas) - @path = parent.path - else - super(parent, *args) # create canvas widget - end + if parent.kind_of?(TkCanvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end end @chart = _create_chart @@ -253,7 +253,7 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG tk_call_without_enc(self.class::TkCommandNames[1], @path, - array2tk_list(@xaxis), array2tk_list(@yaxis)) + array2tk_list(@xaxis), array2tk_list(@yaxis)) end private :_create_chart @@ -268,10 +268,10 @@ module Tk::Tcllib::Plotchart def dataconfig(series, key, value=None) if key.kind_of?(Hash) - tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true)) + tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'dataconfig', series, - "-#{key}", _get_eval_enc_str(value)) + tk_call_without_enc(@chart, 'dataconfig', series, + "-#{key}", _get_eval_enc_str(value)) end end end @@ -296,19 +296,19 @@ module Tk::Tcllib::Plotchart def initialize(*args) # args := ([parent,] radius_data [, keys]) # radius_data := Array of [maximum_radius, stepsize] if args[0].kind_of?(Array) - @radius_data = args.shift + @radius_data = args.shift - super(*args) # create canvas widget + super(*args) # create canvas widget else - parent = args.shift + parent = args.shift - @radius_data = args.shift + @radius_data = args.shift - if parent.kind_of?(TkCanvas) - @path = parent.path - else - super(parent, *args) # create canvas widget - end + if parent.kind_of?(TkCanvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end end @chart = _create_chart @@ -317,7 +317,7 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG tk_call_without_enc(self.class::TkCommandNames[1], @path, - array2tk_list(@radius_data)) + array2tk_list(@radius_data)) end private :_create_chart @@ -327,16 +327,16 @@ module Tk::Tcllib::Plotchart def plot(series, radius, angle) tk_call_without_enc(@chart, 'plot', _get_eval_enc_str(series), - radius, angle) + radius, angle) self end def dataconfig(series, key, value=None) if key.kind_of?(Hash) - tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true)) + tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'dataconfig', series, - "-#{key}", _get_eval_enc_str(value)) + tk_call_without_enc(@chart, 'dataconfig', series, + "-#{key}", _get_eval_enc_str(value)) end end end @@ -356,33 +356,33 @@ module Tk::Tcllib::Plotchart # yaxis := Array of [minimum, maximum] # step := Float of stepsize | "noaxes" | :noaxes if args[0].kind_of?(Array) - @xaxis = args.shift - @yaxis = args.shift + @xaxis = args.shift + @yaxis = args.shift - if args[0].kind_of?(Hash) - @stepsize = :noaxes - else - @stepsize = args.shift - end + if args[0].kind_of?(Hash) + @stepsize = :noaxes + else + @stepsize = args.shift + end - super(*args) # create canvas widget + super(*args) # create canvas widget else - parent = args.shift - - @xaxis = args.shift - @yaxis = args.shift - - if args[0].kind_of?(Hash) - @stepsize = :noaxes - else - @stepsize = args.shift - end - - if parent.kind_of?(TkCanvas) - @path = parent.path - else - super(parent, *args) # create canvas widget - end + parent = args.shift + + @xaxis = args.shift + @yaxis = args.shift + + if args[0].kind_of?(Hash) + @stepsize = :noaxes + else + @stepsize = args.shift + end + + if parent.kind_of?(TkCanvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end end @chart = _create_chart @@ -391,8 +391,8 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG tk_call_without_enc(self.class::TkCommandNames[1], @path, - array2tk_list(@xaxis), array2tk_list(@yaxis), - @stepsize) + array2tk_list(@xaxis), array2tk_list(@yaxis), + @stepsize) end private :_create_chart @@ -436,23 +436,23 @@ module Tk::Tcllib::Plotchart # yaxis := Array of [minimum, maximum, stepsize] # zaxis := Array of [minimum, maximum, stepsize] if args[0].kind_of?(Array) - @xaxis = args.shift - @yaxis = args.shift - @zaxis = args.shift + @xaxis = args.shift + @yaxis = args.shift + @zaxis = args.shift - super(*args) # create canvas widget + super(*args) # create canvas widget else - parent = args.shift + parent = args.shift - @xaxis = args.shift - @yaxis = args.shift - @zaxis = args.shift + @xaxis = args.shift + @yaxis = args.shift + @zaxis = args.shift - if parent.kind_of?(TkCanvas) - @path = parent.path - else - super(parent, *args) # create canvas widget - end + if parent.kind_of?(TkCanvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end end @chart = _create_chart @@ -461,9 +461,9 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG tk_call_without_enc(self.class::TkCommandNames[1], @path, - array2tk_list(@xaxis), - array2tk_list(@yaxis), - array2tk_list(@zaxis)) + array2tk_list(@xaxis), + array2tk_list(@yaxis), + array2tk_list(@zaxis)) end private :_create_chart @@ -508,10 +508,10 @@ module Tk::Tcllib::Plotchart def initialize(*args) # args := ([parent] [, keys]) if args[0].kind_of?(TkCanvas) - parent = args.shift - @path = parent.path + parent = args.shift + @path = parent.path else - super(*args) # create canvas widget + super(*args) # create canvas widget end @chart = _create_chart end @@ -545,33 +545,33 @@ module Tk::Tcllib::Plotchart # axis := Array of [minimum, maximum, stepsize] # series := Integer number of data series | 'stacked' | :stacked if args[0].kind_of?(Array) - @xlabels = args.shift - @ylabels = args.shift + @xlabels = args.shift + @ylabels = args.shift - if args[0].kind_of?(Hash) - @series_size = :stacked - else - @series_size = args.shift - end + if args[0].kind_of?(Hash) + @series_size = :stacked + else + @series_size = args.shift + end - super(*args) # create canvas widget + super(*args) # create canvas widget else - parent = args.shift - - @xlabels = args.shift - @ylabels = args.shift - - if args[0].kind_of?(Hash) - @series_size = :stacked - else - @series_size = args.shift - end - - if parent.kind_of?(TkCanvas) - @path = parent.path - else - super(parent, *args) # create canvas widget - end + parent = args.shift + + @xlabels = args.shift + @ylabels = args.shift + + if args[0].kind_of?(Hash) + @series_size = :stacked + else + @series_size = args.shift + end + + if parent.kind_of?(TkCanvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end end @chart = _create_chart @@ -580,8 +580,8 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG tk_call_without_enc(self.class::TkCommandNames[1], @path, - array2tk_list(@xlabels), array2tk_list(@ylabels), - @series_size) + array2tk_list(@xlabels), array2tk_list(@ylabels), + @series_size) end private :_create_chart @@ -628,23 +628,23 @@ module Tk::Tcllib::Plotchart # items := Expected/maximum number of items # ( This determines the vertical spacing. ) if args[0].kind_of?(Array) - @time_begin = args.shift - @time_end = args.shift - @items = args.shift + @time_begin = args.shift + @time_end = args.shift + @items = args.shift - super(*args) # create canvas widget + super(*args) # create canvas widget else - parent = args.shift + parent = args.shift - @time_begin = args.shift - @time_end = args.shift - @items = args.shift + @time_begin = args.shift + @time_end = args.shift + @items = args.shift - if parent.kind_of?(TkCanvas) - @path = parent.path - else - super(parent, *args) # create canvas widget - end + if parent.kind_of?(TkCanvas) + @path = parent.path + else + super(parent, *args) # create canvas widget + end end @chart = _create_chart @@ -653,7 +653,7 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG tk_call_without_enc(self.class::TkCommandNames[1], @path, - @time_begin, @time_end, @items) + @time_begin, @time_end, @items) end private :_create_chart diff --git a/ext/tk/lib/tkextlib/tcllib/style.rb b/ext/tk/lib/tkextlib/tcllib/style.rb index 17fc834ccb..9fc4e92329 100644 --- a/ext/tk/lib/tkextlib/tcllib/style.rb +++ b/ext/tk/lib/tkextlib/tcllib/style.rb @@ -13,9 +13,9 @@ module Tk::Tcllib module Style def self.package_version begin - TkPackage.require('style') + TkPackage.require('style') rescue - '' + '' end end diff --git a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb index 4665edca7e..4e6008bb3b 100644 --- a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb +++ b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb @@ -48,7 +48,7 @@ module Tk::Tcllib::Tkpiechart def __configinfo_struct {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, - :default_value=>1, :current_value=>2} + :default_value=>1, :current_value=>2} end private :__configinfo_struct end @@ -69,10 +69,10 @@ module Tk::Tcllib::Tkpiechart def create_self(x, y, width, height, keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', 'pie', - @c, x, y, *hash_kv(keys, true)) + @tag_key = tk_call_without_enc('::stooop::new', 'pie', + @c, x, y, *hash_kv(keys, true)) else - @tag_key = tk_call_without_enc('::stooop::new', 'pie', @c, x, y) + @tag_key = tk_call_without_enc('::stooop::new', 'pie', @c, x, y) end @slice_tbl = {} @@ -114,20 +114,20 @@ module Tk::Tcllib::Tkpiechart def delete_slice(slice) unless slice.kind_of?(Slice) - unless (slice = @slice_tbl[slice]) - return tk_call_without_enc('pie::deleteSlice', @tag_key, slice) - end + unless (slice = @slice_tbl[slice]) + return tk_call_without_enc('pie::deleteSlice', @tag_key, slice) + end end unless slice.kind_of?(Slice) && slice.pie == self - fail ArgumentError, "argument is not a slice of self" + fail ArgumentError, "argument is not a slice of self" end slice.delete end def selected_slices tk_split_simplelist(tk_call_without_enc('pie::selectedSlices', - @tag_key)).collect{|slice| - @slice_tbl[slice] || Slice.new(:no_create, self, slice) + @tag_key)).collect{|slice| + @slice_tbl[slice] || Slice.new(:no_create, self, slice) } end end @@ -145,15 +145,15 @@ module Tk::Tcllib::Tkpiechart def initialize(pie, *args) unless pie.kind_of?(Pie) && pie != :no_create - fail ArgumentError, "expects TkPiechart::Pie for 1st argument" + fail ArgumentError, "expects TkPiechart::Pie for 1st argument" end if pie == :no_create - @pie, @tag_key = args + @pie, @tag_key = args else - text = args[0] || None - @pie = pie - @tag_key = tk_call_without_enc('pie::newSlice', @pie.tag_key, text) + text = args[0] || None + @pie = pie + @tag_key = tk_call_without_enc('pie::newSlice', @pie.tag_key, text) end @parent = @c = @pie.canvas @path = @parent.path @@ -186,7 +186,7 @@ module Tk::Tcllib::Tkpiechart def size(share, disp=None) tk_call_without_enc('pie::sizeSlice', - @pie.tag_key, @tag_key, share, disp) + @pie.tag_key, @tag_key, share, disp) self end @@ -209,10 +209,10 @@ module Tk::Tcllib::Tkpiechart def create_self(keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler', - *hash_kv(keys, true)) + @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler', + *hash_kv(keys, true)) else - @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler') + @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler') end id = "pieBoxLabeler(#{@tag_key})" @@ -241,11 +241,11 @@ module Tk::Tcllib::Tkpiechart def create_self(keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', - 'piePeripheralLabeler', - *hash_kv(keys, true)) + @tag_key = tk_call_without_enc('::stooop::new', + 'piePeripheralLabeler', + *hash_kv(keys, true)) else - @tag_key = tk_call_without_enc('::stooop::new', 'piePeripheralLabeler') + @tag_key = tk_call_without_enc('::stooop::new', 'piePeripheralLabeler') end id = "piePeripheralLabeler(#{@tag_key})" @@ -269,12 +269,12 @@ module Tk::Tcllib::Tkpiechart def create_self(x, y, keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', - @c, x, y, width, height, - *hash_kv(keys, true)) + @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', + @c, x, y, width, height, + *hash_kv(keys, true)) else - @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', - @c, x, y, width, height) + @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', + @c, x, y, width, height) end id = "canvasLabel(#{@tag_key})" diff --git a/ext/tk/lib/tkextlib/tclx/tclx.rb b/ext/tk/lib/tkextlib/tclx/tclx.rb index d10689d209..760ebd92b1 100644 --- a/ext/tk/lib/tkextlib/tclx/tclx.rb +++ b/ext/tk/lib/tkextlib/tclx/tclx.rb @@ -17,9 +17,9 @@ module Tk module TclX def self.package_version begin - TkPackage.require('Tclx') + TkPackage.require('Tclx') rescue - '' + '' end end @@ -31,28 +31,28 @@ module Tk class XPG3_MsgCat class << self - alias open new + alias open new end def initialize(catname, fail_mode=false) - if fail_mode - @msgcat_id = Tk.tk_call('catopen', '-fail', catname) - else - @msgcat_id = Tk.tk_call('catopen', '-nofail', catname) - end + if fail_mode + @msgcat_id = Tk.tk_call('catopen', '-fail', catname) + else + @msgcat_id = Tk.tk_call('catopen', '-nofail', catname) + end end def close(fail_mode=false) - if fail_mode - Tk.tk_call('catclose', '-fail', @msgcat_id) - else - Tk.tk_call('catclose', '-nofail', @msgcat_id) - end - self + if fail_mode + Tk.tk_call('catclose', '-fail', @msgcat_id) + else + Tk.tk_call('catclose', '-nofail', @msgcat_id) + end + self end def get(setnum, msgnum, defaultstr) - Tk.tk_call('catgets', @msgcat_id, setnum, msgnum, defaultstr) + Tk.tk_call('catgets', @msgcat_id, setnum, msgnum, defaultstr) end end end diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb index 91c01ca736..80a9083694 100644 --- a/ext/tk/lib/tkextlib/tile.rb +++ b/ext/tk/lib/tkextlib/tile.rb @@ -22,29 +22,29 @@ module Tk def self.package_version begin - TkPackage.require('tile') + TkPackage.require('tile') rescue - '' + '' end end module TileWidget def instate(state, script=nil, &b) - if script - tk_send('instate', state, script) - elsif b - tk_send('instate', state, Proc.new(&b)) - else - bool(tk_send('instate', state)) - end + if script + tk_send('instate', state, script) + elsif b + tk_send('instate', state, Proc.new(&b)) + else + bool(tk_send('instate', state)) + end end def state(state=nil) - if state - tk_send('state', state) - else - list(tk_send('state')) - end + if state + tk_send('state', state) + else + list(tk_send('state')) + end end end diff --git a/ext/tk/lib/tkextlib/tkDND/shape.rb b/ext/tk/lib/tkextlib/tkDND/shape.rb index 8f4716ceea..7187f0a3b3 100644 --- a/ext/tk/lib/tkextlib/tkDND/shape.rb +++ b/ext/tk/lib/tkextlib/tkDND/shape.rb @@ -19,93 +19,93 @@ module Tk module Shape =begin def self.package_version - begin - TkPackage.require('shape') - rescue - '' - end + begin + TkPackage.require('shape') + rescue + '' + end end =end def self.package_version - Tk.tk_call('set', 'shape_version') + Tk.tk_call('set', 'shape_version') end alias shape_version package_version def self.package_patchlevel - Tk.tk_call('set', 'shape_patchlevel') + Tk.tk_call('set', 'shape_patchlevel') end alias shape_patchlevel package_patchlevel def self.version - tk_call('shape', 'version') + tk_call('shape', 'version') end alias xshape_version version ############################ def shape_bounds(kind=nil) - if kind - ret = tk_call('shape', 'bounds', @path, "-#{kind}") - else - ret = tk_call('shape', 'bounds', @path) - end - if ret == "" - nil - else - list(ret) - end + if kind + ret = tk_call('shape', 'bounds', @path, "-#{kind}") + else + ret = tk_call('shape', 'bounds', @path) + end + if ret == "" + nil + else + list(ret) + end end def shape_get(kind=nil) - if kind - list(tk_call('shape', 'get', @path, "-#{kind}")) - else - list(tk_call('shape', 'get', @path)) - end + if kind + list(tk_call('shape', 'get', @path, "-#{kind}")) + else + list(tk_call('shape', 'get', @path)) + end end def shape_offset(x, y, kind=nil) - if kind - tk_call('shape', 'get', @path, "-#{kind}", x, y) - else - tk_call('shape', 'get', @path, x, y) - end - self + if kind + tk_call('shape', 'get', @path, "-#{kind}", x, y) + else + tk_call('shape', 'get', @path, x, y) + end + self end def _parse_shapespec_param(args) - cmd = [] + cmd = [] - kind_keys = ['bounding', 'clip', 'both'] - offset_keys = ['offset'] - srckind_keys = ['bitmap', 'rectangles', 'reset', 'test', 'window'] + kind_keys = ['bounding', 'clip', 'both'] + offset_keys = ['offset'] + srckind_keys = ['bitmap', 'rectangles', 'reset', 'test', 'window'] - cmd << "-#{args.shift}" if kind_keys.member?(args[0].to_s) + cmd << "-#{args.shift}" if kind_keys.member?(args[0].to_s) - if offset_keys.member?(args[0].to_s) - cmd << "-#{args.shift}" - cmd << args.shift # xOffset - cmd << args.shift # yOffset - end + if offset_keys.member?(args[0].to_s) + cmd << "-#{args.shift}" + cmd << args.shift # xOffset + cmd << args.shift # yOffset + end - if srckind_keys.member?(args[0].to_s) - cmd << "-#{args.shift}" - end + if srckind_keys.member?(args[0].to_s) + cmd << "-#{args.shift}" + end - cmd.concat(args) + cmd.concat(args) - cmd + cmd end private :_parse_shapespec_param def shape_set(*args) # ?kind? ?offset <x> <y>? srckind ?arg ...? - tk_call('shape', 'set', @path, *(_parse_shapespec_param(args))) - self + tk_call('shape', 'set', @path, *(_parse_shapespec_param(args))) + self end def shape_update(op, *args) # ?kind? ?offset <x> <y>? srckind ?arg ...? - tk_call('shape', 'update', @path, op, *(_parse_shapespec_param(args))) - self + tk_call('shape', 'update', @path, op, *(_parse_shapespec_param(args))) + self end end end diff --git a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb index d0895c2afd..78381f8df0 100644 --- a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb +++ b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb @@ -17,39 +17,39 @@ module Tk module TkDND def self.package_version begin - TkPackage.require('tkdnd') + TkPackage.require('tkdnd') rescue - '' + '' end end class DND_Subst < TkUtil::CallbackSubst KEY_TBL = [ - [ ?a, ?l, :actions ], - [ ?A, ?s, :action ], - [ ?b, ?L, :codes ], - [ ?c, ?s, :code ], - [ ?d, ?l, :descriptions ], - [ ?D, ?l, :data ], - [ ?L, ?l, :source_types ], - [ ?m, ?l, :modifiers ], - [ ?t, ?l, :types ], - [ ?T, ?s, :type ], - [ ?W, ?w, :widget ], - [ ?x, ?n, :x ], - [ ?X, ?n, :x_root ], - [ ?y, ?n, :y ], - [ ?Y, ?n, :y_root ], - nil + [ ?a, ?l, :actions ], + [ ?A, ?s, :action ], + [ ?b, ?L, :codes ], + [ ?c, ?s, :code ], + [ ?d, ?l, :descriptions ], + [ ?D, ?l, :data ], + [ ?L, ?l, :source_types ], + [ ?m, ?l, :modifiers ], + [ ?t, ?l, :types ], + [ ?T, ?s, :type ], + [ ?W, ?w, :widget ], + [ ?x, ?n, :x ], + [ ?X, ?n, :x_root ], + [ ?y, ?n, :y ], + [ ?Y, ?n, :y_root ], + nil ] PROC_TBL = [ - [ ?n, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?l, TkComm.method(:list) ], - [ ?L, TkComm.method(:simplelist) ], - [ ?w, TkComm.method(:window) ], - nil + [ ?n, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?l, TkComm.method(:list) ], + [ ?L, TkComm.method(:simplelist) ], + [ ?w, TkComm.method(:window) ], + nil ] # setup tables @@ -58,62 +58,62 @@ module Tk module DND def self.version - begin - TkPackage.require('tkdnd') - rescue - '' - end + begin + TkPackage.require('tkdnd') + rescue + '' + end end def dnd_bindtarget_info(type=nil, event=nil) - if event - procedure(tk_call('dnd', 'bindtarget', @path, type, event)) - elsif type - procedure(tk_call('dnd', 'bindtarget', @path, type)) - else - simplelist(tk_call('dnd', 'bindtarget', @path)) - end + if event + procedure(tk_call('dnd', 'bindtarget', @path, type, event)) + elsif type + procedure(tk_call('dnd', 'bindtarget', @path, type)) + else + simplelist(tk_call('dnd', 'bindtarget', @path)) + end end def dnd_bindtarget(type, event, cmd=Proc.new, prior=50, *args) - event = tk_event_sequence(event) - if prior.kind_of?(Numeric) - tk_call('dnd', 'bindtarget', @path, type, event, - install_bind_for_event_class(DND_Subst, cmd, *args), - prior) - else - tk_call('dnd', 'bindtarget', @path, type, event, - install_bind_for_event_class(DND_Subst, cmd, prior, *args)) - end - self + event = tk_event_sequence(event) + if prior.kind_of?(Numeric) + tk_call('dnd', 'bindtarget', @path, type, event, + install_bind_for_event_class(DND_Subst, cmd, *args), + prior) + else + tk_call('dnd', 'bindtarget', @path, type, event, + install_bind_for_event_class(DND_Subst, cmd, prior, *args)) + end + self end def dnd_cleartarget - tk_call('dnd', 'cleartarget', @path) - self + tk_call('dnd', 'cleartarget', @path) + self end def dnd_bindsource_info(type=nil) - if type - procedure(tk_call('dnd', 'bindsource', @path, type)) - else - simplelist(tk_call('dnd', 'bindsource', @path)) - end + if type + procedure(tk_call('dnd', 'bindsource', @path, type)) + else + simplelist(tk_call('dnd', 'bindsource', @path)) + end end def dnd_bindsource(type, cmd=Proc.new, prior=None) - tk_call('dnd', 'bindsource', @path, type, cmd, prior) - self + tk_call('dnd', 'bindsource', @path, type, cmd, prior) + self end def dnd_clearsource() - tk_call('dnd', 'clearsource', @path) - self + tk_call('dnd', 'clearsource', @path) + self end def dnd_drag(keys=nil) - tk_call('dnd', 'drag', @path, *hash_kv(keys)) - self + tk_call('dnd', 'drag', @path, *hash_kv(keys)) + self end end end diff --git a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb index 0c900cdb85..b9a203575a 100644 --- a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb +++ b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb @@ -18,9 +18,9 @@ module Tk class HTML_Widget < TkWindow def self.package_version begin - TkPackage.require('Tkhtml') + TkPackage.require('Tkhtml') rescue - '' + '' end end @@ -55,7 +55,7 @@ class Tk::HTML_Widget::ClippingWindow if widgetname =~ /^(.*)\.[^.]+$/ ppath2 = $1 if ppath2[0] != ?. - ppath2 = ppath + '.' + ppath2 + ppath2 = ppath + '.' + ppath2 end return HtmlClip_TBL[ppath2] if HtmlClip_TBL[ppath2] diff --git a/ext/tk/lib/tkextlib/tkimg.rb b/ext/tk/lib/tkextlib/tkimg.rb index f70d76c9d1..ffeafbb58e 100644 --- a/ext/tk/lib/tkextlib/tkimg.rb +++ b/ext/tk/lib/tkextlib/tkimg.rb @@ -19,9 +19,9 @@ module Tk module Img def self.package_version begin - TkPackage.require('Img') + TkPackage.require('Img') rescue - '' + '' end end end diff --git a/ext/tk/lib/tkextlib/tkimg/bmp.rb b/ext/tk/lib/tkextlib/tkimg/bmp.rb index e6031a43ea..581483f8f4 100644 --- a/ext/tk/lib/tkextlib/tkimg/bmp.rb +++ b/ext/tk/lib/tkextlib/tkimg/bmp.rb @@ -17,11 +17,11 @@ module Tk module Img module BMP def self.package_version - begin - TkPackage.require('img::bmp') - rescue - '' - end + begin + TkPackage.require('img::bmp') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/gif.rb b/ext/tk/lib/tkextlib/tkimg/gif.rb index b464434498..6ef18f8e90 100644 --- a/ext/tk/lib/tkextlib/tkimg/gif.rb +++ b/ext/tk/lib/tkextlib/tkimg/gif.rb @@ -17,11 +17,11 @@ module Tk module Img module GIF def self.package_version - begin - TkPackage.require('img::gif') - rescue - '' - end + begin + TkPackage.require('img::gif') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/ico.rb b/ext/tk/lib/tkextlib/tkimg/ico.rb index 2872a621ad..1e3cb5f497 100644 --- a/ext/tk/lib/tkextlib/tkimg/ico.rb +++ b/ext/tk/lib/tkextlib/tkimg/ico.rb @@ -17,11 +17,11 @@ module Tk module Img module ICO def self.package_version - begin - TkPackage.require('img::ico') - rescue - '' - end + begin + TkPackage.require('img::ico') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/jpeg.rb b/ext/tk/lib/tkextlib/tkimg/jpeg.rb index eac39083bc..017c93ee0e 100644 --- a/ext/tk/lib/tkextlib/tkimg/jpeg.rb +++ b/ext/tk/lib/tkextlib/tkimg/jpeg.rb @@ -17,11 +17,11 @@ module Tk module Img module JPEG def self.package_version - begin - TkPackage.require('img::jpeg') - rescue - '' - end + begin + TkPackage.require('img::jpeg') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/pcx.rb b/ext/tk/lib/tkextlib/tkimg/pcx.rb index 26311e5984..e924d48869 100644 --- a/ext/tk/lib/tkextlib/tkimg/pcx.rb +++ b/ext/tk/lib/tkextlib/tkimg/pcx.rb @@ -17,11 +17,11 @@ module Tk module Img module PCX def self.package_version - begin - TkPackage.require('img::pcx') - rescue - '' - end + begin + TkPackage.require('img::pcx') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/pixmap.rb b/ext/tk/lib/tkextlib/tkimg/pixmap.rb index ae8d3201cb..f9aaa65a9b 100644 --- a/ext/tk/lib/tkextlib/tkimg/pixmap.rb +++ b/ext/tk/lib/tkextlib/tkimg/pixmap.rb @@ -17,11 +17,11 @@ module Tk module Img module PIXMAP def self.package_version - begin - TkPackage.require('img::pixmap') - rescue - '' - end + begin + TkPackage.require('img::pixmap') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/png.rb b/ext/tk/lib/tkextlib/tkimg/png.rb index acdd8c536f..b155836395 100644 --- a/ext/tk/lib/tkextlib/tkimg/png.rb +++ b/ext/tk/lib/tkextlib/tkimg/png.rb @@ -17,11 +17,11 @@ module Tk module Img module PNG def self.package_version - begin - TkPackage.require('img::png') - rescue - '' - end + begin + TkPackage.require('img::png') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/ppm.rb b/ext/tk/lib/tkextlib/tkimg/ppm.rb index f15bdb9f18..df56baee4a 100644 --- a/ext/tk/lib/tkextlib/tkimg/ppm.rb +++ b/ext/tk/lib/tkextlib/tkimg/ppm.rb @@ -17,11 +17,11 @@ module Tk module Img module PPM def self.package_version - begin - TkPackage.require('img::ppm') - rescue - '' - end + begin + TkPackage.require('img::ppm') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/ps.rb b/ext/tk/lib/tkextlib/tkimg/ps.rb index 7c5cab2a4f..3025066eb4 100644 --- a/ext/tk/lib/tkextlib/tkimg/ps.rb +++ b/ext/tk/lib/tkextlib/tkimg/ps.rb @@ -17,11 +17,11 @@ module Tk module Img module PS def self.package_version - begin - TkPackage.require('img::ps') - rescue - '' - end + begin + TkPackage.require('img::ps') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/sgi.rb b/ext/tk/lib/tkextlib/tkimg/sgi.rb index 1cdf60e64c..e505c87e8b 100644 --- a/ext/tk/lib/tkextlib/tkimg/sgi.rb +++ b/ext/tk/lib/tkextlib/tkimg/sgi.rb @@ -17,11 +17,11 @@ module Tk module Img module SGI def self.package_version - begin - TkPackage.require('img::sgi') - rescue - '' - end + begin + TkPackage.require('img::sgi') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/sun.rb b/ext/tk/lib/tkextlib/tkimg/sun.rb index 88f9a44656..25bfea8fb7 100644 --- a/ext/tk/lib/tkextlib/tkimg/sun.rb +++ b/ext/tk/lib/tkextlib/tkimg/sun.rb @@ -17,11 +17,11 @@ module Tk module Img module SUN def self.package_version - begin - TkPackage.require('img::sun') - rescue - '' - end + begin + TkPackage.require('img::sun') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/tga.rb b/ext/tk/lib/tkextlib/tkimg/tga.rb index c4068a729c..e3f84c3714 100644 --- a/ext/tk/lib/tkextlib/tkimg/tga.rb +++ b/ext/tk/lib/tkextlib/tkimg/tga.rb @@ -17,11 +17,11 @@ module Tk module Img module TGA def self.package_version - begin - TkPackage.require('img::tga') - rescue - '' - end + begin + TkPackage.require('img::tga') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/tiff.rb b/ext/tk/lib/tkextlib/tkimg/tiff.rb index 529999ef2d..e7e12406ac 100644 --- a/ext/tk/lib/tkextlib/tkimg/tiff.rb +++ b/ext/tk/lib/tkextlib/tkimg/tiff.rb @@ -17,11 +17,11 @@ module Tk module Img module TIFF def self.package_version - begin - TkPackage.require('img::tiff') - rescue - '' - end + begin + TkPackage.require('img::tiff') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/window.rb b/ext/tk/lib/tkextlib/tkimg/window.rb index 229445dd46..00ed7d1b86 100644 --- a/ext/tk/lib/tkextlib/tkimg/window.rb +++ b/ext/tk/lib/tkextlib/tkimg/window.rb @@ -17,11 +17,11 @@ module Tk module Img module WINDOW def self.package_version - begin - TkPackage.require('img::window') - rescue - '' - end + begin + TkPackage.require('img::window') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/xbm.rb b/ext/tk/lib/tkextlib/tkimg/xbm.rb index 3b680d9b59..08b1b9876b 100644 --- a/ext/tk/lib/tkextlib/tkimg/xbm.rb +++ b/ext/tk/lib/tkextlib/tkimg/xbm.rb @@ -17,11 +17,11 @@ module Tk module Img module XBM def self.package_version - begin - TkPackage.require('img::xbm') - rescue - '' - end + begin + TkPackage.require('img::xbm') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tkimg/xpm.rb b/ext/tk/lib/tkextlib/tkimg/xpm.rb index eff1e3c2b6..e29c1d554f 100644 --- a/ext/tk/lib/tkextlib/tkimg/xpm.rb +++ b/ext/tk/lib/tkextlib/tkimg/xpm.rb @@ -17,11 +17,11 @@ module Tk module Img module XPM def self.package_version - begin - TkPackage.require('img::xpm') - rescue - '' - end + begin + TkPackage.require('img::xpm') + rescue + '' + end end end end diff --git a/ext/tk/lib/tkextlib/tktable/tktable.rb b/ext/tk/lib/tkextlib/tktable/tktable.rb index 18751fca6c..2f2b14a69f 100644 --- a/ext/tk/lib/tkextlib/tktable/tktable.rb +++ b/ext/tk/lib/tkextlib/tktable/tktable.rb @@ -19,9 +19,9 @@ module Tk class TkTable < TkWindow def self.package_version begin - TkPackage.require('Tktable') + TkPackage.require('Tktable') rescue - '' + '' end end @@ -200,28 +200,28 @@ class Tk::TkTable class BrowseCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :column ], - [ ?C, ?s, :index ], - [ ?i, ?x, :cursor ], - [ ?r, ?n, :row ], - [ ?s, ?s, :last_index ], - [ ?S, ?s, :new_index ], - [ ?W, ?w, :widget ], - nil + [ ?c, ?n, :column ], + [ ?C, ?s, :index ], + [ ?i, ?x, :cursor ], + [ ?r, ?n, :row ], + [ ?s, ?s, :last_index ], + [ ?S, ?s, :new_index ], + [ ?W, ?w, :widget ], + nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?x, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], - nil + [ ?n, TkComm.method(:number) ], + [ ?x, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], + nil ] _setup_subst_table(KEY_TBL, PROC_TBL); def self.ret_val(val) - val + val end end @@ -233,28 +233,28 @@ class Tk::TkTable class CellCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :column ], - [ ?C, ?s, :index ], - [ ?i, ?m, :rw_mode ], - [ ?r, ?n, :row ], - [ ?s, ?v, :value ], - [ ?W, ?w, :widget ], - nil + [ ?c, ?n, :column ], + [ ?C, ?s, :index ], + [ ?i, ?m, :rw_mode ], + [ ?r, ?n, :row ], + [ ?s, ?v, :value ], + [ ?W, ?w, :widget ], + nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], - [ ?m, proc{|val| (val == '0')? (:r) : (:w)} ], - [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], - nil + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], + [ ?m, proc{|val| (val == '0')? (:r) : (:w)} ], + [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], + nil ] _setup_subst_table(KEY_TBL, PROC_TBL); def self.ret_val(val) - TkComm._get_eval_string(val) + TkComm._get_eval_string(val) end end @@ -266,26 +266,26 @@ class Tk::TkTable class SelectionCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :sel_columns ], - [ ?C, ?s, :sel_area ], - [ ?i, ?n, :total ], - [ ?r, ?n, :sel_rows ], - [ ?s, ?s, :value ], - [ ?W, ?w, :widget ], - nil + [ ?c, ?n, :sel_columns ], + [ ?C, ?s, :sel_area ], + [ ?i, ?n, :total ], + [ ?r, ?n, :sel_rows ], + [ ?s, ?s, :value ], + [ ?W, ?w, :widget ], + nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], - nil + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], + nil ] _setup_subst_table(KEY_TBL, PROC_TBL); def self.ret_val(val) - val.to_s + val.to_s end end @@ -297,23 +297,23 @@ class Tk::TkTable class ValidateCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :column ], - [ ?C, ?s, :index ], - [ ?i, ?x, :cursor ], - [ ?r, ?n, :row ], - [ ?s, ?v, :current_value ], - [ ?S, ?v, :new_value ], - [ ?W, ?w, :widget ], - nil + [ ?c, ?n, :column ], + [ ?C, ?s, :index ], + [ ?i, ?x, :cursor ], + [ ?r, ?n, :row ], + [ ?s, ?v, :current_value ], + [ ?S, ?v, :new_value ], + [ ?W, ?w, :widget ], + nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?x, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], - [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], - nil + [ ?n, TkComm.method(:number) ], + [ ?x, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], + [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], + nil ] _setup_subst_table(KEY_TBL, PROC_TBL); @@ -447,9 +447,9 @@ class Tk::TkTable def hidden?(idx, *args) if args.empty? if (ret = tk_send('hidden', tagid(idx))) == '' - false + false else - ret + ret end else bool(tk_send('hidden', tagid(idx), *(args.collect{|i| tagid(i)}))) @@ -582,8 +582,8 @@ class Tk::TkTable # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| - args << tagid(pairs[i]) - args << pairs[i+1] + args << tagid(pairs[i]) + args << pairs[i+1] } tk_send('set', *args) end @@ -599,8 +599,8 @@ class Tk::TkTable # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| - args << tagid(pairs[i]) - args << pairs[i+1] + args << tagid(pairs[i]) + args << pairs[i+1] } tk_send('set', 'row', *args) end @@ -616,8 +616,8 @@ class Tk::TkTable # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| - args << tagid(pairs[i]) - args << pairs[i+1] + args << tagid(pairs[i]) + args << pairs[i+1] } tk_send('set', 'col', *args) end @@ -647,9 +647,9 @@ class Tk::TkTable args << tagid(pairs[i]) val = pairs[i+1] if val.kind_of?(Array) - args << val.join(',') + args << val.join(',') else - args << val + args << val end } tk_send('spans', *args) @@ -661,25 +661,25 @@ class Tk::TkTable # [idx, val], [idx, val], ... args = [] pairs.each{|idx, val| - args << tagid(idx) - if val.kind_of?(Array) - args << val.join(',') - else - args << val - end + args << tagid(idx) + if val.kind_of?(Array) + args << val.join(',') + else + args << val + end } tk_send('spans', *args) else # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| - args << tagid(pairs[i]) - val = pairs[i+1] - if val.kind_of?(Array) - args << val.join(',') - else - args << val - end + args << tagid(pairs[i]) + val = pairs[i+1] + if val.kind_of?(Array) + args << val.join(',') + else + args << val + end } tk_send('spans', *args) end @@ -692,10 +692,10 @@ class Tk::TkTable tag.id elsif tag.kind_of?(Array) if tag[0].kind_of?(Integer) && tag[1].kind_of?(Integer) - # [row, col] - tag.join(',') + # [row, col] + tag.join(',') else - tag + tag end else tag @@ -705,9 +705,9 @@ class Tk::TkTable def tagid2obj(tagid) if Tk::TkTable::CellTag::CellTagID_TBL.key?(@path) if Tk::TkTable::CellTag::CellTagID_TBL[@path].key?(tagid) - Tk::TkTable::CellTag::CellTagID_TBL[@path][tagid] + Tk::TkTable::CellTag::CellTagID_TBL[@path][tagid] else - tagid + tagid end else tagid @@ -734,9 +734,9 @@ class Tk::TkTable tk_send('tag', 'delete', tagid(tag)) if Tk::TkTable::CellTag::CellTagID_TBL[@path] if tag.kind_of? Tk::TkTable::CellTag - Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag.id) + Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag.id) else - Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag) + Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag) end end self diff --git a/ext/tk/lib/tkextlib/tktrans/tktrans.rb b/ext/tk/lib/tkextlib/tktrans/tktrans.rb index 2acdac7217..55ac03e563 100644 --- a/ext/tk/lib/tkextlib/tktrans/tktrans.rb +++ b/ext/tk/lib/tkextlib/tktrans/tktrans.rb @@ -16,9 +16,9 @@ module Tk module TkTrans def self.package_version begin - TkPackage.require('tktrans') + TkPackage.require('tktrans') rescue - '' + '' end end end diff --git a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb index 3ea1a324cb..cc23857c5f 100644 --- a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb +++ b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb @@ -18,9 +18,9 @@ module Tk class TreeCtrl < TkWindow def self.package_version begin - TkPackage.require('treectrl') + TkPackage.require('treectrl') rescue - '' + '' end end @@ -81,14 +81,14 @@ class Tk::TreeCtrl::NotifyEvent [ ?b, proc{|val| list(val)} ], [ ?e, proc{|val| - case val - when /^<<[^<>]+>>$/ - TkVirtualEvent.getobj(val[1..-2]) - when /^<[^<>]+>$/ - val[1..-2] - else - val - end + case val + when /^<<[^<>]+>>$/ + TkVirtualEvent.getobj(val[1..-2]) + when /^<[^<>]+>$/ + val[1..-2] + else + val + end } ], @@ -194,12 +194,12 @@ module Tk::TreeCtrl::ConfigMethod if id.kind_of?(Array) key = id[0] if key.kind_of?(Array) - key = key.join(' ') + key = key.join(' ') end tag = id[1] if tag.kind_of?(Array) - tag = tag.join(' ') + tag = tag.join(' ') end id = [key, tag].join(':') @@ -211,10 +211,10 @@ module Tk::TreeCtrl::ConfigMethod def __item_configinfo_struct(id) if id.kind_of?(Array) && id[0].to_s == 'notify' {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, - :default_value=>nil, :current_value=>1} + :default_value=>nil, :current_value=>1} else {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, - :default_value=>3, :current_value=>4} + :default_value=>3, :current_value=>4} end end private :__item_configinfo_struct @@ -621,13 +621,13 @@ class Tk::TreeCtrl opts = opts.collect{|opt| if opt.kind_of?(Array) - key = "-#{opt[0]}" - flag = true if key == '-notreally' - ["-#{opt[0]}", opt[1]] + key = "-#{opt[0]}" + flag = true if key == '-notreally' + ["-#{opt[0]}", opt[1]] else - key = "-#{opt}" - flag = true if key == '-notreally' - key + key = "-#{opt}" + flag = true if key == '-notreally' + key end }.flatten @@ -664,9 +664,9 @@ class Tk::TreeCtrl def item_style_set(item, column=nil, *args) if args.empty? if column - tk_send('item', 'style', 'set', item, column) + tk_send('item', 'style', 'set', item, column) else - list(tk_send('item', 'style', 'set', item)) + list(tk_send('item', 'style', 'set', item)) end else tk_send('item', 'style', 'set', item, *(args.flatten)) @@ -677,10 +677,10 @@ class Tk::TreeCtrl def item_text(item, column, txt=nil, *args) if args.empty? if txt - tk_send('item', 'text', item, column, txt) - self + tk_send('item', 'text', item, column, txt) + self else - tk_send('item', 'text', item, column) + tk_send('item', 'text', item, column) end else tk_send('item', 'text', item, txt, *args) @@ -897,10 +897,10 @@ class Tk::TreeCtrl def style_layout(style, elem, keys=None) if keys && keys != None if keys.kind_of?(Hash) - tk_send('style', 'layout', style, elem, *hash_kv(keys)) - self + tk_send('style', 'layout', style, elem, *hash_kv(keys)) + self else - tk_send('style', 'layout', style, elem, "-#{keys}") + tk_send('style', 'layout', style, elem, "-#{keys}") end else list(tk_send('style', 'layout', style, elem)) diff --git a/ext/tk/lib/tkextlib/vu.rb b/ext/tk/lib/tkextlib/vu.rb index d3809f05b7..c4ea1b86e6 100644 --- a/ext/tk/lib/tkextlib/vu.rb +++ b/ext/tk/lib/tkextlib/vu.rb @@ -22,9 +22,9 @@ module Tk def self.package_version begin - TkPackage.require('vu') + TkPackage.require('vu') rescue - '' + '' end end diff --git a/ext/tk/lib/tkextlib/vu/charts.rb b/ext/tk/lib/tkextlib/vu/charts.rb index 594582d69b..a578c6979b 100644 --- a/ext/tk/lib/tkextlib/vu/charts.rb +++ b/ext/tk/lib/tkextlib/vu/charts.rb @@ -13,12 +13,12 @@ module Tk module ChartsConfig include TkItemConfigOptkeys def __item_boolval_optkeys(id) - super(id) << 'lefttrunc' << 'autocolor' + super(id) << 'lefttrunc' << 'autocolor' end private :__item_boolval_optkeys def __item_listval_optkeys(id) - super(id) << 'values' << 'tags' + super(id) << 'values' << 'tags' end private :__item_listval_optkeys end diff --git a/ext/tk/lib/tkextlib/vu/dial.rb b/ext/tk/lib/tkextlib/vu/dial.rb index e675ceb2de..e27a38ae42 100644 --- a/ext/tk/lib/tkextlib/vu/dial.rb +++ b/ext/tk/lib/tkextlib/vu/dial.rb @@ -58,7 +58,7 @@ class Tk::Vu::Dial < TkWindow ret = [] lst = simplelist(tk_call(@path, 'label')) while lst.size > 0 - ret << ([num_or_str(lst.shift)] << lst.shift) + ret << ([num_or_str(lst.shift)] << lst.shift) end end end @@ -80,7 +80,7 @@ class Tk::Vu::Dial < TkWindow ret = [] lst = simplelist(tk_call(@path, 'tag')) while lst.size > 0 - ret << ([num_or_str(lst.shift)] << lst.shift) + ret << ([num_or_str(lst.shift)] << lst.shift) end end end diff --git a/ext/tk/lib/tkextlib/winico/winico.rb b/ext/tk/lib/tkextlib/winico/winico.rb index 959f05ec79..8a71cbb401 100644 --- a/ext/tk/lib/tkextlib/winico/winico.rb +++ b/ext/tk/lib/tkextlib/winico/winico.rb @@ -18,9 +18,9 @@ module Tk class Winico < TkObject def self.package_version begin - TkPackage.require('winico') + TkPackage.require('winico') rescue - '' + '' end end end @@ -61,9 +61,9 @@ class Tk::Winico if resource_name # from resource if file_name - @id = Tk.tk_call('winico', 'load', resource_name, file_name) + @id = Tk.tk_call('winico', 'load', resource_name, file_name) else - @id = Tk.tk_call('winico', 'load', resource_name) + @id = Tk.tk_call('winico', 'load', resource_name) end elsif file_name # from .ico file @@ -72,7 +72,7 @@ class Tk::Winico @id = winico_id else fail ArgumentError, - "must be given proper information from where loading icons" + "must be given proper information from where loading icons" end @path = @id WinicoID_TBL[@id] = self @@ -104,35 +104,35 @@ class Tk::Winico class Winico_callback < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?m, ?s, :message ], - [ ?i, ?x, :icon ], - [ ?x, ?n, :x ], - [ ?y, ?n, :y ], - [ ?X, ?n, :last_x ], - [ ?Y, ?n, :last_y ], - [ ?t, ?n, :tickcount ], - [ ?w, ?n, :icon_idnum ], - [ ?l, ?n, :msg_idnum ], - nil + [ ?m, ?s, :message ], + [ ?i, ?x, :icon ], + [ ?x, ?n, :x ], + [ ?y, ?n, :y ], + [ ?X, ?n, :last_x ], + [ ?Y, ?n, :last_y ], + [ ?t, ?n, :tickcount ], + [ ?w, ?n, :icon_idnum ], + [ ?l, ?n, :msg_idnum ], + nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?x, proc{|id| - if Tk::Winico::WinicoID_TBL.key?(id) - Tk::Winico::WinicoID_TBL[id] - else - Tk::Winico.new(nil, nil, id) - end - } ], - nil + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?x, proc{|id| + if Tk::Winico::WinicoID_TBL.key?(id) + Tk::Winico::WinicoID_TBL[id] + else + Tk::Winico.new(nil, nil, id) + end + } ], + nil ] _setup_subst_table(KEY_TBL, PROC_TBL); def self.ret_val(val) - val + val end end @@ -147,10 +147,10 @@ class Tk::Winico keys = _symbolkey2str(keys) Winico_callback._config_keys.each{|k| if keys[k].kind_of?(Array) - cmd, *args = keys[k] - keys[k] = Winico_callback.new(cmd, args.join(' ')) + cmd, *args = keys[k] + keys[k] = Winico_callback.new(cmd, args.join(' ')) elsif keys[k].kind_of?(Proc) - keys[k] = Winico_callback.new(keys[k]) + keys[k] = Winico_callback.new(keys[k]) end } tk_call('winico', 'taskbar', 'add', @id, *(hash_kv(keys))) @@ -162,10 +162,10 @@ class Tk::Winico keys = _symbolkey2str(keys) Winico_callback._config_keys.each{|k| if keys[k].kind_of?(Array) - cmd, *args = keys[k] - keys[k] = Winico_callback.new(cmd, args.join(' ')) + cmd, *args = keys[k] + keys[k] = Winico_callback.new(cmd, args.join(' ')) elsif keys[k].kind_of?(Proc) - keys[k] = Winico_callback.new(keys[k]) + keys[k] = Winico_callback.new(keys[k]) end } tk_call('winico', 'taskbar', 'modify', @id, *(hash_kv(keys))) |