summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-11 04:51:21 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-11 04:51:21 +0000
commit94d960beb57ead291992a6ceb34871b377ade1d1 (patch)
tree81258b81d9111c762cb80ca56141cd1f8ce9d0f9 /ext/tk/lib/tk
parent5716ff7b80b90b0c2aebcc1d41d8806aaf707bf3 (diff)
* ext/tk/lib/tk/*: untabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk')
-rw-r--r--ext/tk/lib/tk/canvas.rb372
-rw-r--r--ext/tk/lib/tk/clock.rb24
-rw-r--r--ext/tk/lib/tk/composite.rb328
-rw-r--r--ext/tk/lib/tk/console.rb2
-rw-r--r--ext/tk/lib/tk/dialog.rb60
-rw-r--r--ext/tk/lib/tk/encodedstr.rb48
-rw-r--r--ext/tk/lib/tk/entry.rb6
-rw-r--r--ext/tk/lib/tk/event.rb38
-rw-r--r--ext/tk/lib/tk/font.rb806
-rw-r--r--ext/tk/lib/tk/grid.rb50
-rw-r--r--ext/tk/lib/tk/image.rb34
-rw-r--r--ext/tk/lib/tk/itemconfig.rb1168
-rw-r--r--ext/tk/lib/tk/itemfont.rb184
-rw-r--r--ext/tk/lib/tk/kinput.rb6
-rw-r--r--ext/tk/lib/tk/listbox.rb226
-rw-r--r--ext/tk/lib/tk/menu.rb238
-rw-r--r--ext/tk/lib/tk/menubar.rb20
-rw-r--r--ext/tk/lib/tk/menuspec.rb194
-rw-r--r--ext/tk/lib/tk/msgcat.rb94
-rw-r--r--ext/tk/lib/tk/namespace.rb46
-rw-r--r--ext/tk/lib/tk/optiondb.rb162
-rw-r--r--ext/tk/lib/tk/optionobj.rb148
-rw-r--r--ext/tk/lib/tk/package.rb20
-rw-r--r--ext/tk/lib/tk/palette.rb8
-rw-r--r--ext/tk/lib/tk/panedwindow.rb132
-rw-r--r--ext/tk/lib/tk/place.rb50
-rw-r--r--ext/tk/lib/tk/root.rb22
-rw-r--r--ext/tk/lib/tk/scale.rb12
-rw-r--r--ext/tk/lib/tk/scrollable.rb32
-rw-r--r--ext/tk/lib/tk/scrollbar.rb10
-rw-r--r--ext/tk/lib/tk/scrollbox.rb6
-rw-r--r--ext/tk/lib/tk/selection.rb6
-rw-r--r--ext/tk/lib/tk/spinbox.rb6
-rw-r--r--ext/tk/lib/tk/text.rb994
-rw-r--r--ext/tk/lib/tk/textimage.rb14
-rw-r--r--ext/tk/lib/tk/textmark.rb6
-rw-r--r--ext/tk/lib/tk/texttag.rb60
-rw-r--r--ext/tk/lib/tk/textwindow.rb72
-rw-r--r--ext/tk/lib/tk/timer.rb78
-rw-r--r--ext/tk/lib/tk/toplevel.rb58
-rw-r--r--ext/tk/lib/tk/validation.rb198
-rw-r--r--ext/tk/lib/tk/variable.rb386
-rw-r--r--ext/tk/lib/tk/virtevent.rb32
-rw-r--r--ext/tk/lib/tk/winfo.rb10
-rw-r--r--ext/tk/lib/tk/winpkg.rb32
-rw-r--r--ext/tk/lib/tk/wm.rb206
-rw-r--r--ext/tk/lib/tk/xim.rb60
47 files changed, 3397 insertions, 3367 deletions
diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb
index ac297c8ce5..1a8a7927d3 100644
--- a/ext/tk/lib/tk/canvas.rb
+++ b/ext/tk/lib/tk/canvas.rb
@@ -1,9 +1,7 @@
#
-# tk/canvas.rb - Tk canvas classes
-# $Date$
-# by Yukihiro Matsumoto <matz@caelum.co.jp>
-# $Date$
-# by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
+# tk/canvas.rb - Tk canvas classes
+# $Date$
+# by Yukihiro Matsumoto <matz@caelum.co.jp>
#
require 'tk'
require 'tk/canvastag'
@@ -93,7 +91,7 @@ class TkCanvas<TkWindow
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)
@@ -135,14 +133,14 @@ class TkCanvas<TkWindow
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)})
@@ -189,9 +187,9 @@ class TkCanvas<TkWindow
else
ret = tk_send_without_enc('focus')
if ret == ""
- nil
+ nil
else
- TkcItem.id2obj(self, ret)
+ TkcItem.id2obj(self, ret)
end
end
end
@@ -213,7 +211,7 @@ class TkCanvas<TkWindow
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
@@ -223,9 +221,9 @@ class TkCanvas<TkWindow
when 'dash', 'activedash', 'disableddash'
conf = tk_send_without_enc('itemcget', tagid(tagOrId), "-#{option}")
if conf =~ /^[0-9]/
- list(conf)
+ list(conf)
else
- conf
+ conf
end
when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
_fromUTF8(tk_send_without_enc('itemcget', tagid(tagOrId), "-#{option}"))
@@ -233,17 +231,17 @@ class TkCanvas<TkWindow
#fnt = tk_tcl2ruby(tk_send('itemcget', tagid(tagOrId), "-#{option}"))
fnt = tk_tcl2ruby(_fromUTF8(tk_send_with_enc('itemcget', tagid(tagOrId), '-font')))
unless fnt.kind_of?(TkFont)
- fnt = tagfontobj(tagid(tagOrId), fnt)
+ fnt = tagfontobj(tagid(tagOrId), fnt)
end
if option.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
- # obsolete; just for compatibility
- fnt.kanji_font
+ # obsolete; just for compatibility
+ fnt.kanji_font
else
- fnt
+ fnt
end
else
tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', tagid(tagOrId),
- "-#{option}")))
+ "-#{option}")))
end
end
@@ -254,28 +252,28 @@ class TkCanvas<TkWindow
self.coords(tagOrId, coords) if coords
if ( key['font'] || key['kanjifont'] \
- || key['latinfont'] || key['asciifont'] )
- tagfont_configure(tagid(tagOrId), key.dup)
+ || key['latinfont'] || key['asciifont'] )
+ tagfont_configure(tagid(tagOrId), key.dup)
else
- _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),
- *hash_kv(key, true)))
+ _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),
+ *hash_kv(key, true)))
end
else
if ( key == 'coords' || key == :coords )
- self.coords(tagOrId, value)
+ self.coords(tagOrId, value)
elsif ( key == 'font' || key == :font ||
- key == 'kanjifont' || key == :kanjifont ||
- key == 'latinfont' || key == :latinfont ||
- key == 'asciifont' || key == :asciifont )
- if value == None
- tagfontobj(tagid(tagOrId))
- else
- tagfont_configure(tagid(tagOrId), {key=>value})
- end
+ key == 'kanjifont' || key == :kanjifont ||
+ key == 'latinfont' || key == :latinfont ||
+ key == 'asciifont' || key == :asciifont )
+ if value == None
+ tagfontobj(tagid(tagOrId))
+ else
+ tagfont_configure(tagid(tagOrId), {key=>value})
+ end
else
- _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),
- "-#{key}", _get_eval_enc_str(value)))
+ _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),
+ "-#{key}", _get_eval_enc_str(value)))
end
end
self
@@ -294,142 +292,142 @@ class TkCanvas<TkWindow
def itemconfiginfo(tagOrId, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- case key.to_s
- when 'coords'
- return ['coords', '', '', '', self.coords(tagOrId)]
- when 'dash', 'activedash', 'disableddash'
- conf = tk_split_simplelist(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}"))
- if conf[3] && conf[3] =~ /^[0-9]/
- conf[3] = list(conf[3])
- end
- if conf[4] && conf[4] =~ /^[0-9]/
- conf[4] = list(conf[4])
- end
- when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
- when 'font', 'kanjifont'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),"-#{key}")))
- conf[4] = tagfont_configinfo(tagid(tagOrId), conf[4])
- else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
- end
- conf[0] = conf[0][1..-1]
- conf
+ case key.to_s
+ when 'coords'
+ return ['coords', '', '', '', self.coords(tagOrId)]
+ when 'dash', 'activedash', 'disableddash'
+ conf = tk_split_simplelist(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}"))
+ if conf[3] && conf[3] =~ /^[0-9]/
+ conf[3] = list(conf[3])
+ end
+ if conf[4] && conf[4] =~ /^[0-9]/
+ conf[4] = list(conf[4])
+ end
+ when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),"-#{key}")))
+ conf[4] = tagfont_configinfo(tagid(tagOrId), conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
else
- ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId)))).collect{|conflist|
- conf = tk_split_simplelist(conflist)
- conf[0] = conf[0][1..-1]
- case conf[0]
- when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
- when 'dash', 'activedash', 'disableddash'
- if conf[3] && conf[3] =~ /^[0-9]/
- conf[3] = list(conf[3])
- end
- if conf[4] && conf[4] =~ /^[0-9]/
- conf[4] = list(conf[4])
- end
- 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
- }
-
- fontconf = ret.assoc('font')
- if fontconf
- ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
- fontconf[4] = tagfont_configinfo(tagid(tagOrId), fontconf[4])
- ret.push(fontconf)
- end
-
- ret << ['coords', '', '', '', self.coords(tagOrId)]
+ ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId)))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ case conf[0]
+ when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
+ when 'dash', 'activedash', 'disableddash'
+ if conf[3] && conf[3] =~ /^[0-9]/
+ conf[3] = list(conf[3])
+ end
+ if conf[4] && conf[4] =~ /^[0-9]/
+ conf[4] = list(conf[4])
+ end
+ 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
+ }
+
+ fontconf = ret.assoc('font')
+ if fontconf
+ ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
+ fontconf[4] = tagfont_configinfo(tagid(tagOrId), fontconf[4])
+ ret.push(fontconf)
+ end
+
+ ret << ['coords', '', '', '', self.coords(tagOrId)]
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- case key.to_s
- when 'coords'
- {'coords' => ['', '', '', self.coords(tagOrId)]}
- when 'dash', 'activedash', 'disableddash'
- conf = tk_split_simplelist(tk_send_without_enc('itemconfigure',
- tagid(tagOrId),
- "-#{key}"))
- if conf[3] && conf[3] =~ /^[0-9]/
- conf[3] = list(conf[3])
- end
- if conf[4] && conf[4] =~ /^[0-9]/
- conf[4] = list(conf[4])
- end
- when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
- when 'font', 'kanjifont'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),"-#{key}")))
- conf[4] = tagfont_configinfo(tagid(tagOrId), conf[4])
- else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
- end
- key = conf.shift[1..-1]
- { key => conf }
+ case key.to_s
+ when 'coords'
+ {'coords' => ['', '', '', self.coords(tagOrId)]}
+ when 'dash', 'activedash', 'disableddash'
+ conf = tk_split_simplelist(tk_send_without_enc('itemconfigure',
+ tagid(tagOrId),
+ "-#{key}"))
+ if conf[3] && conf[3] =~ /^[0-9]/
+ conf[3] = list(conf[3])
+ end
+ if conf[4] && conf[4] =~ /^[0-9]/
+ conf[4] = list(conf[4])
+ end
+ when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId),"-#{key}")))
+ conf[4] = tagfont_configinfo(tagid(tagOrId), conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
else
- ret = {}
- tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId)))).each{|conflist|
- conf = tk_split_simplelist(conflist)
- key = conf.shift[1..-1]
- case key
- when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
- when 'dash', 'activedash', 'disableddash'
- if conf[2] && conf[2] =~ /^[0-9]/
- conf[2] = list(conf[2])
- end
- if conf[3] && conf[3] =~ /^[0-9]/
- conf[3] = list(conf[3])
- end
- 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
- }
-
- fontconf = ret['font']
- if fontconf
- ret.delete('font')
- ret.delete('kanjifont')
- fontconf[3] = tagfont_configinfo(tagid(tagOrId), fontconf[3])
- ret['font'] = fontconf
- end
-
- ret['coords'] = ['', '', '', self.coords(tagOrId)]
-
- ret
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId)))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ case key
+ when 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile'
+ when 'dash', 'activedash', 'disableddash'
+ if conf[2] && conf[2] =~ /^[0-9]/
+ conf[2] = list(conf[2])
+ end
+ if conf[3] && conf[3] =~ /^[0-9]/
+ conf[3] = list(conf[3])
+ end
+ 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
+ }
+
+ fontconf = ret['font']
+ if fontconf
+ ret.delete('font')
+ ret.delete('kanjifont')
+ fontconf[3] = tagfont_configinfo(tagid(tagOrId), fontconf[3])
+ ret['font'] = fontconf
+ end
+
+ ret['coords'] = ['', '', '', self.coords(tagOrId)]
+
+ ret
end
end
end
@@ -437,19 +435,19 @@ class TkCanvas<TkWindow
def current_itemconfiginfo(tagOrId, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- conf = itemconfiginfo(tagOrId, key)
- {conf[0] => conf[4]}
+ conf = itemconfiginfo(tagOrId, key)
+ {conf[0] => conf[4]}
else
- ret = {}
- itemconfiginfo(tagOrId).each{|conf|
- ret[conf[0]] = conf[4] if conf.size > 2
- }
- ret
+ ret = {}
+ itemconfiginfo(tagOrId).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
itemconfiginfo(tagOrId, key).each{|k, conf|
- ret[k] = conf[-1] if conf.kind_of?(Array)
+ ret[k] = conf[-1] if conf.kind_of?(Array)
}
ret
end
@@ -551,32 +549,32 @@ class TkcItem<TkObject
if args[-1].kind_of? Hash
keys = _symbolkey2str(args.pop)
if args.size == 0
- args = keys.delete('coords')
- unless args.kind_of?(Array)
- fail "coords parameter must be given by an Array"
- end
+ args = keys.delete('coords')
+ unless args.kind_of?(Array)
+ fail "coords parameter must be given by an Array"
+ end
end
#['font', 'kanjifont', 'latinfont', 'asciifont'].each{|key|
# fontkeys[key] = keys.delete(key) if keys.key?(key)
#}
__item_font_optkeys(nil).each{|key|
- fkey = key.to_s
- fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
+ fkey = key.to_s
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
- fkey = "kanji#{key}"
- fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
+ fkey = "kanji#{key}"
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
- fkey = "latin#{key}"
- fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
+ fkey = "latin#{key}"
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
- fkey = "ascii#{key}"
- fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
+ fkey = "ascii#{key}"
+ fontkeys[fkey] = keys.delete(fkey) if keys.key?(fkey)
}
__item_methodcall_optkeys(nil).each{|key|
- key = key.to_s
- methodkeys[key] = keys.delete(key) if keys.key?(key)
+ key = key.to_s
+ methodkeys[key] = keys.delete(key) if keys.key?(key)
}
#args = args.flatten.concat(hash_kv(keys))
@@ -595,7 +593,7 @@ class TkcItem<TkObject
end
args, fontkeys = _parse_create_args(args)
idnum = tk_call_without_enc(canvas.path, 'create',
- self::CItemTypeName, *args)
+ self::CItemTypeName, *args)
canvas.itemconfigure(idnum, fontkeys) unless fontkeys.empty?
idnum.to_i # 'canvas item id' is an integer number
end
diff --git a/ext/tk/lib/tk/clock.rb b/ext/tk/lib/tk/clock.rb
index 88b66129ea..823b8a6341 100644
--- a/ext/tk/lib/tk/clock.rb
+++ b/ext/tk/lib/tk/clock.rb
@@ -8,45 +8,45 @@ module Tk
def self.clicks(ms=nil)
case ms
when nil
- tk_call_without_enc('clock','clicks').to_i
+ tk_call_without_enc('clock','clicks').to_i
when /^mic/
- tk_call_without_enc('clock','clicks','-microseconds').to_i
+ tk_call_without_enc('clock','clicks','-microseconds').to_i
when /^mil/
- tk_call_without_enc('clock','clicks','-milliseconds').to_i
+ tk_call_without_enc('clock','clicks','-milliseconds').to_i
else
- tk_call_without_enc('clock','clicks','-milliseconds').to_i
+ tk_call_without_enc('clock','clicks','-milliseconds').to_i
end
end
def self.format(clk, form=nil)
if form
- tk_call('clock','format',clk,'-format',form)
+ tk_call('clock','format',clk,'-format',form)
else
- tk_call('clock','format',clk)
+ tk_call('clock','format',clk)
end
end
def self.formatGMT(clk, form=nil)
if form
- tk_call('clock','format',clk,'-format',form,'-gmt','1')
+ tk_call('clock','format',clk,'-format',form,'-gmt','1')
else
- tk_call('clock','format',clk,'-gmt','1')
+ tk_call('clock','format',clk,'-gmt','1')
end
end
def self.scan(str, base=nil)
if base
- tk_call('clock','scan',str,'-base',base).to_i
+ tk_call('clock','scan',str,'-base',base).to_i
else
- tk_call('clock','scan',str).to_i
+ tk_call('clock','scan',str).to_i
end
end
def self.scanGMT(str, base=nil)
if base
- tk_call('clock','scan',str,'-base',base,'-gmt','1').to_i
+ tk_call('clock','scan',str,'-base',base,'-gmt','1').to_i
else
- tk_call('clock','scan',str,'-gmt','1').to_i
+ tk_call('clock','scan',str,'-gmt','1').to_i
end
end
diff --git a/ext/tk/lib/tk/composite.rb b/ext/tk/lib/tk/composite.rb
index ac5ed2f171..d85b815dd7 100644
--- a/ext/tk/lib/tk/composite.rb
+++ b/ext/tk/lib/tk/composite.rb
@@ -39,7 +39,7 @@ module TkComposite
m_cget = m_cget.to_s if m_cget
m_info = m_info.to_s if m_info
@option_methods[m_set] = {
- :set => m_set, :cget => m_cget, :info => m_info
+ :set => m_set, :cget => m_cget, :info => m_info
}
}
end
@@ -55,9 +55,9 @@ module TkComposite
option = option.to_s
if @delegates[alias_opt].kind_of?(Array)
if (elem = @delegates[alias_opt].assoc(option))
- wins.each{|w| elem[1].push(w)}
+ wins.each{|w| elem[1].push(w)}
else
- @delegates[alias_opt] << [option, wins]
+ @delegates[alias_opt] << [option, wins]
end
else
@delegates[alias_opt] = [ [option, wins] ]
@@ -73,13 +73,13 @@ module TkComposite
if @option_methods.include?(slot)
if @option_methods[slot][:cget]
- return self.__send__(@option_methods[slot][:cget])
+ return self.__send__(@option_methods[slot][:cget])
else
- if @option_setting[slot]
- return @option_setting[slot]
- else
- return ''
- end
+ if @option_setting[slot]
+ return @option_setting[slot]
+ else
+ return ''
+ end
end
end
@@ -88,11 +88,11 @@ module TkComposite
begin
if tbl
- opt, wins = tbl[-1]
- opt = slot if opt == 'DEFAULT'
- if wins && wins[-1]
- return wins[-1].cget(opt)
- end
+ opt, wins = tbl[-1]
+ opt = slot if opt == 'DEFAULT'
+ if wins && wins[-1]
+ return wins[-1].cget(opt)
+ end
end
rescue
end
@@ -110,11 +110,11 @@ module TkComposite
if @option_methods.include?(slot)
unless @option_methods[slot][:cget]
- if value.kind_of?(Symbol)
- @option_setting[slot] = value.to_s
- else
- @option_setting[slot] = value
- end
+ if value.kind_of?(Symbol)
+ @option_setting[slot] = value.to_s
+ else
+ @option_setting[slot] = value
+ end
end
return self.__send__(@option_methods[slot][:set], value)
end
@@ -124,12 +124,12 @@ module TkComposite
begin
if tbl
- last = nil
- tbl.each{|opt, wins|
- opt = slot if opt == 'DEFAULT'
- wins.each{|w| last = w.configure(opt, value)}
- }
- return last
+ last = nil
+ tbl.each{|opt, wins|
+ opt = slot if opt == 'DEFAULT'
+ wins.each{|w| last = w.configure(opt, value)}
+ }
+ return last
end
rescue
end
@@ -140,153 +140,153 @@ module TkComposite
def configinfo(slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
- slot = slot.to_s
- if @option_methods.include?(slot)
- if @option_methods[slot][:info]
- return self.__send__(@option_methods[slot][:info])
- else
- return [slot, '', '', '', self.cget(slot)]
- end
- end
-
- tbl = @delegates[slot]
- tbl = @delegates['DEFAULT'] unless tbl
-
- begin
- if tbl
- if tbl.length == 1
- opt, wins = tbl[0]
- if slot == opt || opt == 'DEFAULT'
- return wins[-1].configinfo(slot)
- else
- info = wins[-1].configinfo(opt)
- info[0] = slot
- return info
- end
- else
- opt, wins = tbl[-1]
- return [slot, '', '', '', wins[-1].cget(opt)]
- end
- end
- rescue
- end
-
- super
+ slot = slot.to_s
+ if @option_methods.include?(slot)
+ if @option_methods[slot][:info]
+ return self.__send__(@option_methods[slot][:info])
+ else
+ return [slot, '', '', '', self.cget(slot)]
+ end
+ end
+
+ tbl = @delegates[slot]
+ tbl = @delegates['DEFAULT'] unless tbl
+
+ begin
+ if tbl
+ if tbl.length == 1
+ opt, wins = tbl[0]
+ if slot == opt || opt == 'DEFAULT'
+ return wins[-1].configinfo(slot)
+ else
+ info = wins[-1].configinfo(opt)
+ info[0] = slot
+ return info
+ end
+ else
+ opt, wins = tbl[-1]
+ return [slot, '', '', '', wins[-1].cget(opt)]
+ end
+ end
+ rescue
+ end
+
+ super
else # slot == nil
- info_list = super
-
- tbl = @delegates['DEFAULT']
- if tbl
- wins = tbl[0][1]
- if wins && wins[-1]
- wins[-1].configinfo.each{|info|
- slot = info[0]
- info_list.delete_if{|i| i[0] == slot} << info
- }
- end
- end
-
- @delegates.each{|slot, tbl|
- next if slot == 'DEFAULT'
- if tbl.length == 1
- opt, wins = tbl[0]
- next unless wins && wins[-1]
- if slot == opt
- info_list.delete_if{|i| i[0] == slot} <<
- wins[-1].configinfo(slot)
- else
- info = wins[-1].configinfo(opt)
- info[0] = slot
- info_list.delete_if{|i| i[0] == slot} << info
- end
- else
- opt, wins = tbl[-1]
- info_list.delete_if{|i| i[0] == slot} <<
- [slot, '', '', '', wins[-1].cget(opt)]
- end
- }
-
- @option_methods.each{|slot, m|
- if m[:info]
- info = self.__send__(m[:info])
- else
- info = [slot, '', '', '', self.cget(slot)]
- end
- info_list.delete_if{|i| i[0] == slot} << info
- }
-
- info_list
+ info_list = super
+
+ tbl = @delegates['DEFAULT']
+ if tbl
+ wins = tbl[0][1]
+ if wins && wins[-1]
+ wins[-1].configinfo.each{|info|
+ slot = info[0]
+ info_list.delete_if{|i| i[0] == slot} << info
+ }
+ end
+ end
+
+ @delegates.each{|slot, tbl|
+ next if slot == 'DEFAULT'
+ if tbl.length == 1
+ opt, wins = tbl[0]
+ next unless wins && wins[-1]
+ if slot == opt
+ info_list.delete_if{|i| i[0] == slot} <<
+ wins[-1].configinfo(slot)
+ else
+ info = wins[-1].configinfo(opt)
+ info[0] = slot
+ info_list.delete_if{|i| i[0] == slot} << info
+ end
+ else
+ opt, wins = tbl[-1]
+ info_list.delete_if{|i| i[0] == slot} <<
+ [slot, '', '', '', wins[-1].cget(opt)]
+ end
+ }
+
+ @option_methods.each{|slot, m|
+ if m[:info]
+ info = self.__send__(m[:info])
+ else
+ info = [slot, '', '', '', self.cget(slot)]
+ end
+ info_list.delete_if{|i| i[0] == slot} << info
+ }
+
+ info_list
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
- slot = slot.to_s
- if @option_methods.include?(slot)
- if @option_methods[slot][:info]
- return self.__send__(@option_methods[slot][:info])
- else
- return {slot => ['', '', '', self.cget(slot)]}
- end
- end
-
- tbl = @delegates[slot]
- tbl = @delegates['DEFAULT'] unless tbl
-
- begin
- if tbl
- if tbl.length == 1
- opt, wins = tbl[0]
- if slot == opt || opt == 'DEFAULT'
- return wins[-1].configinfo(slot)
- else
- return {slot => wins[-1].configinfo(opt)[opt]}
- end
- else
- opt, wins = tbl[-1]
- return {slot => ['', '', '', wins[-1].cget(opt)]}
- end
- end
- rescue
- end
-
- super
+ slot = slot.to_s
+ if @option_methods.include?(slot)
+ if @option_methods[slot][:info]
+ return self.__send__(@option_methods[slot][:info])
+ else
+ return {slot => ['', '', '', self.cget(slot)]}
+ end
+ end
+
+ tbl = @delegates[slot]
+ tbl = @delegates['DEFAULT'] unless tbl
+
+ begin
+ if tbl
+ if tbl.length == 1
+ opt, wins = tbl[0]
+ if slot == opt || opt == 'DEFAULT'
+ return wins[-1].configinfo(slot)
+ else
+ return {slot => wins[-1].configinfo(opt)[opt]}
+ end
+ else
+ opt, wins = tbl[-1]
+ return {slot => ['', '', '', wins[-1].cget(opt)]}
+ end
+ end
+ rescue
+ end
+
+ super
else # slot == nil
- info_list = super
-
- tbl = @delegates['DEFAULT']
- if tbl
- wins = tbl[0][1]
- info_list.update(wins[-1].configinfo) if wins && wins[-1]
- end
-
- @delegates.each{|slot, tbl|
- next if slot == 'DEFAULT'
- if tbl.length == 1
- opt, wins = tbl[0]
- next unless wins && wins[-1]
- if slot == opt
- info_list.update(wins[-1].configinfo(slot))
- else
- info_list.update({slot => wins[-1].configinfo(opt)[opt]})
- end
- else
- opt, wins = tbl[-1]
- info_list.update({slot => ['', '', '', wins[-1].cget(opt)]})
- end
- }
-
- @option_methods.each{|slot, m|
- if m[:info]
- info = self.__send__(m[:info])
- else
- info = {slot => ['', '', '', self.cget(slot)]}
- end
- info_list.update(info)
- }
-
- info_list
+ info_list = super
+
+ tbl = @delegates['DEFAULT']
+ if tbl
+ wins = tbl[0][1]
+ info_list.update(wins[-1].configinfo) if wins && wins[-1]
+ end
+
+ @delegates.each{|slot, tbl|
+ next if slot == 'DEFAULT'
+ if tbl.length == 1
+ opt, wins = tbl[0]
+ next unless wins && wins[-1]
+ if slot == opt
+ info_list.update(wins[-1].configinfo(slot))
+ else
+ info_list.update({slot => wins[-1].configinfo(opt)[opt]})
+ end
+ else
+ opt, wins = tbl[-1]
+ info_list.update({slot => ['', '', '', wins[-1].cget(opt)]})
+ end
+ }
+
+ @option_methods.each{|slot, m|
+ if m[:info]
+ info = self.__send__(m[:info])
+ else
+ info = {slot => ['', '', '', self.cget(slot)]}
+ end
+ info_list.update(info)
+ }
+
+ info_list
end
end
end
diff --git a/ext/tk/lib/tk/console.rb b/ext/tk/lib/tk/console.rb
index 855ee6a94f..f0d2c7aa87 100644
--- a/ext/tk/lib/tk/console.rb
+++ b/ext/tk/lib/tk/console.rb
@@ -24,6 +24,6 @@ module TkConsole
# I have no idea to support a Ruby script seamlessly.
#
_fromUTF8(tk_call_without_enc('console', 'eval',
- _get_eval_enc_str(tcl_script)))
+ _get_eval_enc_str(tcl_script)))
end
end
diff --git a/ext/tk/lib/tk/dialog.rb b/ext/tk/lib/tk/dialog.rb
index d6355f21c1..2ced26b193 100644
--- a/ext/tk/lib/tk/dialog.rb
+++ b/ext/tk/lib/tk/dialog.rb
@@ -17,34 +17,34 @@ class TkDialog2 < TkWindow
def _set_button_config(configs)
set_config = proc{|c,i|
if $VERBOSE && (c.has_key?('command') || c.has_key?(:command))
- STDERR.print("Warning: cannot give a command option " +
- "to the dialog button#{i}. It was removed.\n")
+ STDERR.print("Warning: cannot give a command option " +
+ "to the dialog button#{i}. It was removed.\n")
end
c.delete('command'); c.delete(:command)
# @config << Kernel.format("%s.button%s configure %s; ",
- # @path, i, hash_kv(c).join(' '))
+ # @path, i, hash_kv(c).join(' '))
@config << @path+'.button'+i.to_s+'configure '+hash_kv(c).join(' ')+'; '
}
case configs
when Proc
@buttons.each_index{|i|
- if (c = configs.call(i)).kind_of? Hash
- set_config.call(c,i)
- end
+ if (c = configs.call(i)).kind_of? Hash
+ set_config.call(c,i)
+ end
}
when Array
@buttons.each_index{|i|
- if (c = configs[i]).kind_of? Hash
- set_config.call(c,i)
- end
+ if (c = configs[i]).kind_of? Hash
+ set_config.call(c,i)
+ end
}
when Hash
@buttons.each_with_index{|s,i|
- if (c = configs[s]).kind_of? Hash
- set_config.call(c,i)
- end
+ if (c = configs[s]).kind_of? Hash
+ set_config.call(c,i)
+ end
}
end
@config = 'after idle {' + @config + '};' if @config != ""
@@ -99,7 +99,7 @@ class TkDialog2 < TkWindow
if @buttons.kind_of? Array
_set_button_config(@buttons.collect{|cfg|
- (cfg.kind_of? Array)? cfg[1]: nil})
+ (cfg.kind_of? Array)? cfg[1]: nil})
@buttons = @buttons.collect{|cfg| (cfg.kind_of? Array)? cfg[0]: cfg}
end
if @buttons.kind_of? Hash
@@ -109,36 +109,36 @@ class TkDialog2 < TkWindow
@buttons = tk_split_simplelist(@buttons) if @buttons.kind_of? String
@buttons = @buttons.collect{|s|
if s.kind_of? Array
- s = s.join(' ')
+ s = s.join(' ')
end
if s.include? ?\s
- '{' + s + '}'
+ '{' + s + '}'
else
- s
+ s
end
}
if @message_config.kind_of? Hash
# @config << Kernel.format("%s.msg configure %s;",
- # @path, hash_kv(@message_config).join(' '))
+ # @path, hash_kv(@message_config).join(' '))
@config << @path+'.msg configure '+hash_kv(@message_config).join(' ')+';'
end
if @msgframe_config.kind_of? Hash
# @config << Kernel.format("%s.top configure %s;",
- # @path, hash_kv(@msgframe_config).join(' '))
+ # @path, hash_kv(@msgframe_config).join(' '))
@config << @path+'.top configure '+hash_kv(@msgframe_config).join(' ')+';'
end
if @btnframe_config.kind_of? Hash
# @config << Kernel.format("%s.bot configure %s;",
- # @path, hash_kv(@btnframe_config).join(' '))
+ # @path, hash_kv(@btnframe_config).join(' '))
@config << @path+'.bot configure '+hash_kv(@btnframe_config).join(' ')+';'
end
if @bitmap_config.kind_of? Hash
# @config << Kernel.format("%s.bitmap configure %s;",
- # @path, hash_kv(@bitmap_config).join(' '))
+ # @path, hash_kv(@bitmap_config).join(' '))
@config << @path+'.bitmap configure '+hash_kv(@bitmap_config).join(' ')+';'
end
@@ -158,16 +158,16 @@ class TkDialog2 < TkWindow
end
default_button = '{}' if default_button == nil
#Tk.ip_eval('eval {global '+@var.id+';'+@config+
- # 'set '+@var.id+' [tk_dialog '+
- # @path+" "+@title+" {#{@message}} "+@bitmap+" "+
- # String(default_button)+" "+@buttons.join(' ')+']}')
+ # 'set '+@var.id+' [tk_dialog '+
+ # @path+" "+@title+" {#{@message}} "+@bitmap+" "+
+ # String(default_button)+" "+@buttons.join(' ')+']}')
Tk.ip_eval(@config)
# @val = Tk.ip_eval('tk_dialog ' + @path + ' ' + @title +
- # ' {' + @message + '} ' + @bitmap + ' ' +
- # String(default_button) + ' ' + @buttons.join(' ')).to_i
+ # ' {' + @message + '} ' + @bitmap + ' ' +
+ # String(default_button) + ' ' + @buttons.join(' ')).to_i
@val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' +
- @title + ' {' + @message + '} ' + @bitmap + ' ' +
- String(default_button) + ' ' + @buttons.join(' ')).to_i
+ @title + ' {' + @message + '} ' + @bitmap + ' ' +
+ String(default_button) + ' ' + @buttons.join(' ')).to_i
end
def value
@@ -248,10 +248,10 @@ class TkWarning2 < TkDialog2
def initialize(parent = nil, mes = nil)
if !mes
if parent.kind_of? TkWindow
- mes = ""
+ mes = ""
else
- mes = parent.to_s
- parent = nil
+ mes = parent.to_s
+ parent = nil
end
end
super(parent, :message=>mes)
diff --git a/ext/tk/lib/tk/encodedstr.rb b/ext/tk/lib/tk/encodedstr.rb
index 5eb989f420..aed0e7524e 100644
--- a/ext/tk/lib/tk/encodedstr.rb
+++ b/ext/tk/lib/tk/encodedstr.rb
@@ -24,11 +24,11 @@ module Tk
def self.utf_to_backslash_sequence(str)
str.unpack('U*').collect{|c|
- if c <= 0xFF # ascii character
- c.chr
- else
- format('\u%X', c)
- end
+ if c <= 0xFF # ascii character
+ c.chr
+ else
+ format('\u%X', c)
+ end
}.join('')
end
def self.utf_to_backslash(str)
@@ -37,23 +37,23 @@ module Tk
def self.to_backslash_sequence(str)
str.unpack('U*').collect{|c|
- if c <= 0x1F # control character
- case c
- when 0x07; '\a'
- when 0x08; '\b'
- when 0x09; '\t'
- when 0x0a; '\n'
- when 0x0b; '\v'
- when 0x0c; '\f'
- when 0x0d; '\r'
- else
- format('\x%02X', c)
- end
- elsif c <= 0xFF # ascii character
- c.chr
- else
- format('\u%X', c)
- end
+ if c <= 0x1F # control character
+ case c
+ when 0x07; '\a'
+ when 0x08; '\b'
+ when 0x09; '\t'
+ when 0x0a; '\n'
+ when 0x0b; '\v'
+ when 0x0c; '\f'
+ when 0x0d; '\r'
+ else
+ format('\x%02X', c)
+ end
+ elsif c <= 0xFF # ascii character
+ c.chr
+ else
+ format('\u%X', c)
+ end
}.join('')
end
@@ -68,8 +68,8 @@ module Tk
def initialize(str, enc = nil)
super(str)
@encoding = ( enc ||
- ((self.class::Encoding)?
- self.class::Encoding : Tk.encoding_system) )
+ ((self.class::Encoding)?
+ self.class::Encoding : Tk.encoding_system) )
end
attr_reader :encoding
diff --git a/ext/tk/lib/tk/entry.rb b/ext/tk/lib/tk/entry.rb
index 0e45538c76..2a8a9d413c 100644
--- a/ext/tk/lib/tk/entry.rb
+++ b/ext/tk/lib/tk/entry.rb
@@ -1,7 +1,7 @@
#
-# tk/entry.rb - Tk entry classes
-# $Date$
-# by Yukihiro Matsumoto <matz@caelum.co.jp>
+# tk/entry.rb - Tk entry classes
+# $Date$
+# by Yukihiro Matsumoto <matz@caelum.co.jp>
require 'tk'
require 'tk/label'
diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb
index 9c46cb5d75..16adeedc6c 100644
--- a/ext/tk/lib/tk/event.rb
+++ b/ext/tk/lib/tk/event.rb
@@ -33,7 +33,7 @@ module TkEvent
CreateNotify = 16
DestroyNotify = 17
UnmapNotify = 18
- MapNotify = 19
+ MapNotify = 19
MapRequest = 20
ReparentNotify = 21
ConfigureNotify = 22
@@ -93,12 +93,12 @@ module TkEvent
[ ?w, TkComm.method(:window) ],
[ ?x, proc{|val|
- begin
- TkComm::number(val)
- rescue ArgumentError
- val
- end
- }
+ begin
+ TkComm::number(val)
+ rescue ArgumentError
+ val
+ end
+ }
],
nil
@@ -141,14 +141,14 @@ module TkEvent
keys = klass._get_subst_key(args)
if cmd.kind_of?(String)
- id = cmd
+ id = cmd
elsif cmd.kind_of?(TkCallbackEntry)
- id = install_cmd(cmd)
+ id = install_cmd(cmd)
else
- id = install_cmd(proc{|*arg|
- ex_args = []
- extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
- TkUtil.eval_cmd(cmd, *(ex_args.concat(klass.scan_args(keys, arg))))
+ id = install_cmd(proc{|*arg|
+ ex_args = []
+ extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
+ TkUtil.eval_cmd(cmd, *(ex_args.concat(klass.scan_args(keys, arg))))
})
end
id + ' ' + args
@@ -156,15 +156,15 @@ module TkEvent
keys, args = klass._get_all_subst_keys
if cmd.kind_of?(String)
- id = cmd
+ id = cmd
elsif cmd.kind_of?(TkCallbackEntry)
- id = install_cmd(cmd)
+ id = install_cmd(cmd)
else
id = install_cmd(proc{|*arg|
- ex_args = []
- extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
- TkUtil.eval_cmd(cmd,
- *(ex_args << klass.new(*klass.scan_args(keys, arg))))
+ ex_args = []
+ extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
+ TkUtil.eval_cmd(cmd,
+ *(ex_args << klass.new(*klass.scan_args(keys, arg))))
})
end
id + ' ' + args
diff --git a/ext/tk/lib/tk/font.rb b/ext/tk/lib/tk/font.rb
index 527584f1ed..02e09c6066 100644
--- a/ext/tk/lib/tk/font.rb
+++ b/ext/tk/lib/tk/font.rb
@@ -30,36 +30,36 @@ class TkFont
if JAPANIZED_TK
begin
fontnames = tk_call('font', 'names')
- case fontnames
- when /defaultgui/
+ case fontnames
+ when /defaultgui/
# Tcl/Tk-JP for Windows
ltn = 'defaultgui'
knj = 'defaultgui'
- when /Mincho:Helvetica-Bold-12/
+ when /Mincho:Helvetica-Bold-12/
# Tcl/Tk-JP for UNIX/X
ltn, knj = tk_split_simplelist(tk_call('font', 'configure',
'Mincho:Helvetica-Bold-12',
'-compound'))
else
# unknown Tcl/Tk-JP
- platform = tk_call('set', 'tcl_platform(platform)')
- case platform
- when 'unix'
- ltn = {'family'=>'Helvetica'.freeze,
- 'size'=>-12, 'weight'=>'bold'.freeze}
- #knj = 'k14'
- #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0'
- knj = '-*-fixed-bold-r-normal--12-*-*-*-c-*-jisx0208.1983-0'
- when 'windows'
- ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
- knj = 'mincho'
- when 'macintosh'
- ltn = 'system'
- knj = 'mincho'
- else # unknown
- ltn = 'Helvetica'
- knj = 'mincho'
- end
+ platform = tk_call('set', 'tcl_platform(platform)')
+ case platform
+ when 'unix'
+ ltn = {'family'=>'Helvetica'.freeze,
+ 'size'=>-12, 'weight'=>'bold'.freeze}
+ #knj = 'k14'
+ #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0'
+ knj = '-*-fixed-bold-r-normal--12-*-*-*-c-*-jisx0208.1983-0'
+ when 'windows'
+ ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
+ knj = 'mincho'
+ when 'macintosh'
+ ltn = 'system'
+ knj = 'mincho'
+ else # unknown
+ ltn = 'Helvetica'
+ knj = 'mincho'
+ end
end
rescue
ltn = 'Helvetica'
@@ -68,20 +68,20 @@ class TkFont
else # not JAPANIZED_TK
begin
- platform = tk_call('set', 'tcl_platform(platform)')
- case platform
- when 'unix'
- ltn = {'family'=>'Helvetica'.freeze,
- 'size'=>-12, 'weight'=>'bold'.freeze}
- when 'windows'
- ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
- when 'macintosh'
- ltn = 'system'
- else # unknown
- ltn = 'Helvetica'
- end
+ platform = tk_call('set', 'tcl_platform(platform)')
+ case platform
+ when 'unix'
+ ltn = {'family'=>'Helvetica'.freeze,
+ 'size'=>-12, 'weight'=>'bold'.freeze}
+ when 'windows'
+ ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8}
+ when 'macintosh'
+ ltn = 'system'
+ else # unknown
+ ltn = 'Helvetica'
+ end
rescue
- ltn = 'Helvetica'
+ ltn = 'Helvetica'
end
knj = ltn.dup
@@ -106,14 +106,14 @@ class TkFont
class DescendantFont
def initialize(compound, type)
unless compound.kind_of?(TkFont)
- fail ArgumentError, "a TkFont object is expected for the 1st argument"
+ fail ArgumentError, "a TkFont object is expected for the 1st argument"
end
@compound = compound
case type
when 'kanji', 'latin', 'ascii'
- @type = type
+ @type = type
else
- fail ArgumentError, "unknown type '#{type}'"
+ fail ArgumentError, "unknown type '#{type}'"
end
end
@@ -155,9 +155,9 @@ class TkFont
when /^8\.*/
if window
- tk_split_simplelist(tk_call('font', 'families', '-displayof', window))
+ tk_split_simplelist(tk_call('font', 'families', '-displayof', window))
else
- tk_split_simplelist(tk_call('font', 'families'))
+ tk_split_simplelist(tk_call('font', 'families'))
end
end
end
@@ -205,11 +205,11 @@ class TkFont
regexp = /^-(|kanji)#{key} /
conf_list = tk_split_simplelist(tk_call(*args)).
- find_all{|prop| prop =~ regexp}.
- collect{|prop| tk_split_simplelist(prop)}
+ find_all{|prop| prop =~ regexp}.
+ collect{|prop| tk_split_simplelist(prop)}
if conf_list.size == 0
- raise RuntimeError, "the widget may not support 'font' option"
+ raise RuntimeError, "the widget may not support 'font' option"
end
args << {}
@@ -231,11 +231,11 @@ class TkFont
regexp = /^-#{key} /
conf_list = tk_split_simplelist(tk_call(*args)).
- find_all{|prop| prop =~ regexp}.
- collect{|prop| tk_split_simplelist(prop)}
+ find_all{|prop| prop =~ regexp}.
+ collect{|prop| tk_split_simplelist(prop)}
if conf_list.size == 0
- raise RuntimeError, "the widget may not support 'font' option"
+ raise RuntimeError, "the widget may not support 'font' option"
end
args << {}
@@ -247,23 +247,23 @@ class TkFont
fnt = nil if fnt == [] || fnt == ""
unless fnt
- TkFont.new(nil, nil).call_font_configure([path, key], *args)
+ TkFont.new(nil, nil).call_font_configure([path, key], *args)
else
- begin
- compound = tk_split_simplelist(
+ begin
+ compound = tk_split_simplelist(
Hash[*tk_split_simplelist(tk_call('font', 'configure',
- fnt))].collect{|key,value|
+ fnt))].collect{|key,value|
[key[1..-1], value]
}.assoc('compound')[1])
- rescue
- compound = []
- end
- if compound == []
- TkFont.new(fnt).call_font_configure([path, key], *args)
- else
- TkFont.new(compound[0],
- compound[1]).call_font_configure([path, key], *args)
- end
+ rescue
+ compound = []
+ end
+ if compound == []
+ TkFont.new(fnt).call_font_configure([path, key], *args)
+ else
+ TkFont.new(compound[0],
+ compound[1]).call_font_configure([path, key], *args)
+ end
end
end
end
@@ -307,33 +307,33 @@ class TkFont
# compound font check
if Tk::TK_VERSION == '8.0' && JAPANIZED_TK
begin
- compound = tk_split_simplelist(tk_call('font', 'configure',
- ltn, '-compound'))
- if knj == nil
- if compound != []
- ltn, knj = compound
- end
- else
- if compound != []
- ltn = compound[0]
- end
- compound = tk_split_simplelist(tk_call('font', 'configure',
- knj, '-compound'))
- if compound != []
- knj = compound[1]
- end
- end
+ compound = tk_split_simplelist(tk_call('font', 'configure',
+ ltn, '-compound'))
+ if knj == nil
+ if compound != []
+ ltn, knj = compound
+ end
+ else
+ if compound != []
+ ltn = compound[0]
+ end
+ compound = tk_split_simplelist(tk_call('font', 'configure',
+ knj, '-compound'))
+ if compound != []
+ knj = compound[1]
+ end
+ end
rescue
end
end
if ltn
if JAPANIZED_TK && !knj
- if Tk::TK_VERSION =~ /^4.*/
- knj = DEFAULT_KANJI_FONT_NAME
- else
- knj = ltn
- end
+ if Tk::TK_VERSION =~ /^4.*/
+ knj = DEFAULT_KANJI_FONT_NAME
+ else
+ knj = ltn
+ end
end
else
ltn = DEFAULT_LATIN_FONT_NAME
@@ -372,28 +372,28 @@ class TkFont
finfo = {}
finfo['family'] = font[0].to_s
if font[1]
- fsize = font[1].to_s
- if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
- if $1 == '-'
- finfo['pixels'] = $2
- else
- finfo['points'] = $2
- end
- else
- finfo['points'] = '13'
- end
+ fsize = font[1].to_s
+ if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
+ if $1 == '-'
+ finfo['pixels'] = $2
+ else
+ finfo['points'] = $2
+ end
+ else
+ finfo['points'] = '13'
+ end
end
font[2..-1].each{|style|
- case (style)
- when 'normal'
- finfo['weight'] = style
- when 'bold'
- finfo['weight'] = style
- when 'roman'
- finfo['slant'] = 'r'
- when 'italic'
- finfo['slant'] = 'i'
- end
+ case (style)
+ when 'normal'
+ finfo['weight'] = style
+ when 'bold'
+ finfo['weight'] = style
+ when 'roman'
+ finfo['slant'] = 'r'
+ when 'italic'
+ finfo['slant'] = 'i'
+ end
}
@latinfont = '-' + _get_font_info_from_hash(finfo).join('-') + '-'
@@ -424,28 +424,28 @@ class TkFont
finfo = {}
finfo['family'] = font[0].to_s
if font[1]
- fsize = font[1].to_s
- if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
- if $1 == '-'
- finfo['pixels'] = $2
- else
- finfo['points'] = $2
- end
- else
- finfo['points'] = '13'
- end
+ fsize = font[1].to_s
+ if fsize != '0' && fsize =~ /^(|\+|-)([0-9]+)$/
+ if $1 == '-'
+ finfo['pixels'] = $2
+ else
+ finfo['points'] = $2
+ end
+ else
+ finfo['points'] = '13'
+ end
end
font[2..-1].each{|style|
- case (style)
- when 'normal'
- finfo['weight'] = style
- when 'bold'
- finfo['weight'] = style
- when 'roman'
- finfo['slant'] = 'r'
- when 'italic'
- finfo['slant'] = 'i'
- end
+ case (style)
+ when 'normal'
+ finfo['weight'] = style
+ when 'bold'
+ finfo['weight'] = style
+ when 'roman'
+ finfo['slant'] = 'r'
+ when 'italic'
+ finfo['slant'] = 'i'
+ end
}
@kanjifont = '-' + _get_font_info_from_hash(finfo).join('-') + '-'
@@ -478,42 +478,42 @@ class TkFont
if JAPANIZED_TK
if font.kind_of? Hash
- if font[:charset] || font['charset']
- tk_call('font', 'create', @latinfont, *hash_kv(font))
- else
- tk_call('font', 'create', @latinfont,
+ if font[:charset] || font['charset']
+ tk_call('font', 'create', @latinfont, *hash_kv(font))
+ else
+ tk_call('font', 'create', @latinfont,
'-charset', 'iso8859', *hash_kv(font))
- end
+ end
elsif font.kind_of? Array
- tk_call('font', 'create', @latinfont, '-copy', array2tk_list(font))
+ tk_call('font', 'create', @latinfont, '-copy', array2tk_list(font))
tk_call('font', 'configure', @latinfont, '-charset', 'iso8859')
elsif font.kind_of? TkFont
- tk_call('font', 'create', @latinfont, '-copy', font.latin_font)
+ tk_call('font', 'create', @latinfont, '-copy', font.latin_font)
elsif font
- tk_call('font', 'create', @latinfont, '-copy', font,
+ tk_call('font', 'create', @latinfont, '-copy', font,
'-charset', 'iso8859')
else
- tk_call('font', 'create', @latinfont, '-charset', 'iso8859')
+ tk_call('font', 'create', @latinfont, '-charset', 'iso8859')
end
else
if font.kind_of? Hash
- tk_call('font', 'create', @latinfont, *hash_kv(font))
+ tk_call('font', 'create', @latinfont, *hash_kv(font))
else
- keys = {}
- if font.kind_of? Array
- actual_core(array2tk_list(font)).each{|key,val| keys[key] = val}
- elsif font.kind_of? TkFont
- actual_core(font.latin_font).each{|key,val| keys[key] = val}
- elsif font
- actual_core(font).each{|key,val| keys[key] = val}
- end
- tk_call('font', 'create', @latinfont, *hash_kv(keys))
+ keys = {}
+ if font.kind_of? Array
+ actual_core(array2tk_list(font)).each{|key,val| keys[key] = val}
+ elsif font.kind_of? TkFont
+ actual_core(font.latin_font).each{|key,val| keys[key] = val}
+ elsif font
+ actual_core(font).each{|key,val| keys[key] = val}
+ end
+ tk_call('font', 'create', @latinfont, *hash_kv(keys))
end
if font && @compoundfont
keys = {}
actual_core(@latinfont).each{|key,val| keys[key] = val}
- tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
+ tk_call('font', 'configure', @compoundfont, *hash_kv(keys))
end
end
end
@@ -524,10 +524,10 @@ class TkFont
if JAPANIZED_TK
if font.kind_of? Hash
if font[:charset] || font['charset']
- tk_call('font', 'create', @kanjifont, *hash_kv(font))
+ tk_call('font', 'create', @kanjifont, *hash_kv(font))
else
- tk_call('font', 'create', @kanjifont,
- '-charset', 'jisx0208.1983', *hash_kv(font))
+ tk_call('font', 'create', @kanjifont,
+ '-charset', 'jisx0208.1983', *hash_kv(font))
end
elsif font.kind_of? Array
tk_call('font', 'create', @kanjifont, '-copy', array2tk_list(font))
@@ -536,7 +536,7 @@ class TkFont
tk_call('font', 'create', @kanjifont, '-copy', font.kanji_font_id)
elsif font
tk_call('font', 'create', @kanjifont, '-copy', font,
- '-charset', 'jisx0208.1983')
+ '-charset', 'jisx0208.1983')
else
tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983')
end
@@ -548,11 +548,11 @@ class TkFont
else
keys = {}
if font.kind_of? Array
- actual_core(array2tk_list(font)).each{|key,val| keys[key] = val}
+ actual_core(array2tk_list(font)).each{|key,val| keys[key] = val}
elsif font.kind_of? TkFont
- actual_core(font.kanji_font_id).each{|key,val| keys[key] = val}
+ actual_core(font.kanji_font_id).each{|key,val| keys[key] = val}
elsif font
- actual_core(font).each{|key,val| keys[key] = val}
+ actual_core(font).each{|key,val| keys[key] = val}
end
tk_call('font', 'create', @kanjifont, *hash_kv(keys))
end
@@ -572,87 +572,87 @@ class TkFont
@compoundfont = @id + 'c'
if JAPANIZED_TK
unless keys
- keys = {}
+ keys = {}
else
- keys = keys.dup
+ keys = keys.dup
end
if (tk_call('font', 'configure', @latinfont, '-underline') == '1' &&
- tk_call('font', 'configure', @kanjifont, '-underline') == '1' &&
- !keys.key?('underline'))
- keys['underline'] = true
+ tk_call('font', 'configure', @kanjifont, '-underline') == '1' &&
+ !keys.key?('underline'))
+ keys['underline'] = true
end
if (tk_call('font', 'configure', @latinfont, '-overstrike') == '1' &&
- tk_call('font', 'configure', @kanjifont, '-overstrike') == '1' &&
- !keys.key?('overstrike'))
- keys['overstrike'] = true
+ tk_call('font', 'configure', @kanjifont, '-overstrike') == '1' &&
+ !keys.key?('overstrike'))
+ keys['overstrike'] = true
end
@fontslot = {'font'=>@compoundfont}
begin
- tk_call('font', 'create', @compoundfont,
- '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+ tk_call('font', 'create', @compoundfont,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
rescue RuntimeError => e
- if ltn == knj
- if e.message =~ /kanji font .* specified/
- tk_call('font', 'delete', @latinfont)
- create_latinfont(DEFAULT_LATIN_FONT_NAME)
- opts = []
- Hash[*(tk_split_simplelist(tk_call('font', 'configure',
- @kanjifont)))].each{|k,v|
- case k
- when '-size', '-weight', '-slant', '-underline', '-overstrike'
- opts << k << v
- end
- }
- tk_call('font', 'configure', @latinfont, *opts)
- tk_call('font', 'create', @compoundfont,
- '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
-
- elsif e.message =~ /ascii font .* specified/
- tk_call('font', 'delete', @kanjifont)
- create_kanjifont(DEFAULT_KANJI_FONT_NAME)
- opts = []
- Hash[*(tk_split_simplelist(tk_call('font', 'configure',
- @latinfont)))].each{|k,v|
- case k
- when '-size', '-weight', '-slant', '-underline', '-overstrike'
- opts << k << v
- end
- }
- tk_call('font', 'configure', @kanjifont, *opts)
- tk_call('font', 'create', @compoundfont,
- '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
-
- else
- raise e
- end
- else
- raise e
- end
+ if ltn == knj
+ if e.message =~ /kanji font .* specified/
+ tk_call('font', 'delete', @latinfont)
+ create_latinfont(DEFAULT_LATIN_FONT_NAME)
+ opts = []
+ Hash[*(tk_split_simplelist(tk_call('font', 'configure',
+ @kanjifont)))].each{|k,v|
+ case k
+ when '-size', '-weight', '-slant', '-underline', '-overstrike'
+ opts << k << v
+ end
+ }
+ tk_call('font', 'configure', @latinfont, *opts)
+ tk_call('font', 'create', @compoundfont,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+
+ elsif e.message =~ /ascii font .* specified/
+ tk_call('font', 'delete', @kanjifont)
+ create_kanjifont(DEFAULT_KANJI_FONT_NAME)
+ opts = []
+ Hash[*(tk_split_simplelist(tk_call('font', 'configure',
+ @latinfont)))].each{|k,v|
+ case k
+ when '-size', '-weight', '-slant', '-underline', '-overstrike'
+ opts << k << v
+ end
+ }
+ tk_call('font', 'configure', @kanjifont, *opts)
+ tk_call('font', 'create', @compoundfont,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+
+ else
+ raise e
+ end
+ else
+ raise e
+ end
end
else
tk_call('font', 'create', @compoundfont)
latinkeys = {}
begin
- actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
+ actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
rescue
- latinkeys {}
+ latinkeys {}
end
if latinkeys != {}
- tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
+ tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
end
if knj
- kanjikeys = {}
- begin
- actual_core(@kanjifont).each{|key,val| kanjikeys[key] = val}
- rescue
- kanjikeys {}
- end
- if kanjikeys != {}
- tk_call('font', 'configure', @compoundfont, *hash_kv(kanjikeys))
- end
+ kanjikeys = {}
+ begin
+ actual_core(@kanjifont).each{|key,val| kanjikeys[key] = val}
+ rescue
+ kanjikeys {}
+ end
+ if kanjikeys != {}
+ tk_call('font', 'configure', @compoundfont, *hash_kv(kanjikeys))
+ end
end
@fontslot = {'font'=>@compoundfont}
@@ -666,8 +666,8 @@ class TkFont
""
else
[['family',[]], ['size',[]], ['weight',[]], ['slant',[]],
- ['underline',[]], ['overstrike',[]], ['charset',[]],
- ['pointadjust',[]]]
+ ['underline',[]], ['overstrike',[]], ['charset',[]],
+ ['pointadjust',[]]]
end
end
@@ -676,24 +676,24 @@ class TkFont
""
elsif option
if window
- tk_call('font', 'actual', font, "-displayof", window, "-#{option}")
+ tk_call('font', 'actual', font, "-displayof", window, "-#{option}")
else
- tk_call('font', 'actual', font, "-#{option}")
+ tk_call('font', 'actual', font, "-#{option}")
end
else
l = tk_split_simplelist(if window
- tk_call('font', 'actual', font,
- "-displayof", window)
- else
- tk_call('font', 'actual', font)
- end)
+ tk_call('font', 'actual', font,
+ "-displayof", window)
+ else
+ tk_call('font', 'actual', font)
+ end)
r = []
while key=l.shift
- if key == '-compound'
- l.shift
- else
- r.push [key[1..-1], l.shift]
- end
+ if key == '-compound'
+ l.shift
+ else
+ r.push [key[1..-1], l.shift]
+ end
end
r
end
@@ -708,11 +708,11 @@ class TkFont
# dummy
if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
if option
- ""
+ ""
else
- [['family',[]], ['size',[]], ['weight',[]], ['slant',[]],
- ['underline',[]], ['overstrike',[]], ['charset',[]],
- ['pointadjust',[]]]
+ [['family',[]], ['size',[]], ['weight',[]], ['slant',[]],
+ ['underline',[]], ['overstrike',[]], ['charset',[]],
+ ['pointadjust',[]]]
end
else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
current_configinfo_core_tk4x(font, option)
@@ -724,69 +724,69 @@ class TkFont
""
else
{'family'=>'', 'size'=>'', 'weight'=>'', 'slant'=>'',
- 'underline'=>'', 'overstrike'=>'', 'charset'=>'', 'pointadjust'=>''}
+ 'underline'=>'', 'overstrike'=>'', 'charset'=>'', 'pointadjust'=>''}
end
end
def configure_core_tk8x(font, slot, value=None)
if JAPANIZED_TK
begin
- padjust = tk_call('font', 'configure', font, '-pointadjust')
+ padjust = tk_call('font', 'configure', font, '-pointadjust')
rescue
- padjust = nil
+ padjust = nil
end
else
padjust = nil
end
if slot.kind_of? Hash
if JAPANIZED_TK && (slot.key?('family') || slot.key?(:family))
- slot = _symbolkey2str(slot)
- configure_core_tk8x(font, 'family', slot.delete('family'))
+ slot = _symbolkey2str(slot)
+ configure_core_tk8x(font, 'family', slot.delete('family'))
end
if ((slot.key?('size') || slot.key?(:size)) &&
- padjust && !slot.key?('pointadjust') && !slot.key?(:pointadjust))
- tk_call('font', 'configure', font,
- '-pointadjust', padjust, *hash_kv(slot))
+ padjust && !slot.key?('pointadjust') && !slot.key?(:pointadjust))
+ tk_call('font', 'configure', font,
+ '-pointadjust', padjust, *hash_kv(slot))
else
- tk_call('font', 'configure', font, *hash_kv(slot))
+ tk_call('font', 'configure', font, *hash_kv(slot))
end
elsif (slot == 'size' || slot == :size) && padjust != nil
tk_call('font', 'configure', font,
- "-#{slot}", value, '-pointadjust', padjust)
+ "-#{slot}", value, '-pointadjust', padjust)
elsif JAPANIZED_TK && (slot == 'family' || slot == :family)
# coumpund font?
begin
- compound = tk_split_simplelist(tk_call('font', 'configure',
- font, '-compound'))
+ compound = tk_split_simplelist(tk_call('font', 'configure',
+ font, '-compound'))
rescue
- tk_call('font', 'configure', font, '-family', value)
- return self
+ tk_call('font', 'configure', font, '-family', value)
+ return self
end
if compound == []
- tk_call('font', 'configure', font, '-family', value)
- return self
+ tk_call('font', 'configure', font, '-family', value)
+ return self
end
ltn, knj = compound
lfnt = tk_call('font', 'create', '-copy', ltn)
begin
- tk_call('font', 'configure', lfnt, '-family', value)
- latin_replace_core_tk8x(lfnt)
+ tk_call('font', 'configure', lfnt, '-family', value)
+ latin_replace_core_tk8x(lfnt)
rescue RuntimeError => e
- fail e if $DEBUG
+ fail e if $DEBUG
ensure
- tk_call('font', 'delete', lfnt) if lfnt != ''
+ tk_call('font', 'delete', lfnt) if lfnt != ''
end
kfnt = tk_call('font', 'create', '-copy', knj)
begin
- tk_call('font', 'configure', kfnt, '-family', value)
- kanji_replace_core_tk8x(lfnt)
+ tk_call('font', 'configure', kfnt, '-family', value)
+ kanji_replace_core_tk8x(lfnt)
rescue RuntimeError => e
- fail e if $DEBUG
+ fail e if $DEBUG
ensure
- tk_call('font', 'delete', kfnt) if kfnt != ''
+ tk_call('font', 'delete', kfnt) if kfnt != ''
end
else
@@ -798,20 +798,20 @@ class TkFont
def configinfo_core_tk8x(font, option=nil)
if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
if option == 'compound'
- ""
+ ""
elsif option
- tk_call('font', 'configure', font, "-#{option}")
+ tk_call('font', 'configure', font, "-#{option}")
else
- l = tk_split_simplelist(tk_call('font', 'configure', font))
- r = []
- while key=l.shift
- if key == '-compound'
- l.shift
- else
- r.push [key[1..-1], l.shift]
- end
- end
- r
+ l = tk_split_simplelist(tk_call('font', 'configure', font))
+ r = []
+ while key=l.shift
+ if key == '-compound'
+ l.shift
+ else
+ r.push [key[1..-1], l.shift]
+ end
+ end
+ r
end
else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
current_configinfo_core_tk8x(font, option)
@@ -827,11 +827,11 @@ class TkFont
l = tk_split_simplelist(tk_call('font', 'configure', font))
r = {}
while key=l.shift
- if key == '-compound'
- l.shift
- else
- r[key[1..-1]] = l.shift
- end
+ if key == '-compound'
+ l.shift
+ else
+ r[key[1..-1]] = l.shift
+ end
end
r
end
@@ -865,28 +865,28 @@ class TkFont
@fontslot['font'] = @latinfont
Tk_FontUseTBL.dup.each{|w, fobj|
if self == fobj
- begin
- if w.include?(';')
- win, tag, optkey = w.split(';')
- optkey = 'font' if optkey == nil || optkey == ''
- winobj = tk_tcl2ruby(win)
-# winobj.tagfont_configure(tag, {'font'=>@latinfont})
- if winobj.kind_of? TkText
- tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @latinfont)
- elsif winobj.kind_of? TkCanvas
- tk_call(win, 'itemconfigure', tag, "-#{optkey}", @latinfont)
- elsif winobj.kind_of? TkMenu
- tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
- else
- raise RuntimeError, "unknown widget type"
- end
- else
-# tk_tcl2ruby(w).font_configure('font'=>@latinfont)
- tk_call(w, 'configure', '-font', @latinfont)
- end
- rescue
- Tk_FontUseTBL.delete(w)
- end
+ begin
+ if w.include?(';')
+ win, tag, optkey = w.split(';')
+ optkey = 'font' if optkey == nil || optkey == ''
+ winobj = tk_tcl2ruby(win)
+# winobj.tagfont_configure(tag, {'font'=>@latinfont})
+ if winobj.kind_of? TkText
+ tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @latinfont)
+ elsif winobj.kind_of? TkCanvas
+ tk_call(win, 'itemconfigure', tag, "-#{optkey}", @latinfont)
+ elsif winobj.kind_of? TkMenu
+ tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
+ else
+ raise RuntimeError, "unknown widget type"
+ end
+ else
+# tk_tcl2ruby(w).font_configure('font'=>@latinfont)
+ tk_call(w, 'configure', '-font', @latinfont)
+ end
+ rescue
+ Tk_FontUseTBL.delete(w)
+ end
end
}
self
@@ -900,28 +900,28 @@ class TkFont
@fontslot['kanjifont'] = @kanjifont
Tk_FontUseTBL.dup.each{|w, fobj|
if self == fobj
- begin
- if w.include?(';')
- win, tag, optkey = w.split(';')
- optkey = 'kanjifont' unless optkey
- winobj = tk_tcl2ruby(win)
-# winobj.tagfont_configure(tag, {'kanjifont'=>@kanjifont})
- if winobj.kind_of? TkText
- tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @kanjifont)
- elsif winobj.kind_of? TkCanvas
- tk_call(win, 'itemconfigure', tag, "-#{optkey}", @kanjifont)
- elsif winobj.kind_of? TkMenu
- tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
- else
- raise RuntimeError, "unknown widget type"
- end
- else
-# tk_tcl2ruby(w).font_configure('kanjifont'=>@kanjifont)
- tk_call(w, 'configure', '-kanjifont', @kanjifont)
- end
- rescue
- Tk_FontUseTBL.delete(w)
- end
+ begin
+ if w.include?(';')
+ win, tag, optkey = w.split(';')
+ optkey = 'kanjifont' unless optkey
+ winobj = tk_tcl2ruby(win)
+# winobj.tagfont_configure(tag, {'kanjifont'=>@kanjifont})
+ if winobj.kind_of? TkText
+ tk_call(win, 'tag', 'configure', tag, "-#{optkey}", @kanjifont)
+ elsif winobj.kind_of? TkCanvas
+ tk_call(win, 'itemconfigure', tag, "-#{optkey}", @kanjifont)
+ elsif winobj.kind_of? TkMenu
+ tk_call(win, 'entryconfigure', tag, "-#{optkey}", @latinfont)
+ else
+ raise RuntimeError, "unknown widget type"
+ end
+ else
+# tk_tcl2ruby(w).font_configure('kanjifont'=>@kanjifont)
+ tk_call(w, 'configure', '-kanjifont', @kanjifont)
+ end
+ rescue
+ Tk_FontUseTBL.delete(w)
+ end
end
}
self
@@ -930,14 +930,14 @@ class TkFont
def latin_replace_core_tk8x(ltn)
if JAPANIZED_TK
begin
- tk_call('font', 'delete', '@font_tmp')
+ tk_call('font', 'delete', '@font_tmp')
rescue
end
begin
- fnt_bup = tk_call('font', 'create', '@font_tmp', '-copy', @latinfont)
+ fnt_bup = tk_call('font', 'create', '@font_tmp', '-copy', @latinfont)
rescue
- #fnt_bup = ''
- fnt_bup = DEFAULT_LATIN_FONT_NAME
+ #fnt_bup = ''
+ fnt_bup = DEFAULT_LATIN_FONT_NAME
end
end
@@ -951,40 +951,40 @@ class TkFont
keys = self.configinfo
tk_call('font', 'delete', @compoundfont)
begin
- tk_call('font', 'create', @compoundfont,
- '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+ tk_call('font', 'create', @compoundfont,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
=begin
- latinkeys = {}
- begin
- actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
- rescue
- latinkeys {}
- end
- if latinkeys != {}
- tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
- end
+ latinkeys = {}
+ begin
+ actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
+ rescue
+ latinkeys {}
+ end
+ if latinkeys != {}
+ tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
+ end
=end
rescue RuntimeError => e
- tk_call('font', 'delete', @latinfont)
- if fnt_bup && fnt_bup != ''
- tk_call('font', 'create', @latinfont, '-copy', fnt_bup)
- tk_call('font', 'create', @compoundfont,
- '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
- tk_call('font', 'delete', fnt_bup)
- else
- fail e
- end
+ tk_call('font', 'delete', @latinfont)
+ if fnt_bup && fnt_bup != ''
+ tk_call('font', 'create', @latinfont, '-copy', fnt_bup)
+ tk_call('font', 'create', @compoundfont,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+ tk_call('font', 'delete', fnt_bup)
+ else
+ fail e
+ end
end
else
latinkeys = {}
begin
- actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
+ actual_core(@latinfont).each{|key,val| latinkeys[key] = val}
rescue
- latinkeys {}
+ latinkeys {}
end
if latinkeys != {}
- tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
+ tk_call('font', 'configure', @compoundfont, *hash_kv(latinkeys))
end
end
self
@@ -993,14 +993,14 @@ class TkFont
def kanji_replace_core_tk8x(knj)
if JAPANIZED_TK
begin
- tk_call('font', 'delete', '@font_tmp')
+ tk_call('font', 'delete', '@font_tmp')
rescue
end
begin
- fnt_bup = tk_call('font', 'create', '@font_tmp', '-copy', @kanjifont)
+ fnt_bup = tk_call('font', 'create', '@font_tmp', '-copy', @kanjifont)
rescue
- #fnt_bup = ''
- fnt_bup = DEFAULT_KANJI_FONT_NAME
+ #fnt_bup = ''
+ fnt_bup = DEFAULT_KANJI_FONT_NAME
end
end
@@ -1014,18 +1014,18 @@ class TkFont
keys = self.configinfo
tk_call('font', 'delete', @compoundfont)
begin
- tk_call('font', 'create', @compoundfont,
- '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+ tk_call('font', 'create', @compoundfont,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
rescue RuntimeError => e
- tk_call('font', 'delete', @kanjifont)
- if fnt_bup && fnt_bup != ''
- tk_call('font', 'create', @kanjifont, '-copy', fnt_bup)
- tk_call('font', 'create', @compoundfont,
- '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
- tk_call('font', 'delete', fnt_bup)
- else
- fail e
- end
+ tk_call('font', 'delete', @kanjifont)
+ if fnt_bup && fnt_bup != ''
+ tk_call('font', 'create', @kanjifont, '-copy', fnt_bup)
+ tk_call('font', 'create', @compoundfont,
+ '-compound', [@latinfont, @kanjifont], *hash_kv(keys))
+ tk_call('font', 'delete', fnt_bup)
+ else
+ fail e
+ end
end
end
self
@@ -1038,7 +1038,7 @@ class TkFont
def measure_core_tk8x(window, text)
if window
number(tk_call('font', 'measure', @compoundfont,
- '-displayof', window, text))
+ '-displayof', window, text))
else
number(tk_call('font', 'measure', @compoundfont, text))
end
@@ -1056,20 +1056,20 @@ class TkFont
def metrics_core_tk8x(font, window, option=nil)
if option
if window
- number(tk_call('font', 'metrics', font,
- "-displayof", window, "-#{option}"))
+ number(tk_call('font', 'metrics', font,
+ "-displayof", window, "-#{option}"))
else
- number(tk_call('font', 'metrics', font, "-#{option}"))
+ number(tk_call('font', 'metrics', font, "-#{option}"))
end
else
l = tk_split_list(if window
- tk_call('font','metrics',font,"-displayof",window)
- else
- tk_call('font','metrics',font)
- end)
+ tk_call('font','metrics',font,"-displayof",window)
+ else
+ tk_call('font','metrics',font)
+ end)
r = []
while key=l.shift
- r.push [key[1..-1], l.shift.to_i]
+ r.push [key[1..-1], l.shift.to_i]
end
r
end
@@ -1133,9 +1133,9 @@ class TkFont
configure name, args[0]
when 0
begin
- configinfo name
+ configinfo name
rescue
- fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at
+ fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at
end
else
fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
@@ -1171,49 +1171,49 @@ class TkFont
Tk_FontUseTBL.each{|key,value|
next unless self == value
if key.include?(';')
- win, tag, optkey = key.split(';')
- winobj = tk_tcl2ruby(win)
- if winobj.kind_of? TkText
- if optkey
- ret.push([winobj, winobj.tagid2obj(tag), optkey])
- else
- ret.push([winobj, winobj.tagid2obj(tag)])
- end
- elsif winobj.kind_of? TkCanvas
- if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
- if optkey
- ret.push([winobj, tagobj, optkey])
- else
- ret.push([winobj, tagobj])
- end
- elsif (tagobj = TkcItem.id2obj(winobj, tag)).kind_of? TkcItem
- if optkey
- ret.push([winobj, tagobj, optkey])
- else
- ret.push([winobj, tagobj])
- end
- else
- if optkey
- ret.push([winobj, tag, optkey])
- else
- ret.push([winobj, tag])
- end
- end
- elsif winobj.kind_of? TkMenu
- if optkey
- ret.push([winobj, tag, optkey])
- else
- ret.push([winobj, tag])
- end
- else
- if optkey
- ret.push([win, tag, optkey])
- else
- ret.push([win, tag])
- end
- end
+ win, tag, optkey = key.split(';')
+ winobj = tk_tcl2ruby(win)
+ if winobj.kind_of? TkText
+ if optkey
+ ret.push([winobj, winobj.tagid2obj(tag), optkey])
+ else
+ ret.push([winobj, winobj.tagid2obj(tag)])
+ end
+ elsif winobj.kind_of? TkCanvas
+ if (tagobj = TkcTag.id2obj(winobj, tag)).kind_of? TkcTag
+ if optkey
+ ret.push([winobj, tagobj, optkey])
+ else
+ ret.push([winobj, tagobj])
+ end
+ elsif (tagobj = TkcItem.id2obj(winobj, tag)).kind_of? TkcItem
+ if optkey
+ ret.push([winobj, tagobj, optkey])
+ else
+ ret.push([winobj, tagobj])
+ end
+ else
+ if optkey
+ ret.push([winobj, tag, optkey])
+ else
+ ret.push([winobj, tag])
+ end
+ end
+ elsif winobj.kind_of? TkMenu
+ if optkey
+ ret.push([winobj, tag, optkey])
+ else
+ ret.push([winobj, tag])
+ end
+ else
+ if optkey
+ ret.push([win, tag, optkey])
+ else
+ ret.push([win, tag])
+ end
+ end
else
- ret.push(tk_tcl2ruby(key))
+ ret.push(tk_tcl2ruby(key))
end
}
ret
diff --git a/ext/tk/lib/tk/grid.rb b/ext/tk/lib/tk/grid.rb
index c591eea187..74287d43bd 100644
--- a/ext/tk/lib/tk/grid.rb
+++ b/ext/tk/lib/tk/grid.rb
@@ -33,9 +33,9 @@ module TkGrid
args.each{|win|
case win
when '-', 'x', '^' # RELATIVE PLACEMENT
- params.push(win)
+ params.push(win)
else
- params.push(_epath(win))
+ params.push(_epath(win))
end
}
opts.each{|k, v|
@@ -50,7 +50,7 @@ module TkGrid
# master = master.epath if master.kind_of?(TkObject)
master = _epath(master)
tk_call_without_enc("grid", 'columnconfigure',
- master, index, *hash_kv(args))
+ master, index, *hash_kv(args))
end
def rowconfigure(master, index, args)
@@ -65,24 +65,24 @@ module TkGrid
if slot
case slot
when 'uniform', :uniform
- tk_call_without_enc('grid', 'columnconfigure',
- master, index, "-#{slot}")
+ tk_call_without_enc('grid', 'columnconfigure',
+ master, index, "-#{slot}")
else
- num_or_str(tk_call_without_enc('grid', 'columnconfigure',
- master, index, "-#{slot}"))
+ num_or_str(tk_call_without_enc('grid', 'columnconfigure',
+ master, index, "-#{slot}"))
end
else
#ilist = list(tk_call_without_enc('grid','columnconfigure',master,index))
ilist = simplelist(tk_call_without_enc('grid', 'columnconfigure',
- master, index))
+ master, index))
info = {}
while key = ilist.shift
- case key
- when 'uniform'
- info[key[1..-1]] = ilist.shift
- else
- info[key[1..-1]] = tk_tcl2ruby(ilist.shift)
- end
+ case key
+ when 'uniform'
+ info[key[1..-1]] = ilist.shift
+ else
+ info[key[1..-1]] = tk_tcl2ruby(ilist.shift)
+ end
end
info
end
@@ -94,24 +94,24 @@ module TkGrid
if slot
case slot
when 'uniform', :uniform
- tk_call_without_enc('grid', 'rowconfigure',
- master, index, "-#{slot}")
+ tk_call_without_enc('grid', 'rowconfigure',
+ master, index, "-#{slot}")
else
- num_or_str(tk_call_without_enc('grid', 'rowconfigure',
- master, index, "-#{slot}"))
+ num_or_str(tk_call_without_enc('grid', 'rowconfigure',
+ master, index, "-#{slot}"))
end
else
#ilist = list(tk_call_without_enc('grid', 'rowconfigure', master, index))
ilist = simplelist(tk_call_without_enc('grid', 'rowconfigure',
- master, index))
+ master, index))
info = {}
while key = ilist.shift
- case key
- when 'uniform'
- info[key[1..-1]] = ilist.shift
- else
- info[key[1..-1]] = tk_tcl2ruby(ilist.shift)
- end
+ case key
+ when 'uniform'
+ info[key[1..-1]] = ilist.shift
+ else
+ info[key[1..-1]] = tk_tcl2ruby(ilist.shift)
+ end
end
info
end
diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb
index 7868ed0c8f..7fd61eff5d 100644
--- a/ext/tk/lib/tk/image.rb
+++ b/ext/tk/lib/tk/image.rb
@@ -65,9 +65,9 @@ class TkPhotoImage<TkImage
keys = _symbolkey2str(keys)
NullArgOptionKeys.collect{|opt|
if keys[opt]
- keys[opt] = None
+ keys[opt] = None
else
- keys.delete(opt)
+ keys.delete(opt)
end
}
hash_kv(keys).flatten
@@ -101,11 +101,11 @@ class TkPhotoImage<TkImage
else
# for backward compatibility
args = opts.collect{|term|
- if term.kind_of?(String) && term.include?(?\s)
- term.split
- else
- term
- end
+ if term.kind_of?(String) && term.include?(?\s)
+ term.split
+ else
+ term
+ end
}.flatten
tk_send('copy', src, *args)
end
@@ -141,11 +141,11 @@ class TkPhotoImage<TkImage
else
# for backward compatibility
args = opts.collect{|term|
- if term.kind_of?(String) && term.include?(?\s)
- term.split
- else
- term
- end
+ if term.kind_of?(String) && term.include?(?\s)
+ term.split
+ else
+ term
+ end
}.flatten
tk_send('read', file, *args)
end
@@ -173,11 +173,11 @@ class TkPhotoImage<TkImage
else
# for backward compatibility
args = opts.collect{|term|
- if term.kind_of?(String) && term.include?(?\s)
- term.split
- else
- term
- end
+ if term.kind_of?(String) && term.include?(?\s)
+ term.split
+ else
+ term
+ end
}.flatten
tk_send('write', file, *args)
end
diff --git a/ext/tk/lib/tk/itemconfig.rb b/ext/tk/lib/tk/itemconfig.rb
index 2714500419..34c64adb2c 100644
--- a/ext/tk/lib/tk/itemconfig.rb
+++ b/ext/tk/lib/tk/itemconfig.rb
@@ -61,14 +61,14 @@ module TkItemConfigOptkeys
keys.each{|k, v|
optkey = keyonly.find{|kk,vv| kk.to_s == k.to_s}
if optkey
- defkey, undefkey = optkey
- if v
- keys2[defkey.to_s] = None
- else
- keys2[undefkey.to_s] = None
- end
+ defkey, undefkey = optkey
+ if v
+ keys2[defkey.to_s] = None
+ else
+ keys2[undefkey.to_s] = None
+ end
else
- keys2[k.to_s] = v
+ keys2[k.to_s] = v
end
}
keys2
@@ -122,9 +122,9 @@ module TkItemConfigMethod
case option
when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
begin
- number(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
+ number(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
rescue
- nil
+ nil
end
when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
@@ -132,9 +132,9 @@ module TkItemConfigMethod
when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
begin
- bool(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
+ bool(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")))
rescue
- nil
+ nil
end
when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
@@ -143,9 +143,9 @@ module TkItemConfigMethod
when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
conf = tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}"))
if conf =~ /^[0-9]/
- list(conf)
+ list(conf)
else
- conf
+ conf
end
when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
@@ -156,13 +156,13 @@ module TkItemConfigMethod
fontkey = $2
fnt = tk_tcl2ruby(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{fontkey}")), true)
unless fnt.kind_of?(TkFont)
- fnt = tagfontobj(tagid(tagOrId), fontkey)
+ fnt = tagfontobj(tagid(tagOrId), fontkey)
end
if fontcode == 'kanji' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
- # obsolete; just for compatibility
- fnt.kanji_font
+ # obsolete; just for compatibility
+ fnt.kanji_font
else
- fnt
+ fnt
end
else
tk_tcl2ruby(tk_call_without_enc(*(__item_cget_cmd(tagid(tagOrId)) << "-#{option}")), true)
@@ -174,48 +174,48 @@ module TkItemConfigMethod
slot = _symbolkey2str(slot)
__item_methodcall_optkeys(tagid(tagOrId)).each{|key, method|
- value = slot.delete(key.to_s)
- self.__send__(method, tagOrId, value) if value
+ value = slot.delete(key.to_s)
+ self.__send__(method, tagOrId, value) if value
}
__item_keyonly_optkeys(tagid(tagOrId)).each{|defkey, undefkey|
- conf = slot.find{|kk, vv| kk == defkey.to_s}
- if conf
- k, v = conf
- if v
- slot[k] = None
- else
- slot[undefkey.to_s] = None if undefkey
- slot.delete(k)
- end
- end
+ conf = slot.find{|kk, vv| kk == defkey.to_s}
+ if conf
+ k, v = conf
+ if v
+ slot[k] = None
+ else
+ slot[undefkey.to_s] = None if undefkey
+ slot.delete(k)
+ end
+ end
}
if (slot.find{|k, v| k =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/})
- tagfont_configure(tagid(tagOrId), slot)
+ tagfont_configure(tagid(tagOrId), slot)
elsif slot.size > 0
- tk_call(*(__item_config_cmd(tagid(tagOrId)).concat(hash_kv(slot))))
+ tk_call(*(__item_config_cmd(tagid(tagOrId)).concat(hash_kv(slot))))
end
else
slot = slot.to_s
if ( conf = __item_keyonly_optkeys(tagid(tagOrId)).find{|k, v| k.to_s == slot } )
- defkey, undefkey = conf
- if value
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{defkey}"))
- elsif undefkey
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{undefkey}"))
- end
+ defkey, undefkey = conf
+ if value
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{defkey}"))
+ elsif undefkey
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{undefkey}"))
+ end
elsif ( method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot] )
- self.__send__(method, tagOrId, value)
+ self.__send__(method, tagOrId, value)
elsif (slot =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
- if value == None
- tagfontobj(tagid(tagOrId), $2)
- else
- tagfont_configure(tagid(tagOrId), {slot=>value})
- end
+ if value == None
+ tagfontobj(tagid(tagOrId), $2)
+ else
+ tagfont_configure(tagid(tagOrId), {slot=>value})
+ end
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}" << value))
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}" << value))
end
end
self
@@ -224,531 +224,531 @@ module TkItemConfigMethod
def itemconfiginfo(tagOrId, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if (slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
- fontkey = $2
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
- if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
- || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), fontkey)
- elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
- && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
- end
- conf
+ fontkey = $2
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), fontkey)
+ elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+ conf
else
- if slot
- slot = slot.to_s
- case slot
- when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
- method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
- return [slot, '', '', '', self.__send__(method, tagOrId)]
-
- when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- end
- end
-
- when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- end
- end
-
- when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- else
- conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
- end
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
- && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
- end
-
- conf
-
- else
- ret = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)))))).collect{|conflist|
- conf = tk_split_simplelist(conflist)
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
-
- case conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
- when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
- # do nothing
-
- when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- end
- end
-
- when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- end
- end
-
- when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- else
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{')
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- end
- if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
- if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{')
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
- end
- end
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
- && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
- end
-
- conf
- }
-
- __item_font_optkeys(tagid(tagOrId)).each{|optkey|
- optkey = optkey.to_s
- fontconf = ret.assoc(optkey)
- if fontconf && fontconf.size > 2
- ret.delete_if{|inf| inf[0] =~ /^(|latin|ascii|kanji)#{optkey}$/}
- fontconf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), optkey)
- ret.push(fontconf)
- end
- }
-
- __item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
- ret << [optkey.to_s, '', '', '', self.__send__(method, tagOrId)]
- }
-
- ret
- end
+ if slot
+ slot = slot.to_s
+ case slot
+ when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
+ method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
+ return [slot, '', '', '', self.__send__(method, tagOrId)]
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ else
+ conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+ end
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+
+ conf
+
+ else
+ ret = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)))))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
+
+ case conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ # do nothing
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ else
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{')
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ else
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ end
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{')
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ else
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+ end
+ end
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?- )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+
+ conf
+ }
+
+ __item_font_optkeys(tagid(tagOrId)).each{|optkey|
+ optkey = optkey.to_s
+ fontconf = ret.assoc(optkey)
+ if fontconf && fontconf.size > 2
+ ret.delete_if{|inf| inf[0] =~ /^(|latin|ascii|kanji)#{optkey}$/}
+ fontconf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), optkey)
+ ret.push(fontconf)
+ end
+ }
+
+ __item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
+ ret << [optkey.to_s, '', '', '', self.__send__(method, tagOrId)]
+ }
+
+ ret
+ end
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
if (slot.to_s =~ /^(|latin|ascii|kanji)(#{__item_font_optkeys(tagid(tagOrId)).join('|')})$/)
- fontkey = $2
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
-
- if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
- || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = fontobj(tagid(tagOrId), fontkey)
- { conf.shift => conf }
- elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
- && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
- if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
- end
- { conf[0] => conf[1] }
- else
- { conf.shift => conf }
- end
+ fontkey = $2
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{fontkey}"))))
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
+
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = fontobj(tagid(tagOrId), fontkey)
+ { conf.shift => conf }
+ elsif ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+ { conf[0] => conf[1] }
+ else
+ { conf.shift => conf }
+ end
else
- if slot
- slot = slot.to_s
- case slot
- when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
- method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
- return {slot => ['', '', '', self.__send__(method, tagOrId)]}
-
- when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- end
- end
-
- when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- num_or_stre(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- end
- end
-
- when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
- conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
-
- else
- conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
- end
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
- && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
- if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
- end
- { conf[0] => conf[1] }
- else
- { conf.shift => conf }
- end
-
- else
- ret = {}
- tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)))))).each{|conflist|
- conf = tk_split_simplelist(conflist)
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
-
- case conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
- when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
- # do nothing
-
- when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- end
- end
-
- when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
- end
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- begin
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- rescue
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
- end
- end
-
- when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
-
- else
- if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
- && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
- if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{')
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
- tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
- end
- end
- if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
- if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{')
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- else
- conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
- tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
- end
- end
- end
-
- if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
- && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
- if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
- conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
- end
- ret[conf[0]] = conf[1]
- else
- ret[conf.shift] = conf
- end
- }
-
- __item_font_optkeys(tagid(tagOrId)).each{|optkey|
- optkey = optkey.to_s
- fontconf = ret[optkey]
- if fontconf.kind_of?(Array)
- ret.delete(optkey)
- ret.delete('latin' << optkey)
- ret.delete('ascii' << optkey)
- ret.delete('kanji' << optkey)
- fontconf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), optkey)
- ret[optkey] = fontconf
- end
- }
-
- __item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
- ret[optkey.to_s] = ['', '', '', self.__send__(method, tagOrId)]
- }
-
- ret
- end
+ if slot
+ slot = slot.to_s
+ case slot
+ when /^(#{__item_methodcall_optkeys(tagid(tagOrId)).keys.join('|')})$/
+ method = _symbolkey2str(__item_methodcall_optkeys(tagid(tagOrId)))[slot]
+ return {slot => ['', '', '', self.__send__(method, tagOrId)]}
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ num_or_stre(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+
+ else
+ conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)) << "-#{slot}"))))
+ end
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+ { conf[0] => conf[1] }
+ else
+ { conf.shift => conf }
+ end
+
+ else
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_config_cmd(tagid(tagOrId)))))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1]
+
+ case conf[__item_configinfo_struct(tagid(tagOrId))[:key]]
+ when /^(#{__item_strval_optkeys(tagid(tagOrId)).join('|')})$/
+ # do nothing
+
+ when /^(#{__item_numval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ number(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_numstrval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_boolval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] = nil
+ end
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ begin
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ bool(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ rescue
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = nil
+ end
+ end
+
+ when /^(#{__item_listval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ when /^(#{__item_numlistval_optkeys(tagid(tagOrId)).join('|')})$/
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =~ /^[0-9]/ )
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+
+ else
+ if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \
+ && conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] )
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]].index('{')
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ else
+ conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]] =
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:default_value]])
+ end
+ end
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]].index('{')
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ tk_split_list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ else
+ conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] =
+ tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]])
+ end
+ end
+ end
+
+ if ( __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ && conf.size == __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ if conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][0] == ?-
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] =
+ conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1]
+ end
+ ret[conf[0]] = conf[1]
+ else
+ ret[conf.shift] = conf
+ end
+ }
+
+ __item_font_optkeys(tagid(tagOrId)).each{|optkey|
+ optkey = optkey.to_s
+ fontconf = ret[optkey]
+ if fontconf.kind_of?(Array)
+ ret.delete(optkey)
+ ret.delete('latin' << optkey)
+ ret.delete('ascii' << optkey)
+ ret.delete('kanji' << optkey)
+ fontconf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tagfontobj(tagid(tagOrId), optkey)
+ ret[optkey] = fontconf
+ end
+ }
+
+ __item_methodcall_optkeys(tagid(tagOrId)).each{|optkey, method|
+ ret[optkey.to_s] = ['', '', '', self.__send__(method, tagOrId)]
+ }
+
+ ret
+ end
end
end
end
@@ -756,31 +756,31 @@ module TkItemConfigMethod
def current_itemconfiginfo(tagOrId, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
- org_slot = slot
- begin
- conf = itemconfiginfo(tagOrId, slot)
- if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
- || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
- return {conf[0] => conf[-1]}
- end
- slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]]
- end while(org_slot != slot)
- fail RuntimeError,
- "there is a configure alias loop about '#{org_slot}'"
+ org_slot = slot
+ begin
+ conf = itemconfiginfo(tagOrId, slot)
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ return {conf[0] => conf[-1]}
+ end
+ slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]]
+ end while(org_slot != slot)
+ fail RuntimeError,
+ "there is a configure alias loop about '#{org_slot}'"
else
- ret = {}
- itemconfiginfo(tagOrId).each{|conf|
- if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
- || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
- ret[conf[0]] = conf[-1]
- end
- }
- ret
+ ret = {}
+ itemconfiginfo(tagOrId).each{|conf|
+ if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \
+ || conf.size > __item_configinfo_struct(tagid(tagOrId))[:alias] + 1 )
+ ret[conf[0]] = conf[-1]
+ end
+ }
+ ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
- itemconfiginfo(slot).each{|key, conf|
- ret[key] = conf[-1] if conf.kind_of?(Array)
+ itemconfiginfo(slot).each{|key, conf|
+ ret[key] = conf[-1] if conf.kind_of?(Array)
}
ret
end
diff --git a/ext/tk/lib/tk/itemfont.rb b/ext/tk/lib/tk/itemfont.rb
index f194595d57..1f77ad11e7 100644
--- a/ext/tk/lib/tk/itemfont.rb
+++ b/ext/tk/lib/tk/itemfont.rb
@@ -33,19 +33,19 @@ module TkTreatItemFont
if key
pathname = [win, tag, key].join(';')
TkFont.used_on(pathname) ||
- TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
+ TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
elsif optkeys.size == 1
pathname = [win, tag, optkeys[0]].join(';')
TkFont.used_on(pathname) ||
- TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
+ TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
else
fonts = {}
optkeys.each{|key|
- key = key.to_s
- pathname = [win, tag, key].join(';')
- fonts[key] =
- TkFont.used_on(pathname) ||
- TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
+ key = key.to_s
+ pathname = [win, tag, key].join(';')
+ fonts[key] =
+ TkFont.used_on(pathname) ||
+ TkFont.init_widget_font(pathname, *(__item_config_cmd(tagid(tagOrId))))
}
fonts
end
@@ -64,38 +64,38 @@ module TkTreatItemFont
k_optkey = 'kanji' << optkey
if slot.key?(optkey)
- fnt = slot.delete(optkey)
- if fnt.kind_of?(TkFont)
- slot.delete(l_optkey)
- slot.delete(a_optkey)
- slot.delete(k_optkey)
-
- fnt.call_font_configure([pathname, optkey],
- *(__item_config_cmd(tagid(tagOrId)) << {}))
- next
- else
- if fnt
- if (slot.key?(l_optkey) ||
- slot.key?(a_optkey) ||
- slot.key?(k_optkey))
- fnt = TkFont.new(fnt)
-
- lfnt = slot.delete(l_optkey)
- lfnt = slot.delete(a_optkey) if slot.key?(a_optkey)
- kfnt = slot.delete(k_optkey)
-
- fnt.latin_replace(lfnt) if lfnt
- fnt.kanji_replace(kfnt) if kfnt
-
- fnt.call_font_configure([pathname, optkey],
- *(__item_config_cmd(tagid(tagOrId)) << {}))
- next
- else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
- end
- end
- next
- end
+ fnt = slot.delete(optkey)
+ if fnt.kind_of?(TkFont)
+ slot.delete(l_optkey)
+ slot.delete(a_optkey)
+ slot.delete(k_optkey)
+
+ fnt.call_font_configure([pathname, optkey],
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
+ next
+ else
+ if fnt
+ if (slot.key?(l_optkey) ||
+ slot.key?(a_optkey) ||
+ slot.key?(k_optkey))
+ fnt = TkFont.new(fnt)
+
+ lfnt = slot.delete(l_optkey)
+ lfnt = slot.delete(a_optkey) if slot.key?(a_optkey)
+ kfnt = slot.delete(k_optkey)
+
+ fnt.latin_replace(lfnt) if lfnt
+ fnt.kanji_replace(kfnt) if kfnt
+
+ fnt.call_font_configure([pathname, optkey],
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
+ next
+ else
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << fnt))
+ end
+ end
+ next
+ end
end
lfnt = slot.delete(l_optkey)
@@ -103,12 +103,12 @@ module TkTreatItemFont
kfnt = slot.delete(k_optkey)
if lfnt && kfnt
- TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey],
- *(__item_config_cmd(tagid(tagOrId)) << {}))
+ TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey],
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
elsif lfnt
- latintagfont_configure([lfnt, optkey])
+ latintagfont_configure([lfnt, optkey])
elsif kfnt
- kanjitagfont_configure([kfnt, optkey])
+ kanjitagfont_configure([kfnt, optkey])
end
}
@@ -140,26 +140,26 @@ module TkTreatItemFont
pathname = [win, tag, optkey].join(';')
if (fobj = TkFont.used_on(pathname))
- fobj = TkFont.new(fobj) # create a new TkFont object
+ fobj = TkFont.new(fobj) # create a new TkFont object
elsif Tk::JAPANIZED_TK
- fobj = fontobj # create a new TkFont object
+ fobj = fontobj # create a new TkFont object
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
- next
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << ltn))
+ next
end
if fobj.kind_of?(TkFont)
- if ltn.kind_of?(TkFont)
- conf = {}
- ltn.latin_configinfo.each{|key,val| conf[key] = val}
- if keys
- fobj.latin_configure(conf.update(keys))
- else
- fobj.latin_configure(conf)
- end
- else
- fobj.latin_replace(ltn)
- end
+ if ltn.kind_of?(TkFont)
+ conf = {}
+ ltn.latin_configinfo.each{|key,val| conf[key] = val}
+ if keys
+ fobj.latin_configure(conf.update(keys))
+ else
+ fobj.latin_configure(conf)
+ end
+ else
+ fobj.latin_replace(ltn)
+ end
end
fobj.call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {}))
@@ -191,26 +191,26 @@ module TkTreatItemFont
pathname = [win, tag, optkey].join(';')
if (fobj = TkFont.used_on(pathname))
- fobj = TkFont.new(fobj) # create a new TkFont object
+ fobj = TkFont.new(fobj) # create a new TkFont object
elsif Tk::JAPANIZED_TK
- fobj = fontobj # create a new TkFont object
+ fobj = fontobj # create a new TkFont object
else
- tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
- next
+ tk_call(*(__item_config_cmd(tagid(tagOrId)) << "-#{optkey}" << knj))
+ next
end
if fobj.kind_of?(TkFont)
- if knj.kind_of?(TkFont)
- conf = {}
- knj.kanji_configinfo.each{|key,val| conf[key] = val}
- if keys
- fobj.kanji_configure(conf.update(keys))
- else
- fobj.kanji_configure(conf)
- end
- else
- fobj.kanji_replace(knj)
- end
+ if knj.kind_of?(TkFont)
+ conf = {}
+ knj.kanji_configinfo.each{|key,val| conf[key] = val}
+ if keys
+ fobj.kanji_configure(conf.update(keys))
+ else
+ fobj.kanji_configure(conf)
+ end
+ else
+ fobj.kanji_replace(knj)
+ end
end
fobj.call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {}))
@@ -221,24 +221,24 @@ module TkTreatItemFont
def tagfont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
if wintag
if winkey
- fnt = window.tagfontobj(wintag, winkey).dup
+ fnt = window.tagfontobj(wintag, winkey).dup
else
- fnt = window.tagfontobj(wintag).dup
+ fnt = window.tagfontobj(wintag).dup
end
else
if winkey
- fnt = window.fontobj(winkey).dup
+ fnt = window.fontobj(winkey).dup
else
- fnt = window.fontobj.dup
+ fnt = window.fontobj.dup
end
end
if targetkey
fnt.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey],
- *(__item_config_cmd(tagid(tagOrId)) << {}))
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
else
fnt.call_font_configure(__item_pathname(tagid(tagOrId)),
- *(__item_config_cmd(tagid(tagOrId)) << {}))
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
end
self
end
@@ -247,23 +247,23 @@ module TkTreatItemFont
def latintagfont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
if targetkey
fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey],
- *(__item_config_cmd(tagid(tagOrId)) << {}))
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
else
fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)),
- *(__item_config_cmd(tagid(tagOrId)) << {}))
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
end
if wintag
if winkey
- fontobj.latin_replace(window.tagfontobj(wintag, winkey).latin_font_id)
+ fontobj.latin_replace(window.tagfontobj(wintag, winkey).latin_font_id)
else
- fontobj.latin_replace(window.tagfontobj(wintag).latin_font_id)
+ fontobj.latin_replace(window.tagfontobj(wintag).latin_font_id)
end
else
if winkey
- fontobj.latin_replace(window.fontobj(winkey).latin_font_id)
+ fontobj.latin_replace(window.fontobj(winkey).latin_font_id)
else
- fontobj.latin_replace(window.fontobj.latin_font_id)
+ fontobj.latin_replace(window.fontobj.latin_font_id)
end
end
self
@@ -273,23 +273,23 @@ module TkTreatItemFont
def kanjifont_copy(tagOrId, window, wintag=nil, winkey=nil, targetkey=nil)
if targetkey
fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey],
- *(__item_config_cmd(tagid(tagOrId)) << {}))
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
else
- fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)),
- *(__item_config_cmd(tagid(tagOrId)) << {}))
+ fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)),
+ *(__item_config_cmd(tagid(tagOrId)) << {}))
end
if wintag
if winkey
- fontobj.kanji_replace(window.tagfontobj(wintag, winkey).kanji_font_id)
+ fontobj.kanji_replace(window.tagfontobj(wintag, winkey).kanji_font_id)
else
- fontobj.kanji_replace(window.tagfontobj(wintag).kanji_font_id)
+ fontobj.kanji_replace(window.tagfontobj(wintag).kanji_font_id)
end
else
if winkey
- fontobj.kanji_replace(window.fontobj(winkey).kanji_font_id)
+ fontobj.kanji_replace(window.fontobj(winkey).kanji_font_id)
else
- fontobj.kanji_replace(window.fontobj.kanji_font_id)
+ fontobj.kanji_replace(window.fontobj.kanji_font_id)
end
end
self
diff --git a/ext/tk/lib/tk/kinput.rb b/ext/tk/lib/tk/kinput.rb
index 418b3aec47..fc731b6569 100644
--- a/ext/tk/lib/tk/kinput.rb
+++ b/ext/tk/lib/tk/kinput.rb
@@ -48,13 +48,13 @@ module TkKinput
def TkKinput.attribute_info(window, slot=nil)
if slot
conf = tk_split_list(tk_call('kanjiInput', 'attribute',
- window, "-#{slot}"))
+ window, "-#{slot}"))
conf[0] = conf[0][1..-1]
conf
else
tk_split_list(tk_call('kanjiInput', 'attribute', window)).collect{|conf|
- conf[0] = conf[0][1..-1]
- conf
+ conf[0] = conf[0][1..-1]
+ conf
}
end
end
diff --git a/ext/tk/lib/tk/listbox.rb b/ext/tk/lib/tk/listbox.rb
index d642ba2f09..f00db19239 100644
--- a/ext/tk/lib/tk/listbox.rb
+++ b/ext/tk/lib/tk/listbox.rb
@@ -105,15 +105,15 @@ class TkListbox<TkTextWin
when 'font', 'kanjifont'
#fnt = tk_tcl2ruby(tk_send('itemcget', index, "-#{key}"))
fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', index,
- '-font')))
+ '-font')))
unless fnt.kind_of?(TkFont)
- fnt = tagfontobj(index, fnt)
+ fnt = tagfontobj(index, fnt)
end
if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
- # obsolete; just for compatibility
- fnt.kanji_font
+ # obsolete; just for compatibility
+ fnt.kanji_font
else
- fnt
+ fnt
end
else
tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', index, "-#{key}")))
@@ -123,25 +123,25 @@ class TkListbox<TkTextWin
if key.kind_of? Hash
if (key['font'] || key[:font] ||
key['kanjifont'] || key[:kanjifont] ||
- key['latinfont'] || key[:latinfont] ||
+ key['latinfont'] || key[:latinfont] ||
key['asciifont'] || key[:asciifont] )
- tagfont_configure(index, _symbolkey2str(key))
+ tagfont_configure(index, _symbolkey2str(key))
else
- tk_send_without_enc('itemconfigure', index, *hash_kv(key, true))
+ tk_send_without_enc('itemconfigure', index, *hash_kv(key, true))
end
else
if (key == 'font' || key == :font ||
key == 'kanjifont' || key == :kanjifont ||
- key == 'latinfont' || key == :latinfont ||
+ key == 'latinfont' || key == :latinfont ||
key == 'asciifont' || key == :asciifont )
- if val == None
- tagfontobj(index)
- else
- tagfont_configure(index, {key=>val})
- end
+ if val == None
+ tagfontobj(index)
+ else
+ tagfont_configure(index, {key=>val})
+ end
else
- tk_call('itemconfigure', index, "-#{key}", val)
+ tk_call('itemconfigure', index, "-#{key}", val)
end
end
self
@@ -150,101 +150,101 @@ class TkListbox<TkTextWin
def itemconfiginfo(index, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- case key.to_s
- when 'text', 'label', 'show'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
- when 'font', 'kanjifont'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
- conf[4] = tagfont_configinfo(index, conf[4])
- else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
- end
- conf[0] = conf[0][1..-1]
- conf
+ case key.to_s
+ when 'text', 'label', 'show'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ conf[4] = tagfont_configinfo(index, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
else
- ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', index))).collect{|conflist|
- conf = tk_split_simplelist(conflist)
- conf[0] = conf[0][1..-1]
- case conf[0]
- when 'text', 'label', 'show'
- 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
- }
- fontconf = ret.assoc('font')
- if fontconf
- ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
- fontconf[4] = tagfont_configinfo(index, fontconf[4])
- ret.push(fontconf)
- else
- ret
- end
+ ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', index))).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ case conf[0]
+ when 'text', 'label', 'show'
+ 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
+ }
+ fontconf = ret.assoc('font')
+ if fontconf
+ ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
+ fontconf[4] = tagfont_configinfo(index, fontconf[4])
+ ret.push(fontconf)
+ else
+ ret
+ end
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- case key.to_s
- when 'text', 'label', 'show'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
- when 'font', 'kanjifont'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
- conf[4] = tagfont_configinfo(index, conf[4])
- else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
- end
- key = conf.shift[1..-1]
- { key => conf }
+ case key.to_s
+ when 'text', 'label', 'show'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ conf[4] = tagfont_configinfo(index, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('itemconfigure',index,"-#{key}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
else
- ret = {}
- tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', index))).each{|conflist|
- conf = tk_split_simplelist(conflist)
- key = conf.shift[1..-1]
- case key
- when 'text', 'label', 'show'
- 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
- }
- fontconf = ret['font']
- if fontconf
- ret.delete('font')
- ret.delete('kanjifont')
- fontconf[3] = tagfont_configinfo(index, fontconf[3])
- ret['font'] = fontconf
- end
- ret
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('itemconfigure', index))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ case key
+ when 'text', 'label', 'show'
+ 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
+ }
+ fontconf = ret['font']
+ if fontconf
+ ret.delete('font')
+ ret.delete('kanjifont')
+ fontconf[3] = tagfont_configinfo(index, fontconf[3])
+ ret['font'] = fontconf
+ end
+ ret
end
end
end
@@ -252,19 +252,19 @@ class TkListbox<TkTextWin
def current_itemconfiginfo(index, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- conf = itemconfiginfo(index, key)
- {conf[0] => conf[4]}
+ conf = itemconfiginfo(index, key)
+ {conf[0] => conf[4]}
else
- ret = {}
- itemconfiginfo(index).each{|conf|
- ret[conf[0]] = conf[4] if conf.size > 2
- }
- ret
+ ret = {}
+ itemconfiginfo(index).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
itemconfiginfo(index, key).each{|k, conf|
- ret[k] = conf[-1] if conf.kind_of?(Array)
+ ret[k] = conf[-1] if conf.kind_of?(Array)
}
ret
end
diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb
index f13a7c5a68..5014dea603 100644
--- a/ext/tk/lib/tk/menu.rb
+++ b/ext/tk/lib/tk/menu.rb
@@ -84,13 +84,13 @@ class TkMenu<TkWindow
end
def insert(index, type, keys=nil)
tk_send_without_enc('insert', _get_eval_enc_str(index),
- type, *hash_kv(keys, true))
+ type, *hash_kv(keys, true))
self
end
def delete(first, last=nil)
if last
tk_send_without_enc('delete', _get_eval_enc_str(first),
- _get_eval_enc_str(last))
+ _get_eval_enc_str(last))
else
tk_send_without_enc('delete', _get_eval_enc_str(first))
end
@@ -99,7 +99,7 @@ class TkMenu<TkWindow
def popup(x, y, index=nil)
if index
tk_call_without_enc('tk_popup', path, x, y,
- _get_eval_enc_str(index))
+ _get_eval_enc_str(index))
else
tk_call_without_enc('tk_popup', path, x, y)
end
@@ -140,18 +140,18 @@ class TkMenu<TkWindow
case key.to_s
when 'text', 'label', 'show'
_fromUTF8(tk_send_without_enc('entrycget',
- _get_eval_enc_str(index), "-#{key}"))
+ _get_eval_enc_str(index), "-#{key}"))
when 'font', 'kanjifont'
#fnt = tk_tcl2ruby(tk_send('entrycget', index, "-#{key}"))
fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('entrycget', _get_eval_enc_str(index), '-font')))
unless fnt.kind_of?(TkFont)
- fnt = tagfontobj(index, fnt)
+ fnt = tagfontobj(index, fnt)
end
if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
- # obsolete; just for compatibility
- fnt.kanji_font
+ # obsolete; just for compatibility
+ fnt.kanji_font
else
- fnt
+ fnt
end
else
tk_tcl2ruby(_fromUTF8(tk_send_without_enc('entrycget', _get_eval_enc_str(index), "-#{key}")))
@@ -161,26 +161,26 @@ class TkMenu<TkWindow
if key.kind_of? Hash
if (key['font'] || key[:font] ||
key['kanjifont'] || key[:kanjifont] ||
- key['latinfont'] || key[:latinfont] ||
+ key['latinfont'] || key[:latinfont] ||
key['asciifont'] || key[:asciifont])
- tagfont_configure(index, _symbolkey2str(key))
+ tagfont_configure(index, _symbolkey2str(key))
else
- tk_send_without_enc('entryconfigure', _get_eval_enc_str(index),
- *hash_kv(key, true))
+ tk_send_without_enc('entryconfigure', _get_eval_enc_str(index),
+ *hash_kv(key, true))
end
else
if (key == 'font' || key == :font ||
key == 'kanjifont' || key == :kanjifont ||
- key == 'latinfont' || key == :latinfont ||
+ key == 'latinfont' || key == :latinfont ||
key == 'asciifont' || key == :asciifont )
- if val == None
- tagfontobj(index)
- else
- tagfont_configure(index, {key=>val})
- end
+ if val == None
+ tagfontobj(index)
+ else
+ tagfont_configure(index, {key=>val})
+ end
else
- tk_call('entryconfigure', index, "-#{key}", val)
+ tk_call('entryconfigure', index, "-#{key}", val)
end
end
self
@@ -189,100 +189,100 @@ class TkMenu<TkWindow
def entryconfiginfo(index, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- case key.to_s
- when 'text', 'label', 'show'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
- when 'font', 'kanjifont'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
- conf[4] = tagfont_configinfo(index, conf[4])
- else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
- end
- conf[0] = conf[0][1..-1]
- conf
+ case key.to_s
+ when 'text', 'label', 'show'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ conf[4] = tagfont_configinfo(index, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
else
- ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure', _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'
- 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
- }
- if fontconf
- ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
- fontconf[4] = tagfont_configinfo(index, fontconf[4])
- ret.push(fontconf)
- else
- ret
- end
+ ret = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure', _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'
+ 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
+ }
+ if fontconf
+ ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
+ fontconf[4] = tagfont_configinfo(index, fontconf[4])
+ ret.push(fontconf)
+ else
+ ret
+ end
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- case key.to_s
- when 'text', 'label', 'show'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
- when 'font', 'kanjifont'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
- conf[4] = tagfont_configinfo(index, conf[4])
- else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
- end
- key = conf.shift[1..-1]
- { key => conf }
+ case key.to_s
+ when 'text', 'label', 'show'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ conf[4] = tagfont_configinfo(index, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('entryconfigure',_get_eval_enc_str(index),"-#{key}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
else
- ret = {}
- tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure', _get_eval_enc_str(index)))).each{|conflist|
- conf = tk_split_simplelist(conflist)
- key = conf.shift[1..-1]
- case key
- when 'text', 'label', 'show'
- 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
- }
- fontconf = ret['font']
- if fontconf
- ret.delete('font')
- ret.delete('kanjifont')
- fontconf[3] = tagfont_configinfo(index, fontconf[3])
- ret['font'] = fontconf
- end
- ret
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_send_without_enc('entryconfigure', _get_eval_enc_str(index)))).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ case key
+ when 'text', 'label', 'show'
+ 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
+ }
+ fontconf = ret['font']
+ if fontconf
+ ret.delete('font')
+ ret.delete('kanjifont')
+ fontconf[3] = tagfont_configinfo(index, fontconf[3])
+ ret['font'] = fontconf
+ end
+ ret
end
end
end
@@ -290,19 +290,19 @@ class TkMenu<TkWindow
def current_entryconfiginfo(index, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- conf = entryconfiginfo(index, key)
- {conf[0] => conf[4]}
+ conf = entryconfiginfo(index, key)
+ {conf[0] => conf[4]}
else
- ret = {}
- entryconfiginfo(index).each{|conf|
- ret[conf[0]] = conf[4] if conf.size > 2
- }
- ret
+ ret = {}
+ entryconfiginfo(index).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
entryconfiginfo(index, key).each{|k, conf|
- ret[k] = conf[-1] if conf.kind_of?(Array)
+ ret[k] = conf[-1] if conf.kind_of?(Array)
}
ret
end
@@ -422,7 +422,7 @@ class TkOptionMenubutton<TkMenubutton
@variable.value = firstval
install_win(if parent then parent.path end)
@menu = OptionMenu.new(tk_call('tk_optionMenu', @path, @variable.id,
- firstval, *vals))
+ firstval, *vals))
end
def value
@@ -435,7 +435,7 @@ class TkOptionMenubutton<TkMenubutton
end
def add(value)
@menu.add('radiobutton', 'variable'=>@variable,
- 'label'=>value, 'value'=>value)
+ 'label'=>value, 'value'=>value)
self
end
def index(index)
@@ -446,7 +446,7 @@ class TkOptionMenubutton<TkMenubutton
end
def insert(index, value)
@menu.insert(index, 'radiobutton', 'variable'=>@variable,
- 'label'=>value, 'value'=>value)
+ 'label'=>value, 'value'=>value)
self
end
def delete(index, last=None)
diff --git a/ext/tk/lib/tk/menubar.rb b/ext/tk/lib/tk/menubar.rb
index f29c40ff38..392b6fbd4e 100644
--- a/ext/tk/lib/tk/menubar.rb
+++ b/ext/tk/lib/tk/menubar.rb
@@ -18,10 +18,10 @@
# ['Paste', proc{puts('Paste clicked')}, 0]]
# ]
# menubar = TkMenubar.new(nil, menu_spec,
-# 'tearoff'=>false,
-# 'foreground'=>'grey40',
-# 'activeforeground'=>'red',
-# 'font'=>'-adobe-helvetica-bold-r-*--12-*-iso8859-1')
+# 'tearoff'=>false,
+# 'foreground'=>'grey40',
+# 'activeforeground'=>'red',
+# 'font'=>'-adobe-helvetica-bold-r-*--12-*-iso8859-1')
# menubar.pack('side'=>'top', 'fill'=>'x')
#
#
@@ -30,13 +30,13 @@
#
# menubar = TkMenubar.new
# menubar.add_menu([['File', 0],
-# ['Open', proc{puts('Open clicked')}, 0],
-# '---',
-# ['Quit', proc{exit}, 0]])
+# ['Open', proc{puts('Open clicked')}, 0],
+# '---',
+# ['Quit', proc{exit}, 0]])
# menubar.add_menu([['Edit', 0],
-# ['Cut', proc{puts('Cut clicked')}, 2],
-# ['Copy', proc{puts('Copy clicked')}, 0],
-# ['Paste', proc{puts('Paste clicked')}, 0]])
+# ['Cut', proc{puts('Cut clicked')}, 2],
+# ['Copy', proc{puts('Copy clicked')}, 0],
+# ['Paste', proc{puts('Paste clicked')}, 0]])
# menubar.configure('tearoff', false)
# menubar.configure('foreground', 'grey40')
# menubar.configure('activeforeground', 'red')
diff --git a/ext/tk/lib/tk/menuspec.rb b/ext/tk/lib/tk/menuspec.rb
index dfc1871ba9..c8819f8e41 100644
--- a/ext/tk/lib/tk/menuspec.rb
+++ b/ext/tk/lib/tk/menuspec.rb
@@ -36,7 +36,7 @@
module TkMenuSpec
def _create_menu(parent, menu_info, menu_name = nil,
- tearoff = false, default_opts = nil)
+ tearoff = false, default_opts = nil)
if tearoff.kind_of?(Hash)
default_opts = tearoff
tearoff = false
@@ -64,79 +64,79 @@ module TkMenuSpec
for item_info in menu_info
if item_info.kind_of?(Hash)
- options = orig_opts.dup
- options.update(_symbolkey2str(item_info))
- item_type = (options.delete('type') || 'command').to_s
- menu_name = options.delete('menu_name')
- menu_opts = orig_opts.dup
- menu_opts.update(_symbolkey2str(options.delete('menu_config') || {}))
- if item_type == 'cascade' && options['menu'].kind_of?(Array)
- # create cascade menu
- submenu = _create_menu(menu, options['menu'], menu_name,
- tearoff, menu_opts)
- options['menu'] = submenu
- end
- menu.add(item_type, options)
+ options = orig_opts.dup
+ options.update(_symbolkey2str(item_info))
+ item_type = (options.delete('type') || 'command').to_s
+ menu_name = options.delete('menu_name')
+ menu_opts = orig_opts.dup
+ menu_opts.update(_symbolkey2str(options.delete('menu_config') || {}))
+ if item_type == 'cascade' && options['menu'].kind_of?(Array)
+ # create cascade menu
+ submenu = _create_menu(menu, options['menu'], menu_name,
+ tearoff, menu_opts)
+ options['menu'] = submenu
+ end
+ menu.add(item_type, options)
elsif item_info.kind_of?(Array)
- options = orig_opts.dup
-
- options['label'] = item_info[0] if item_info[0]
-
- case item_info[1]
- when TkVariable
- # checkbutton
- item_type = 'checkbutton'
- options['variable'] = item_info[1]
- options['onvalue'] = true
- options['offvalue'] = false
-
- when Array
- # radiobutton or cascade
- if item_info[1][0].kind_of?(TkVariable)
- # radiobutton
- item_type = 'radiobutton'
- options['variable'] = item_info[1][0]
- options['value'] = item_info[1][1] if item_info[1][1]
-
- else
- # cascade
- item_type = 'cascade'
- menu_opts = orig_opts.dup
- if item_info[4] && item_info[4].kind_of?(Hash)
- opts = _symbolkey2str(item_info[4])
- menu_name = opts.delete('menu_name')
- menu_config = opts.delete('menu_config') || {}
- menu_opts.update(_symbolkey2str(menu_config))
- end
- submenu = _create_menu(menu, item_info[1], menu_name,
- tearoff, menu_opts)
- options['menu'] = submenu
- end
-
- else
- # command
- item_type = 'command'
- options['command'] = item_info[1] if item_info[1]
- end
-
- options['underline'] = item_info[2] if item_info[2]
- options['accelerator'] = item_info[3] if item_info[3]
- if item_info[4] && item_info[4].kind_of?(Hash)
- opts = _symbolkey2str(item_info[4])
- if item_type == 'cascade'
- opts.delete('menu_name')
- opts.delete('menu_config')
- end
- options.update(opts)
- end
- menu.add(item_type, options)
+ options = orig_opts.dup
+
+ options['label'] = item_info[0] if item_info[0]
+
+ case item_info[1]
+ when TkVariable
+ # checkbutton
+ item_type = 'checkbutton'
+ options['variable'] = item_info[1]
+ options['onvalue'] = true
+ options['offvalue'] = false
+
+ when Array
+ # radiobutton or cascade
+ if item_info[1][0].kind_of?(TkVariable)
+ # radiobutton
+ item_type = 'radiobutton'
+ options['variable'] = item_info[1][0]
+ options['value'] = item_info[1][1] if item_info[1][1]
+
+ else
+ # cascade
+ item_type = 'cascade'
+ menu_opts = orig_opts.dup
+ if item_info[4] && item_info[4].kind_of?(Hash)
+ opts = _symbolkey2str(item_info[4])
+ menu_name = opts.delete('menu_name')
+ menu_config = opts.delete('menu_config') || {}
+ menu_opts.update(_symbolkey2str(menu_config))
+ end
+ submenu = _create_menu(menu, item_info[1], menu_name,
+ tearoff, menu_opts)
+ options['menu'] = submenu
+ end
+
+ else
+ # command
+ item_type = 'command'
+ options['command'] = item_info[1] if item_info[1]
+ end
+
+ options['underline'] = item_info[2] if item_info[2]
+ options['accelerator'] = item_info[3] if item_info[3]
+ if item_info[4] && item_info[4].kind_of?(Hash)
+ opts = _symbolkey2str(item_info[4])
+ if item_type == 'cascade'
+ opts.delete('menu_name')
+ opts.delete('menu_config')
+ end
+ options.update(opts)
+ end
+ menu.add(item_type, options)
elsif /^-+$/ =~ item_info
- menu.add('separator')
+ menu.add('separator')
else
- menu.add('command', 'label' => item_info)
+ menu.add('command', 'label' => item_info)
end
end
@@ -150,8 +150,8 @@ module TkMenuSpec
return true
else
begin
- parent.cget('menu')
- return true
+ parent.cget('menu')
+ return true
rescue
end
end
@@ -192,22 +192,22 @@ module TkMenuSpec
menu_name = nil
if btn_info.kind_of?(Hash)
- keys.update(_symbolkey2str(btn_info))
- menu_name = keys.delete('menu_name')
- keys['label'] = keys.delete('text') if keys.key?('text')
+ keys.update(_symbolkey2str(btn_info))
+ menu_name = keys.delete('menu_name')
+ keys['label'] = keys.delete('text') if keys.key?('text')
elsif btn_info.kind_of?(Array)
- keys['label'] = btn_info[0] if btn_info[0]
- keys['underline'] = btn_info[1] if btn_info[1]
- if btn_info[2]&&btn_info[2].kind_of?(Hash)
- keys.update(_symbolkey2str(btn_info[2]))
- menu_name = keys.delete('menu_name')
- end
+ keys['label'] = btn_info[0] if btn_info[0]
+ keys['underline'] = btn_info[1] if btn_info[1]
+ if btn_info[2]&&btn_info[2].kind_of?(Hash)
+ keys.update(_symbolkey2str(btn_info[2]))
+ menu_name = keys.delete('menu_name')
+ end
else
- keys = {:label=>btn_info}
+ keys = {:label=>btn_info}
end
menu = _create_menu(mbar, menu_info[1..-1], menu_name,
- tearoff, default_opts)
+ tearoff, default_opts)
menu.tearoff(tearoff)
keys['menu'] = menu
@@ -222,27 +222,27 @@ module TkMenuSpec
menu_name = nil
if btn_info.kind_of?(Hash)
- keys.update(_symbolkey2str(btn_info))
- menu_name = keys.delete('menu_name')
- keys['text'] = keys.delete('label') if keys.key?('label')
- mbtn.configure(keys)
+ keys.update(_symbolkey2str(btn_info))
+ menu_name = keys.delete('menu_name')
+ keys['text'] = keys.delete('label') if keys.key?('label')
+ mbtn.configure(keys)
elsif btn_info.kind_of?(Array)
- mbtn.configure('text', btn_info[0]) if btn_info[0]
- mbtn.configure('underline', btn_info[1]) if btn_info[1]
- # mbtn.configure('accelerator', btn_info[2]) if btn_info[2]
- if btn_info[2]&&btn_info[2].kind_of?(Hash)
- keys.update(_symbolkey2str(btn_info[2]))
- menu_name = keys.delete('menu_name')
- mbtn.configure(keys)
- end
+ mbtn.configure('text', btn_info[0]) if btn_info[0]
+ mbtn.configure('underline', btn_info[1]) if btn_info[1]
+ # mbtn.configure('accelerator', btn_info[2]) if btn_info[2]
+ if btn_info[2]&&btn_info[2].kind_of?(Hash)
+ keys.update(_symbolkey2str(btn_info[2]))
+ menu_name = keys.delete('menu_name')
+ mbtn.configure(keys)
+ end
else
- mbtn.configure('text', btn_info)
+ mbtn.configure('text', btn_info)
end
mbtn.pack('side' => 'left')
menu = _create_menu(mbtn, menu_info[1..-1], menu_name,
- tearoff, default_opts)
+ tearoff, default_opts)
mbtn.menu(menu)
@@ -255,8 +255,8 @@ module TkMenuSpec
menus = []
(0..(menu.index('last'))).each{|idx|
if menu.menutype(idx) == 'cascade'
- submenu = menu.entrycget(idx, 'menu')
- menus << [submenu, _get_cascade_menus(submenu)]
+ submenu = menu.entrycget(idx, 'menu')
+ menus << [submenu, _get_cascade_menus(submenu)]
end
}
menus
diff --git a/ext/tk/lib/tk/msgcat.rb b/ext/tk/lib/tk/msgcat.rb
index e7a5499008..4e095c6fc0 100644
--- a/ext/tk/lib/tk/msgcat.rb
+++ b/ext/tk/lib/tk/msgcat.rb
@@ -46,7 +46,7 @@ class TkMsgCatalog < TkObject
return -code $st $ret
}
} else {
- return $ret
+ return $ret
}
EOL
@@ -64,17 +64,17 @@ class TkMsgCatalog < TkObject
exit!(1)
rescue Exception => e
begin
- msg = _toUTF8(e.class.inspect) + ': ' +
- _toUTF8(e.message) + "\n" +
- "\n---< backtrace of Ruby side >-----\n" +
- _toUTF8(e.backtrace.join("\n")) +
- "\n---< backtrace of Tk side >-------"
- msg.instance_variable_set(:@encoding, 'utf-8')
+ msg = _toUTF8(e.class.inspect) + ': ' +
+ _toUTF8(e.message) + "\n" +
+ "\n---< backtrace of Ruby side >-----\n" +
+ _toUTF8(e.backtrace.join("\n")) +
+ "\n---< backtrace of Tk side >-------"
+ msg.instance_variable_set(:@encoding, 'utf-8')
rescue Exception
- msg = e.class.inspect + ': ' + e.message + "\n" +
- "\n---< backtrace of Ruby side >-----\n" +
- e.backtrace.join("\n") +
- "\n---< backtrace of Tk side >-------"
+ msg = e.class.inspect + ': ' + e.message + "\n" +
+ "\n---< backtrace of Ruby side >-----\n" +
+ e.backtrace.join("\n") +
+ "\n---< backtrace of Tk side >-------"
end
fail(e, msg)
end
@@ -103,22 +103,22 @@ class TkMsgCatalog < TkObject
when 1 # src only, or trans_list
if args[0].kind_of?(Array)
- # trans_list
- #list = args[0].collect{|src, trans|
- # [ Tk::UTF8_String.new(src), Tk::UTF8_String.new(trans) ]
- #}
- self.set_translation_list(loc, args[0])
+ # trans_list
+ #list = args[0].collect{|src, trans|
+ # [ Tk::UTF8_String.new(src), Tk::UTF8_String.new(trans) ]
+ #}
+ self.set_translation_list(loc, args[0])
else
- # src
- #self.set_translation(loc, Tk::UTF8_String.new(args[0]))
- self.set_translation(loc, args[0])
+ # src
+ #self.set_translation(loc, Tk::UTF8_String.new(args[0]))
+ self.set_translation(loc, args[0])
end
when 2 # src and trans, or, trans_list and enc
if args[0].kind_of?(Array)
else
- #self.set_translation(loc, args[0], Tk::UTF8_String.new(args[1]))
- self.set_translation(loc, *args)
+ #self.set_translation(loc, args[0], Tk::UTF8_String.new(args[1]))
+ self.set_translation(loc, *args)
end
when 3 # src and trans and enc
@@ -144,7 +144,7 @@ class TkMsgCatalog < TkObject
def translate(*args)
dst = args.collect{|src|
@namespace.eval{tk_call_without_enc('::msgcat::mc',
- _get_eval_string(src, true))}
+ _get_eval_string(src, true))}
}
Tk.UTF8_String(sprintf(*dst))
end
@@ -188,8 +188,8 @@ class TkMsgCatalog < TkObject
preferences().each{|loc|
file = File.join(dir, loc + self::MSGCAT_EXT)
if File.readable?(file)
- count += 1
- eval(open(file){|f| f.read})
+ count += 1
+ eval(open(file){|f| f.read})
end
}
count
@@ -204,8 +204,8 @@ class TkMsgCatalog < TkObject
preferences().each{|loc|
file = File.join(dir, loc + @msgcat_ext)
if File.readable?(file)
- count += 1
- @namespace.eval(open(file){|f| f.read})
+ count += 1
+ @namespace.eval(open(file){|f| f.read})
end
}
count
@@ -220,29 +220,29 @@ class TkMsgCatalog < TkObject
if trans_str && trans_str != None
trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc))
Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true),
- trans_str))
+ locale,
+ _get_eval_string(src_str, true),
+ trans_str))
else
Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true)))
+ locale,
+ _get_eval_string(src_str, true)))
end
end
def set_translation(locale, src_str, trans_str=None, enc='utf-8')
if trans_str && trans_str != None
trans_str = Tk.UTF8_String(_toUTF8(trans_str, enc))
Tk.UTF8_String(@namespace.eval{
- tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true),
- trans_str)
- })
+ tk_call_without_enc('::msgcat::mcset',
+ locale,
+ _get_eval_string(src_str, true),
+ trans_str)
+ })
else
Tk.UTF8_String(@namespace.eval{
- tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true))})
+ tk_call_without_enc('::msgcat::mcset',
+ locale,
+ _get_eval_string(src_str, true))})
end
end
@@ -251,10 +251,10 @@ class TkMsgCatalog < TkObject
list = []
trans_list.each{|src, trans|
if trans && trans != None
- list << _get_eval_string(src, true)
- list << Tk.UTF8_Stirng(_toUTF8(trans, enc))
+ list << _get_eval_string(src, true)
+ list << Tk.UTF8_Stirng(_toUTF8(trans, enc))
else
- list << _get_eval_string(src, true) << ''
+ list << _get_eval_string(src, true) << ''
end
}
number(tk_call_without_enc('::msgcat::mcmset', locale, list))
@@ -264,15 +264,15 @@ class TkMsgCatalog < TkObject
list = []
trans_list.each{|src, trans|
if trans && trans != None
- list << _get_eval_string(src, true)
- list << Tk.UTF8_String(_toUTF8(trans, enc))
+ list << _get_eval_string(src, true)
+ list << Tk.UTF8_String(_toUTF8(trans, enc))
else
- list << _get_eval_string(src, true) << ''
+ list << _get_eval_string(src, true) << ''
end
}
number(@namespace.eval{
- tk_call_without_enc('::msgcat::mcmset', locale, list)
- })
+ tk_call_without_enc('::msgcat::mcmset', locale, list)
+ })
end
def self.def_unknown_proc(cmd=Proc.new)
diff --git a/ext/tk/lib/tk/namespace.rb b/ext/tk/lib/tk/namespace.rb
index 912ed1b5d3..a236fb6a99 100644
--- a/ext/tk/lib/tk/namespace.rb
+++ b/ext/tk/lib/tk/namespace.rb
@@ -24,19 +24,19 @@ class TkNamespace < TkObject
#super('namespace', 'eval', @namespace, *args)
args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @namespace,
- TkCore::INTERP._merge_tklist(*args))
+ TkCore::INTERP._merge_tklist(*args))
end
def tk_call_without_enc(*args)
#super('namespace', 'eval', @namespace, *args)
args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @namespace,
- TkCore::INTERP._merge_tklist(*args))
+ TkCore::INTERP._merge_tklist(*args))
end
def tk_call_with_enc(*args)
#super('namespace', 'eval', @namespace, *args)
args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @namespace,
- TkCore::INTERP._merge_tklist(*args))
+ TkCore::INTERP._merge_tklist(*args))
end
def initialize(namespace, *args)
@@ -68,19 +68,19 @@ class TkNamespace < TkObject
#super('namespace', 'eval', @fullname, *args)
args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @fullname,
- TkCore::INTERP._merge_tklist(*args))
+ TkCore::INTERP._merge_tklist(*args))
end
def tk_call_without_enc(*args)
#super('namespace', 'eval', @fullname, *args)
args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @fullname,
- TkCore::INTERP._merge_tklist(*args))
+ TkCore::INTERP._merge_tklist(*args))
end
def tk_call_with_enc(*args)
#super('namespace', 'eval', @fullname, *args)
args = args.collect{|arg| (s = _get_eval_string(arg))? s: ''}
super('namespace', 'eval', @fullname,
- TkCore::INTERP._merge_tklist(*args))
+ TkCore::INTERP._merge_tklist(*args))
end
alias ns_tk_call tk_call
alias ns_tk_call_without_enc tk_call_without_enc
@@ -95,27 +95,27 @@ class TkNamespace < TkObject
name = __tk_call('namespace', 'current') if name == ''
if parent
if parent =~ /^::/
- if name =~ /^::/
- @fullname = parent + name
- else
- @fullname = parent +'::'+ name
- end
+ if name =~ /^::/
+ @fullname = parent + name
+ else
+ @fullname = parent +'::'+ name
+ end
else
- ancestor = __tk_call('namespace', 'current')
- ancestor = '' if ancestor == '::'
- if name =~ /^::/
- @fullname = ancestor + '::' + parent + name
- else
- @fullname = ancestor + '::'+ parent +'::'+ name
- end
+ ancestor = __tk_call('namespace', 'current')
+ ancestor = '' if ancestor == '::'
+ if name =~ /^::/
+ @fullname = ancestor + '::' + parent + name
+ else
+ @fullname = ancestor + '::'+ parent +'::'+ name
+ end
end
else # parent == nil
ancestor = __tk_call('namespace', 'current')
ancestor = '' if ancestor == '::'
if name =~ /^::/
- @fullname = name
+ @fullname = name
else
- @fullname = ancestor + '::' + name
+ @fullname = ancestor + '::' + name
end
end
@path = @fullname
@@ -134,9 +134,9 @@ class TkNamespace < TkObject
tk_split_simplelist(tk_call('namespace', 'children', *args)).collect{|ns|
# ns is fullname
if Tk_Namespace_ID_TBL.key?(ns)
- Tk_Namespace_ID_TBL[ns]
+ Tk_Namespace_ID_TBL[ns]
else
- ns
+ ns
end
}
end
@@ -156,7 +156,7 @@ class TkNamespace < TkObject
fail ArgumentError, "String or Proc is expected"
end
TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code',
- _get_eval_string(cmd, false)))
+ _get_eval_string(cmd, false)))
end
def self.current
diff --git a/ext/tk/lib/tk/optiondb.rb b/ext/tk/lib/tk/optiondb.rb
index d940f38769..1484671920 100644
--- a/ext/tk/lib/tk/optiondb.rb
+++ b/ext/tk/lib/tk/optiondb.rb
@@ -41,7 +41,7 @@ module TkOptionDB
def read_entries(file, f_enc=nil)
if TkCore::INTERP.safe?
fail SecurityError,
- "can't call 'TkOptionDB.read_entries' on a safe interpreter"
+ "can't call 'TkOptionDB.read_entries' on a safe interpreter"
end
i_enc = Tk.encoding()
@@ -54,29 +54,29 @@ module TkOptionDB
cline = ''
open(file, 'r') {|f|
while line = f.gets
- #cline += line.chomp!
- cline.concat(line.chomp!)
- case cline
- when /\\$/ # continue
- cline.chop!
- next
- when /^\s*(!|#)/ # coment
- cline = ''
- next
- when /^([^:]+):(.*)$/
- pat = $1.strip
- val = $2.lstrip
- p "ResourceDB: #{[pat, val].inspect}" if $DEBUG
- pat = TkCore::INTERP._toUTF8(pat, f_enc)
- pat = TkCore::INTERP._fromUTF8(pat, i_enc)
- val = TkCore::INTERP._toUTF8(val, f_enc)
- val = TkCore::INTERP._fromUTF8(val, i_enc)
- ent << [pat, val]
- cline = ''
- else # unknown --> ignore
- cline = ''
- next
- end
+ #cline += line.chomp!
+ cline.concat(line.chomp!)
+ case cline
+ when /\\$/ # continue
+ cline.chop!
+ next
+ when /^\s*(!|#)/ # coment
+ cline = ''
+ next
+ when /^([^:]+):(.*)$/
+ pat = $1.strip
+ val = $2.lstrip
+ p "ResourceDB: #{[pat, val].inspect}" if $DEBUG
+ pat = TkCore::INTERP._toUTF8(pat, f_enc)
+ pat = TkCore::INTERP._fromUTF8(pat, i_enc)
+ val = TkCore::INTERP._toUTF8(val, f_enc)
+ val = TkCore::INTERP._fromUTF8(val, i_enc)
+ ent << [pat, val]
+ cline = ''
+ else # unknown --> ignore
+ cline = ''
+ next
+ end
end
}
ent
@@ -99,28 +99,28 @@ module TkOptionDB
cline = ''
open(file, 'r') {|f|
while line = f.gets
- cline += line.chomp!
- case cline
- when /\\$/ # continue
- cline.chop!
- next
- when /^\s*!/ # coment
- cline = ''
- next
- when /^([^:]+):\s(.*)$/
- pat = $1
- val = $2
- p "ResourceDB: #{[pat, val].inspect}" if $DEBUG
- pat = TkCore::INTERP._toUTF8(pat, f_enc)
- pat = TkCore::INTERP._fromUTF8(pat, i_enc)
- val = TkCore::INTERP._toUTF8(val, f_enc)
- val = TkCore::INTERP._fromUTF8(val, i_enc)
- add(pat, val, pri)
- cline = ''
- else # unknown --> ignore
- cline = ''
- next
- end
+ cline += line.chomp!
+ case cline
+ when /\\$/ # continue
+ cline.chop!
+ next
+ when /^\s*!/ # coment
+ cline = ''
+ next
+ when /^([^:]+):\s(.*)$/
+ pat = $1
+ val = $2
+ p "ResourceDB: #{[pat, val].inspect}" if $DEBUG
+ pat = TkCore::INTERP._toUTF8(pat, f_enc)
+ pat = TkCore::INTERP._fromUTF8(pat, i_enc)
+ val = TkCore::INTERP._toUTF8(val, f_enc)
+ val = TkCore::INTERP._fromUTF8(val, i_enc)
+ add(pat, val, pri)
+ cline = ''
+ else # unknown --> ignore
+ cline = ''
+ next
+ end
end
}
=end
@@ -133,7 +133,7 @@ module TkOptionDB
@@resource_proc_class.const_set(:CARRIER, '.'.freeze)
@@resource_proc_class.instance_variable_set('@method_tbl',
- TkCore::INTERP.create_table)
+ TkCore::INTERP.create_table)
@@resource_proc_class.instance_variable_set('@add_method', false)
@@resource_proc_class.instance_variable_set('@safe_mode', 4)
@@ -151,14 +151,14 @@ module TkOptionDB
def __closed_block_check__(str)
depth = 0
str.scan(/[{}]/){|x|
- if x == "{"
- depth += 1
- elsif x == "}"
- depth -= 1
- end
- if depth <= 0 && !($' =~ /\A\s*\Z/)
- fail RuntimeError, "bad string for procedure : #{str.inspect}"
- end
+ if x == "{"
+ depth += 1
+ elsif x == "}"
+ depth -= 1
+ end
+ if depth <= 0 && !($' =~ /\A\s*\Z/)
+ fail RuntimeError, "bad string for procedure : #{str.inspect}"
+ end
}
str
end
@@ -184,20 +184,20 @@ module TkOptionDB
raise NoMethodError,
"not support resource-proc '#{id.id2name}' for #{self.name}"
end
- proc_str = proc_source
+ proc_str = proc_source
proc_str = '{' + proc_str + '}' unless /\A\{.*\}\Z/ =~ proc_str
- #proc_str = __closed_block_check__(proc_str)
+ #proc_str = __closed_block_check__(proc_str)
proc_str = __check_proc_string__(proc_str)
res_proc = proc{
- begin
- #eval("$SAFE = #{self::SAFE_MODE};\nProc.new" + proc_str)
- eval("$SAFE = #{@safe_mode};\nProc.new" + proc_str)
- rescue SyntaxError=>err
- raise SyntaxError,
- TkCore::INTERP._toUTF8(err.message.gsub(/\(eval\):\d:/,
- "(#{id.id2name}):"))
- end
- }.call
+ begin
+ #eval("$SAFE = #{self::SAFE_MODE};\nProc.new" + proc_str)
+ eval("$SAFE = #{@safe_mode};\nProc.new" + proc_str)
+ rescue SyntaxError=>err
+ raise SyntaxError,
+ TkCore::INTERP._toUTF8(err.message.gsub(/\(eval\):\d:/,
+ "(#{id.id2name}):"))
+ end
+ }.call
#self::METHOD_TBL[id] = [res_proc, proc_source]
@method_tbl[id] = [res_proc, proc_source]
end
@@ -255,16 +255,16 @@ module TkOptionDB
else
klass = klass.to_s if klass.kind_of? Symbol
unless (?A..?Z) === klass[0]
- fail ArgumentError, "bad string '#{klass}' for class name"
+ fail ArgumentError, "bad string '#{klass}' for class name"
end
if parent == nil
- install_win(nil)
+ install_win(nil)
elsif parent.kind_of?(TkWindow)
- install_win(parent.path)
+ install_win(parent.path)
elsif parent <= @@resource_proc_class
- install_win(parent::CARRIER)
+ install_win(parent::CARRIER)
else
- fail ArgumentError, "parent must be Resource-Proc class"
+ fail ArgumentError, "parent must be Resource-Proc class"
end
carrier = Tk.tk_call_without_enc('frame', @path, '-class', klass)
end
@@ -304,16 +304,16 @@ module TkOptionDB
class << klass
def __null_method(*args); nil; end
[ :class_eval, :name, :superclass, :clone, :dup, :autoload, :autoload?,
- :ancestors, :const_defined?, :const_get, :const_set, :const_missing,
- :class_variables, :constants, :included_modules, :instance_methods,
- :method_defined?, :module_eval, :private_instance_methods,
- :protected_instance_methods, :public_instance_methods,
- :singleton_methods, :remove_const, :remove_method, :undef_method,
- :to_s, :inspect, :display, :method, :methods, :respond_to?,
+ :ancestors, :const_defined?, :const_get, :const_set, :const_missing,
+ :class_variables, :constants, :included_modules, :instance_methods,
+ :method_defined?, :module_eval, :private_instance_methods,
+ :protected_instance_methods, :public_instance_methods,
+ :singleton_methods, :remove_const, :remove_method, :undef_method,
+ :to_s, :inspect, :display, :method, :methods, :respond_to?,
:instance_variable_get, :instance_variable_set, :instance_method,
- :instance_eval, :instance_variables, :kind_of?, :is_a?,
- :private_methods, :protected_methods, :public_methods ].each{|m|
- alias_method(m, :__null_method)
+ :instance_eval, :instance_variables, :kind_of?, :is_a?,
+ :private_methods, :protected_methods, :public_methods ].each{|m|
+ alias_method(m, :__null_method)
}
end
end
@@ -351,7 +351,7 @@ module TkOptionDB
def eval_under_random_base(parent = nil, &b)
new_klass = __create_new_class(__get_random_basename(),
- [], 4, false, parent)
+ [], 4, false, parent)
ret = new_klass.class_eval(&b) if block_given?
__remove_methods_of_proc_class(new_klass)
new_klass.freeze
diff --git a/ext/tk/lib/tk/optionobj.rb b/ext/tk/lib/tk/optionobj.rb
index 2c8a1efd5e..8fe7e0ee5a 100644
--- a/ext/tk/lib/tk/optionobj.rb
+++ b/ext/tk/lib/tk/optionobj.rb
@@ -25,32 +25,32 @@ module Tk
def observs
@observ.collect{|win|
- if win.kind_of?(Array)
- win[0]
- else
- win
- end
+ if win.kind_of?(Array)
+ win[0]
+ else
+ win
+ end
}
end
def _remove_win(win)
if win.kind_of?(Array)
- widget, method = win
- @observ.delete_if{|x|
- if x.kind_of?(Array)
- x[0] == widget
- else
- x == widget
- end
- }
+ widget, method = win
+ @observ.delete_if{|x|
+ if x.kind_of?(Array)
+ x[0] == widget
+ else
+ x == widget
+ end
+ }
else
- @observ.delete_if{|x|
- if x.kind_of?(Array)
- x[0] == win
- else
- x == win
- end
- }
+ @observ.delete_if{|x|
+ if x.kind_of?(Array)
+ x[0] == win
+ else
+ x == win
+ end
+ }
end
end
private :_remove_win
@@ -81,27 +81,27 @@ module Tk
# #==> set all of them
#
wins.each{|win|
- _remove_win(win)
- @observ << win
- notify(win)
+ _remove_win(win)
+ @observ << win
+ notify(win)
}
self
end
def unassign(*wins)
wins.each{|win|
- _remove_win(win)
+ _remove_win(win)
}
self
end
def notify(target = nil)
if target
- targets = [target]
+ targets = [target]
elsif @observ.empty?
- return self
+ return self
else
- targets = @observ.dup
+ targets = @observ.dup
end
return self if empty?
@@ -109,50 +109,50 @@ module Tk
org_hash = _symbolkey2str(self)
targets.each{|win|
- widget = receiver = win
- hash = org_hash
- begin
- if win.kind_of?(Array)
- widget, method, conv_tbl = win
- receiver = widget
-
- if conv_tbl
- hash = {}
- org_hash.each{|key, val|
- key = conv_tbl[key] if conv_tbl.key?(key)
- next unless key
- if key.kind_of?(Array)
- key.each{|k| hash[k] = val}
- else
- hash[key] = val
- end
- }
- end
-
- if method.kind_of?(Array)
- receiver, method, *args = method
- receiver.__send__(method, *(args << hash))
- elsif method
- widget.__send__(method, hash)
- else
- widget.configure(hash)
- end
-
- else
- widget.configure(self)
- end
- rescue => e
- if ( ( widget.kind_of?(TkObject) \
- && widget.respond_to?('exist?') \
- && ! receiver.exist? ) \
- || ( receiver.kind_of?(TkObject) \
- && receiver.respond_to?('exist?') \
- && ! receiver.exist? ) )
- @observ.delete(win)
- else
- fail e
- end
- end
+ widget = receiver = win
+ hash = org_hash
+ begin
+ if win.kind_of?(Array)
+ widget, method, conv_tbl = win
+ receiver = widget
+
+ if conv_tbl
+ hash = {}
+ org_hash.each{|key, val|
+ key = conv_tbl[key] if conv_tbl.key?(key)
+ next unless key
+ if key.kind_of?(Array)
+ key.each{|k| hash[k] = val}
+ else
+ hash[key] = val
+ end
+ }
+ end
+
+ if method.kind_of?(Array)
+ receiver, method, *args = method
+ receiver.__send__(method, *(args << hash))
+ elsif method
+ widget.__send__(method, hash)
+ else
+ widget.configure(hash)
+ end
+
+ else
+ widget.configure(self)
+ end
+ rescue => e
+ if ( ( widget.kind_of?(TkObject) \
+ && widget.respond_to?('exist?') \
+ && ! receiver.exist? ) \
+ || ( receiver.kind_of?(TkObject) \
+ && receiver.respond_to?('exist?') \
+ && ! receiver.exist? ) )
+ @observ.delete(win)
+ else
+ fail e
+ end
+ end
}
self
@@ -161,7 +161,7 @@ module Tk
def +(hash)
unless hash.kind_of?(Hash)
- fail ArgumentError, "expect a Hash"
+ fail ArgumentError, "expect a Hash"
end
new_obj = self.dup
new_obj.update_without_notify(_symbolkey2str(hash))
@@ -177,9 +177,9 @@ module Tk
def configure(key, value=nil)
if key.kind_of?(Hash)
- update(key)
+ update(key)
else
- store(key,value)
+ store(key,value)
end
end
diff --git a/ext/tk/lib/tk/package.rb b/ext/tk/lib/tk/package.rb
index dbb0ca33e8..d1eb27674d 100644
--- a/ext/tk/lib/tk/package.rb
+++ b/ext/tk/lib/tk/package.rb
@@ -35,12 +35,12 @@ module TkPackage
# set proc
cmd = arg[0]
if cmd
- tk_call('package', 'ifneeded', pkg, ver, cmd)
- cmd
+ tk_call('package', 'ifneeded', pkg, ver, cmd)
+ cmd
else
- # remove proc
- tk_call('package', 'ifneeded', pkg, ver, '')
- nil
+ # remove proc
+ tk_call('package', 'ifneeded', pkg, ver, '')
+ nil
end
else
@@ -112,12 +112,12 @@ module TkPackage
# set proc
cmd = arg[0]
if cmd
- tk_call('package', 'unknown', cmd)
- cmd
+ tk_call('package', 'unknown', cmd)
+ cmd
else
- # remove proc
- tk_call('package', 'unknown', '')
- nil
+ # remove proc
+ tk_call('package', 'unknown', '')
+ nil
end
else
diff --git a/ext/tk/lib/tk/palette.rb b/ext/tk/lib/tk/palette.rb
index abcafcfb3a..dfe46940f3 100644
--- a/ext/tk/lib/tk/palette.rb
+++ b/ext/tk/lib/tk/palette.rb
@@ -37,11 +37,11 @@ module TkPalette
colors.each{|key, value|
begin
- if window.cget(key) == tk_call('set', "tkPalette(#{key})")
- window[key] = colors[key]
- end
+ if window.cget(key) == tk_call('set', "tkPalette(#{key})")
+ window[key] = colors[key]
+ end
rescue
- # ignore
+ # ignore
end
}
diff --git a/ext/tk/lib/tk/panedwindow.rb b/ext/tk/lib/tk/panedwindow.rb
index 1e0430b606..37be77508f 100644
--- a/ext/tk/lib/tk/panedwindow.rb
+++ b/ext/tk/lib/tk/panedwindow.rb
@@ -88,9 +88,9 @@ class TkPanedWindow<TkWindow
if key.kind_of? Hash
params = []
key.each{|k, v|
- params.push("-#{k}")
- # params.push((v.kind_of?(TkObject))? v.epath: v)
- params.push(_epath(v))
+ params.push("-#{k}")
+ # params.push((v.kind_of?(TkObject))? v.epath: v)
+ params.push(_epath(v))
}
tk_send_without_enc('paneconfigure', win, *params)
else
@@ -107,68 +107,68 @@ class TkPanedWindow<TkWindow
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
if key
- conf = tk_split_list(tk_send_without_enc('paneconfigure',
- win, "-#{key}"))
- conf[0] = conf[0][1..-1]
- conf
+ conf = tk_split_list(tk_send_without_enc('paneconfigure',
+ win, "-#{key}"))
+ conf[0] = conf[0][1..-1]
+ conf
else
- tk_split_simplelist(tk_send_without_enc('paneconfigure',
- win)).collect{|conflist|
- conf = tk_split_simplelist(conflist)
- conf[0] = conf[0][1..-1]
- 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
- conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
- conf
- }
+ tk_split_simplelist(tk_send_without_enc('paneconfigure',
+ win)).collect{|conflist|
+ conf = tk_split_simplelist(conflist)
+ conf[0] = conf[0][1..-1]
+ 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
+ conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
+ conf
+ }
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
if key
- conf = tk_split_list(tk_send_without_enc('paneconfigure',
- win, "-#{key}"))
- key = conf.shift[1..-1]
- { key => conf }
+ conf = tk_split_list(tk_send_without_enc('paneconfigure',
+ win, "-#{key}"))
+ key = conf.shift[1..-1]
+ { key => conf }
else
- ret = {}
- tk_split_simplelist(tk_send_without_enc('paneconfigure',
- win)).each{|conflist|
- conf = tk_split_simplelist(conflist)
- key = conf.shift[1..-1]
- if key
- 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
- if conf.size == 1
- ret[key] = conf[0][1..-1] # alias info
- else
- ret[key] = conf
- end
- }
- ret
+ ret = {}
+ tk_split_simplelist(tk_send_without_enc('paneconfigure',
+ win)).each{|conflist|
+ conf = tk_split_simplelist(conflist)
+ key = conf.shift[1..-1]
+ if key
+ 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
+ if conf.size == 1
+ ret[key] = conf[0][1..-1] # alias info
+ else
+ ret[key] = conf
+ end
+ }
+ ret
end
end
end
@@ -177,19 +177,19 @@ class TkPanedWindow<TkWindow
def current_paneconfiginfo(win, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- conf = paneconfiginfo(win, key)
- {conf[0] => conf[4]}
+ conf = paneconfiginfo(win, key)
+ {conf[0] => conf[4]}
else
- ret = {}
- paneconfiginfo(win).each{|conf|
- ret[conf[0]] = conf[4] if conf.size > 2
- }
- ret
+ ret = {}
+ paneconfiginfo(win).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
paneconfiginfo(win, key).each{|k, conf|
- ret[k] = conf[-1] if conf.kind_of?(Array)
+ ret[k] = conf[-1] if conf.kind_of?(Array)
}
ret
end
diff --git a/ext/tk/lib/tk/place.rb b/ext/tk/lib/tk/place.rb
index ea70a6bea0..f7ebdfcbd6 100644
--- a/ext/tk/lib/tk/place.rb
+++ b/ext/tk/lib/tk/place.rb
@@ -16,9 +16,9 @@ module TkPlace
if slot.kind_of? Hash
params = []
slot.each{|k, v|
- params.push("-#{k}")
- # params.push((v.kind_of?(TkObject))? v.epath: v)
- params.push(_epath(v))
+ params.push("-#{k}")
+ # params.push((v.kind_of?(TkObject))? v.epath: v)
+ params.push(_epath(v))
}
tk_call_without_enc('place', 'configure', win, *params)
else
@@ -35,24 +35,24 @@ module TkPlace
# win = win.epath if win.kind_of?(TkObject)
win = _epath(win)
if slot
- #conf = tk_split_list(tk_call_without_enc('place', 'configure',
- # win, "-#{slot}") )
- conf = tk_split_simplelist(tk_call_without_enc('place', 'configure',
- win, "-#{slot}") )
- conf[0] = conf[0][1..-1]
- conf[1] = tk_tcl2ruby(conf[1])
- conf[2] = tk_tcl2ruby(conf[1])
- conf[3] = tk_tcl2ruby(conf[1])
- conf[4] = tk_tcl2ruby(conf[1])
- conf
+ #conf = tk_split_list(tk_call_without_enc('place', 'configure',
+ # win, "-#{slot}") )
+ conf = tk_split_simplelist(tk_call_without_enc('place', 'configure',
+ win, "-#{slot}") )
+ conf[0] = conf[0][1..-1]
+ conf[1] = tk_tcl2ruby(conf[1])
+ conf[2] = tk_tcl2ruby(conf[1])
+ conf[3] = tk_tcl2ruby(conf[1])
+ conf[4] = tk_tcl2ruby(conf[1])
+ conf
else
- tk_split_simplelist(tk_call_without_enc('place', 'configure',
- win)).collect{|conflist|
- #conf = list(conflist)
- conf = simplelist(conflist).collect!{|inf| tk_tcl2ruby(inf)}
- conf[0] = conf[0][1..-1]
- conf
- }
+ tk_split_simplelist(tk_call_without_enc('place', 'configure',
+ win)).collect{|conflist|
+ #conf = list(conflist)
+ conf = simplelist(conflist).collect!{|inf| tk_tcl2ruby(inf)}
+ conf[0] = conf[0][1..-1]
+ conf
+ }
end
else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
current_configinfo(win, slot)
@@ -66,17 +66,17 @@ module TkPlace
#conf = tk_split_list(tk_call_without_enc('place', 'configure',
# win, "-#{slot}") )
conf = tk_split_simplelist(tk_call_without_enc('place', 'configure',
- win, "-#{slot}") )
+ win, "-#{slot}") )
# { conf[0][1..-1] => conf[1] }
{ conf[0][1..-1] => tk_tcl2ruby(conf[4]) }
else
ret = {}
#tk_split_list(tk_call_without_enc('place','configure',win)).each{|conf|
tk_split_simplelist(tk_call_without_enc('place', 'configure',
- win)).each{|conf_list|
- #ret[conf[0][1..-1]] = conf[1]
- conf = simplelist(conf_list)
- ret[conf[0][1..-1]] = tk_tcl2ruby(conf[4])
+ win)).each{|conf_list|
+ #ret[conf[0][1..-1]] = conf[1]
+ conf = simplelist(conf_list)
+ ret[conf[0][1..-1]] = tk_tcl2ruby(conf[4])
}
ret
end
diff --git a/ext/tk/lib/tk/root.rb b/ext/tk/lib/tk/root.rb
index 6e16fb1989..24a5cf1ea0 100644
--- a/ext/tk/lib/tk/root.rb
+++ b/ext/tk/lib/tk/root.rb
@@ -19,11 +19,11 @@ class TkRoot<TkWindow
new = super(:without_creating=>true, :widgetname=>'.')
if keys # wm commands
keys.each{|k,v|
- if v.kind_of? Array
- new.send(k,*v)
- else
- new.send(k,v)
- end
+ if v.kind_of? Array
+ new.send(k,*v)
+ else
+ new.send(k,v)
+ end
}
end
ROOT[0] = new
@@ -33,16 +33,16 @@ class TkRoot<TkWindow
def TkRoot.new(keys=nil, &b)
unless TkCore::INTERP.tk_windows['.']
TkCore::INTERP.tk_windows['.'] =
- super(:without_creating=>true, :widgetname=>'.'){}
+ super(:without_creating=>true, :widgetname=>'.'){}
end
root = TkCore::INTERP.tk_windows['.']
if keys # wm commands
keys.each{|k,v|
- if v.kind_of? Array
- root.__send__(k,*v)
- else
- root.__send__(k,v)
- end
+ if v.kind_of? Array
+ root.__send__(k,*v)
+ else
+ root.__send__(k,v)
+ end
}
end
root.instance_eval(&b) if block_given?
diff --git a/ext/tk/lib/tk/scale.rb b/ext/tk/lib/tk/scale.rb
index 135a0cf62d..7214c46f5e 100644
--- a/ext/tk/lib/tk/scale.rb
+++ b/ext/tk/lib/tk/scale.rb
@@ -11,12 +11,12 @@ class TkScale<TkWindow
def create_self(keys)
if keys and keys != None
if keys.key?('command') && ! keys['command'].kind_of?(String)
- cmd = keys.delete('command')
- keys['command'] = proc{|val| cmd.call(val.to_f)}
+ cmd = keys.delete('command')
+ keys['command'] = proc{|val| cmd.call(val.to_f)}
end
#tk_call_without_enc('scale', @path, *hash_kv(keys, true))
tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
+ *hash_kv(keys, true))
else
#tk_call_without_enc('scale', @path)
tk_call_without_enc(self.class::TkCommandNames[0], @path)
@@ -27,9 +27,9 @@ class TkScale<TkWindow
def _wrap_command_arg(cmd)
proc{|val|
if val.kind_of?(String)
- cmd.call(number(val))
+ cmd.call(number(val))
else
- cmd.call(val)
+ cmd.call(val)
end
}
end
@@ -43,7 +43,7 @@ class TkScale<TkWindow
if (slot == 'command' || slot == :command)
configure('command'=>value)
elsif slot.kind_of?(Hash) &&
- (slot.key?('command') || slot.key?(:command))
+ (slot.key?('command') || slot.key?(:command))
slot = _symbolkey2str(slot)
slot['command'] = _wrap_command_arg(slot.delete('command'))
end
diff --git a/ext/tk/lib/tk/scrollable.rb b/ext/tk/lib/tk/scrollable.rb
index 6e10ef51a2..74816a9228 100644
--- a/ext/tk/lib/tk/scrollable.rb
+++ b/ext/tk/lib/tk/scrollable.rb
@@ -18,10 +18,10 @@ module Tk
def xview(*index)
if index.size == 0
- list(tk_send_without_enc('xview'))
+ list(tk_send_without_enc('xview'))
else
- tk_send_without_enc('xview', *index)
- self
+ tk_send_without_enc('xview', *index)
+ self
end
end
def xview_moveto(*index)
@@ -33,10 +33,10 @@ module Tk
def yview(*index)
if index.size == 0
- list(tk_send_without_enc('yview'))
+ list(tk_send_without_enc('yview'))
else
- tk_send_without_enc('yview', *index)
- self
+ tk_send_without_enc('yview', *index)
+ self
end
end
def yview_moveto(*index)
@@ -48,21 +48,21 @@ module Tk
def xscrollbar(bar=nil)
if bar
- @xscrollbar = bar
- @xscrollbar.orient 'horizontal'
- self.xscrollcommand {|*arg| @xscrollbar.set(*arg)}
- @xscrollbar.command {|*arg| self.xview(*arg)}
- Tk.update # avoid scrollbar trouble
+ @xscrollbar = bar
+ @xscrollbar.orient 'horizontal'
+ self.xscrollcommand {|*arg| @xscrollbar.set(*arg)}
+ @xscrollbar.command {|*arg| self.xview(*arg)}
+ Tk.update # avoid scrollbar trouble
end
@xscrollbar
end
def yscrollbar(bar=nil)
if bar
- @yscrollbar = bar
- @yscrollbar.orient 'vertical'
- self.yscrollcommand {|*arg| @yscrollbar.set(*arg)}
- @yscrollbar.command {|*arg| self.yview(*arg)}
- Tk.update # avoid scrollbar trouble
+ @yscrollbar = bar
+ @yscrollbar.orient 'vertical'
+ self.yscrollcommand {|*arg| @yscrollbar.set(*arg)}
+ @yscrollbar.command {|*arg| self.yview(*arg)}
+ Tk.update # avoid scrollbar trouble
end
@yscrollbar
end
diff --git a/ext/tk/lib/tk/scrollbar.rb b/ext/tk/lib/tk/scrollbar.rb
index c6591a1270..70aadfdd4c 100644
--- a/ext/tk/lib/tk/scrollbar.rb
+++ b/ext/tk/lib/tk/scrollbar.rb
@@ -12,16 +12,16 @@ class TkScrollbar<TkWindow
@assigned = []
@scroll_proc = proc{|*args|
if self.orient == 'horizontal'
- @assigned.each{|w| w.xview(*args)}
+ @assigned.each{|w| w.xview(*args)}
else # 'vertical'
- @assigned.each{|w| w.yview(*args)}
+ @assigned.each{|w| w.yview(*args)}
end
}
if keys and keys != None
#tk_call_without_enc('scrollbar', @path, *hash_kv(keys, true))
tk_call_without_enc(self.class::TkCommandNames[0], @path,
- *hash_kv(keys, true))
+ *hash_kv(keys, true))
else
#tk_call_without_enc('scrollbar', @path)
tk_call_without_enc(self.class::TkCommandNames[0], @path)
@@ -48,9 +48,9 @@ class TkScrollbar<TkWindow
wins.each{|w|
@assigned << w unless @assigned.index(w)
if orient == 'horizontal'
- w.xscrollcommand proc{|first, last| self.propagate_set(w, first, last)}
+ w.xscrollcommand proc{|first, last| self.propagate_set(w, first, last)}
else # 'vertical'
- w.yscrollcommand proc{|first, last| self.propagate_set(w, first, last)}
+ w.yscrollcommand proc{|first, last| self.propagate_set(w, first, last)}
end
}
Tk.update # avoid scrollbar trouble
diff --git a/ext/tk/lib/tk/scrollbox.rb b/ext/tk/lib/tk/scrollbox.rb
index 5f304d377f..fd04057fb6 100644
--- a/ext/tk/lib/tk/scrollbox.rb
+++ b/ext/tk/lib/tk/scrollbox.rb
@@ -1,8 +1,8 @@
#
-# tk/scrollbox.rb - Tk Listbox with Scrollbar
+# tk/scrollbox.rb - Tk Listbox with Scrollbar
# as an example of Composite Widget
-# $Date$
-# by Yukihiro Matsumoto <matz@netlab.co.jp>
+# $Date$
+# by Yukihiro Matsumoto <matz@netlab.co.jp>
#
require 'tk'
require 'tk/listbox'
diff --git a/ext/tk/lib/tk/selection.rb b/ext/tk/lib/tk/selection.rb
index 970c3faa80..5caa6ef8ef 100644
--- a/ext/tk/lib/tk/selection.rb
+++ b/ext/tk/lib/tk/selection.rb
@@ -19,7 +19,7 @@ module TkSelection
def self.clear_on_display(win, sel=nil)
if sel
tk_call_without_enc('selection', 'clear',
- '-displayof', win, '-selection', sel)
+ '-displayof', win, '-selection', sel)
else
tk_call_without_enc('selection', 'clear', '-displayof', win)
end
@@ -36,7 +36,7 @@ module TkSelection
def self.get_on_display(win, keys=nil)
#tk_call('selection', 'get', '-displayof', win, *hash_kv(keys))
_fromUTF8(tk_call_without_enc('selection', 'get', '-displayof',
- win, *hash_kv(keys)))
+ win, *hash_kv(keys)))
end
def get(keys=nil)
TkSelection.get_on_display(self, sel)
@@ -66,7 +66,7 @@ module TkSelection
def self.get_owner_on_display(win, sel=nil)
if sel
window(tk_call_without_enc('selection', 'own',
- '-displayof', win, '-selection', sel))
+ '-displayof', win, '-selection', sel))
else
window(tk_call_without_enc('selection', 'own', '-displayof', win))
end
diff --git a/ext/tk/lib/tk/spinbox.rb b/ext/tk/lib/tk/spinbox.rb
index 06abb5fb3c..f4febb05b1 100644
--- a/ext/tk/lib/tk/spinbox.rb
+++ b/ext/tk/lib/tk/spinbox.rb
@@ -1,7 +1,7 @@
#
-# tk/spinbox.rb - Tk spinbox classes
-# $Date$
-# by Yukihiro Matsumoto <matz@caelum.co.jp>
+# tk/spinbox.rb - Tk spinbox classes
+# $Date$
+# by Yukihiro Matsumoto <matz@caelum.co.jp>
#
require 'tk'
require 'tk/entry'
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index 123f49af03..a0af642376 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -1,7 +1,7 @@
#
-# tk/text.rb - Tk text classes
-# $Date$
-# by Yukihiro Matsumoto <matz@caelum.co.jp>
+# tk/text.rb - Tk text classes
+# $Date$
+# by Yukihiro Matsumoto <matz@caelum.co.jp>
require 'tk'
require 'tk/itemfont'
require 'tk/itemconfig'
@@ -91,7 +91,7 @@ class TkText<TkTextWin
#if keys and keys != None
# #tk_call_without_enc('text', @path, *hash_kv(keys, true))
# tk_call_without_enc(self.class::TkCommandNames[0], @path,
- # *hash_kv(keys, true))
+ # *hash_kv(keys, true))
#else
# #tk_call_without_enc('text', @path)
# tk_call_without_enc(self.class::TkCommandNames[0], @path)
@@ -169,7 +169,7 @@ class TkText<TkTextWin
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))
@@ -178,27 +178,27 @@ class TkText<TkTextWin
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
@@ -206,24 +206,24 @@ class TkText<TkTextWin
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
@@ -231,80 +231,80 @@ class TkText<TkTextWin
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
@@ -312,19 +312,19 @@ class TkText<TkTextWin
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
@@ -351,16 +351,16 @@ class TkText<TkTextWin
# 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
@@ -383,7 +383,7 @@ class TkText<TkTextWin
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 count(idx1, idx2, *opts)
@@ -495,8 +495,8 @@ class TkText<TkTextWin
def tag_add(tag, index1, index2=None)
tk_send_without_enc('tag', 'add', _get_eval_enc_str(tag),
- _get_eval_enc_str(index1),
- _get_eval_enc_str(index2))
+ _get_eval_enc_str(index1),
+ _get_eval_enc_str(index2))
self
end
alias addtag tag_add
@@ -504,14 +504,14 @@ class TkText<TkTextWin
def tag_delete(*tags)
tk_send_without_enc('tag', 'delete',
- *(tags.collect{|tag| _get_eval_enc_str(tag)}))
+ *(tags.collect{|tag| _get_eval_enc_str(tag)}))
if TkTextTag::TTagID_TBL[@path]
tags.each{|tag|
- if tag.kind_of? TkTextTag
- TkTextTag::TTagID_TBL[@path].delete(tag.id)
- else
- TkTextTag::TTagID_TBL[@path].delete(tag)
- end
+ if tag.kind_of? TkTextTag
+ TkTextTag::TTagID_TBL[@path].delete(tag.id)
+ else
+ TkTextTag::TTagID_TBL[@path].delete(tag)
+ end
}
end
self
@@ -543,18 +543,18 @@ class TkText<TkTextWin
case key.to_s
when 'text', 'label', 'show', 'data', 'file'
tk_call_without_enc(@path, 'tag', 'cget',
- _get_eval_enc_str(tag), "-#{key}")
+ _get_eval_enc_str(tag), "-#{key}")
when 'font', 'kanjifont'
#fnt = tk_tcl2ruby(tk_send('tag', 'cget', tag, "-#{key}"))
fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('tag','cget',_get_eval_enc_str(tag),'-font')))
unless fnt.kind_of?(TkFont)
- fnt = tagfontobj(tag, fnt)
+ fnt = tagfontobj(tag, fnt)
end
if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
- # obsolete; just for compatibility
- fnt.kanji_font
+ # obsolete; just for compatibility
+ fnt.kanji_font
else
- fnt
+ fnt
end
else
tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@path,'tag','cget',_get_eval_enc_str(tag),"-#{key}")))
@@ -565,26 +565,26 @@ class TkText<TkTextWin
if key.kind_of? Hash
key = _symbolkey2str(key)
if ( key['font'] || key['kanjifont'] \
- || key['latinfont'] || key['asciifont'] )
- tagfont_configure(tag, key)
+ || key['latinfont'] || key['asciifont'] )
+ tagfont_configure(tag, key)
else
- tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag),
- *hash_kv(key, true))
+ tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag),
+ *hash_kv(key, true))
end
else
if key == 'font' || key == :font ||
key == 'kanjifont' || key == :kanjifont ||
- key == 'latinfont' || key == :latinfont ||
+ key == 'latinfont' || key == :latinfont ||
key == 'asciifont' || key == :asciifont
- if val == None
- tagfontobj(tag)
- else
- tagfont_configure(tag, {key=>val})
- end
+ if val == None
+ tagfontobj(tag)
+ else
+ tagfont_configure(tag, {key=>val})
+ end
else
- tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag),
- "-#{key}", _get_eval_enc_str(val))
+ tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag),
+ "-#{key}", _get_eval_enc_str(val))
end
end
self
@@ -593,101 +593,101 @@ class TkText<TkTextWin
def tag_configinfo(tag, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- case key.to_s
- when 'text', 'label', 'show', 'data', 'file'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
- when 'font', 'kanjifont'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
- conf[4] = tagfont_configinfo(tag, conf[4])
- else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
- end
- conf[0] = conf[0][1..-1]
- conf
+ case key.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ conf[4] = tagfont_configinfo(tag, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
else
- ret = tk_split_simplelist(_fromUTF8(tk_send('tag','configure',_get_eval_enc_str(tag)))).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
- }
- fontconf = ret.assoc('font')
- if fontconf
- ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
- fontconf[4] = tagfont_configinfo(tag, fontconf[4])
- ret.push(fontconf)
- else
- ret
- end
+ ret = tk_split_simplelist(_fromUTF8(tk_send('tag','configure',_get_eval_enc_str(tag)))).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
+ }
+ fontconf = ret.assoc('font')
+ if fontconf
+ ret.delete_if{|item| item[0] == 'font' || item[0] == 'kanjifont'}
+ fontconf[4] = tagfont_configinfo(tag, fontconf[4])
+ ret.push(fontconf)
+ else
+ ret
+ end
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- case key.to_s
- when 'text', 'label', 'show', 'data', 'file'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
- when 'font', 'kanjifont'
- conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
- conf[4] = tagfont_configinfo(tag, conf[4])
- else
- conf = tk_split_list(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
- end
- key = conf.shift[1..-1]
- { key => conf }
+ case key.to_s
+ when 'text', 'label', 'show', 'data', 'file'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ when 'font', 'kanjifont'
+ conf = tk_split_simplelist(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ conf[4] = tagfont_configinfo(tag, conf[4])
+ else
+ conf = tk_split_list(_fromUTF8(tk_send_without_enc('tag','configure',_get_eval_enc_str(tag),"-#{key}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
else
- ret = {}
- tk_split_simplelist(_fromUTF8(tk_send('tag','configure',_get_eval_enc_str(tag)))).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
- }
- fontconf = ret['font']
- if fontconf
- ret.delete('font')
- ret.delete('kanjifont')
- fontconf[3] = tagfont_configinfo(tag, fontconf[3])
- ret['font'] = fontconf
- end
- ret
+ ret = {}
+ tk_split_simplelist(_fromUTF8(tk_send('tag','configure',_get_eval_enc_str(tag)))).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
+ }
+ fontconf = ret['font']
+ if fontconf
+ ret.delete('font')
+ ret.delete('kanjifont')
+ fontconf[3] = tagfont_configinfo(tag, fontconf[3])
+ ret['font'] = fontconf
+ end
+ ret
end
end
end
@@ -695,19 +695,19 @@ class TkText<TkTextWin
def current_tag_configinfo(tag, key=nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if key
- conf = tag_configinfo(tag, key)
- {conf[0] => conf[4]}
+ conf = tag_configinfo(tag, key)
+ {conf[0] => conf[4]}
else
- ret = {}
- tag_configinfo(tag).each{|conf|
- ret[conf[0]] = conf[4] if conf.size > 2
- }
- ret
+ ret = {}
+ tag_configinfo(tag).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
tag_configinfo(tag, key).each{|k, conf|
- ret[k] = conf[-1] if conf.kind_of?(Array)
+ ret[k] = conf[-1] if conf.kind_of?(Array)
}
ret
end
@@ -716,25 +716,25 @@ class TkText<TkTextWin
def tag_raise(tag, above=None)
tk_send_without_enc('tag', 'raise', _get_eval_enc_str(tag),
- _get_eval_enc_str(above))
+ _get_eval_enc_str(above))
self
end
def tag_lower(tag, below=None)
tk_send_without_enc('tag', 'lower', _get_eval_enc_str(tag),
- _get_eval_enc_str(below))
+ _get_eval_enc_str(below))
self
end
def tag_remove(tag, *indices)
tk_send_without_enc('tag', 'remove', _get_eval_enc_str(tag),
- *(indices.collect{|idx| _get_eval_enc_str(idx)}))
+ *(indices.collect{|idx| _get_eval_enc_str(idx)}))
self
end
def tag_ranges(tag)
l = tk_split_simplelist(tk_send_without_enc('tag', 'ranges',
- _get_eval_enc_str(tag)))
+ _get_eval_enc_str(tag)))
r = []
while key=l.shift
r.push [key, l.shift]
@@ -744,16 +744,16 @@ class TkText<TkTextWin
def tag_nextrange(tag, first, last=None)
tk_split_list(tk_send_without_enc('tag', 'nextrange',
- _get_eval_enc_str(tag),
- _get_eval_enc_str(first),
- _get_eval_enc_str(last)))
+ _get_eval_enc_str(tag),
+ _get_eval_enc_str(first),
+ _get_eval_enc_str(last)))
end
def tag_prevrange(tag, first, last=None)
tk_split_list(tk_send_without_enc('tag', 'prevrange',
- _get_eval_enc_str(tag),
- _get_eval_enc_str(first),
- _get_eval_enc_str(last)))
+ _get_eval_enc_str(tag),
+ _get_eval_enc_str(first),
+ _get_eval_enc_str(last)))
end
=begin
@@ -761,18 +761,18 @@ class TkText<TkTextWin
case slot.to_s
when 'text', 'label', 'show', 'data', 'file'
_fromUTF8(tk_send_without_enc('window', 'cget',
- _get_eval_enc_str(index), "-#{slot}"))
+ _get_eval_enc_str(index), "-#{slot}"))
when 'font', 'kanjifont'
#fnt = tk_tcl2ruby(tk_send('window', 'cget', index, "-#{slot}"))
fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('window', 'cget', _get_eval_enc_str(index), '-font')))
unless fnt.kind_of?(TkFont)
- fnt = tagfontobj(index, fnt)
+ fnt = tagfontobj(index, fnt)
end
if slot.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
- # obsolete; just for compatibility
- fnt.kanji_font
+ # obsolete; just for compatibility
+ fnt.kanji_font
else
- fnt
+ fnt
end
else
tk_tcl2ruby(_fromUTF8(tk_send_without_enc('window', 'cget', _get_eval_enc_str(index), "-#{slot}")))
@@ -784,54 +784,54 @@ class TkText<TkTextWin
index.configure(slot, value)
else
if slot.kind_of? Hash
- slot = _symbolkey2str(slot)
- win = slot['window']
- # slot['window'] = win.epath if win.kind_of?(TkWindow)
- slot['window'] = _epath(win) if win
- if slot['create']
- p_create = slot['create']
- if p_create.kind_of? Proc
+ slot = _symbolkey2str(slot)
+ win = slot['window']
+ # slot['window'] = win.epath if win.kind_of?(TkWindow)
+ slot['window'] = _epath(win) if win
+ if slot['create']
+ p_create = slot['create']
+ if p_create.kind_of? Proc
#=begin
- slot['create'] = install_cmd(proc{
- id = p_create.call
- if id.kind_of?(TkWindow)
- id.epath
- else
- id
- end
- })
+ slot['create'] = install_cmd(proc{
+ id = p_create.call
+ if id.kind_of?(TkWindow)
+ id.epath
+ else
+ id
+ end
+ })
#=end
- slot['create'] = install_cmd(proc{_epath(p_create.call)})
- end
- end
- tk_send_without_enc('window', 'configure',
- _get_eval_enc_str(index),
- *hash_kv(slot, true))
+ slot['create'] = install_cmd(proc{_epath(p_create.call)})
+ end
+ end
+ tk_send_without_enc('window', 'configure',
+ _get_eval_enc_str(index),
+ *hash_kv(slot, true))
else
- if slot == 'window' || slot == :window
- # id = value
- # value = id.epath if id.kind_of?(TkWindow)
- value = _epath(value)
- end
- if slot == 'create' || slot == :create
- p_create = value
- if p_create.kind_of? Proc
+ if slot == 'window' || slot == :window
+ # id = value
+ # value = id.epath if id.kind_of?(TkWindow)
+ value = _epath(value)
+ end
+ if slot == 'create' || slot == :create
+ p_create = value
+ if p_create.kind_of? Proc
#=begin
- value = install_cmd(proc{
- id = p_create.call
- if id.kind_of?(TkWindow)
- id.epath
- else
- id
- end
- })
+ value = install_cmd(proc{
+ id = p_create.call
+ if id.kind_of?(TkWindow)
+ id.epath
+ else
+ id
+ end
+ })
#=end
- value = install_cmd(proc{_epath(p_create.call)})
- end
- end
- tk_send_without_enc('window', 'configure',
- _get_eval_enc_str(index),
- "-#{slot}", _get_eval_enc_str(value))
+ value = install_cmd(proc{_epath(p_create.call)})
+ end
+ end
+ tk_send_without_enc('window', 'configure',
+ _get_eval_enc_str(index),
+ "-#{slot}", _get_eval_enc_str(value))
end
end
self
@@ -840,80 +840,80 @@ class TkText<TkTextWin
def window_configinfo(win, 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('window', 'configure', _get_eval_enc_str(win), "-#{slot}")))
- else
- conf = tk_split_list(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win), "-#{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('window', 'configure', _get_eval_enc_str(win), "-#{slot}")))
+ else
+ conf = tk_split_list(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win), "-#{slot}")))
+ end
+ conf[0] = conf[0][1..-1]
+ conf
else
- tk_split_simplelist(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win)))).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('window', 'configure', _get_eval_enc_str(win)))).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('window', 'configure', _get_eval_enc_str(win), "-#{slot}")))
- else
- conf = tk_split_list(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win), "-#{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('window', 'configure', _get_eval_enc_str(win), "-#{slot}")))
+ else
+ conf = tk_split_list(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win), "-#{slot}")))
+ end
+ key = conf.shift[1..-1]
+ { key => conf }
else
- ret = {}
- tk_split_simplelist(_fromUTF8(tk_send('window', 'configure', _get_eval_enc_str(win)))).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('window', 'configure', _get_eval_enc_str(win)))).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
@@ -921,19 +921,19 @@ class TkText<TkTextWin
def current_window_configinfo(win, slot = nil)
if TkComm::GET_CONFIGINFO_AS_ARRAY
if slot
- conf = window_configinfo(win, slot)
- {conf[0] => conf[4]}
+ conf = window_configinfo(win, slot)
+ {conf[0] => conf[4]}
else
- ret = {}
- window_configinfo(win).each{|conf|
- ret[conf[0]] = conf[4] if conf.size > 2
- }
- ret
+ ret = {}
+ window_configinfo(win).each{|conf|
+ ret[conf[0]] = conf[4] if conf.size > 2
+ }
+ ret
end
else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
ret = {}
window_configinfo(win, slot).each{|k, conf|
- ret[k] = conf[-1] if conf.kind_of?(Array)
+ ret[k] = conf[-1] if conf.kind_of?(Array)
}
ret
end
@@ -954,14 +954,14 @@ class TkText<TkTextWin
# $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
@@ -974,9 +974,9 @@ class TkText<TkTextWin
nocase = false
if args[0].kind_of?(Array)
opts = args.shift.collect{|opt|
- s_opt = opt.to_s
- nocase = true if s_opt == 'nocase'
- '-' + s_opt
+ s_opt = opt.to_s
+ nocase = true if s_opt == 'nocase'
+ '-' + s_opt
}
else
opts = []
@@ -985,7 +985,7 @@ class TkText<TkTextWin
if args[0].kind_of?(Regexp)
regexp = args.shift
if !nocase && (regexp.options & Regexp::IGNORECASE) != 0
- opts << '-nocase'
+ opts << '-nocase'
end
args.unshift(regexp.source)
end
@@ -1007,9 +1007,9 @@ class TkText<TkTextWin
nocase = false
if args[0].kind_of?(Array)
opts = args.shift.collect{|opt|
- s_opt = opt.to_s
- nocase = true if s_opt == 'nocase'
- '-' + s_opt
+ s_opt = opt.to_s
+ nocase = true if s_opt == 'nocase'
+ '-' + s_opt
}
else
opts = []
@@ -1020,7 +1020,7 @@ class TkText<TkTextWin
if args[0].kind_of?(Regexp)
regexp = args.shift
if !nocase && (regexp.options & Regexp::IGNORECASE) != 0
- opts << '-nocase'
+ opts << '-nocase'
end
args.unshift(regexp.source)
end
@@ -1041,53 +1041,53 @@ class TkText<TkTextWin
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
@@ -1102,48 +1102,48 @@ class TkText<TkTextWin
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
@@ -1168,56 +1168,56 @@ class TkText<TkTextWin
# retrieve value
case result[-1]
when 'text'
- if str[i] == ?{
- # text formed as {...}
- val, i = _retrieve_braced_text(str, i)
- result.push val
- else
- # text which may contain backslahes
- val, i = _retrieve_backslashed_text(str, i)
- result.push val
- end
+ if str[i] == ?{
+ # text formed as {...}
+ val, i = _retrieve_braced_text(str, i)
+ result.push val
+ else
+ # text which may contain backslahes
+ val, i = _retrieve_backslashed_text(str, i)
+ result.push val
+ end
else
- idx = str.index(/ /, i)
- val = str[i..(idx-1)]
- case result[-1]
- when 'mark'
- case val
- when 'insert'
- result.push TkTextMarkInsert.new(self)
- when 'current'
- result.push TkTextMarkCurrent.new(self)
- when 'anchor'
- result.push TkTextMarkAnchor.new(self)
- else
- result.push tk_tcl2ruby(val)
- end
- when 'tagon'
- if val == 'sel'
- if sel
- result.push sel
- else
- result.push TkTextTagSel.new(self)
- end
- else
- result.push tk_tcl2ruby(val)
- end
- when 'tagoff'
- result.push tk_tcl2ruby(val)
- when 'window'
- result.push tk_tcl2ruby(val)
- end
- i = idx + 1
+ idx = str.index(/ /, i)
+ val = str[i..(idx-1)]
+ case result[-1]
+ when 'mark'
+ case val
+ when 'insert'
+ result.push TkTextMarkInsert.new(self)
+ when 'current'
+ result.push TkTextMarkCurrent.new(self)
+ when 'anchor'
+ result.push TkTextMarkAnchor.new(self)
+ else
+ result.push tk_tcl2ruby(val)
+ end
+ when 'tagon'
+ if val == 'sel'
+ if sel
+ result.push sel
+ else
+ result.push TkTextTagSel.new(self)
+ end
+ else
+ result.push tk_tcl2ruby(val)
+ end
+ when 'tagoff'
+ result.push tk_tcl2ruby(val)
+ when 'window'
+ result.push tk_tcl2ruby(val)
+ end
+ i = idx + 1
end
# retrieve index
idx = str.index(/ /, i)
if idx
- result.push str[i..(idx-1)]
- i = idx + 1
+ result.push str[i..(idx-1)]
+ i = idx + 1
else
- result.push str[i..-1]
- break
+ result.push str[i..-1]
+ break
end
end
@@ -1234,12 +1234,12 @@ class TkText<TkTextWin
while idx < str.size
case str[idx]
when ?{
- cnt += 1
+ cnt += 1
when ?}
- cnt -= 1
- if cnt == 0
- break
- end
+ cnt -= 1
+ if cnt == 0
+ break
+ end
end
idx += 1
end
@@ -1253,9 +1253,9 @@ class TkText<TkTextWin
loop {
idx = str.index(/ /, j)
if str[idx-1] == ?\\
- j += 1
+ j += 1
else
- break
+ break
end
}
val = str[i..(idx-1)]
diff --git a/ext/tk/lib/tk/textimage.rb b/ext/tk/lib/tk/textimage.rb
index d36d17098a..bd92387e3c 100644
--- a/ext/tk/lib/tk/textimage.rb
+++ b/ext/tk/lib/tk/textimage.rb
@@ -14,20 +14,20 @@ class TkTextImage<TkObject
@path = TkTextMark.new(@t, tk_call(@t.path, 'index', 'end - 1 chars'))
elsif index.kind_of? TkTextMark
if tk_call_without_enc(@t.path,'index',index.path) == tk_call_without_enc(@t.path,'index','end')
- @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
- 'end - 1 chars'))
+ @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
+ 'end - 1 chars'))
else
- @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
- index.path))
+ @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
+ index.path))
end
else
@path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
- _get_eval_enc_str(index)))
+ _get_eval_enc_str(index)))
end
@path.gravity = 'left'
@index = @path.path
@id = tk_call_without_enc(@t.path, 'image', 'create', @index,
- *hash_kv(keys, true))
+ *hash_kv(keys, true))
end
def [](slot)
@@ -65,7 +65,7 @@ class TkTextImage<TkObject
def image=(value)
tk_call_without_enc(@t.path, 'image', 'configure', @index, '-image',
- _get_eval_enc_str(value))
+ _get_eval_enc_str(value))
#self
value
end
diff --git a/ext/tk/lib/tk/textmark.rb b/ext/tk/lib/tk/textmark.rb
index a5e6f99d20..6004b86028 100644
--- a/ext/tk/lib/tk/textmark.rb
+++ b/ext/tk/lib/tk/textmark.rb
@@ -29,7 +29,7 @@ class TkTextMark<TkObject
TMarkID_TBL[@tpath][@id] = self
Tk_TextMark_ID[1].succ!
tk_call_without_enc(@t.path, 'mark', 'set', @id,
- _get_eval_enc_str(index))
+ _get_eval_enc_str(index))
@t._addtag id, self
end
@@ -54,7 +54,7 @@ class TkTextMark<TkObject
def set(where)
tk_call_without_enc(@t.path, 'mark', 'set', @id,
- _get_eval_enc_str(where))
+ _get_eval_enc_str(where))
self
end
@@ -111,7 +111,7 @@ class TkTextNamedMark<TkTextMark
TMarkID_TBL[@tpath] = {} unless TMarkID_TBL[@tpath]
TMarkID_TBL[@tpath][@id] = self unless TMarkID_TBL[@tpath][@id]
tk_call_without_enc(@t.path, 'mark', 'set', @id,
- _get_eval_enc_str(index)) if index
+ _get_eval_enc_str(index)) if index
@t._addtag id, self
end
end
diff --git a/ext/tk/lib/tk/texttag.rb b/ext/tk/lib/tk/texttag.rb
index 3196da9b5b..d2611509a4 100644
--- a/ext/tk/lib/tk/texttag.rb
+++ b/ext/tk/lib/tk/texttag.rb
@@ -35,11 +35,11 @@ class TkTextTag<TkObject
if args != [] then
keys = args.pop
if keys.kind_of? Hash then
- add(*args) if args != []
- configure(keys)
+ add(*args) if args != []
+ configure(keys)
else
- args.push keys
- add(*args)
+ args.push keys
+ add(*args)
end
end
@t._addtag id, self
@@ -67,13 +67,13 @@ class TkTextTag<TkObject
def add(*indices)
tk_call_without_enc(@t.path, 'tag', 'add', @id,
- *(indices.collect{|idx| _get_eval_enc_str(idx)}))
+ *(indices.collect{|idx| _get_eval_enc_str(idx)}))
self
end
def remove(*indices)
tk_call_without_enc(@t.path, 'tag', 'remove', @id,
- *(indices.collect{|idx| _get_eval_enc_str(idx)}))
+ *(indices.collect{|idx| _get_eval_enc_str(idx)}))
self
end
@@ -88,14 +88,14 @@ class TkTextTag<TkObject
def nextrange(first, last=None)
tk_split_list(tk_call_without_enc(@t.path, 'tag', 'nextrange', @id,
- _get_eval_enc_str(first),
- _get_eval_enc_str(last)))
+ _get_eval_enc_str(first),
+ _get_eval_enc_str(last)))
end
def prevrange(first, last=None)
tk_split_list(tk_call_without_enc(@t.path, 'tag', 'prevrange', @id,
- _get_eval_enc_str(first),
- _get_eval_enc_str(last)))
+ _get_eval_enc_str(first),
+ _get_eval_enc_str(last)))
end
def [](key)
@@ -118,19 +118,19 @@ class TkTextTag<TkObject
when 'font', 'kanjifont'
#fnt = tk_tcl2ruby(tk_call(@t.path, 'tag', 'cget', @id, "-#{key}"))
fnt = tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget',
- @id, '-font')))
+ @id, '-font')))
unless fnt.kind_of?(TkFont)
- fnt = tagfontobj(@id, fnt)
+ fnt = tagfontobj(@id, fnt)
end
if key.to_s == 'kanjifont' && JAPANIZED_TK && TK_VERSION =~ /^4\.*/
- # obsolete; just for compatibility
- fnt.kanji_font
+ # obsolete; just for compatibility
+ fnt.kanji_font
else
- fnt
+ fnt
end
else
tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget',
- @id, "-#{key}")))
+ @id, "-#{key}")))
end
end
=end
@@ -183,13 +183,13 @@ class TkTextTag<TkObject
def raise(above=None)
tk_call_without_enc(@t.path, 'tag', 'raise', @id,
- _get_eval_enc_str(above))
+ _get_eval_enc_str(above))
self
end
def lower(below=None)
tk_call_without_enc(@t.path, 'tag', 'lower', @id,
- _get_eval_enc_str(below))
+ _get_eval_enc_str(below))
self
end
@@ -205,14 +205,14 @@ class TkTextNamedTag<TkTextTag
if TTagID_TBL[parent.path] && TTagID_TBL[parent.path][name]
tagobj = TTagID_TBL[parent.path][name]
if args != [] then
- keys = args.pop
- if keys.kind_of? Hash then
- tagobj.add(*args) if args != []
- tagobj.configure(keys)
- else
- args.push keys
- tagobj.add(*args)
- end
+ keys = args.pop
+ if keys.kind_of? Hash then
+ tagobj.add(*args) if args != []
+ tagobj.configure(keys)
+ else
+ args.push keys
+ tagobj.add(*args)
+ end
end
return tagobj
else
@@ -235,11 +235,11 @@ class TkTextNamedTag<TkTextTag
if args != [] then
keys = args.pop
if keys.kind_of? Hash then
- add(*args) if args != []
- configure(keys)
+ add(*args) if args != []
+ configure(keys)
else
- args.push keys
- add(*args)
+ args.push keys
+ add(*args)
end
end
@t._addtag id, self
diff --git a/ext/tk/lib/tk/textwindow.rb b/ext/tk/lib/tk/textwindow.rb
index 778cf0f733..59fafff181 100644
--- a/ext/tk/lib/tk/textwindow.rb
+++ b/ext/tk/lib/tk/textwindow.rb
@@ -12,14 +12,14 @@ class TkTextWindow<TkObject
@t = parent
if index == 'end'
@path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
- 'end - 1 chars'))
+ 'end - 1 chars'))
elsif index.kind_of? TkTextMark
if tk_call_without_enc(@t.path,'index',index.path) == tk_call_without_enc(@t.path,'index','end')
- @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
- 'end - 1 chars'))
+ @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
+ 'end - 1 chars'))
else
- @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
- index.path))
+ @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index',
+ index.path))
end
else
@path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', _get_eval_enc_str(index)))
@@ -34,20 +34,20 @@ class TkTextWindow<TkObject
@p_create = keys['create']
if @p_create.kind_of? Proc
=begin
- keys['create'] = install_cmd(proc{
- @id = @p_create.call
- if @id.kind_of?(TkWindow)
- @id.epath
- else
- @id
- end
- })
+ keys['create'] = install_cmd(proc{
+ @id = @p_create.call
+ if @id.kind_of?(TkWindow)
+ @id.epath
+ else
+ @id
+ end
+ })
=end
- keys['create'] = install_cmd(proc{@id = @p_create.call; _epath(@id)})
+ keys['create'] = install_cmd(proc{@id = @p_create.call; _epath(@id)})
end
end
tk_call_without_enc(@t.path, 'window', 'create', @index,
- *hash_kv(keys, true))
+ *hash_kv(keys, true))
end
def [](slot)
@@ -66,28 +66,28 @@ class TkTextWindow<TkObject
if slot.kind_of? Hash
slot = _symbolkey2str(slot)
if slot['window']
- @id = slot['window']
- # slot['window'] = @id.epath if @id.kind_of?(TkWindow)
- slot['window'] = _epath(@id) if @id
+ @id = slot['window']
+ # slot['window'] = @id.epath if @id.kind_of?(TkWindow)
+ slot['window'] = _epath(@id) if @id
end
if slot['create']
- self.create=slot.delete('create')
+ self.create=slot.delete('create')
end
if slot.size > 0
- tk_call_without_enc(@t.path, 'window', 'configure', @index,
- *hash_kv(slot, true))
+ tk_call_without_enc(@t.path, 'window', 'configure', @index,
+ *hash_kv(slot, true))
end
else
if slot == 'window' || slot == :window
- @id = value
- # value = @id.epath if @id.kind_of?(TkWindow)
- value = _epath(@id) if @id
+ @id = value
+ # value = @id.epath if @id.kind_of?(TkWindow)
+ value = _epath(@id) if @id
end
if slot == 'create' || slot == :create
- self.create=value
+ self.create=value
else
- tk_call_without_enc(@t.path, 'window', 'configure', @index,
- "-#{slot}", _get_eval_enc_str(value))
+ tk_call_without_enc(@t.path, 'window', 'configure', @index,
+ "-#{slot}", _get_eval_enc_str(value))
end
end
self
@@ -110,7 +110,7 @@ class TkTextWindow<TkObject
# value = @id.epath if @id.kind_of?(TkWindow)
value = _epath(@id) if @id
tk_call_without_enc(@t.path, 'window', 'configure', @index,
- '-window', _get_eval_enc_str(value))
+ '-window', _get_eval_enc_str(value))
value
end
@@ -122,16 +122,16 @@ class TkTextWindow<TkObject
@p_create = value
if @p_create.kind_of? Proc
value = install_cmd(proc{
- @id = @p_create.call
- if @id.kind_of?(TkWindow)
- @id.epath
- else
- @id
- end
- })
+ @id = @p_create.call
+ if @id.kind_of?(TkWindow)
+ @id.epath
+ else
+ @id
+ end
+ })
end
tk_call_without_enc(@t.path, 'window', 'configure', @index,
- '-create', _get_eval_enc_str(value))
+ '-create', _get_eval_enc_str(value))
value
end
end
diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb
index 79d7ef55fa..a6d7efa100 100644
--- a/ext/tk/lib/tk/timer.rb
+++ b/ext/tk/lib/tk/timer.rb
@@ -16,9 +16,9 @@ class TkTimer
TkCore::INTERP.add_tk_procs('rb_after', 'id', <<-'EOL')
if {[set st [catch {eval {ruby_cmd TkTimer callback} $id} ret]] != 0} {
- return -code $st $ret
+ return -code $st $ret
} {
- return $ret
+ return $ret
}
EOL
@@ -36,19 +36,19 @@ class TkTimer
def self.info(obj = nil)
if obj
if obj.kind_of?(TkTimer)
- if obj.after_id
- inf = tk_split_list(tk_call_without_enc('after','info',obj.after_id))
- [Tk_CBTBL[inf[0][1]], inf[1]]
- else
- nil
- end
+ if obj.after_id
+ inf = tk_split_list(tk_call_without_enc('after','info',obj.after_id))
+ [Tk_CBTBL[inf[0][1]], inf[1]]
+ else
+ nil
+ end
else
- fail ArgumentError, "TkTimer object is expected"
+ fail ArgumentError, "TkTimer object is expected"
end
else
tk_call_without_enc('after', 'info').split(' ').collect!{|id|
- ret = Tk_CBTBL.find{|key,val| val.after_id == id}
- (ret == nil)? id: ret[1]
+ ret = Tk_CBTBL.find{|key,val| val.after_id == id}
+ (ret == nil)? id: ret[1]
}
end
end
@@ -67,13 +67,13 @@ class TkTimer
exit!(1)
rescue Exception => e
if @cancel_on_exception &&
- @cancel_on_exception.find{|exc| e.kind_of?(exc)}
- cancel
- @return_value = e
- @in_callback = false
- return e
+ @cancel_on_exception.find{|exc| e.kind_of?(exc)}
+ cancel
+ @return_value = e
+ @in_callback = false
+ return e
else
- fail e
+ fail e
end
end
if @set_next
@@ -106,12 +106,12 @@ class TkTimer
end
if @current_pos >= @proc_max
if @do_loop < 0 || (@do_loop -= 1) > 0
- @current_pos = 0
+ @current_pos = 0
else
- Tk_CBTBL.delete(@id) ;# for GC
- @running = false
- @wait_var.value = 0
- return
+ Tk_CBTBL.delete(@id) ;# for GC
+ @running = false
+ @wait_var.value = 0
+ return
end
end
@@ -237,9 +237,9 @@ class TkTimer
@loop_proc = []
procs.each{|e|
if e.kind_of? Proc
- @loop_proc.push([e])
+ @loop_proc.push([e])
else
- @loop_proc.push(e)
+ @loop_proc.push(e)
end
}
@proc_max = @loop_proc.size
@@ -248,14 +248,14 @@ class TkTimer
@do_loop = 0
if loop_exec
if loop_exec.kind_of?(Integer) && loop_exec < 0
- @loop_exec = -1
+ @loop_exec = -1
elsif loop_exec == nil || loop_exec == false || loop_exec == 0
- @loop_exec = 1
+ @loop_exec = 1
else
- if not loop_exec.kind_of?(Integer)
- fail ArguemntError, "expect Integer for 2nd argument"
- end
- @loop_exec = loop_exec
+ if not loop_exec.kind_of?(Integer)
+ fail ArguemntError, "expect Integer for 2nd argument"
+ end
+ @loop_exec = loop_exec
end
@do_loop = @loop_exec
end
@@ -266,9 +266,9 @@ class TkTimer
def add_procs(*procs)
procs.each{|e|
if e.kind_of? Proc
- @loop_proc.push([e])
+ @loop_proc.push([e])
else
- @loop_proc.push(e)
+ @loop_proc.push(e)
end
}
@proc_max = @loop_proc.size
@@ -279,9 +279,9 @@ class TkTimer
def delete_procs(*procs)
procs.each{|e|
if e.kind_of? Proc
- @loop_proc.delete([e])
+ @loop_proc.delete([e])
else
- @loop_proc.delete(e)
+ @loop_proc.delete(e)
end
}
@proc_max = @loop_proc.size
@@ -327,7 +327,7 @@ class TkTimer
if argc > 0
sleep = init_args.shift
if !sleep == 'idle' && !sleep.kind_of?(Integer)
- fail ArguemntError, "expect Integer or 'idle' for 1st argument"
+ fail ArguemntError, "expect Integer or 'idle' for 1st argument"
end
@init_sleep = sleep
end
@@ -340,7 +340,7 @@ class TkTimer
@running = true
if @init_proc
if not @init_proc.kind_of? Proc
- fail ArgumentError, "Argument '#{@init_proc}' need to be Proc"
+ fail ArgumentError, "Argument '#{@init_proc}' need to be Proc"
end
@current_proc = @init_proc
set_callback(@init_sleep, @init_args)
@@ -393,7 +393,7 @@ class TkTimer
fail RuntimeError, "no procedure to continue" unless cmd
if wait
unless wait.kind_of? Integer
- fail ArguemntError, "expect Integer for 1st argument"
+ fail ArguemntError, "expect Integer for 1st argument"
end
sleep = wait
end
@@ -428,9 +428,9 @@ class TkTimer
unless @running
if @return_value.kind_of?(Exception)
- fail @return_value
+ fail @return_value
else
- return @return_value
+ return @return_value
end
end
diff --git a/ext/tk/lib/tk/toplevel.rb b/ext/tk/lib/tk/toplevel.rb
index 1984952248..b96e184aab 100644
--- a/ext/tk/lib/tk/toplevel.rb
+++ b/ext/tk/lib/tk/toplevel.rb
@@ -51,19 +51,19 @@ class TkToplevel<TkWindow
wm_cmds = {}
keys.each{|k,v|
if Wm.method_defined?(k)
- case k
- when 'screen','class','colormap','container','use','visual'
- new_keys[k] = v
- else
- case self.method(k).arity
- when -1,1
- wm_cmds[k] = v
- else
- new_keys[k] = v
- end
- end
+ case k
+ when 'screen','class','colormap','container','use','visual'
+ new_keys[k] = v
+ else
+ case self.method(k).arity
+ when -1,1
+ wm_cmds[k] = v
+ else
+ new_keys[k] = v
+ end
+ end
else
- new_keys[k] = v
+ new_keys[k] = v
end
}
[new_keys, wm_cmds]
@@ -79,7 +79,7 @@ class TkToplevel<TkWindow
if parent.kind_of? Hash
keys = _symbolkey2str(parent)
if keys.key?('classname')
- keys['class'] = keys.delete('classname')
+ keys['class'] = keys.delete('classname')
end
@classname = keys['class']
@colormap = keys['colormap']
@@ -88,25 +88,25 @@ class TkToplevel<TkWindow
@use = keys['use']
@visual = keys['visual']
if !@classname && my_class_name
- keys['class'] = @classname = my_class_name
+ keys['class'] = @classname = my_class_name
end
if @classname.kind_of? TkBindTag
- @db_class = @classname
- @classname = @classname.id
+ @db_class = @classname
+ @classname = @classname.id
elsif @classname
- @db_class = TkDatabaseClass.new(@classname)
+ @db_class = TkDatabaseClass.new(@classname)
else
- @db_class = self.class
- @classname = @db_class::WidgetClassName
+ @db_class = self.class
+ @classname = @db_class::WidgetClassName
end
keys, cmds = _wm_command_option_chk(keys)
super(keys)
cmds.each{|k,v|
- if v.kind_of? Array
- self.__send__(k,*v)
- else
- self.__send__(k,v)
- end
+ if v.kind_of? Array
+ self.__send__(k,*v)
+ else
+ self.__send__(k,v)
+ end
}
return
end
@@ -116,15 +116,15 @@ class TkToplevel<TkWindow
else
@screen = screen
if classname.kind_of? Hash
- keys = classname
+ keys = classname
else
- @classname = classname
+ @classname = classname
end
end
if keys.kind_of? Hash
keys = _symbolkey2str(keys)
if keys.key?('classname')
- keys['class'] = keys.delete('classname')
+ keys['class'] = keys.delete('classname')
end
@classname = keys['class'] unless @classname
@colormap = keys['colormap']
@@ -151,9 +151,9 @@ class TkToplevel<TkWindow
super(parent, keys)
cmds.each{|k,v|
if v.kind_of? Array
- self.send(k,*v)
+ self.send(k,*v)
else
- self.send(k,v)
+ self.send(k,v)
end
}
end
diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb
index ac99f32bdd..5a50de456d 100644
--- a/ext/tk/lib/tk/validation.rb
+++ b/ext/tk/lib/tk/validation.rb
@@ -8,7 +8,7 @@ module Tk
def self.__def_validcmd(scope, klass, keys=nil)
keys = klass._config_keys unless keys
keys.each{|key|
- eval("def #{key}(*args, &b)
+ eval("def #{key}(*args, &b)
__validcmd_call(#{klass.name}, '#{key}', *args, &b)
end", scope)
}
@@ -20,11 +20,11 @@ module Tk
cmd = (b)? proc(&b) : args.shift
if cmd.kind_of?(klass)
- configure(key, cmd)
+ configure(key, cmd)
elsif !args.empty?
- configure(key, [cmd, args])
+ configure(key, [cmd, args])
else
- configure(key, cmd)
+ configure(key, cmd)
end
end
@@ -36,9 +36,9 @@ module Tk
def __get_validate_key2class
k2c = {}
__validation_class_list.each{|klass|
- klass._config_keys.each{|key|
- k2c[key.to_s] = klass
- }
+ klass._config_keys.each{|key|
+ k2c[key.to_s] = klass
+ }
}
k2c
end
@@ -48,12 +48,12 @@ module Tk
keys = _symbolkey2str(keys)
key2class.each{|key, klass|
- if keys[key].kind_of?(Array)
- cmd, *args = keys[key]
- keys[key] = klass.new(cmd, args.join(' '))
- elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
- keys[key] = klass.new(keys[key])
- end
+ if keys[key].kind_of?(Array)
+ cmd, *args = keys[key]
+ keys[key] = klass.new(cmd, args.join(' '))
+ elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
+ keys[key] = klass.new(keys[key])
+ end
}
keys
end
@@ -65,9 +65,9 @@ module Tk
def configure(slot, value=TkComm::None)
if slot.kind_of?(Hash)
- super(__conv_vcmd_on_hash_kv(slot))
+ super(__conv_vcmd_on_hash_kv(slot))
else
- super(__conv_vcmd_on_hash_kv(slot=>value))
+ super(__conv_vcmd_on_hash_kv(slot=>value))
end
self
end
@@ -76,28 +76,28 @@ module Tk
key2class = __get_validate_key2class
if slot.kind_of?(Hash)
- slot = _symbolkey2str(slot)
- key2class.each{|key, klass|
- if slot[key].kind_of?(Array)
- cmd, *args = slot[key]
- slot[key] = klass.new(cmd, args.join(' '))
- elsif slot[key].kind_of?(Proc) || slot[key].kind_of?(Method)
- slot[key] = klass.new(slot[key])
- end
- }
- super(slot)
+ slot = _symbolkey2str(slot)
+ key2class.each{|key, klass|
+ if slot[key].kind_of?(Array)
+ cmd, *args = slot[key]
+ slot[key] = klass.new(cmd, args.join(' '))
+ elsif slot[key].kind_of?(Proc) || slot[key].kind_of?(Method)
+ slot[key] = klass.new(slot[key])
+ end
+ }
+ super(slot)
else
- slot = slot.to_s
- if (klass = key2class[slot])
- if value.kind_of?(Array)
- cmd, *args = value
- value = klass.new(cmd, args.join(' '))
- elsif value.kind_of?(Proc) || value.kind_of?(Method)
- value = klass.new(value)
- end
- end
- super(slot, value)
+ slot = slot.to_s
+ if (klass = key2class[slot])
+ if value.kind_of?(Array)
+ cmd, *args = value
+ value = klass.new(cmd, args.join(' '))
+ elsif value.kind_of?(Proc) || value.kind_of?(Method)
+ value = klass.new(value)
+ end
+ end
+ super(slot, value)
end
self
@@ -109,7 +109,7 @@ module Tk
def self.__def_validcmd(scope, klass, keys=nil)
keys = klass._config_keys unless keys
keys.each{|key|
- eval("def item_#{key}(id, *args, &b)
+ eval("def item_#{key}(id, *args, &b)
__item_validcmd_call(#{klass.name}, '#{key}', id, *args, &b)
end", scope)
}
@@ -121,11 +121,11 @@ module Tk
cmd = (b)? proc(&b) : args.shift
if cmd.kind_of?(klass)
- itemconfigure(tagid(tagOrId), key, cmd)
+ itemconfigure(tagid(tagOrId), key, cmd)
elsif !args.empty?
- itemconfigure(tagid(tagOrId), key, [cmd, args])
+ itemconfigure(tagid(tagOrId), key, [cmd, args])
else
- itemconfigure(tagid(tagOrId), key, cmd)
+ itemconfigure(tagid(tagOrId), key, cmd)
end
end
@@ -137,9 +137,9 @@ module Tk
def __get_item_validate_key2class(id)
k2c = {}
__item_validation_class_list(id).each{|klass|
- klass._config_keys.each{|key|
- k2c[key.to_s] = klass
- }
+ klass._config_keys.each{|key|
+ k2c[key.to_s] = klass
+ }
}
end
@@ -148,21 +148,21 @@ module Tk
keys = _symbolkey2str(keys)
key2class.each{|key, klass|
- if keys[key].kind_of?(Array)
- cmd, *args = keys[key]
- keys[key] = klass.new(cmd, args.join(' '))
- elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
- keys[key] = klass.new(keys[key])
- end
+ if keys[key].kind_of?(Array)
+ cmd, *args = keys[key]
+ keys[key] = klass.new(cmd, args.join(' '))
+ elsif keys[key].kind_of?(Proc) || keys[key].kind_of?(Method)
+ keys[key] = klass.new(keys[key])
+ end
}
keys
end
def itemconfigure(tagOrId, slot, value=TkComm::None)
if slot.kind_of?(Hash)
- super(__conv_item_vcmd_on_hash_kv(slot))
+ super(__conv_item_vcmd_on_hash_kv(slot))
else
- super(__conv_item_vcmd_on_hash_kv(slot=>value))
+ super(__conv_item_vcmd_on_hash_kv(slot=>value))
end
self
end
@@ -171,28 +171,28 @@ module Tk
key2class = __get_item_validate_key2class(tagid(tagOrId))
if slot.kind_of?(Hash)
- slot = _symbolkey2str(slot)
- key2class.each{|key, klass|
- if slot[key].kind_of?(Array)
- cmd, *args = slot[key]
- slot[key] = klass.new(cmd, args.join(' '))
- elsif slot[key].kind_of?(Proc) || slot[key].kind_of?(Method)
- slot[key] = klass.new(slot[key])
- end
- }
- super(slot)
+ slot = _symbolkey2str(slot)
+ key2class.each{|key, klass|
+ if slot[key].kind_of?(Array)
+ cmd, *args = slot[key]
+ slot[key] = klass.new(cmd, args.join(' '))
+ elsif slot[key].kind_of?(Proc) || slot[key].kind_of?(Method)
+ slot[key] = klass.new(slot[key])
+ end
+ }
+ super(slot)
else
- slot = slot.to_s
- if (klass = key2class[slot])
- if value.kind_of?(Array)
- cmd, *args = value
- value = klass.new(cmd, args.join(' '))
- elsif value.kind_of?(Proc) || value.kind_of?(Method)
- value = klass.new(value)
- end
- end
- super(slot, value)
+ slot = slot.to_s
+ if (klass = key2class[slot])
+ if value.kind_of?(Array)
+ cmd, *args = value
+ value = klass.new(cmd, args.join(' '))
+ elsif value.kind_of?(Proc) || value.kind_of?(Method)
+ value = klass.new(value)
+ end
+ end
+ super(slot, value)
end
self
@@ -224,23 +224,23 @@ class TkValidateCommand
[ ?w, TkComm.method(:window) ],
[ ?e, proc{|val|
- enc = Tk.encoding
- if enc
- Tk.fromUTF8(TkComm::string(val), enc)
- else
- TkComm::string(val)
- end
- }
+ enc = Tk.encoding
+ if enc
+ Tk.fromUTF8(TkComm::string(val), enc)
+ else
+ TkComm::string(val)
+ end
+ }
],
[ ?x, proc{|val|
- idx = TkComm::number(val)
- if idx < 0
- nil
- else
- idx
- end
- }
+ idx = TkComm::number(val)
+ if idx < 0
+ nil
+ else
+ idx
+ end
+ }
],
nil
@@ -277,32 +277,32 @@ class TkValidateCommand
args = args.join(' ')
keys = klass._get_subst_key(args)
if cmd.kind_of?(String)
- id = cmd
+ id = cmd
elsif cmd.kind_of?(TkCallbackEntry)
- @id = install_cmd(cmd)
+ @id = install_cmd(cmd)
else
- @id = install_cmd(proc{|*arg|
- ex_args = []
- extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
- klass.ret_val(cmd.call(
+ @id = install_cmd(proc{|*arg|
+ ex_args = []
+ extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
+ klass.ret_val(cmd.call(
*(ex_args.concat(klass.scan_args(keys, arg)))
))
- }) + ' ' + args
+ }) + ' ' + args
end
else
keys, args = klass._get_all_subst_keys
if cmd.kind_of?(String)
- id = cmd
+ id = cmd
elsif cmd.kind_of?(TkCallbackEntry)
- @id = install_cmd(cmd)
+ @id = install_cmd(cmd)
else
- @id = install_cmd(proc{|*arg|
- ex_args = []
- extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
- klass.ret_val(cmd.call(
+ @id = install_cmd(proc{|*arg|
+ ex_args = []
+ extra_args_tbl.reverse_each{|conv| ex_args << conv.call(arg.pop)}
+ klass.ret_val(cmd.call(
*(ex_args << klass.new(*klass.scan_args(keys, arg)))
- ))
- }) + ' ' + args
+ ))
+ }) + ' ' + args
end
end
end
diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb
index 97d18e4a50..d5882fd649 100644
--- a/ext/tk/lib/tk/variable.rb
+++ b/ext/tk/lib/tk/variable.rb
@@ -19,24 +19,24 @@ class TkVariable
Tk_VARIABLE_ID = ["v".freeze, "00000".taint].freeze
#TkCore::INTERP.add_tk_procs('rb_var', 'args',
- # "ruby [format \"TkVariable.callback %%Q!%s!\" $args]")
+ # "ruby [format \"TkVariable.callback %%Q!%s!\" $args]")
TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
if {[set st [catch {eval {ruby_cmd TkVariable callback} $args} ret]] != 0} {
set idx [string first "\n\n" $ret]
if {$idx > 0} {
- global errorInfo
- set tcl_backtrace $errorInfo
- set errorInfo [string range $ret [expr $idx + 2] \
+ global errorInfo
+ set tcl_backtrace $errorInfo
+ set errorInfo [string range $ret [expr $idx + 2] \
[string length $ret]]
append errorInfo "\n" $tcl_backtrace
- bgerror [string range $ret 0 [expr $idx - 1]]
+ bgerror [string range $ret 0 [expr $idx - 1]]
} else {
bgerror $ret
}
return ""
#return -code $st $ret
} else {
- return $ret
+ return $ret
}
EOL
@@ -47,40 +47,40 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
if TkVar_CB_TBL[name1]
#_get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
begin
- _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2, op))
+ _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2, op))
rescue SystemExit
- exit(0)
+ exit(0)
rescue Interrupt
- exit!(1)
+ exit!(1)
rescue Exception => e
- begin
- msg = _toUTF8(e.class.inspect) + ': ' +
- _toUTF8(e.message) + "\n" +
- "\n---< backtrace of Ruby side >-----\n" +
- _toUTF8(e.backtrace.join("\n")) +
- "\n---< backtrace of Tk side >-------"
- msg.instance_variable_set(:@encoding, 'utf-8')
- rescue Exception
- msg = e.class.inspect + ': ' + e.message + "\n" +
- "\n---< backtrace of Ruby side >-----\n" +
- e.backtrace.join("\n") +
- "\n---< backtrace of Tk side >-------"
- end
- fail(e, msg)
+ begin
+ msg = _toUTF8(e.class.inspect) + ': ' +
+ _toUTF8(e.message) + "\n" +
+ "\n---< backtrace of Ruby side >-----\n" +
+ _toUTF8(e.backtrace.join("\n")) +
+ "\n---< backtrace of Tk side >-------"
+ msg.instance_variable_set(:@encoding, 'utf-8')
+ rescue Exception
+ msg = e.class.inspect + ': ' + e.message + "\n" +
+ "\n---< backtrace of Ruby side >-----\n" +
+ e.backtrace.join("\n") +
+ "\n---< backtrace of Tk side >-------"
+ end
+ fail(e, msg)
end
=begin
begin
- raise 'check backtrace'
+ raise 'check backtrace'
rescue
- # ignore backtrace before 'callback'
- pos = -($!.backtrace.size)
+ # ignore backtrace before 'callback'
+ pos = -($!.backtrace.size)
end
begin
- _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
+ _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op))
rescue
- trace = $!.backtrace
- raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" +
- "\tfrom #{trace[1..pos].join("\n\tfrom ")}"
+ trace = $!.backtrace
+ raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" +
+ "\tfrom #{trace[1..pos].join("\n\tfrom ")}"
end
=end
else
@@ -159,7 +159,7 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
=begin
if val == []
# INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)',
- # @id, @id, @id))
+ # @id, @id, @id))
elsif val.kind_of?(Array)
a = []
# val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
@@ -202,15 +202,15 @@ TkCore::INTERP.add_tk_procs('rb_var', 'args', <<-'EOL')
on_thread &= (Thread.list.size != 1)
if on_thread
if check_root
- INTERP._thread_tkwait('variable', @id)
+ INTERP._thread_tkwait('variable', @id)
else
- INTERP._thread_vwait(@id)
+ INTERP._thread_vwait(@id)
end
else
if check_root
- INTERP._invoke_without_enc('tkwait', 'variable', @id)
+ INTERP._invoke_without_enc('tkwait', 'variable', @id)
else
- INTERP._invoke_without_enc('vwait', @id)
+ INTERP._invoke_without_enc('vwait', @id)
end
end
end
@@ -299,21 +299,21 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
if val.kind_of?(Hash)
self.clear
val.each{|k, v|
- #INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)),
- # _toUTF8(_get_eval_string(v)))
- INTERP._set_global_var2(@id, _get_eval_string(k, true),
- _get_eval_string(v, true))
+ #INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(k)),
+ # _toUTF8(_get_eval_string(v)))
+ INTERP._set_global_var2(@id, _get_eval_string(k, true),
+ _get_eval_string(v, true))
}
self.value
elsif val.kind_of?(Array)
INTERP._set_global_var(@id, '')
val.each{|v|
- #INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)),
- INTERP._set_variable(@id, _get_eval_string(v, true),
- TclTkLib::VarAccessFlag::GLOBAL_ONLY |
- TclTkLib::VarAccessFlag::LEAVE_ERR_MSG |
- TclTkLib::VarAccessFlag::APPEND_VALUE |
- TclTkLib::VarAccessFlag::LIST_ELEMENT)
+ #INTERP._set_variable(@id, _toUTF8(_get_eval_string(v)),
+ INTERP._set_variable(@id, _get_eval_string(v, true),
+ TclTkLib::VarAccessFlag::GLOBAL_ONLY |
+ TclTkLib::VarAccessFlag::LEAVE_ERR_MSG |
+ TclTkLib::VarAccessFlag::APPEND_VALUE |
+ TclTkLib::VarAccessFlag::LIST_ELEMENT)
}
self.value
else
@@ -329,11 +329,11 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
rescue => e
case @def_default
when :proc
- @default_val.call(self, *idxs)
+ @default_val.call(self, *idxs)
when :val
- @default_val
+ @default_val
else
- fail e
+ fail e
end
end
#_fromUTF8(INTERP._get_global_var2(@id, index))
@@ -346,9 +346,9 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS
index = args.collect{|idx| _get_eval_string(idx, true)}.join(',')
_fromUTF8(INTERP._set_global_var2(@id, index, _get_eval_string(val, true)))
#_fromUTF8(INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(index)),
- # _toUTF8(_get_eval_string(val))))
+ # _toUTF8(_get_eval_string(val))))
#_fromUTF8(INTERP._set_global_var2(@id, _get_eval_string(index, true),
- # _get_eval_string(val, true)))
+ # _get_eval_string(val, true)))
end
def unset(elem=nil)
@@ -372,13 +372,13 @@ else
#INTERP._invoke_without_enc('set', @id)
rescue
if INTERP._eval(Kernel.format('global %s; array exists %s',
- @id, @id)) != "1"
+ @id, @id)) != "1"
#if INTERP._eval(Kernel.format('array exists %s', @id)) != "1"
#if INTERP._invoke_without_enc('array', 'exists', @id) != "1"
- fail
+ fail
else
- Hash[*tk_split_simplelist(INTERP._eval(Kernel.format('global %s; array get %s', @id, @id)))]
- #Hash[*tk_split_simplelist(_fromUTF8(INTERP._invoke_without_enc('array', 'get', @id)))]
+ Hash[*tk_split_simplelist(INTERP._eval(Kernel.format('global %s; array get %s', @id, @id)))]
+ #Hash[*tk_split_simplelist(_fromUTF8(INTERP._invoke_without_enc('array', 'get', @id)))]
end
end
end
@@ -392,43 +392,43 @@ else
#_fromUTF8(INTERP._invoke_without_enc('set', @id, _toUTF8(s)))
rescue
if INTERP._eval(Kernel.format('global %s; array exists %s',
- @id, @id)) != "1"
+ @id, @id)) != "1"
#if INTERP._eval(Kernel.format('array exists %s', @id)) != "1"
#if INTERP._invoke_without_enc('array', 'exists', @id) != "1"
- fail
+ fail
else
- if val == []
- INTERP._eval(Kernel.format('global %s; unset %s; set %s(0) 0; unset %s(0)', @id, @id, @id, @id))
- #INTERP._eval(Kernel.format('unset %s; set %s(0) 0; unset %s(0)',
- # @id, @id, @id))
- #INTERP._invoke_without_enc('unset', @id)
- #INTERP._invoke_without_enc('set', @id+'(0)', 0)
- #INTERP._invoke_without_enc('unset', @id+'(0)')
- elsif val.kind_of?(Array)
- a = []
- val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
- #s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
- s = '"' + a.join(" ").gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
- INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
- @id, @id, @id, s))
- #INTERP._eval(Kernel.format('unset %s; array set %s %s',
- # @id, @id, s))
- #INTERP._invoke_without_enc('unset', @id)
- #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
- elsif val.kind_of?(Hash)
- #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
- # .gsub(/[\[\]$"]/, '\\\\\&') + '"'
- s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
- .gsub(/[\[\]$\\"]/, '\\\\\&') + '"'
- INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
- @id, @id, @id, s))
- #INTERP._eval(Kernel.format('unset %s; array set %s %s',
- # @id, @id, s))
- #INTERP._invoke_without_enc('unset', @id)
- #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
- else
- fail
- end
+ if val == []
+ INTERP._eval(Kernel.format('global %s; unset %s; set %s(0) 0; unset %s(0)', @id, @id, @id, @id))
+ #INTERP._eval(Kernel.format('unset %s; set %s(0) 0; unset %s(0)',
+ # @id, @id, @id))
+ #INTERP._invoke_without_enc('unset', @id)
+ #INTERP._invoke_without_enc('set', @id+'(0)', 0)
+ #INTERP._invoke_without_enc('unset', @id+'(0)')
+ elsif val.kind_of?(Array)
+ a = []
+ val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e))}
+ #s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + a.join(" ").gsub(/[\[\]$"\\]/, '\\\\\&') + '"'
+ INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
+ @id, @id, @id, s))
+ #INTERP._eval(Kernel.format('unset %s; array set %s %s',
+ # @id, @id, s))
+ #INTERP._invoke_without_enc('unset', @id)
+ #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
+ elsif val.kind_of?(Hash)
+ #s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
+ # .gsub(/[\[\]$"]/, '\\\\\&') + '"'
+ s = '"' + val.to_a.collect{|e| array2tk_list(e)}.join(" ")\
+ .gsub(/[\[\]$\\"]/, '\\\\\&') + '"'
+ INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s',
+ @id, @id, @id, s))
+ #INTERP._eval(Kernel.format('unset %s; array set %s %s',
+ # @id, @id, s))
+ #INTERP._invoke_without_enc('unset', @id)
+ #_fromUTF8(INTERP._invoke_without_enc('array','set', @id, _toUTF8(s)))
+ else
+ fail
+ end
end
end
end
@@ -440,11 +440,11 @@ else
rescue => e
case @def_default
when :proc
- @default_val.call(self, *idxs)
+ @default_val.call(self, *idxs)
when :val
- @default_val
+ @default_val
else
- fail e
+ fail e
end
end
#INTERP._eval(Kernel.format('global %s; set %s(%s)', @id, @id, index))
@@ -462,9 +462,9 @@ else
#INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id,
# _get_eval_string(index), _get_eval_string(val)))
#INTERP._eval(Kernel.format('set %s(%s) %s', @id,
- # _get_eval_string(index), _get_eval_string(val)))
+ # _get_eval_string(index), _get_eval_string(val)))
#INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ') ' +
- # _get_eval_string(val))
+ # _get_eval_string(val))
end
def unset(elem=nil)
@@ -514,9 +514,9 @@ end
else
case val.to_s.downcase
when 'false', '0', 'no', 'off'
- self.value = '0'
+ self.value = '0'
else
- self.value = '1'
+ self.value = '1'
end
end
end
@@ -602,9 +602,9 @@ end
self.value + other
else
begin
- number(self.value) + other
+ number(self.value) + other
rescue
- self.value + other.to_s
+ self.value + other.to_s
end
end
end
@@ -670,17 +670,17 @@ end
def <=>(other)
if other.kind_of?(TkVariable)
begin
- val = other.numeric
- other = val
+ val = other.numeric
+ other = val
rescue
- other = other.value
+ other = other.value
end
end
if other.kind_of?(Numeric)
begin
- return self.numeric <=> other
+ return self.numeric <=> other
rescue
- return self.value <=> other.to_s
+ return self.value <=> other.to_s
end
else
return self.value <=> other
@@ -697,7 +697,7 @@ end
end
if elem.kind_of?(String) && elem != ''
if @trace_elem.kind_of?(Hash) && @trace_elem[elem].kind_of?(Array)
- @trace_elem[elem].each{|m,e| e.call(self,elem,op) if m.index(op)}
+ @trace_elem[elem].each{|m,e| e.call(self,elem,op) if m.index(op)}
end
end
end
@@ -713,12 +713,12 @@ end
Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
end
=end
else
@@ -726,25 +726,25 @@ end
#opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
if newopts != @trace_opts
- Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
- end
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
+ end
=end
end
end
@@ -763,13 +763,13 @@ end
Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
end
=end
else
@@ -777,25 +777,25 @@ end
# opts.each_byte{|c| newopts += c.chr unless newopts.index(c)}
opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
if newopts != @trace_opts
- Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
- @trace_opts.replace(newopts)
- Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
- end
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
+ @trace_opts.replace(newopts)
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
+ end
=end
end
end
@@ -820,8 +820,8 @@ end
newopts = ''
@trace_var.each_with_index{|e,i|
if idx < 0 && e[0] == opts && e[1] == cmd
- idx = i
- next
+ idx = i
+ next
end
# e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
@@ -834,8 +834,8 @@ end
@trace_elem.each{|elem|
@trace_elem[elem].each{|e|
- # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
- e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
+ # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
}
}
@@ -845,28 +845,28 @@ end
Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
end
=end
@trace_opts.replace(newopts)
if @trace_opts != ''
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'variable',
- @id, @trace_opts, 'rb_var')
- end
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable',
+ @id, @trace_opts, 'rb_var')
+ end
=end
end
end
@@ -882,8 +882,8 @@ end
idx = -1
@trace_elem[elem].each_with_index{|e,i|
if idx < 0 && e[0] == opts && e[1] == cmd
- idx = i
- next
+ idx = i
+ next
end
}
if idx >= 0
@@ -899,8 +899,8 @@ end
}
@trace_elem.each{|elem|
@trace_elem[elem].each{|e|
- # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
- e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
+ # e[0].each_byte{|c| newopts += c.chr unless newopts.index(c)}
+ e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c)}
}
}
@@ -910,28 +910,28 @@ end
Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var')
=begin
if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'remove', 'variable',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'remove', 'variable',
+ @id, @trace_opts, 'rb_var')
else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'vdelete',
- @id, @trace_opts, 'rb_var')
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'vdelete',
+ @id, @trace_opts, 'rb_var')
end
=end
@trace_opts.replace(newopts)
if @trace_opts != ''
- Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
+ Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var')
=begin
- if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
- # TCL_VERSION >= 8.4
- Tk.tk_call_without_enc('trace', 'add', 'variable',
- @id, @trace_opts, 'rb_var')
- else
- # TCL_VERSION <= 8.3
- Tk.tk_call_without_enc('trace', 'variable', @id,
- @trace_opts, 'rb_var')
- end
+ if /^(8\.([4-9]|[1-9][0-9])|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION
+ # TCL_VERSION >= 8.4
+ Tk.tk_call_without_enc('trace', 'add', 'variable',
+ @id, @trace_opts, 'rb_var')
+ else
+ # TCL_VERSION <= 8.3
+ Tk.tk_call_without_enc('trace', 'variable', @id,
+ @trace_opts, 'rb_var')
+ end
=end
end
end
@@ -966,9 +966,9 @@ class TkVarAccess<TkVariable
if val
if val.kind_of?(Hash)
- # assoc-array variable
- self[''] = 0
- self.clear
+ # assoc-array variable
+ self[''] = 0
+ self.clear
end
#s = '"' + _get_eval_string(val).gsub(/[\[\]$"]/, '\\\\\&') + '"' #"
#s = '"' + _get_eval_string(val).gsub(/[\[\]$"\\]/, '\\\\\&') + '"' #"
diff --git a/ext/tk/lib/tk/virtevent.rb b/ext/tk/lib/tk/virtevent.rb
index d64c0a3193..c82cfe46e8 100644
--- a/ext/tk/lib/tk/virtevent.rb
+++ b/ext/tk/lib/tk/virtevent.rb
@@ -27,9 +27,9 @@ class TkVirtualEvent<TkObject
obj
else
if tk_call_without_enc('event', 'info').index("<#{event}>")
- PreDefVirtEvent.new(event)
+ PreDefVirtEvent.new(event)
else
- fail ArgumentError, "undefined virtual event '<#{event}>'"
+ fail ArgumentError, "undefined virtual event '<#{event}>'"
end
end
end
@@ -50,9 +50,9 @@ class TkVirtualEvent<TkObject
def add(*sequences)
if sequences != []
tk_call_without_enc('event', 'add', "<#{@id}>",
- *(sequences.collect{|seq|
- "<#{tk_event_sequence(seq)}>"
- }) )
+ *(sequences.collect{|seq|
+ "<#{tk_event_sequence(seq)}>"
+ }) )
TkVirtualEventTBL[@id] = self
end
self
@@ -64,9 +64,9 @@ class TkVirtualEvent<TkObject
TkVirtualEventTBL.delete(@id)
else
tk_call_without_enc('event', 'delete', "<#{@id}>",
- *(sequences.collect{|seq|
- "<#{tk_event_sequence(seq)}>"
- }) )
+ *(sequences.collect{|seq|
+ "<#{tk_event_sequence(seq)}>"
+ }) )
TkVirtualEventTBL.delete(@id) if info == []
end
self
@@ -75,14 +75,14 @@ class TkVirtualEvent<TkObject
def info
tk_call_without_enc('event','info',"<#{@id}>").split(/\s+/).collect!{|seq|
l = seq.scan(/<*[^<>]+>*/).collect!{|subseq|
- case (subseq)
- when /^<<[^<>]+>>$/
- TkVirtualEvent.getobj(subseq[1..-2])
- when /^<[^<>]+>$/
- subseq[1..-2]
- else
- subseq.split('')
- end
+ case (subseq)
+ when /^<<[^<>]+>>$/
+ TkVirtualEvent.getobj(subseq[1..-2])
+ when /^<[^<>]+>$/
+ subseq[1..-2]
+ else
+ subseq.split('')
+ end
}.flatten
(l.size == 1) ? l[0] : l
}
diff --git a/ext/tk/lib/tk/winfo.rb b/ext/tk/lib/tk/winfo.rb
index b4cb79a29a..948042558d 100644
--- a/ext/tk/lib/tk/winfo.rb
+++ b/ext/tk/lib/tk/winfo.rb
@@ -15,7 +15,7 @@ module TkWinfo
def TkWinfo.atom(name, win=nil)
if win
number(tk_call_without_enc('winfo', 'atom', '-displayof', win,
- _get_eval_enc_str(name)))
+ _get_eval_enc_str(name)))
else
number(tk_call_without_enc('winfo', 'atom', _get_eval_enc_str(name)))
end
@@ -27,7 +27,7 @@ module TkWinfo
def TkWinfo.atomname(id, win=nil)
if win
_fromUTF8(tk_call_without_enc('winfo', 'atomname',
- '-displayof', win, id))
+ '-displayof', win, id))
else
_fromUTF8(tk_call_without_enc('winfo', 'atomname', id))
end
@@ -68,7 +68,7 @@ module TkWinfo
def TkWinfo.containing(rootX, rootY, win=nil)
if win
window(tk_call_without_enc('winfo', 'containing',
- '-displayof', win, rootX, rootY))
+ '-displayof', win, rootX, rootY))
else
window(tk_call_without_enc('winfo', 'containing', rootX, rootY))
end
@@ -122,7 +122,7 @@ module TkWinfo
def TkWinfo.interps(window=nil)
if window
tk_split_simplelist(tk_call_without_enc('winfo', 'interps',
- '-displayof', window))
+ '-displayof', window))
else
tk_split_simplelist(tk_call_without_enc('winfo', 'interps'))
end
@@ -299,7 +299,7 @@ module TkWinfo
def TkWinfo.visualsavailable(window, includeids=false)
if includeids
list(tk_call_without_enc('winfo', 'visualsavailable',
- window, "includeids"))
+ window, "includeids"))
else
list(tk_call_without_enc('winfo', 'visualsavailable', window))
end
diff --git a/ext/tk/lib/tk/winpkg.rb b/ext/tk/lib/tk/winpkg.rb
index 1d7d473387..d6f7a0e9d4 100644
--- a/ext/tk/lib/tk/winpkg.rb
+++ b/ext/tk/lib/tk/winpkg.rb
@@ -19,25 +19,27 @@ module TkWinDDE
tk_call_without_enc('package', 'require', 'dde')
end
- def servername(topic=None)
- tk_call('dde', 'servername', topic)
- end
+ #def servername(topic=None)
+ # tk_call('dde', 'servername', topic)
+ #end
def servername(*args)
if args.size == 0
tk_call('dde', 'servername')
else
- if args[-1].kind_of?(Hash)
- keys = _symbolkey2str(args.pop)
- force = (keys.delete('force'))? '-force': None
- exact = (keys.delete('exact'))? '-exact': None
- if keys.size == 0
- tk_call('dde', 'servername', force, exact)
- elsif args.size == 0
- tk_call('dde', 'servername', force, exact, *hash_kv(keys))
- else
- tk_call('dde', 'servername', force, exact,
- *((hash_kv(keys) << '--') + args))
- end
+ if args[-1].kind_of?(Hash) # dde 1.2 +
+ keys = _symbolkey2str(args.pop)
+ force = (keys.delete('force'))? '-force': None
+ exact = (keys.delete('exact'))? '-exact': None
+ if keys.size == 0
+ tk_call('dde', 'servername', force, exact)
+ elsif args.size == 0
+ tk_call('dde', 'servername', force, exact, *hash_kv(keys))
+ else
+ tk_call('dde', 'servername', force, exact,
+ *((hash_kv(keys) << '--') + args))
+ end
+ else
+ tk_call('dde', 'servername', *args)
end
end
end
diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb
index b5106adade..a1002f7b96 100644
--- a/ext/tk/lib/tk/wm.rb
+++ b/ext/tk/lib/tk/wm.rb
@@ -11,237 +11,267 @@ module Tk
def aspect(*args)
if args.length == 0
- list(tk_call_without_enc('wm', 'aspect', path))
+ list(tk_call_without_enc('wm', 'aspect', path))
else
- tk_call('wm', 'aspect', path, *args)
- self
+ tk_call('wm', 'aspect', path, *args)
+ self
end
end
+
def attributes(slot=nil,value=None)
if slot == nil
- lst = tk_split_list(tk_call('wm', 'attributes', path))
- info = {}
- while key = lst.shift
- info[key[1..-1]] = lst.shift
- end
- info
+ lst = tk_split_list(tk_call('wm', 'attributes', path))
+ info = {}
+ while key = lst.shift
+ info[key[1..-1]] = lst.shift
+ end
+ info
elsif slot.kind_of? Hash
- tk_call('wm', 'attributes', path, *hash_kv(slot))
- self
+ tk_call('wm', 'attributes', path, *hash_kv(slot))
+ self
elsif value == None
- tk_call('wm', 'attributes', path, "-#{slot}")
+ tk_call('wm', 'attributes', path, "-#{slot}")
else
- tk_call('wm', 'attributes', path, "-#{slot}", value)
- self
+ tk_call('wm', 'attributes', path, "-#{slot}", value)
+ self
end
end
+
def client(name=None)
if name == None
- tk_call('wm', 'client', path)
+ tk_call('wm', 'client', path)
else
name = '' if name == nil
- tk_call('wm', 'client', path, name)
- self
+ tk_call('wm', 'client', path, name)
+ self
end
end
+
def colormapwindows(*args)
if args.size == 0
- list(tk_call_without_enc('wm', 'colormapwindows', path))
+ list(tk_call_without_enc('wm', 'colormapwindows', path))
else
- tk_call_without_enc('wm', 'colormapwindows', path, *args)
- self
+ tk_call_without_enc('wm', 'colormapwindows', path, *args)
+ self
end
end
+
def wm_command(value=nil)
if value
- tk_call('wm', 'command', path, value)
- self
+ tk_call('wm', 'command', path, value)
+ self
else
- #procedure(tk_call('wm', 'command', path))
- tk_call('wm', 'command', path)
+ #procedure(tk_call('wm', 'command', path))
+ tk_call('wm', 'command', path)
end
end
+
def deiconify(ex = true)
tk_call_without_enc('wm', 'deiconify', path) if ex
self
end
+
def focusmodel(mode = nil)
if mode
- tk_call_without_enc('wm', 'focusmodel', path, mode)
- self
+ tk_call_without_enc('wm', 'focusmodel', path, mode)
+ self
else
- tk_call_without_enc('wm', 'focusmodel', path)
+ tk_call_without_enc('wm', 'focusmodel', path)
end
end
+
def frame
tk_call_without_enc('wm', 'frame', path)
end
+
def geometry(geom=nil)
if geom
- tk_call_without_enc('wm', 'geometry', path, geom)
- self
+ tk_call_without_enc('wm', 'geometry', path, geom)
+ self
else
- tk_call_without_enc('wm', 'geometry', path)
+ tk_call_without_enc('wm', 'geometry', path)
end
end
+
def wm_grid(*args)
if args.size == 0
- list(tk_call_without_enc('wm', 'grid', path))
+ list(tk_call_without_enc('wm', 'grid', path))
else
- tk_call_without_enc('wm', 'grid', path, *args)
- self
+ tk_call_without_enc('wm', 'grid', path, *args)
+ self
end
end
+
def group(leader = nil)
if leader
- tk_call('wm', 'group', path, leader)
- self
+ tk_call('wm', 'group', path, leader)
+ self
else
- window(tk_call('wm', 'group', path))
+ window(tk_call('wm', 'group', path))
end
end
+
def iconbitmap(bmp=nil)
if bmp
- tk_call_without_enc('wm', 'iconbitmap', path, bmp)
- self
+ tk_call_without_enc('wm', 'iconbitmap', path, bmp)
+ self
else
- image_obj(tk_call_without_enc('wm', 'iconbitmap', path))
+ image_obj(tk_call_without_enc('wm', 'iconbitmap', path))
end
end
+
def iconify(ex = true)
tk_call_without_enc('wm', 'iconify', path) if ex
self
end
+
def iconmask(bmp=nil)
if bmp
- tk_call_without_enc('wm', 'iconmask', path, bmp)
- self
+ tk_call_without_enc('wm', 'iconmask', path, bmp)
+ self
else
- image_obj(tk_call_without_enc('wm', 'iconmask', path))
+ image_obj(tk_call_without_enc('wm', 'iconmask', path))
end
end
+
def iconname(name=nil)
if name
- tk_call('wm', 'iconname', path, name)
- self
+ tk_call('wm', 'iconname', path, name)
+ self
else
- tk_call('wm', 'iconname', path)
+ tk_call('wm', 'iconname', path)
end
end
+
def iconposition(*args)
if args.size == 0
- list(tk_call_without_enc('wm', 'iconposition', path))
+ list(tk_call_without_enc('wm', 'iconposition', path))
else
- tk_call_without_enc('wm', 'iconposition', path, *args)
- self
+ tk_call_without_enc('wm', 'iconposition', path, *args)
+ self
end
end
+
def iconwindow(win = nil)
if win
- tk_call_without_enc('wm', 'iconwindow', path, win)
- self
+ tk_call_without_enc('wm', 'iconwindow', path, win)
+ self
else
- w = tk_call_without_enc('wm', 'iconwindow', path)
- (w == '')? nil: window(w)
+ w = tk_call_without_enc('wm', 'iconwindow', path)
+ (w == '')? nil: window(w)
end
end
+
def maxsize(*args)
if args.size == 0
- list(tk_call_without_enc('wm', 'maxsize', path))
+ list(tk_call_without_enc('wm', 'maxsize', path))
else
- tk_call_without_enc('wm', 'maxsize', path, *args)
- self
+ tk_call_without_enc('wm', 'maxsize', path, *args)
+ self
end
end
+
def minsize(*args)
if args.size == 0
- list(tk_call_without_enc('wm', 'minsize', path))
+ list(tk_call_without_enc('wm', 'minsize', path))
else
- tk_call_without_enc('wm', 'minsize', path, *args)
- self
+ tk_call_without_enc('wm', 'minsize', path, *args)
+ self
end
end
+
def overrideredirect(bool=None)
if bool == None
- bool(tk_call_without_enc('wm', 'overrideredirect', path))
+ bool(tk_call_without_enc('wm', 'overrideredirect', path))
else
- tk_call_without_enc('wm', 'overrideredirect', path, bool)
- self
+ tk_call_without_enc('wm', 'overrideredirect', path, bool)
+ self
end
end
+
def positionfrom(who=None)
if who == None
- r = tk_call_without_enc('wm', 'positionfrom', path)
- (r == "")? nil: r
+ r = tk_call_without_enc('wm', 'positionfrom', path)
+ (r == "")? nil: r
else
- tk_call_without_enc('wm', 'positionfrom', path, who)
- self
+ tk_call_without_enc('wm', 'positionfrom', path, who)
+ self
end
end
+
def protocol(name=nil, cmd=nil, &b)
if cmd
- tk_call_without_enc('wm', 'protocol', path, name, cmd)
- self
+ tk_call_without_enc('wm', 'protocol', path, name, cmd)
+ self
elsif b
- tk_call_without_enc('wm', 'protocol', path, name, proc(&b))
- self
+ tk_call_without_enc('wm', 'protocol', path, name, proc(&b))
+ self
elsif name
- result = tk_call_without_enc('wm', 'protocol', path, name)
- (result == "")? nil : tk_tcl2ruby(result)
+ result = tk_call_without_enc('wm', 'protocol', path, name)
+ (result == "")? nil : tk_tcl2ruby(result)
else
- tk_split_simplelist(tk_call_without_enc('wm', 'protocol', path))
+ tk_split_simplelist(tk_call_without_enc('wm', 'protocol', path))
end
end
+
def resizable(*args)
if args.length == 0
- list(tk_call_without_enc('wm', 'resizable', path)).collect{|e| bool(e)}
+ list(tk_call_without_enc('wm', 'resizable', path)).collect{|e| bool(e)}
else
- tk_call_without_enc('wm', 'resizable', path, *args)
- self
+ tk_call_without_enc('wm', 'resizable', path, *args)
+ self
end
end
+
def sizefrom(who=None)
if who == None
- r = tk_call_without_enc('wm', 'sizefrom', path)
- (r == "")? nil: r
+ r = tk_call_without_enc('wm', 'sizefrom', path)
+ (r == "")? nil: r
else
- tk_call_without_enc('wm', 'sizefrom', path, who)
- self
+ tk_call_without_enc('wm', 'sizefrom', path, who)
+ self
end
end
+
def stackorder
list(tk_call('wm', 'stackorder', path))
end
+
def stackorder_isabove(win)
bool(tk_call('wm', 'stackorder', path, 'isabove', win))
end
+
def stackorder_isbelow(win)
bool(tk_call('wm', 'stackorder', path, 'isbelow', win))
end
+
def state(state=nil)
if state
- tk_call_without_enc('wm', 'state', path, state)
- self
+ tk_call_without_enc('wm', 'state', path, state)
+ self
else
- tk_call_without_enc('wm', 'state', path)
+ tk_call_without_enc('wm', 'state', path)
end
end
+
def title(str=nil)
if str
- tk_call('wm', 'title', path, str)
- self
+ tk_call('wm', 'title', path, str)
+ self
else
- tk_call('wm', 'title', path)
+ tk_call('wm', 'title', path)
end
end
+
def transient(master=nil)
if master
- tk_call_without_enc('wm', 'transient', path, master)
- self
+ tk_call_without_enc('wm', 'transient', path, master)
+ self
else
- window(tk_call_without_enc('wm', 'transient', path))
+ window(tk_call_without_enc('wm', 'transient', path))
end
end
+
def withdraw(ex = true)
tk_call_without_enc('wm', 'withdraw', path) if ex
self
diff --git a/ext/tk/lib/tk/xim.rb b/ext/tk/lib/tk/xim.rb
index b4dacdc331..701cd7531c 100644
--- a/ext/tk/lib/tk/xim.rb
+++ b/ext/tk/lib/tk/xim.rb
@@ -13,14 +13,14 @@ module TkXIM
if value == None
if window
bool(tk_call_without_enc('tk', 'useinputmethods',
- '-displayof', window))
+ '-displayof', window))
else
bool(tk_call_without_enc('tk', 'useinputmethods'))
end
else
if window
- bool(tk_call_without_enc('tk', 'useinputmethods',
- '-displayof', window, value))
+ bool(tk_call_without_enc('tk', 'useinputmethods',
+ '-displayof', window, value))
else
bool(tk_call_without_enc('tk', 'useinputmethods', value))
end
@@ -39,7 +39,7 @@ module TkXIM
lst = tk_split_list(tk_call_without_enc('tk', 'caret', window))
info = {}
while key = lst.shift
- info[key[1..-1]] = lst.shift
+ info[key[1..-1]] = lst.shift
end
info
end
@@ -61,22 +61,22 @@ module TkXIM
def TkXIM.configinfo(window, slot=nil)
if TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
begin
- if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
- if slot
- conf = tk_split_list(tk_call('imconfigure', window, "-#{slot}"))
- conf[0] = conf[0][1..-1]
- conf
- else
- tk_split_list(tk_call('imconfigure', window)).collect{|conf|
- conf[0] = conf[0][1..-1]
- conf
- }
- end
- else
- []
- end
+ if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
+ if slot
+ conf = tk_split_list(tk_call('imconfigure', window, "-#{slot}"))
+ conf[0] = conf[0][1..-1]
+ conf
+ else
+ tk_split_list(tk_call('imconfigure', window)).collect{|conf|
+ conf[0] = conf[0][1..-1]
+ conf
+ }
+ end
+ else
+ []
+ end
rescue
- []
+ []
end
else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY
TkXIM.current_configinfo(window, slot)
@@ -86,18 +86,18 @@ module TkXIM
def TkXIM.current_configinfo(window, slot=nil)
begin
if /^8\.*/ === Tk::TK_VERSION && JAPANIZED_TK
- if slot
- conf = tk_split_list(tk_call('imconfigure', window, "-#{slot}"))
- { conf[0][1..-1] => conf[1] }
- else
- ret = {}
- tk_split_list(tk_call('imconfigure', window)).each{|conf|
- ret[conf[0][1..-1]] = conf[1]
- }
- ret
- end
+ if slot
+ conf = tk_split_list(tk_call('imconfigure', window, "-#{slot}"))
+ { conf[0][1..-1] => conf[1] }
+ else
+ ret = {}
+ tk_split_list(tk_call('imconfigure', window)).each{|conf|
+ ret[conf[0][1..-1]] = conf[1]
+ }
+ ret
+ end
else
- {}
+ {}
end
rescue
{}