diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-11 04:51:21 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-11 04:51:21 +0000 |
commit | 3514110b89bee5c37e308b4ca887e66dfe841456 (patch) | |
tree | d280d8542cc44d1cd1a75e8ec87b1f9d231561b7 /ext/tk/lib/tk/listbox.rb | |
parent | 05f5928c9d0f094d1e7e21a9bd9d8a8fc2f1a805 (diff) |
* ext/tk/lib/tk/*: untabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk/listbox.rb')
-rw-r--r-- | ext/tk/lib/tk/listbox.rb | 226 |
1 files changed, 113 insertions, 113 deletions
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 |