diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
commit | 287a34ae0dfc23e4158f67cb7783d239f202c368 (patch) | |
tree | 5e35d5b41aae961b37cf6632f60c42f51c7aa775 /ext | |
parent | 9b52ae2e6491bb5d6c59e1799449f6268baf6f89 (diff) |
* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
433 files changed, 9228 insertions, 9228 deletions
diff --git a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb index 8f4888725e..176ed84caf 100644 --- a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb +++ b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb @@ -17,7 +17,7 @@ module LUSolve end if nrmrow>zero then scales <<= one.div(nrmrow,prec) - else + else raise "Singular matrix" end end diff --git a/ext/bigdecimal/lib/bigdecimal/math.rb b/ext/bigdecimal/lib/bigdecimal/math.rb index f3248a3c5c..24e928b901 100644 --- a/ext/bigdecimal/lib/bigdecimal/math.rb +++ b/ext/bigdecimal/lib/bigdecimal/math.rb @@ -30,10 +30,10 @@ # module BigMath - # Computes the square root of x to the specified number of digits of + # Computes the square root of x to the specified number of digits of # precision. # - # BigDecimal.new('2').sqrt(16).to_s + # BigDecimal.new('2').sqrt(16).to_s # -> "0.14142135623730950488016887242096975E1" # def sqrt(x,prec) @@ -120,7 +120,7 @@ module BigMath y end - # Computes the value of e (the base of natural logarithms) raised to the + # Computes the value of e (the base of natural logarithms) raised to the # power of x, to the specified number of digits of precision. # # If x is infinite or NaN, returns NaN. @@ -148,7 +148,7 @@ module BigMath y end - # Computes the natural logarithm of x to the specified number of digits + # Computes the natural logarithm of x to the specified number of digits # of precision. # # Returns x if x is infinite or NaN. diff --git a/ext/bigdecimal/lib/bigdecimal/newton.rb b/ext/bigdecimal/lib/bigdecimal/newton.rb index 59ac0f7f04..d78c3d7647 100644 --- a/ext/bigdecimal/lib/bigdecimal/newton.rb +++ b/ext/bigdecimal/lib/bigdecimal/newton.rb @@ -1,5 +1,5 @@ # -# newton.rb +# newton.rb # # Solves the nonlinear algebraic equation system f = 0 by Newton's method. # This program is not dependent on BigDecimal. @@ -28,7 +28,7 @@ require "bigdecimal/jacobian" module Newton include LUSolve include Jacobian - + def norm(fv,zero=0.0) s = zero n = fv.size diff --git a/ext/curses/view.rb b/ext/curses/view.rb index 239f414b84..e033fd8ae2 100644 --- a/ext/curses/view.rb +++ b/ext/curses/view.rb @@ -67,10 +67,10 @@ while TRUE else break end - i += 1 + i += 1 end #wscrl(i) - + when "p" #when KEY_UP i = 0 while i < n @@ -79,8 +79,8 @@ while TRUE else break end - i += 1 - end + i += 1 + end #wscrl(-i) when "q" diff --git a/ext/digest/lib/digest.rb b/ext/digest/lib/digest.rb index 0c4ee3c2cc..e42f984f95 100644 --- a/ext/digest/lib/digest.rb +++ b/ext/digest/lib/digest.rb @@ -22,7 +22,7 @@ module Digest class ::Digest::Class # creates a digest object and reads a given file, _name_. - # + # # p Digest::SHA256.file("X11R6.8.2-src.tar.bz2").hexdigest # # => "f02e3c85572dc9ad7cb77c2a638e3be24cc1b5bea9fdbb0b0299c9668475c534" def self.file(name) diff --git a/ext/digest/lib/digest/hmac.rb b/ext/digest/lib/digest/hmac.rb index 0e3068b0c0..f50fef2948 100644 --- a/ext/digest/lib/digest/hmac.rb +++ b/ext/digest/lib/digest/hmac.rb @@ -2,8 +2,8 @@ # # An implementation of HMAC keyed-hashing algorithm # -# == Overview -# +# == Overview +# # This library adds a method named hmac() to Digest classes, which # creates a Digest class for calculating HMAC digests. # @@ -142,7 +142,7 @@ module TM_HMAC } } end -end +end class TC_HMAC_MD5 < Test::Unit::TestCase include TM_HMAC diff --git a/ext/dl/callback/mkcallback.rb b/ext/dl/callback/mkcallback.rb index a210a686e1..81bfb82e9a 100644 --- a/ext/dl/callback/mkcallback.rb +++ b/ext/dl/callback/mkcallback.rb @@ -206,7 +206,7 @@ Init_callback(void) VALUE tmp; VALUE rb_mDL = rb_path2class("DL"); - rb_dl_cb_call = rb_intern("call"); + rb_dl_cb_call = rb_intern("call"); tmp = rb_DLCdeclCallbackProcs = rb_ary_new(); rb_define_const(rb_mDL, "CdeclCallbackProcs", tmp); diff --git a/ext/dl/lib/dl/pack.rb b/ext/dl/lib/dl/pack.rb index 085b42bf17..d760edaab5 100644 --- a/ext/dl/lib/dl/pack.rb +++ b/ext/dl/lib/dl/pack.rb @@ -74,7 +74,7 @@ module DL def size() @size end - + def pack(ary) case SIZEOF_VOIDP when SIZEOF_LONG @@ -96,9 +96,9 @@ module DL raise(RuntimeError, "sizeof(void*)?") end end - + private - + def parse_types(types) @template = "" addr = 0 diff --git a/ext/dl/lib/dl/stack.rb b/ext/dl/lib/dl/stack.rb index f05a83e580..dc22378fcb 100644 --- a/ext/dl/lib/dl/stack.rb +++ b/ext/dl/lib/dl/stack.rb @@ -39,9 +39,9 @@ module DL raise(RuntimeError, "sizeof(void*)?") end end - + private - + def align(addr, align) d = addr % align if( d == 0 ) diff --git a/ext/dl/win32/lib/win32/registry.rb b/ext/dl/win32/lib/win32/registry.rb index 175b34cede..a2b69a08fe 100644 --- a/ext/dl/win32/lib/win32/registry.rb +++ b/ext/dl/win32/lib/win32/registry.rb @@ -11,10 +11,10 @@ It uses dl/import to call Win32 Registry APIs. reg['foo'] = 'bar' # write a value reg['foo', Win32::Registry::REG_SZ] = 'bar' # write a value with type reg.write('foo', Win32::Registry::REG_SZ, 'bar') # write a value - + reg.each_value { |name, type, data| ... } # Enumerate values reg.each_key { |key, wtime| ... } # Enumerate subkeys - + reg.delete_value(name) # Delete a value reg.delete_key(name) # Delete a subkey reg.delete_key(name, true) # Delete a subkey recursively @@ -35,26 +35,26 @@ It uses dl/import to call Win32 Registry APIs. Open the registry key ((|subkey|)) under ((|key|)). ((|key|)) is Win32::Registry object of parent key. You can use predefined key HKEY_* (see ((<constants>))) - + ((|desired|)) and ((|opt|)) is access mask and key option. For detail, see ((<MSDN Library|URL:http://msdn.microsoft.com/library/en-us/sysinfo/base/regopenkeyex.asp>)). - + If block is given, the key is closed automatically. --- Registry.create(key, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED) --- Registry.create(key, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED) { |reg| ... } Create or open the registry key ((|subkey|)) under ((|key|)). You can use predefined key HKEY_* (see ((<constants>))) - + If subkey is already exists, key is opened and Registry#((<created?>)) method will return false. - + If block is given, the key is closed automatically. --- Registry.expand_environ(str) Replace (({%\w+%})) into the environment value of ((|str|)). This method is used for REG_EXPAND_SZ. - + For detail, see ((<ExpandEnvironmentStrings|URL:http://msdn.microsoft.com/library/en-us/sysinfo/base/expandenvironmentstrings.asp>)) Win32 API. --- Registry.type2name(type) @@ -75,14 +75,14 @@ It uses dl/import to call Win32 Registry APIs. --- close Close key. - + After closed, most method raises error. --- read(name, *rtype) Read a registry value named ((|name|)) and return array of [ ((|type|)), ((|data|)) ]. When name is nil, the `default' value is read. - + ((|type|)) is value type. (see ((<Win32::Registry::Constants module>))) ((|data|)) is value data, its class is: :REG_SZ, REG_EXPAND_SZ @@ -93,19 +93,19 @@ It uses dl/import to call Win32 Registry APIs. Integer :REG_BINARY String (contains binary data) - + When ((|rtype|)) is specified, the value type must be included by ((|rtype|)) array, or TypeError is raised. --- self[name, *rtype] Read a registry value named ((|name|)) and return its value data. The class of value is same as ((<read>)) method returns. - + If the value type is REG_EXPAND_SZ, returns value data whose environment variables are replaced. If the value type is neither REG_SZ, REG_MULTI_SZ, REG_DWORD, REG_DWORD_BIG_ENDIAN, nor REG_QWORD, TypeError is raised. - + The meaning of ((|rtype|)) is same as ((<read>)) method. --- read_s(name) @@ -113,26 +113,26 @@ It uses dl/import to call Win32 Registry APIs. --- read_bin(name) Read a REG_SZ(read_s), REG_DWORD(read_i), or REG_BINARY(read_bin) registry value named ((|name|)). - + If the values type does not match, TypeError is raised. --- read_s_expand(name) Read a REG_SZ or REG_EXPAND_SZ registry value named ((|name|)). - + If the value type is REG_EXPAND_SZ, environment variables are replaced. Unless the value type is REG_SZ or REG_EXPAND_SZ, TypeError is raised. --- write(name, type, data) Write ((|data|)) to a registry value named ((|name|)). When name is nil, write to the `default' value. - + ((|type|)) is type value. (see ((<Registry::Constants module>))) Class of ((|data|)) must be same as which ((<read>)) method returns. --- self[name, wtype = nil] = value Write ((|value|)) to a registry value named ((|name|)). - + If ((|wtype|)) is specified, the value type is it. Otherwise, the value type is depend on class of ((|value|)): :Integer @@ -146,7 +146,7 @@ It uses dl/import to call Win32 Registry APIs. --- write_i(name, value) --- write_bin(name, value) Write ((|value|)) to a registry value named ((|name|)). - + The value type is REG_SZ(write_s), REG_DWORD(write_i), or REG_BINARY(write_bin). @@ -156,7 +156,7 @@ It uses dl/import to call Win32 Registry APIs. --- each_key { |subkey, wtime| ... } Enumerate subkeys. - + ((|subkey|)) is String which contains name of subkey. ((|wtime|)) is last write time as FILETIME (64-bit integer). (see ((<Registry.wtime2time>))) @@ -168,7 +168,7 @@ It uses dl/import to call Win32 Registry APIs. --- delete_key(name, recursive = false) Delete a subkey named ((|name|)) and all its values. - + If ((|recursive|)) is false, the subkey must not have subkeys. Otherwise, this method deletes all subkeys and values recursively. @@ -215,7 +215,7 @@ It uses dl/import to call Win32 Registry APIs. Length of security descriptor. :wtime Last write time as FILETIME(64-bit integer) - + For detail, see ((<RegQueryInfoKey|URL:http://msdn.microsoft.com/library/en-us/sysinfo/base/regqueryinfokey.asp>)) Win32 API. --- num_keys @@ -275,7 +275,7 @@ module Win32 HKEY_PERFORMANCE_NLSTEXT = 0x80000060 HKEY_CURRENT_CONFIG = 0x80000005 HKEY_DYN_DATA = 0x80000006 - + REG_NONE = 0 REG_SZ = 1 REG_EXPAND_SZ = 2 @@ -290,7 +290,7 @@ module Win32 REG_RESOURCE_REQUIREMENTS_LIST = 10 REG_QWORD = 11 REG_QWORD_LITTLE_ENDIAN = 11 - + STANDARD_RIGHTS_READ = 0x00020000 STANDARD_RIGHTS_WRITE = 0x00020000 KEY_QUERY_VALUE = 0x0001 @@ -305,7 +305,7 @@ module Win32 KEY_SET_VALUE | KEY_CREATE_SUB_KEY KEY_EXECUTE = KEY_READ KEY_ALL_ACCESS = KEY_READ | KEY_WRITE | KEY_CREATE_LINK - + REG_OPTION_RESERVED = 0x0000 REG_OPTION_NON_VOLATILE = 0x0000 REG_OPTION_VOLATILE = 0x0001 @@ -315,21 +315,21 @@ module Win32 REG_LEGAL_OPTION = REG_OPTION_RESERVED | REG_OPTION_NON_VOLATILE | REG_OPTION_CREATE_LINK | REG_OPTION_BACKUP_RESTORE | REG_OPTION_OPEN_LINK - + REG_CREATED_NEW_KEY = 1 REG_OPENED_EXISTING_KEY = 2 - + REG_WHOLE_HIVE_VOLATILE = 0x0001 REG_REFRESH_HIVE = 0x0002 REG_NO_LAZY_FLUSH = 0x0004 REG_FORCE_RESTORE = 0x0008 - + MAX_KEY_LENGTH = 514 MAX_VALUE_LENGTH = 32768 end include Constants include Enumerable - + # # Error # @@ -348,7 +348,7 @@ module Win32 end attr_reader :code end - + # # Predefined Keys # @@ -359,23 +359,23 @@ module Win32 @keyname = keyname @disposition = REG_OPENED_EXISTING_KEY end - + # Predefined keys cannot be closed def close raise Error.new(5) ## ERROR_ACCESS_DENIED end - + # Fake class for Registry#open, Registry#create def class Registry end - + # Make all Constants.constants.grep(/^HKEY_/) do |c| Registry.const_set c, new(Constants.const_get(c), c) end end - + # # Win32 APIs # @@ -398,37 +398,37 @@ module Win32 cfunc = extern fn, :stdcall const_set cfunc.name.intern, cfunc end - + module_function - + def check(result) raise Error, result, caller(2) if result != 0 end - + def packdw(dw) [dw].pack('V') end - + def unpackdw(dw) dw += [0].pack('V') dw.unpack('V')[0] end - + def packqw(qw) [ qw & 0xFFFFFFFF, qw >> 32 ].pack('VV') end - + def unpackqw(qw) qw = qw.unpack('VV') (qw[1] << 32) | qw[0] end - + def OpenKey(hkey, name, opt, desired) result = packdw(0) check RegOpenKeyExA.call(hkey, name, opt, desired, result) unpackdw(result) end - + def CreateKey(hkey, name, opt, desired) result = packdw(0) disp = packdw(0) @@ -436,14 +436,14 @@ module Win32 0, result, disp) [ unpackdw(result), unpackdw(disp) ] end - + def EnumValue(hkey, index) name = ' ' * Constants::MAX_KEY_LENGTH size = packdw(Constants::MAX_KEY_LENGTH) check RegEnumValueA.call(hkey, index, name, size, 0, 0, 0, 0) name[0, unpackdw(size)] end - + def EnumKey(hkey, index) name = ' ' * Constants::MAX_KEY_LENGTH size = packdw(Constants::MAX_KEY_LENGTH) @@ -451,7 +451,7 @@ module Win32 check RegEnumKeyExA.call(hkey, index, name, size, 0, 0, 0, wtime) [ name[0, unpackdw(size)], unpackqw(wtime) ] end - + def QueryValue(hkey, name) type = packdw(0) size = packdw(0) @@ -460,27 +460,27 @@ module Win32 check RegQueryValueExA.call(hkey, name, 0, type, data, size) [ unpackdw(type), data[0, unpackdw(size)] ] end - + def SetValue(hkey, name, type, data, size) check RegSetValueExA.call(hkey, name, 0, type, data, size) end - + def DeleteValue(hkey, name) check RegDeleteValue.call(hkey, name) end - + def DeleteKey(hkey, name) check RegDeleteKey.call(hkey, name) end - + def FlushKey(hkey) check RegFlushKey.call(hkey) end - + def CloseKey(hkey) check RegCloseKey.call(hkey) end - + def QueryInfoKey(hkey) subkeys = packdw(0) maxsubkeylen = packdw(0) @@ -496,14 +496,14 @@ module Win32 unpackdw(secdescs), unpackqw(wtime) ] end end - + # # utility functions # def self.expand_environ(str) str.gsub(/%([^%]+)%/) { ENV[$1] || ENV[$1.upcase] || $& } end - + @@type2name = { } %w[ REG_NONE REG_SZ REG_EXPAND_SZ REG_BINARY REG_DWORD @@ -513,24 +513,24 @@ module Win32 ].each do |type| @@type2name[Constants.const_get(type)] = type end - + def self.type2name(type) @@type2name[type] || type.to_s end - + def self.wtime2time(wtime) Time.at((wtime - 116444736000000000) / 10000000) end - + def self.time2wtime(time) time.to_i * 10000000 + 116444736000000000 end - + # # constructors # private_class_method :new - + def self.open(hkey, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED) subkey = subkey.chomp('\\') newkey = API.OpenKey(hkey.hkey, subkey, opt, desired) @@ -545,7 +545,7 @@ module Win32 obj end end - + def self.create(hkey, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED) newkey, disp = API.CreateKey(hkey.hkey, subkey, opt, desired) obj = new(newkey, hkey, subkey, disp) @@ -559,12 +559,12 @@ module Win32 obj end end - + # # finalizer # @@final = proc { |hkey| proc { API.CloseKey(hkey[0]) if hkey[0] } } - + # # initialize # @@ -577,18 +577,18 @@ module Win32 ObjectSpace.define_finalizer self, @@final.call(@hkeyfinal) end attr_reader :hkey, :parent, :keyname, :disposition - + # # attributes # def created? @disposition == REG_CREATED_NEW_KEY end - + def open? !@hkey.nil? end - + def name parent = self name = @keyname @@ -597,35 +597,35 @@ module Win32 end name end - + def inspect "\#<Win32::Registry key=#{name.inspect}>" end - + # # marshalling # def _dump(depth) raise TypeError, "can't dump Win32::Registry" end - + # # open/close # def open(subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED, &blk) self.class.open(self, subkey, desired, opt, &blk) end - + def create(subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED, &blk) self.class.create(self, subkey, desired, opt, &blk) end - + def close API.CloseKey(@hkey) @hkey = @parent = @keyname = nil @hkeyfinal[0] = nil end - + # # iterator # @@ -648,7 +648,7 @@ module Win32 index end alias each each_value - + def each_key index = 0 while true @@ -662,13 +662,13 @@ module Win32 end index end - + def keys keys_ary = [] each_key { |key,| keys_ary << key } keys_ary end - + # # reader # @@ -694,7 +694,7 @@ module Win32 raise TypeError, "Type #{type} is not supported." end end - + def [](name, *rtype) type, data = read(name, *rtype) case type @@ -706,11 +706,11 @@ module Win32 raise TypeError, "Type #{type} is not supported." end end - + def read_s(name) read(name, REG_SZ)[1] end - + def read_s_expand(name) type, data = read(name, REG_SZ, REG_EXPAND_SZ) if type == REG_EXPAND_SZ @@ -719,15 +719,15 @@ module Win32 data end end - + def read_i(name) read(name, REG_DWORD, REG_DWORD_BIG_ENDIAN, REG_QWORD)[1] end - + def read_bin(name) read(name, REG_BINARY)[1] end - + # # writer # @@ -750,7 +750,7 @@ module Win32 end API.SetValue(@hkey, name, type, data, data.length) end - + def []=(name, rtype, value = nil) if value write name, rtype, value @@ -768,19 +768,19 @@ module Win32 end value end - + def write_s(name, value) write name, REG_SZ, value.to_s end - + def write_i(name, value) write name, REG_DWORD, value.to_i end - + def write_bin(name, value) write name, REG_BINARY, value.to_s end - + # # delete # @@ -788,7 +788,7 @@ module Win32 API.DeleteValue(@hkey, name) end alias delete delete_value - + def delete_key(name, recursive = false) if recursive open(name, KEY_ALL_ACCESS) do |reg| @@ -810,14 +810,14 @@ module Win32 raise Error.new(5) ## ERROR_ACCESS_DENIED end end - + # # flush # def flush API.FlushKey @hkey end - + # # key information # diff --git a/ext/dl/win32/lib/win32/resolv.rb b/ext/dl/win32/lib/win32/resolv.rb index beb7f40ca4..a164fd54d2 100644 --- a/ext/dl/win32/lib/win32/resolv.rb +++ b/ext/dl/win32/lib/win32/resolv.rb @@ -9,13 +9,13 @@ require 'win32/registry' module Win32 module Resolv API = Registry::API - + def self.get_hosts_path path = get_hosts_dir path = File.expand_path('hosts', path) File.exist?(path) ? path : nil end - + def self.get_resolv_info search, nameserver = get_info if search.empty? @@ -47,7 +47,7 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT #==================================================================== module_eval <<-'__EOS__', __FILE__, __LINE__+1 TCPIP_NT = 'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters' - + class << self private def get_hosts_dir @@ -55,7 +55,7 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT reg.read_s_expand('DataBasePath') end end - + def get_info search = nil nameserver = [] @@ -65,7 +65,7 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT search = slist.split(/,\s*/) unless slist.empty? rescue Registry::Error end - + if add_search = search.nil? search = [] begin @@ -81,7 +81,7 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT rescue Registry::Error end end - + reg.open('Interfaces') do |h| h.each_key do |iface,| h.open(iface) do |regif| @@ -99,7 +99,7 @@ if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT end rescue Registry::Error end - + if add_search begin [ 'Domain', 'DhcpDomain' ].each do |key| @@ -129,16 +129,16 @@ else TCPIP_9X = 'SYSTEM\CurrentControlSet\Services\VxD\MSTCP' DHCP_9X = 'SYSTEM\CurrentControlSet\Services\VxD\DHCP' WINDOWS = 'Software\Microsoft\Windows\CurrentVersion' - + class << self # private - + def get_hosts_dir Registry::HKEY_LOCAL_MACHINE.open(WINDOWS) do |reg| reg.read_s_expand('SystemRoot') end end - + def get_info search = [] nameserver = [] @@ -155,13 +155,13 @@ else end rescue Registry::Error end - + dhcpinfo = get_dhcpinfo search.concat(dhcpinfo[0]) nameserver.concat(dhcpinfo[1]) [ search, nameserver ] end - + def get_dhcpinfo macaddrs = {} ipaddrs = {} @@ -170,7 +170,7 @@ else ipaddr.each { |ipaddr| ipaddrs[ipaddr] = 1 } end iflist = [ macaddrs, ipaddrs ] - + search = [] nameserver = [] version = -1 @@ -179,7 +179,7 @@ else version = API.unpackdw(reg.read_bin("Version")) rescue Registry::Error end - + reg.each_key do |key,| catch(:not_used) do reg.open(key) do |regdi| @@ -192,7 +192,7 @@ else end [ search, nameserver ] end - + def get_dhcpinfo_95(reg) dhcp = reg.read_bin("DhcpInfo") [ @@ -203,7 +203,7 @@ else reg.read_bin("OptionInfo"), ] end - + def get_dhcpinfo_98(reg) [ API.unpackdw(reg.read_bin("DhcpIPAddress")), @@ -213,7 +213,7 @@ else reg.read_bin("OptionInfo"), ] end - + def get_dhcpinfo_key(version, reg, iflist) info = case version when 1 @@ -234,7 +234,7 @@ else macaddr and macaddr.size == 6 and hwtype == 1 and iflist[0][macaddr] and iflist[1][ipaddr] - + size = opt.size idx = 0 while idx <= size @@ -258,7 +258,7 @@ else throw :not_used end end - + module WsControl module WSock32 extend DL::Importer @@ -266,7 +266,7 @@ else end WsControl = WSock32.extern "int WsControl(int, int, void *, void *, void *, void *", :stdcall WSAGetLastError = WSock32.extern "int WSAGetLastError(void)", :stdcall - + MAX_TDI_ENTITIES = 512 IPPROTO_TCP = 6 WSCTL_TCP_QUERY_INFORMATION = 0 @@ -282,7 +282,7 @@ else IF_MIB = 0x202 IF_MIB_STATS_ID = 1 IP_MIB_ADDRTABLE_ENTRY_ID = 0x102 - + def self.wsctl(tei_entity, tei_instance, toi_class, toi_type, toi_id, buffsize) @@ -308,7 +308,7 @@ else [ buff, API.unpackdw(buffsize) ] end private_class_method :wsctl - + def self.get_iflist # Get TDI Entity List entities, size = @@ -345,7 +345,7 @@ else end end end - + # Get IP Addresses entities.each do |entity, instance| if entity == CL_NL_ENTITY diff --git a/ext/dl/win32/lib/win32/sspi.rb b/ext/dl/win32/lib/win32/sspi.rb index ef90ae35a7..6022df96c3 100644 --- a/ext/dl/win32/lib/win32/sspi.rb +++ b/ext/dl/win32/lib/win32/sspi.rb @@ -2,7 +2,7 @@ # = win32/sspi.rb # # Copyright (c) 2006-2007 Justin Bailey -# +# # Written and maintained by Justin Bailey <jgbailey@gmail.com>. # # This program is free software. You can re-distribute and/or @@ -33,7 +33,7 @@ module Win32 ISC_REQ_PROMPT_FOR_CREDS = 0x00000040 ISC_REQ_CONNECTION = 0x00000800 - # Win32 API Functions. Uses Win32API to bind methods to constants contained in class. + # Win32 API Functions. Uses Win32API to bind methods to constants contained in class. module API # Can be called with AcquireCredentialsHandle.call() AcquireCredentialsHandle = Win32API.new("secur32", "AcquireCredentialsHandle", 'ppLpppppp', 'L') @@ -44,22 +44,22 @@ module Win32 # Can be called with FreeCredentialsHandle.call() FreeCredentialsHandle = Win32API.new("secur32", "FreeCredentialsHandle", 'P', 'L') end - + # SecHandle struct class SecurityHandle def upper @struct.unpack("LL")[1] end - + def lower @struct.unpack("LL")[0] end - + def to_p @struct ||= "\0" * 8 end end - + # Some familiar aliases for the SecHandle structure CredHandle = CtxtHandle = SecurityHandle @@ -71,13 +71,13 @@ module Win32 @struct ||= "\0" * 8 end end - + # Creates binary representaiton of a SecBufferDesc structure, # including the SecBuffer contained inside. class SecurityBuffer SECBUFFER_TOKEN = 2 # Security token - + TOKENBUFSIZE = 12288 SECBUFFER_VERSION = 0 @@ -86,22 +86,22 @@ module Win32 @bufferSize = @buffer.length @type = SECBUFFER_TOKEN end - + def bufferSize unpack @bufferSize end - + def bufferType unpack @type end - + def token unpack @buffer end - + def to_p # Assumption is that when to_p is called we are going to get a packed structure. Therefore, # set @unpacked back to nil so we know to unpack when accessors are next accessed. @@ -110,14 +110,14 @@ module Win32 # will not be able to unpack changes to the structure. Alternative, nested unpacks, # does not work (i.e. @struct.unpack("LLP12")[2].unpack("LLP12") results in "no associated pointer") @sec_buffer ||= [@bufferSize, @type, @buffer].pack("LLP") - @struct ||= [SECBUFFER_VERSION, 1, @sec_buffer].pack("LLP") + @struct ||= [SECBUFFER_VERSION, 1, @sec_buffer].pack("LLP") end - + private - + # Unpacks the SecurityBufferDesc structure into member variables. We # only want to do this once per struct, so the struct is deleted - # after unpacking. + # after unpacking. def unpack if ! @unpacked && @sec_buffer && @struct @bufferSize, @type = @sec_buffer.unpack("LL") @@ -128,30 +128,30 @@ module Win32 end end end - + # SEC_WINNT_AUTH_IDENTITY structure class Identity SEC_WINNT_AUTH_IDENTITY_ANSI = 0x1 attr_accessor :user, :domain, :password - + def initialize(user = nil, domain = nil, password = nil) @user = user @domain = domain @password = password @flags = SEC_WINNT_AUTH_IDENTITY_ANSI end - + def to_p - [@user, @user ? @user.length : 0, + [@user, @user ? @user.length : 0, @domain, @domain ? @domain.length : 0, @password, @password ? @password.length : 0, @flags].pack("PLPLPLL") - end + end end # Takes a return result from an SSPI function and interprets the value. - class SSPIResult + class SSPIResult # Good results SEC_E_OK = 0x00000000 SEC_I_CONTINUE_NEEDED = 0x00090312 @@ -172,27 +172,27 @@ module Win32 SEC_E_NOT_OWNER = 0x80090306 SEC_E_SECPKG_NOT_FOUND = 0x80090305 SEC_E_UNKNOWN_CREDENTIALS = 0x8009030D - + @@map = {} constants.each { |v| @@map[self.const_get(v.to_s)] = v } attr_reader :value - + def initialize(value) # convert to unsigned long value = [value].pack("L").unpack("L").first raise "#{value.to_s(16)} is not a recognized result" unless @@map.has_key? value @value = value end - + def to_s @@map[@value].to_s end - + def ok? @value == SEC_I_CONTINUE_NEEDED || @value == SEC_E_OK end - + def ==(other) if other.is_a?(SSPIResult) @value == other.value @@ -205,14 +205,14 @@ module Win32 end # Handles "Negotiate" type authentication. Geared towards authenticating with a proxy server over HTTP - class NegotiateAuth + class NegotiateAuth attr_accessor :credentials, :context, :contextAttributes, :user, :domain # Default request flags for SSPI functions REQUEST_FLAGS = ISC_REQ_CONFIDENTIALITY | ISC_REQ_REPLAY_DETECT | ISC_REQ_CONNECTION # NTLM tokens start with this header always. Encoding alone adds "==" and newline, so remove those - B64_TOKEN_PREFIX = ["NTLMSSP"].pack("m").delete("=\n") + B64_TOKEN_PREFIX = ["NTLMSSP"].pack("m").delete("=\n") # Given a connection and a request path, performs authentication as the current user and returns # the response from a GET request. The connnection should be a Net::HTTP object, and it should @@ -222,7 +222,7 @@ module Win32 def NegotiateAuth.proxy_auth_get(http, path, user = nil, domain = nil) raise "http must respond to :get" unless http.respond_to?(:get) nego_auth = self.new user, domain - + resp = http.get path, { "Proxy-Authorization" => "Negotiate " + nego_auth.get_initial_token } if resp["Proxy-Authenticate"] resp = http.get path, { "Proxy-Authorization" => "Negotiate " + nego_auth.complete_authentication(resp["Proxy-Authenticate"].split(" ").last.strip) } @@ -230,7 +230,7 @@ module Win32 resp end - + # Creates a new instance ready for authentication as the given user in the given domain. # Defaults to current user and domain as defined by ENV["USERDOMAIN"] and ENV["USERNAME"] if # no arguments are supplied. @@ -238,7 +238,7 @@ module Win32 if user.nil? && domain.nil? && ENV["USERNAME"].nil? && ENV["USERDOMAIN"].nil? raise "A username or domain must be supplied since they cannot be retrieved from the environment" end - + @user = user || ENV["USERNAME"] @domain = domain || ENV["USERDOMAIN"] end @@ -253,7 +253,7 @@ module Win32 @context = CtxtHandle.new @contextAttributes = "\0" * 4 - result = SSPIResult.new(API::InitializeSecurityContext.call(@credentials.to_p, nil, nil, + result = SSPIResult.new(API::InitializeSecurityContext.call(@credentials.to_p, nil, nil, REQUEST_FLAGS,0, SECURITY_NETWORK_DREP, nil, 0, @context.to_p, outputBuffer.to_p, @contextAttributes, TimeStamp.new.to_p)) if result.ok? then @@ -262,15 +262,15 @@ module Win32 raise "Error: #{result.to_s}" end end - - # Takes a token and gets the next token in the Negotiate authentication chain. Token can be Base64 encoded or not. + + # Takes a token and gets the next token in the Negotiate authentication chain. Token can be Base64 encoded or not. # The token can include the "Negotiate" header and it will be stripped. # Does not indicate if SEC_I_CONTINUE or SEC_E_OK was returned. # Token returned is Base64 encoded w/ all new lines removed. def complete_authentication(token) raise "This object is no longer usable because its resources have been freed." if @cleaned_up - # Nil token OK, just set it to empty string + # Nil token OK, just set it to empty string token = "" if token.nil? if token.include? "Negotiate" @@ -278,17 +278,17 @@ module Win32 token = token.split(" ").last end - if token.include? B64_TOKEN_PREFIX + if token.include? B64_TOKEN_PREFIX # indicates base64 encoded token token = token.strip.unpack("m")[0] end - + outputBuffer = SecurityBuffer.new - result = SSPIResult.new(API::InitializeSecurityContext.call(@credentials.to_p, @context.to_p, nil, - REQUEST_FLAGS, 0, SECURITY_NETWORK_DREP, SecurityBuffer.new(token).to_p, 0, + result = SSPIResult.new(API::InitializeSecurityContext.call(@credentials.to_p, @context.to_p, nil, + REQUEST_FLAGS, 0, SECURITY_NETWORK_DREP, SecurityBuffer.new(token).to_p, 0, @context.to_p, outputBuffer.to_p, @contextAttributes, TimeStamp.new.to_p)) - + if result.ok? then return encode_token(outputBuffer.token) else @@ -316,7 +316,7 @@ module Win32 @credentials = CredHandle.new ts = TimeStamp.new @identity = Identity.new @user, @domain - result = SSPIResult.new(API::AcquireCredentialsHandle.call(nil, "Negotiate", SECPKG_CRED_OUTBOUND, nil, @identity.to_p, + result = SSPIResult.new(API::AcquireCredentialsHandle.call(nil, "Negotiate", SECPKG_CRED_OUTBOUND, nil, @identity.to_p, nil, nil, @credentials.to_p, ts.to_p)) raise "Error acquire credentials: #{result}" unless result.ok? end diff --git a/ext/json/lib/json.rb b/ext/json/lib/json.rb index 3b0b711550..640baaebb6 100644 --- a/ext/json/lib/json.rb +++ b/ext/json/lib/json.rb @@ -48,7 +48,7 @@ require 'json/common' # * http://json.rubyforge.org # # == Usage -# +# # To use JSON you can # require 'json' # to load the installed variant (either the extension 'json' or the pure @@ -141,7 +141,7 @@ require 'json/common' # # JSON.parse json # # => [1, 2, {"a"=>3.141}, false, true, nil, "4..10"] -# +# # Note, that the range from the original data structure is a simple # string now. The reason for this is, that JSON doesn't support ranges # or arbitrary classes. In this case the json library falls back to call @@ -170,7 +170,7 @@ require 'json/common' # if the given class responds to the json_create class method. If so, it is # called with the JSON object converted to a Ruby hash. So a range can # be deserialised by implementing Range.json_create like this: -# +# # class Range # def self.json_create(o) # new(*o['data']) diff --git a/ext/json/lib/json/common.rb b/ext/json/lib/json/common.rb index 499fcc0dae..1bd0ad5fbd 100644 --- a/ext/json/lib/json/common.rb +++ b/ext/json/lib/json/common.rb @@ -160,7 +160,7 @@ module JSON # * *indent*: a string used to indent levels (default: ''), # * *space*: a string that is put after, a : or , delimiter (default: ''), # * *space_before*: a string that is put before a : pair delimiter (default: ''), - # * *object_nl*: a string that is put at the end of a JSON object (default: ''), + # * *object_nl*: a string that is put at the end of a JSON object (default: ''), # * *array_nl*: a string that is put at the end of a JSON array (default: ''), # * *check_circular*: true if checking for circular data structures # should be done (the default), false otherwise. diff --git a/ext/json/lib/json/editor.rb b/ext/json/lib/json/editor.rb index 12a7f94591..ad86fdb15e 100644 --- a/ext/json/lib/json/editor.rb +++ b/ext/json/lib/json/editor.rb @@ -48,14 +48,14 @@ module JSON # Opens an error dialog on top of _window_ showing the error message # _text_. def Editor.error_dialog(window, text) - dialog = MessageDialog.new(window, Dialog::MODAL, - MessageDialog::ERROR, + dialog = MessageDialog.new(window, Dialog::MODAL, + MessageDialog::ERROR, MessageDialog::BUTTONS_CLOSE, text) dialog.show_all dialog.run rescue TypeError - dialog = MessageDialog.new(Editor.window, Dialog::MODAL, - MessageDialog::ERROR, + dialog = MessageDialog.new(Editor.window, Dialog::MODAL, + MessageDialog::ERROR, MessageDialog::BUTTONS_CLOSE, text) dialog.show_all dialog.run @@ -67,8 +67,8 @@ module JSON # message _text_. If yes was answered _true_ is returned, otherwise # _false_. def Editor.question_dialog(window, text) - dialog = MessageDialog.new(window, Dialog::MODAL, - MessageDialog::QUESTION, + dialog = MessageDialog.new(window, Dialog::MODAL, + MessageDialog::QUESTION, MessageDialog::BUTTONS_YES_NO, text) dialog.show_all dialog.run do |response| @@ -465,7 +465,7 @@ module JSON add_separator add_item("Append new node", ?a, &method(:append_new_node)) add_item("Insert new node before", ?i, &method(:insert_new_node)) - add_separator + add_separator add_item("Collapse/Expand node (recursively)", ?e, &method(:collapse_expand)) @@ -504,7 +504,7 @@ module JSON # Revert the current JSON document in the editor to the saved version. def revert(item) window.instance_eval do - @filename and file_open(@filename) + @filename and file_open(@filename) end end @@ -666,7 +666,7 @@ module JSON collapse_all else self.expanded = true - expand_all + expand_all end end @@ -880,7 +880,7 @@ module JSON dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER) dialog.show_all self.focus = dialog - dialog.run do |response| + dialog.run do |response| if response == Dialog::RESPONSE_ACCEPT @key = key_input.text type = ALL_TYPES[@type = type_input.active] @@ -932,7 +932,7 @@ module JSON dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER) dialog.show_all self.focus = dialog - dialog.run do |response| + dialog.run do |response| if response == Dialog::RESPONSE_ACCEPT type = types[type_input.active] @content = case type @@ -973,7 +973,7 @@ module JSON dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER) dialog.show_all self.focus = dialog - dialog.run do |response| + dialog.run do |response| if response == Dialog::RESPONSE_ACCEPT return @order = order_input.text, reverse_checkbox.active? end @@ -1008,7 +1008,7 @@ module JSON dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER) dialog.show_all self.focus = dialog - dialog.run do |response| + dialog.run do |response| if response == Dialog::RESPONSE_ACCEPT begin return Regexp.new(regex_input.text, icase_checkbox.active? ? Regexp::IGNORECASE : 0) @@ -1207,7 +1207,7 @@ module JSON end end - # Save the current file as the filename + # Save the current file as the filename def file_save_as filename = select_file('Save as a JSON file') store_file(filename) @@ -1233,7 +1233,7 @@ module JSON rescue SystemCallError => e Editor.error_dialog(self, "Failed to store JSON file: #{e}!") end - + # Load the file named _filename_ into the editor as a JSON document. def load_file(filename) if filename @@ -1326,7 +1326,7 @@ module JSON dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER) dialog.show_all - dialog.run do |response| + dialog.run do |response| if response == Dialog::RESPONSE_ACCEPT return @location = location_input.text end diff --git a/ext/json/lib/json/pure/generator.rb b/ext/json/lib/json/pure/generator.rb index 9c7cfac0a2..4a9b05f545 100644 --- a/ext/json/lib/json/pure/generator.rb +++ b/ext/json/lib/json/pure/generator.rb @@ -86,7 +86,7 @@ module JSON # * *indent*: a string used to indent levels (default: ''), # * *space*: a string that is put after, a : or , delimiter (default: ''), # * *space_before*: a string that is put before a : pair delimiter (default: ''), - # * *object_nl*: a string that is put at the end of a JSON object (default: ''), + # * *object_nl*: a string that is put at the end of a JSON object (default: ''), # * *array_nl*: a string that is put at the end of a JSON array (default: ''), # * *check_circular*: true if checking for circular data structures # should be done (the default), false otherwise. @@ -148,13 +148,13 @@ module JSON end # Returns _true_, if _object_ was already seen during this generating - # run. + # run. def seen?(object) @seen.key?(object.__id__) end # Remember _object_, to find out if it was already encountered (if a - # cyclic data structure is if a cyclic data structure is rendered). + # cyclic data structure is if a cyclic data structure is rendered). def remember(object) @seen[object.__id__] = true end @@ -300,7 +300,7 @@ module JSON json_shift(state, depth + 1) << value.to_json(state, depth + 1) }.join(delim) result << state.array_nl if state - result << json_shift(state, depth) + result << json_shift(state, depth) result << ']' result end diff --git a/ext/json/lib/json/pure/parser.rb b/ext/json/lib/json/pure/parser.rb index 9c3fea91da..f5ff574d11 100644 --- a/ext/json/lib/json/pure/parser.rb +++ b/ext/json/lib/json/pure/parser.rb @@ -39,7 +39,7 @@ module JSON [^*/]| # normal chars /[^*]| # slashes that do not start a nested comment \*[^/]| # asterisks that do not end this comment - /(?=\*/) # single slash before this comment's end + /(?=\*/) # single slash before this comment's end )* \*/ # the End of this comment |[ \t\r\n]+ # whitespaces: space, horicontal tab, lf, cr @@ -116,7 +116,7 @@ module JSON ?n => "\n", ?r => "\r", ?t => "\t", - ?u => nil, + ?u => nil, }) def parse_string diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb index 81a8a4b72b..6230996876 100644 --- a/ext/nkf/lib/kconv.rb +++ b/ext/nkf/lib/kconv.rb @@ -47,7 +47,7 @@ module Kconv # # Public Methods # - + # call-seq: # Kconv.kconv(str, to_enc, from_enc=nil) # @@ -205,11 +205,11 @@ class String form_enc = self.encoding if !from_enc && self.encoding != Encoding.list[0] Kconv::kconv(self, to_enc, from_enc) end - + # # to Encoding # - + # call-seq: # String#tojis => string # diff --git a/ext/openssl/lib/openssl/x509-internal.rb b/ext/openssl/lib/openssl/x509-internal.rb index c0e6cdddfc..6aff4ca10d 100644 --- a/ext/openssl/lib/openssl/x509-internal.rb +++ b/ext/openssl/lib/openssl/x509-internal.rb @@ -26,7 +26,7 @@ module OpenSSL end def create_ext_from_array(ary) - raise ExtensionError, "unexpected array form" if ary.size > 3 + raise ExtensionError, "unexpected array form" if ary.size > 3 create_ext(ary[0], ary[1], ary[2]) end @@ -36,12 +36,12 @@ module OpenSSL value.strip! create_ext(oid, value) end - + def create_ext_from_hash(hash) create_ext(hash["oid"], hash["value"], hash["critical"]) end end - + class Extension def to_s # "oid = critical, value" str = self.oid @@ -49,7 +49,7 @@ module OpenSSL str << "critical, " if self.critical? str << self.value.gsub(/\n/, ", ") end - + def to_h # {"oid"=>sn|ln, "value"=>value, "critical"=>true|false} {"oid"=>self.oid,"value"=>self.value,"critical"=>self.critical?} end diff --git a/ext/pty/expect_sample.rb b/ext/pty/expect_sample.rb index 2a2e29f866..d3b072b83c 100644 --- a/ext/pty/expect_sample.rb +++ b/ext/pty/expect_sample.rb @@ -12,9 +12,9 @@ require 'expect' fnames = [] PTY.spawn("ftp ftp.ruby-lang.org") do |r_f,w_f,pid| w_f.sync = true - + $expect_verbose = false - + if !ENV['USER'].nil? username = ENV['USER'] elsif !ENV['LOGNAME'].nil? @@ -22,14 +22,14 @@ PTY.spawn("ftp ftp.ruby-lang.org") do |r_f,w_f,pid| else username = 'guest' end - + r_f.expect(/^(Name).*: |(word):|> /) do w_f.puts($1 ? "ftp" : $2 ? "#{username}@" : "cd pub/ruby") end r_f.expect("> ") do w_f.print "dir\n" end - + r_f.expect(/[^\-]> /) do |output| for x in output[0].split("\n") if x =~ /(ruby.*?\.tar\.gz)/ then diff --git a/ext/pty/script.rb b/ext/pty/script.rb index dbb933171f..903a6f75bd 100644 --- a/ext/pty/script.rb +++ b/ext/pty/script.rb @@ -18,7 +18,7 @@ PTY.spawn("/bin/csh") do |r_pty,w_pty,pid| w_pty.flush end end - + begin while true c = r_pty.sysread(512) diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb index 14ef99f034..5bbee39e06 100644 --- a/ext/ripper/lib/ripper/lexer.rb +++ b/ext/ripper/lib/ripper/lexer.rb @@ -173,7 +173,7 @@ class Ripper @tokens[@match.begin(n)...@match.end(n)].map {|pos,type,str| str } end end - + end end diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb index 8d325c941c..21a302fc8c 100644 --- a/ext/socket/lib/socket.rb +++ b/ext/socket/lib/socket.rb @@ -388,7 +388,7 @@ class Socket # yield socket and client address for each a connection accepted via given sockets. # # The arguments are a list of sockets. - # The individual argument should be a socket or an array of sockets. + # The individual argument should be a socket or an array of sockets. # # This method yields the block sequentially. # It means that the next connection is not accepted until the block returns. diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb index 13930b99ab..3074a8ff8d 100644 --- a/ext/socket/mkconstants.rb +++ b/ext/socket/mkconstants.rb @@ -417,14 +417,14 @@ MSG_SEND MSG_HAVEMORE MSG_RCVMORE MSG_COMPAT -MSG_PROXY -MSG_FIN -MSG_SYN -MSG_CONFIRM -MSG_RST -MSG_ERRQUEUE -MSG_NOSIGNAL -MSG_MORE +MSG_PROXY +MSG_FIN +MSG_SYN +MSG_CONFIRM +MSG_RST +MSG_ERRQUEUE +MSG_NOSIGNAL +MSG_MORE SOL_SOCKET SOL_IP diff --git a/ext/syslog/test.rb b/ext/syslog/test.rb index cfa33eff8f..5172aa981e 100644 --- a/ext/syslog/test.rb +++ b/ext/syslog/test.rb @@ -47,7 +47,7 @@ class TestSyslog < Test::Unit::TestCase Syslog.close # given parameters - Syslog.open("foo", Syslog::LOG_NDELAY | Syslog::LOG_PERROR, Syslog::LOG_DAEMON) + Syslog.open("foo", Syslog::LOG_NDELAY | Syslog::LOG_PERROR, Syslog::LOG_DAEMON) assert_equal('foo', Syslog.ident) assert_equal(Syslog::LOG_NDELAY | Syslog::LOG_PERROR, Syslog.options) diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb index 419c79ceda..ebc83a0c0b 100644 --- a/ext/tk/extconf.rb +++ b/ext/tk/extconf.rb @@ -42,7 +42,7 @@ unless is_win32 have_library("nsl", "t_open") have_library("socket", "socket") have_library("dl", "dlopen") - have_library("m", "log") + have_library("m", "log") end tk_idir, tk_ldir = dir_config("tk") @@ -185,7 +185,7 @@ def find_tk(tklib, stubs, version, *opt_paths) find_library("#{lib}#{ver}g", func, *paths) or find_library("#{lib}#{ver.delete('.')}g", func, *paths) or find_library("tk#{ver}", func, *paths) or - find_library("tk#{ver.delete('.')}", func, *paths) or + find_library("tk#{ver.delete('.')}", func, *paths) or find_library("tk#{ver}g", func, *paths) or find_library("tk#{ver.delete('.')}g", func, *paths) } || (!version && find_library(lib, func, *paths)) @@ -227,7 +227,7 @@ def find_tcltk_header(tclver, tkver) end def find_X11(*opt_paths) - default_paths = + default_paths = [ "/usr/X11/lib", "/usr/lib/X11", "/usr/X11R6/lib", "/usr/openwin/lib" ] paths = opt_paths.compact.concat(default_paths) st = find_library("X11", "XOpenDisplay", *paths) @@ -235,7 +235,7 @@ def find_X11(*opt_paths) puts("Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby == Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11.") end st -end +end def pthread_check() tcl_major_ver = nil @@ -295,9 +295,9 @@ def pthread_check() puts(%Q'\ ***************************************************************************** ** -** PTHREAD SUPPORT CHECK WARNING: +** PTHREAD SUPPORT CHECK WARNING: ** -** We cannot check the consistency of pthread support between Ruby +** We cannot check the consistency of pthread support between Ruby ** and the Tcl/Tk library in your environment (are you perhaps ** cross-compiling?). If pthread support for these 2 packages is ** inconsistent you may find you get errors when running Ruby/Tk @@ -314,7 +314,7 @@ def pthread_check() # tcl-thread is unknown if try_run(<<EOF) #include <tcl.h> -int main() { +int main() { Tcl_Interp *ip; ip = Tcl_CreateInterp(); exit((Tcl_Eval(ip, "set tcl_platform(threaded)") == TCL_OK)? 0: 1); @@ -340,7 +340,7 @@ EOF puts(%Q'\ ***************************************************************************** ** -** PTHREAD SUPPORT MODE WARNING: +** PTHREAD SUPPORT MODE WARNING: ** ** Ruby is compiled with --enable-pthread, but your Tcl/Tk library ** seems to be compiled without pthread support. Although you can @@ -349,9 +349,9 @@ EOF ** keep the current pthread support status, we recommend you reconfigure ** and recompile the libraries so that both or neither support pthreads. ** -** If you want change the status of pthread support, please recompile -** Ruby without "--enable-pthread" configure option or recompile Tcl/Tk -** with "--enable-threads" configure option (if your Tcl/Tk is later +** If you want change the status of pthread support, please recompile +** Ruby without "--enable-pthread" configure option or recompile Tcl/Tk +** with "--enable-threads" configure option (if your Tcl/Tk is later ** than or equal to Tcl/Tk 8.1). ** ***************************************************************************** @@ -374,9 +374,9 @@ EOF puts(%Q'\ ***************************************************************************** ** -** PTHREAD SUPPORT MODE ERROR: +** PTHREAD SUPPORT MODE ERROR: ** -** Ruby is not compiled with --enable-pthread, but your Tcl/Tk +** Ruby is not compiled with --enable-pthread, but your Tcl/Tk ** library seems to be compiled with pthread support. This ** combination may cause frequent hang or segmentation fault ** errors when Ruby/Tk is working. We recommend that you NEVER @@ -399,8 +399,8 @@ end tclver, tkver = check_tcltk_version(tcltk_version) -if ( tcltk_framework || - ( find_tcltk_header(tclver, tkver) && +if ( tcltk_framework || + ( find_tcltk_header(tclver, tkver) && ( !use_X || find_X11(x11_ldir2, x11_ldir) ) && find_tcl(tcllib, stubs, tclver, *tcl_ldir_list) && find_tk(tklib, stubs, tkver, *tk_ldir_list) ) ) diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb index 4bc89a8147..32aaa2099c 100644 --- a/ext/tk/lib/multi-tk.rb +++ b/ext/tk/lib/multi-tk.rb @@ -41,7 +41,7 @@ end ################################################ # use pseudo-toplevel feature of MultiTkIp ? -if (!defined?(Use_PseudoToplevel_Feature_of_MultiTkIp) || +if (!defined?(Use_PseudoToplevel_Feature_of_MultiTkIp) || Use_PseudoToplevel_Feature_of_MultiTkIp) module MultiTkIp_PseudoToplevel_Evaluable #def pseudo_toplevel_eval(body = Proc.new) @@ -73,9 +73,9 @@ if (!defined?(Use_PseudoToplevel_Feature_of_MultiTkIp) || def method_missing(id, *args) begin - has_top = (top = MultiTkIp.__getip.__pseudo_toplevel) && - top.respond_to?(:pseudo_toplevel_evaluable?) && - top.pseudo_toplevel_evaluable? && + has_top = (top = MultiTkIp.__getip.__pseudo_toplevel) && + top.respond_to?(:pseudo_toplevel_evaluable?) && + top.pseudo_toplevel_evaluable? && top.respond_to?(id) rescue Exception => e has_top = false @@ -142,13 +142,13 @@ class MultiTkIp # @@TK_CMD_TBL.instance_variable_set('@tbl', {}.taint) @@TK_CMD_TBL.instance_variable_set('@tbl', Hash.new{|hash,key| - fail IndexError, + fail IndexError, "unknown command ID '#{key}'" }.taint) class << @@TK_CMD_TBL allow = [ - '__send__', '__id__', 'freeze', 'inspect', 'kind_of?', 'object_id', + '__send__', '__id__', 'freeze', 'inspect', 'kind_of?', 'object_id', '[]', '[]=', 'delete', 'each', 'has_key?' ] instance_methods.each{|m| undef_method(m) unless allow.index(m.to_s)} @@ -187,7 +187,7 @@ class MultiTkIp def delete(idx, &blk) # if gets an entry, is permited to delete if self[idx] - @tbl.delete(idx) + @tbl.delete(idx) elsif blk blk.call(idx) else @@ -443,7 +443,7 @@ class MultiTkIp rescue SystemExit => e # delete IP unless @interp.deleted? - @slave_ip_tbl.each{|name, subip| + @slave_ip_tbl.each{|name, subip| _destroy_slaves_of_slaveIP(subip) begin # subip._eval_without_enc("foreach i [after info] {after cancel $i}") @@ -466,11 +466,11 @@ class MultiTkIp next if subip.deleted? end end - if subip.respond_to?(:safe_base?) && subip.safe_base? && + if subip.respond_to?(:safe_base?) && subip.safe_base? && !subip.deleted? # do 'exit' to call the delete_hook procedure begin - subip._eval_without_enc('exit') + subip._eval_without_enc('exit') rescue Exception end else @@ -545,11 +545,11 @@ class MultiTkIp next if subip.deleted? end end - if subip.respond_to?(:safe_base?) && subip.safe_base? && + if subip.respond_to?(:safe_base?) && subip.safe_base? && !subip.deleted? # do 'exit' to call the delete_hook procedure begin - subip._eval_without_enc('exit') + subip._eval_without_enc('exit') rescue Exception end else @@ -664,12 +664,12 @@ class MultiTkIp case cmd when 'set_safe_level' begin - safe_level = args[0] if safe_level < args[0] + safe_level = args[0] if safe_level < args[0] rescue Exception end when 'call_mainloop' thread = args.shift - _check_and_return(thread, + _check_and_return(thread, MultiTkIp_OK.new(_receiver_mainloop(*args))) else # ignore @@ -677,8 +677,8 @@ class MultiTkIp else # procedure - last_thread[thread] = _receiver_eval_proc(last_thread[thread], - safe_level, thread, + last_thread[thread] = _receiver_eval_proc(last_thread[thread], + safe_level, thread, cmd, *args) end end @@ -703,7 +703,7 @@ class MultiTkIp if @interp.deleted? thread.raise RuntimeError, 'the interpreter is already deleted' else - thread.raise RuntimeError, + thread.raise RuntimeError, 'the interpreter no longer receives command procedures' end end @@ -831,13 +831,13 @@ class MultiTkIp @pseudo_toplevel = [false, nil] def self.__pseudo_toplevel - Thread.current.group == ThreadGroup::Default && + Thread.current.group == ThreadGroup::Default && MultiTkIp.__getip == @@DEFAULT_MASTER && self.__pseudo_toplevel_evaluable? && @pseudo_toplevel[1] end def self.__pseudo_toplevel=(m) - unless (Thread.current.group == ThreadGroup::Default && + unless (Thread.current.group == ThreadGroup::Default && MultiTkIp.__getip == @@DEFAULT_MASTER) fail SecurityError, "no permission to manipulate" end @@ -861,7 +861,7 @@ class MultiTkIp end def self.__pseudo_toplevel_evaluable=(mode) - unless (Thread.current.group == ThreadGroup::Default && + unless (Thread.current.group == ThreadGroup::Default && MultiTkIp.__getip == @@DEFAULT_MASTER) fail SecurityError, "no permission to manipulate" end @@ -888,7 +888,7 @@ class MultiTkIp rescue @assign_request=>req begin req.ret[0] = req.target.instance_eval{ - @cmd_receiver, @receiver_watchdog = + @cmd_receiver, @receiver_watchdog = _create_receiver_and_watchdog(@safe_level[0]) @threadgroup.add @cmd_receiver @threadgroup.add @receiver_watchdog @@ -985,7 +985,7 @@ class MultiTkIp end ensure subclass.freeze - fail SecurityError, + fail SecurityError, "cannot create subclass of MultiTkIp on a untrusted ThreadGroup" end end @@ -994,9 +994,9 @@ class MultiTkIp ###################################### @@SAFE_OPT_LIST = [ - 'accessPath'.freeze, - 'statics'.freeze, - 'nested'.freeze, + 'accessPath'.freeze, + 'statics'.freeze, + 'nested'.freeze, 'deleteHook'.freeze ].freeze @@ -1009,7 +1009,7 @@ class MultiTkIp keys.each{|k,v| k_str = k.to_s if k_str == 'name' - name = v + name = v elsif k_str == 'safe' safe = v elsif @@SAFE_OPT_LIST.member?(k_str) @@ -1081,8 +1081,8 @@ class MultiTkIp # match display? if assoc_display != new_keys['display'] if optkeys.key?(:display) || optkeys.key?('display') - fail RuntimeError, - "conflicting 'display'=>#{new_keys['display']} " + + fail RuntimeError, + "conflicting 'display'=>#{new_keys['display']} " + "and display '#{assoc_display}' on 'use'=>#{new_keys['use']}" else new_keys['display'] = assoc_display @@ -1149,14 +1149,14 @@ class MultiTkIp fc.bindtags = fc.bindtags.unshift(tag) TkFrame.new(fc, :bd=>0){|f| - TkButton.new(f, - :text=>'Delete', :bd=>1, :padx=>2, :pady=>0, + TkButton.new(f, + :text=>'Delete', :bd=>1, :padx=>2, :pady=>0, :highlightthickness=>0, :command=>slave_delete_proc ).pack(:side=>:right, :fill=>:both) f.pack(:side=>:right, :fill=>:both, :expand=>true) } - TkLabel.new(fc, :text=>msg, :padx=>2, :pady=>0, + TkLabel.new(fc, :text=>msg, :padx=>2, :pady=>0, :anchor=>:w).pack(:side=>:left, :fill=>:both, :expand=>true) fc.pack(:side=>:bottom, :fill=>:x) @@ -1199,7 +1199,7 @@ class MultiTkIp if tk_opts.key?('use') @slave_ip_top[ip_name] = '' else - tk_opts, top_path = __create_safetk_frame(slave_ip, ip_name, app_name, + tk_opts, top_path = __create_safetk_frame(slave_ip, ip_name, app_name, tk_opts) @slave_ip_top[ip_name] = top_path end @@ -1209,11 +1209,11 @@ class MultiTkIp end if safe_opts.key?('deleteHook') || safe_opts.key?(:deleteHook) - @interp._eval("::safe::interpConfigure #{ip_name} " + + @interp._eval("::safe::interpConfigure #{ip_name} " + _keys2opts(safe_opts)) else - @interp._eval("::safe::interpConfigure #{ip_name} " + - _keys2opts(safe_opts) + '-deleteHook {' + + @interp._eval("::safe::interpConfigure #{ip_name} " + + _keys2opts(safe_opts) + '-deleteHook {' + TkComm._get_eval_string(proc{|slave| self._default_delete_hook(slave) }) + '}') @@ -1337,7 +1337,7 @@ class MultiTkIp # create slave-ip if safeip || master.safe? @safe_base = true - @interp, @ip_name = master.__create_safe_slave_obj(safe_opts, + @interp, @ip_name = master.__create_safe_slave_obj(safe_opts, name, tk_opts) # @interp_thread = nil if RUBY_VERSION < '1.9.0' ### !!!!!!!!!!! @interp_thread = nil unless WITH_RUBY_VM ### Ruby 1.9 !!!!!!!!!!! @@ -1358,7 +1358,7 @@ class MultiTkIp @safe_level = [master.safe_level] end end - @set_alias_proc = proc{|name| + @set_alias_proc = proc{|name| master._invoke('interp', 'alias', @ip_name, name, '', name) }.freeze end @@ -1385,7 +1385,7 @@ class MultiTkIp @@DEFAULT_MASTER.assign_receiver_and_watchdog(self) @@IP_TABLE[@threadgroup] = self - @@TK_TABLE_LIST.size.times{ + @@TK_TABLE_LIST.size.times{ (tbl = {}).tainted? || tbl.taint @tk_table_list << tbl } @@ -1453,7 +1453,7 @@ class MultiTkIp else ip = @@IP_TABLE[current.group] unless ip - fail SecurityError, + fail SecurityError, "cannot call Tk methods on #{Thread.current.inspect}" end ip @@ -1470,7 +1470,7 @@ class << MultiTkIp def new_master(safe=nil, keys={}) if MultiTkIp::WITH_RUBY_VM #### TODO !!!!!! - fail RuntimeError, + fail RuntimeError, 'sorry, still not support multiple master-interpreters on Ruby VM' end @@ -1621,7 +1621,7 @@ class MultiTkIp def slaves(all = false) raise SecurityError, "no permission to manipulate" unless self.manipulable? - @interp._invoke('interp','slaves').split.map!{|name| + @interp._invoke('interp','slaves').split.map!{|name| if @slave_ip_tbl.key?(name) @slave_ip_tbl[name] elsif all @@ -1668,7 +1668,7 @@ class MultiTkIp end def _add_new_tables - (@@TK_TABLE_LIST.size - @tk_table_list.size).times{ + (@@TK_TABLE_LIST.size - @tk_table_list.size).times{ (tbl = {}).tainted? || tbl.taint @tk_table_list << tbl } @@ -1705,7 +1705,7 @@ class MultiTkIp def _init_ip_internal(init_ip_env, add_tk_procs) #init_ip_env.each{|script| self.eval_proc{script.call(self)}} init_ip_env.each{|script| self._init_ip_env(script)} - add_tk_procs.each{|name, args, body| + add_tk_procs.each{|name, args, body| if master? @interp._invoke('proc', name, args, body) if args && body else @@ -1728,7 +1728,7 @@ class MultiTkIp __getip._tk_table_list[id] end def self.create_table - if __getip.slave? + if __getip.slave? begin raise SecurityError, "slave-IP has no permission creating a new table" rescue SecurityError => e @@ -1778,7 +1778,7 @@ class MultiTkIp end end - # @@IP_TABLE.each{|tg, ip| + # @@IP_TABLE.each{|tg, ip| # ip._init_ip_env(script) # } @@DEFAULT_MASTER.__init_ip_env__(@@IP_TABLE, script) @@ -1790,7 +1790,7 @@ class MultiTkIp else name = name.to_s @@ADD_TK_PROCS << [name, args, body] - @@IP_TABLE.each{|tg, ip| + @@IP_TABLE.each{|tg, ip| ip._add_tk_procs(name, args, body) } end @@ -1799,11 +1799,11 @@ class MultiTkIp def self.remove_tk_procs(*names) names.each{|name| name = name.to_s - @@ADD_TK_PROCS.delete_if{|elem| + @@ADD_TK_PROCS.delete_if{|elem| elem.kind_of?(Array) && elem[0].to_s == name } } - @@IP_TABLE.each{|tg, ip| + @@IP_TABLE.each{|tg, ip| ip._remove_tk_procs(*names) } end @@ -1903,7 +1903,7 @@ class MultiTkIp end def __pseudo_toplevel=(m) - unless (Thread.current.group == ThreadGroup::Default && + unless (Thread.current.group == ThreadGroup::Default && MultiTkIp.__getip == @@DEFAULT_MASTER) fail SecurityError, "no permission to manipulate" end @@ -1927,7 +1927,7 @@ class MultiTkIp end def __pseudo_toplevel_evaluable=(mode) - unless (Thread.current.group == ThreadGroup::Default && + unless (Thread.current.group == ThreadGroup::Default && MultiTkIp.__getip == @@DEFAULT_MASTER) fail SecurityError, "no permission to manipulate" end @@ -1947,7 +1947,7 @@ class MultiTkIp end # on IP thread - if @cmd_receiver == Thread.current || + if @cmd_receiver == Thread.current || (!req_val && TclTkLib.mainloop_thread? != false) # callback begin ret = cmd.call(safe_level, *args) @@ -1962,8 +1962,8 @@ class MultiTkIp ret = nil rescue Exception => e if $DEBUG - warn("Warning: " + e.class.inspect + - ((e.message.length > 0)? ' "' + e.message + '"': '') + + warn("Warning: " + e.class.inspect + + ((e.message.length > 0)? ' "' + e.message + '"': '') + " on " + self.inspect) end =begin @@ -1990,9 +1990,9 @@ class MultiTkIp rescue Exception => e # ignore if $DEBUG - warn("Warning: " + e.class.inspect + - ((e.message.length > 0)? ' "' + e.message + '"': '') + - " on " + self.inspect) + warn("Warning: " + e.class.inspect + + ((e.message.length > 0)? ' "' + e.message + '"': '') + + " on " + self.inspect) end return e end @@ -2021,9 +2021,9 @@ class MultiTkIp end rescue Exception => e if $DEBUG - warn("Warning: " + e.class.inspect + - ((e.message.length > 0)? ' "' + e.message + '"': '') + - " on " + self.inspect) + warn("Warning: " + e.class.inspect + + ((e.message.length > 0)? ' "' + e.message + '"': '') + + " on " + self.inspect) end return e end @@ -2048,8 +2048,8 @@ class MultiTkIp end def eval_proc(*args) - # The scope of the eval-block of 'eval_proc' method is different from - # the external. If you want to pass local values to the eval-block, + # The scope of the eval-block of 'eval_proc' method is different from + # the external. If you want to pass local values to the eval-block, # use arguments of eval_proc method. They are passed to block-arguments. if block_given? cmd = Proc.new @@ -2064,7 +2064,7 @@ class MultiTkIp backup_ip = current[:callback_ip] current[:callback_ip] = self begin - eval_proc_core(false, + eval_proc_core(false, proc{|safe, *params| $SAFE=safe if $SAFE < safe cmd.call(*params) @@ -2073,8 +2073,8 @@ class MultiTkIp current[:callback_ip] = backup_ip end else - eval_proc_core(true, - proc{|safe, *params| + eval_proc_core(true, + proc{|safe, *params| $SAFE=safe if $SAFE < safe Thread.new(*params, &cmd).value }, @@ -2094,8 +2094,8 @@ class MultiTkIp Thread.new{ eval_proc(cmd, *args) =begin - eval_proc_core(false, - proc{|safe, *params| + eval_proc_core(false, + proc{|safe, *params| $SAFE=safe if $SAFE < safe Thread.new(*params, &cmd).value }, @@ -2114,8 +2114,8 @@ class MultiTkIp raise RuntimeError, "A String object is expected for the 'cmd' argument" end - eval_proc_core(true, - proc{|safe| + eval_proc_core(true, + proc{|safe| Kernel.eval("$SAFE=#{safe} if $SAFE < #{safe};" << cmd, *eval_args) }) @@ -2128,8 +2128,8 @@ class MultiTkIp raise RuntimeError, "A String object is expected for the 'cmd' argument" end Thread.new{ - eval_proc_core(true, - proc{|safe| + eval_proc_core(true, + proc{|safe| Kernel.eval("$SAFE=#{safe} if $SAFE < #{safe};" << cmd, *eval_args) }) @@ -2494,7 +2494,7 @@ class MultiTkIp if $SAFE >= 4 _receiver_mainloop(check_root).join else - @cmd_queue.enq([@system, 'call_mainloop', + @cmd_queue.enq([@system, 'call_mainloop', Thread.current, check_root]) Thread.stop end @@ -2515,9 +2515,9 @@ class MultiTkIp self.delete rescue StandardError => e if $DEBUG - warn("Warning: " + e.class.inspect + - ((e.message.length > 0)? ' "' + e.message + '"': '') + - " on " + self.inspect) + warn("Warning: " + e.class.inspect + + ((e.message.length > 0)? ' "' + e.message + '"': '') + + " on " + self.inspect) end return e rescue Exception => e @@ -2536,9 +2536,9 @@ class MultiTkIp @interp.mainloop(check_root) rescue StandardError => e if $DEBUG - warn("Warning: " + e.class.inspect + - ((e.message.length > 0)? ' "' + e.message + '"': '') + - " on " + self.inspect) + warn("Warning: " + e.class.inspect + + ((e.message.length > 0)? ' "' + e.message + '"': '') + + " on " + self.inspect) end end =end @@ -2563,7 +2563,7 @@ class MultiTkIp @interp.mainloop(check_root) rescue StandardError => e if TclTkLib.mainloop_abort_on_exception != nil - #STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect, + #STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect, # " exception (ignore) : ", $!.message, "\n"); if $DEBUG warn("Warning: Tk mainloop receives " << e.class.inspect << @@ -2574,7 +2574,7 @@ class MultiTkIp rescue Exception => e =begin if TclTkLib.mainloop_abort_on_exception != nil - #STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect, + #STDERR.print("Warning: Tk mainloop receives ", $!.class.inspect, # " exception (ignore) : ", $!.message, "\n"); if $DEBUG warn("Warning: Tk mainloop receives " << e.class.inspect << @@ -2645,11 +2645,11 @@ class MultiTkIp next if subip.deleted? end end - if subip.respond_to?(:safe_base?) && subip.safe_base? && + if subip.respond_to?(:safe_base?) && subip.safe_base? && !subip.deleted? # do 'exit' to call the delete_hook procedure begin - subip._eval_without_enc('exit') + subip._eval_without_enc('exit') rescue Exception end else @@ -2943,7 +2943,7 @@ class MultiTkIp def def_alias(slave, new_cmd, org_cmd, *args) raise SecurityError, "no permission to manipulate" unless self.manipulable? - ret = @interp._invoke('interp', 'alias', _slavearg(slave), new_cmd, + ret = @interp._invoke('interp', 'alias', _slavearg(slave), new_cmd, '', org_cmd, *args) (ret == new_cmd)? self: nil end @@ -3036,7 +3036,7 @@ class MultiTkIp end keys << _slavearg(slave) if Tk::TCL_MAJOR_VERSION > 8 || - (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) + (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) keys << '--' end keys << cmd @@ -3057,7 +3057,7 @@ class MultiTkIp keys << _slavearg(slave) keys << '-global' if Tk::TCL_MAJOR_VERSION > 8 || - (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) + (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) keys << '--' end keys << cmd @@ -3133,11 +3133,11 @@ class MultiTkIp raise SecurityError, "no permission to manipulate" unless self.manipulable? if slot - num_or_str(@interp._invoke('interp', 'limit', _slavearg(slave), + num_or_str(@interp._invoke('interp', 'limit', _slavearg(slave), limit_type, slot)) else - l = @interp._split_tklist(@interp._invoke_without_enc('interp', 'limit', - _slavearg(slave), + l = @interp._split_tklist(@interp._invoke_without_enc('interp', 'limit', + _slavearg(slave), limit_type)) l.map!{|s| _fromUTF8(s)} r = {} @@ -3156,7 +3156,7 @@ class MultiTkIp def recursion_limit(slave = '', limit = None) raise SecurityError, "no permission to manipulate" unless self.manipulable? - number(@interp._invoke('interp', 'recursionlimit', + number(@interp._invoke('interp', 'recursionlimit', _slavearg(slave), limit)) end def self.recursion_limit(slave = '', limit = None) @@ -3266,7 +3266,7 @@ class MultiTkIp ip = MultiTkIp.__getip ip._eval('::safe::interpConfigure ' + @ip_name + ' ' + _keys2opts(slot)) else - ip._eval('::safe::interpConfigure ' + @ip_name + ' ' + + ip._eval('::safe::interpConfigure ' + @ip_name + ' ' + "-#{slot} #{_get_eval_string(value)}") end self @@ -3276,7 +3276,7 @@ class MultiTkIp ip = MultiTkIp.__getip ret = {} if slot - conf = _lst2ary(ip._eval("::safe::interpConfigure " + + conf = _lst2ary(ip._eval("::safe::interpConfigure " + @ip_name + " -#{slot}")) if conf[0] == '-deleteHook' =begin @@ -3292,7 +3292,7 @@ class MultiTkIp ret[conf[0][1..-1]] = conf[1] end else - Hash[*_lst2ary(ip._eval("::safe::interpConfigure " + + Hash[*_lst2ary(ip._eval("::safe::interpConfigure " + @ip_name))].each{|k, v| if k == '-deleteHook' =begin @@ -3437,7 +3437,7 @@ class MultiTkIp end module TkCore - if MultiTkIp::WITH_RUBY_VM && + if MultiTkIp::WITH_RUBY_VM && ! MultiTkIp::RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!! INTERP_THREAD = MultiTkIp::INTERP_THREAD INTERP_MUTEX = MultiTkIp::INTERP_MUTEX @@ -3450,7 +3450,7 @@ class MultiTkIp remove_const(:INTERP_ROOT_CHECK) end =end -if MultiTkIp::WITH_RUBY_VM && +if MultiTkIp::WITH_RUBY_VM && ! MultiTkIp::RUN_EVENTLOOP_ON_MAIN_THREAD ### check Ruby 1.9 !!!!!!! class MultiTkIp INTERP_THREAD = @@DEFAULT_MASTER.instance_variable_get('@interp_thread') diff --git a/ext/tk/lib/remote-tk.rb b/ext/tk/lib/remote-tk.rb index f267900d53..f56864687e 100644 --- a/ext/tk/lib/remote-tk.rb +++ b/ext/tk/lib/remote-tk.rb @@ -118,7 +118,7 @@ class RemoteTkIp @@DEFAULT_MASTER.assign_receiver_and_watchdog(self) @@IP_TABLE[@threadgroup] = self - @@TK_TABLE_LIST.size.times{ + @@TK_TABLE_LIST.size.times{ (tbl = {}).tainted? || tbl.taint @tk_table_list << tbl } @@ -158,13 +158,13 @@ class RemoteTkIp return nil if timeout < 1 @ret_val.value = '' - @interp._invoke('send', '-async', @remote, - 'send', '-async', Tk.appname, + @interp._invoke('send', '-async', @remote, + 'send', '-async', Tk.appname, "set #{@ret_val.id} ready") Tk.update if @ret_val != 'ready' (1..(timeout*5)).each{ - sleep 0.2 + sleep 0.2 Tk.update break if @ret_val == 'ready' } @@ -208,10 +208,10 @@ class RemoteTkIp cmds = @interp._merge_tklist(*TkUtil::_conv_args([], enc_mode, *cmds)) if @displayof if async - @interp.__invoke('send', '-async', '-displayof', @displayof, + @interp.__invoke('send', '-async', '-displayof', @displayof, '--', @remote, *cmds) else - @interp.__invoke('send', '-displayof', @displayof, + @interp.__invoke('send', '-displayof', @displayof, '--', @remote, *cmds) end else @@ -233,7 +233,7 @@ class RemoteTkIp def is_rubytk? return false if _appsend(false, false, 'info', 'command', 'ruby') == "" - [ _appsend(false, false, 'ruby', 'RUBY_VERSION'), + [ _appsend(false, false, 'ruby', 'RUBY_VERSION'), _appsend(false, false, 'set', 'tk_patchLevel') ] end @@ -302,7 +302,7 @@ class RemoteTkIp raise SecurityError, "no permission to manipulate" unless self.manipulable? if @displayof - lst = @interp._invoke_without_enc('winfo', 'interps', + lst = @interp._invoke_without_enc('winfo', 'interps', '-displayof', @displayof) else lst = @interp._invoke_without_enc('winfo', 'interps') diff --git a/ext/tk/lib/tcltk.rb b/ext/tk/lib/tcltk.rb index c875a3503e..2df3b2fd8c 100644 --- a/ext/tk/lib/tcltk.rb +++ b/ext/tk/lib/tcltk.rb @@ -84,7 +84,7 @@ end # class TclTkInterpreter: tcl/tk interpreter class TclTkInterpreter - # initialize(): + # initialize(): def initialize() # generate interpreter object @ip = TclTkIp.new() @@ -181,7 +181,7 @@ end # class TclTkObject: base class of the tcl/tk objects class TclTkObject - # initialize(ip, exp): + # initialize(ip, exp): # ip: interpreter(TclTkIp) # exp: tcl/tk representation def initialize(ip, exp) @@ -211,7 +211,7 @@ end # class TclTkLibCommand: tcl/tk commands in the library class TclTkLibCommand < TclTkCommand - # initialize(ip, name): + # initialize(ip, name): # ip: interpreter(TclTkInterpreter) # name: command name (String) def initialize(ip, name) @@ -222,7 +222,7 @@ end # class TclTkVariable: tcl/tk variable class TclTkVariable < TclTkObject - # initialize(interp, dat): + # initialize(interp, dat): # interp: interpreter(TclTkInterpreter) # dat: the value to set(String) # if nil, not initialize variable @@ -255,7 +255,7 @@ end # class TclTkWidget: tcl/tk widget class TclTkWidget < TclTkCommand - # initialize(*args): + # initialize(*args): # *args: parameters def initialize(*args) if args[0].kind_of?(TclTkIp) @@ -281,7 +281,7 @@ class TclTkWidget < TclTkCommand # interp: interpreter(TclTkInterpreter) # parent: parent widget # command: widget generating tk command(label Åù) - # *args: argument to the command + # *args: argument to the command interp, parent, command, *args = args # generate widget name @@ -303,14 +303,14 @@ end # class TclTkCallback: tcl/tk callbacks class TclTkCallback < TclTkObject - # initialize(interp, pr, arg): + # initialize(interp, pr, arg): # interp: interpreter(TclTkInterpreter) # pr: callback procedure(Proc) # arg: string to pass as block parameters of pr # bind command of tcl/tk uses % replacement for parameters # pr can receive replaced data using block parameter # its format is specified by arg string - # You should not specify arg for the command like + # You should not specify arg for the command like # scrollbar with -command option, which receives parameters # without specifying any replacement def initialize(interp, pr, arg = nil) @@ -347,7 +347,7 @@ end # class TclTkImage: tcl/tk images class TclTkImage < TclTkCommand - # initialize(interp, t, *args): + # initialize(interp, t, *args): # generating image is done by TclTkImage.new() # destrying is done by image delete (inconsistent, sigh) # interp: interpreter(TclTkInterpreter) diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 85c1e76f83..49e4ca2564 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -76,7 +76,7 @@ module TkComm unless const_defined?(:GET_CONFIGINFO_AS_ARRAY) # GET_CONFIGINFO_AS_ARRAY = false => returns a Hash { opt =>val, ... } # true => returns an Array [[opt,val], ... ] - # val is a list which includes resource info. + # val is a list which includes resource info. GET_CONFIGINFO_AS_ARRAY = true end unless const_defined?(:GET_CONFIGINFOwoRES_AS_ARRAY) @@ -177,7 +177,7 @@ module TkComm #{classname_def} end" end - Object.class_eval "#{gen_class_name}.new('widgetname'=>'#{path}', + Object.class_eval "#{gen_class_name}.new('widgetname'=>'#{path}', 'without_creating'=>true)" =end base = Object @@ -192,7 +192,7 @@ module TkComm #{klass}" end } - base.class_eval "#{gen_class_name}.new('widgetname'=>'#{path}', + base.class_eval "#{gen_class_name}.new('widgetname'=>'#{path}', 'without_creating'=>true)" end private :_genobj_for_tkwidget @@ -233,7 +233,7 @@ module TkComm val.to_i when /\A\.\S*\z/ #Tk_WINDOWS[val] ? Tk_WINDOWS[val] : _genobj_for_tkwidget(val) - TkCore::INTERP.tk_windows[val]? + TkCore::INTERP.tk_windows[val]? TkCore::INTERP.tk_windows[val] : _genobj_for_tkwidget(val) when /\Ai(_\d+_)?\d+\z/ TkImage::Tk_IMGTBL.mutex.synchronize{ @@ -438,7 +438,7 @@ else def tk_split_list(str, depth=0, src_enc=true, dst_enc=true) return [] if str == "" - tk_split_escstr(str).collect{|token| + tk_split_escstr(str).collect{|token| tk_split_sublist(token, depth - 1) } end @@ -584,7 +584,7 @@ end def window(val) if val =~ /^\./ #Tk_WINDOWS[val]? Tk_WINDOWS[val] : _genobj_for_tkwidget(val) - TkCore::INTERP.tk_windows[val]? + TkCore::INTERP.tk_windows[val]? TkCore::INTERP.tk_windows[val] : _genobj_for_tkwidget(val) else nil @@ -620,7 +620,7 @@ end def subst(str, *opts) # opts := :nobackslashes | :nocommands | novariables - tk_call('subst', + tk_call('subst', *(opts.collect{|opt| opt = opt.to_s (opt[0] == ?-)? opt: '-' << opt @@ -678,7 +678,7 @@ end else str = str.to_s() || '' unless str.kind_of? String - fail RuntimeError, "fail to convert the object to a string" + fail RuntimeError, "fail to convert the object to a string" end str = _toUTF8(str) if enc_mode end @@ -717,7 +717,7 @@ end begin obj = obj.to_s || '' rescue - fail RuntimeError, "fail to convert object '#{obj}' to string" + fail RuntimeError, "fail to convert object '#{obj}' to string" end (enc_mode)? _toUTF8(obj): obj end @@ -936,7 +936,7 @@ module TkComm def _bind_core(mode, what, context, cmd, *args) id = install_bind(cmd, *args) if cmd begin - tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>", + tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>", mode + id])) rescue uninstall_cmd(id) if cmd @@ -995,7 +995,7 @@ module TkComm def _bind_core_for_event_class(klass, mode, what, context, cmd, *args) id = install_bind_for_event_class(klass, cmd, *args) if cmd begin - tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>", + tk_call_without_enc(*(what + ["<#{tk_event_sequence(context)}>", mode + id])) rescue uninstall_cmd(id) if cmd @@ -1021,8 +1021,8 @@ module TkComm private :tk_event_sequence private :_bind_core, :_bind, :_bind_append, :_bind_remove, :_bindinfo - private :_bind_core_for_event_class, :_bind_for_event_class, - :_bind_append_for_event_class, :_bind_remove_for_event_class, + private :_bind_core_for_event_class, :_bind_for_event_class, + :_bind_append_for_event_class, :_bind_remove_for_event_class, :_bindinfo_for_event_class #def bind(tagOrClass, context, cmd=Proc.new, *args) @@ -1133,11 +1133,11 @@ module TkCore if WITH_RUBY_VM ### check Ruby 1.9 !!!!!!! # *** NEED TO FIX *** ip = TclTkIp.new(name, opts) - if ip._invoke_without_enc('tk', 'windowingsystem') == 'aqua' && + if ip._invoke_without_enc('tk', 'windowingsystem') == 'aqua' && (TclTkLib.get_version <=> [8,4,TclTkLib::RELEASE_TYPE::FINAL,9]) > 0 # *** KNOWN BUG *** - # Main event loop thread of TkAqua (> Tk8.4.9) must be the main - # application thread. So, ruby1.9 users must call Tk.mainloop on + # Main event loop thread of TkAqua (> Tk8.4.9) must be the main + # application thread. So, ruby1.9 users must call Tk.mainloop on # the main application thread. RUN_EVENTLOOP_ON_MAIN_THREAD = true INTERP = ip @@ -1318,7 +1318,7 @@ module TkCore def INTERP.remove_tk_procs(*names) names.each{|name| name = name.to_s - @add_tk_procs.delete_if{|elem| + @add_tk_procs.delete_if{|elem| elem.kind_of?(Array) && elem[0].to_s == name } self._invoke('rename', name, '') @@ -1337,7 +1337,7 @@ module TkCore end WIDGET_DESTROY_HOOK = '<WIDGET_DESTROY_HOOK>' - INTERP._invoke_without_enc('event', 'add', + INTERP._invoke_without_enc('event', 'add', "<#{WIDGET_DESTROY_HOOK}>", '<Destroy>') INTERP._invoke_without_enc('bind', 'all', "<#{WIDGET_DESTROY_HOOK}>", install_cmd(proc{|path| @@ -1354,7 +1354,7 @@ module TkCore end }) << ' %W') - INTERP.add_tk_procs(TclTkLib::FINALIZE_PROC_NAME, '', + INTERP.add_tk_procs(TclTkLib::FINALIZE_PROC_NAME, '', "catch { bind all <#{WIDGET_DESTROY_HOOK}> {} }") INTERP.add_tk_procs('rb_out', 'ns args', <<-'EOL') @@ -1457,10 +1457,10 @@ module TkCore fail(e) rescue Exception => e begin - msg = _toUTF8(e.class.inspect) + ': ' + - _toUTF8(e.message) + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - _toUTF8(e.backtrace.join("\n")) + + 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 >-------" if TkCore::WITH_ENCODING msg.force_encoding('utf-8') @@ -1468,9 +1468,9 @@ module TkCore msg.instance_variable_set(:@encoding, 'utf-8') end rescue Exception - msg = e.class.inspect + ': ' + e.message + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - e.backtrace.join("\n") + + msg = e.class.inspect + ': ' + e.message + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + e.backtrace.join("\n") + "\n---< backtrace of Tk side >-------" end # TkCore::INTERP._set_global_var('errorInfo', msg) @@ -1483,15 +1483,15 @@ module TkCore # arg = tk_split_list(arg_str) arg = tk_split_simplelist(arg_str) #_get_eval_string(TkUtil.eval_cmd(Tk_CMDTBL[arg.shift], *arg)) - #_get_eval_string(TkUtil.eval_cmd(TkCore::INTERP.tk_cmd_tbl[arg.shift], + #_get_eval_string(TkUtil.eval_cmd(TkCore::INTERP.tk_cmd_tbl[arg.shift], # *arg)) # TkCore::INTERP.tk_cmd_tbl[arg.shift].call(*arg) begin TkCore::INTERP.tk_cmd_tbl[arg.shift].call(*arg) rescue Exception => e - raise(e, e.class.inspect + ': ' + e.message + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - e.backtrace.join("\n") + + raise(e, e.class.inspect + ': ' + e.message + "\n" + + "\n---< backtrace of Ruby side >-----\n" + + e.backtrace.join("\n") + "\n---< backtrace of Tk side >-------") end #=begin @@ -1509,7 +1509,7 @@ module TkCore # cb_obj.call(*arg) # rescue # trace = $!.backtrace -# raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" + +# raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" + # "\tfrom #{trace[1..pos].join("\n\tfrom ")}" # end # end @@ -1703,11 +1703,11 @@ module TkCore TclTkLib.mainloop(check_root) elsif TkCore::RUN_EVENTLOOP_ON_MAIN_THREAD - # if TclTkLib::WINDOWING_SYSTEM == 'aqua' && + # if TclTkLib::WINDOWING_SYSTEM == 'aqua' && if TkCore::INTERP._invoke_without_enc('tk','windowingsystem')=='aqua' && - Thread.current != Thread.main && + Thread.current != Thread.main && (TclTkLib.get_version <=> [8,4,TclTkLib::RELEASE_TYPE::FINAL,9]) > 0 - raise RuntimeError, + raise RuntimeError, "eventloop on TkAqua ( > Tk8.4.9 ) works on the main thread only" end TclTkLib.mainloop(check_root) @@ -1810,11 +1810,11 @@ module TkCore if context.kind_of?(TkEvent::Event) context.generate(win, ((keys)? keys: {})) elsif keys - tk_call_without_enc('event', 'generate', win, - "<#{tk_event_sequence(context)}>", + tk_call_without_enc('event', 'generate', win, + "<#{tk_event_sequence(context)}>", *hash_kv(keys, true)) else - tk_call_without_enc('event', 'generate', win, + tk_call_without_enc('event', 'generate', win, "<#{tk_event_sequence(context)}>") end nil @@ -1919,9 +1919,9 @@ module TkCore # err = $! begin args.unshift "unknown" - #res = INTERP._invoke(*args).taint - #res = INTERP._invoke(enc_mode, *args) - res = _ip_invoke_core(enc_mode, *args) + #res = INTERP._invoke(*args).taint + #res = INTERP._invoke(enc_mode, *args) + res = _ip_invoke_core(enc_mode, *args) # >>>>> _invoke returns a TAINTED string <<<<< rescue StandardError => err2 fail err2 unless /^invalid command/ =~ err2.message @@ -2003,7 +2003,7 @@ module Tk TK_MAJOR_VERSION = major.to_i TK_MINOR_VERSION = minor.to_i - JAPANIZED_TK = (INTERP._invoke_without_enc("info", "commands", + JAPANIZED_TK = (INTERP._invoke_without_enc("info", "commands", "kanji") != "").freeze def Tk.const_missing(sym) @@ -2032,14 +2032,14 @@ module Tk fail SecurityError, "can't get #{sym} when $SAFE >= 4" end INTERP._invoke_without_enc('global', 'tcl_platform') - Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get', + Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get', 'tcl_platform'))] when :ENV INTERP._invoke_without_enc('global', 'env') Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', 'env'))] - #when :AUTO_PATH #<=== + #when :AUTO_PATH #<=== # tk_split_simplelist(INTERP._invoke('set', 'auto_path')) #when :AUTO_OLDPATH @@ -2057,7 +2057,7 @@ module Tk var_nam = 'tkPriv' end INTERP._invoke_without_enc('global', var_nam) - Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', + Hash[*tk_split_simplelist(INTERP._invoke('array', 'get', var_nam))].each{|k,v| k.freeze case v @@ -2284,9 +2284,9 @@ module Tk end # NOTE:: - # If no eventloop-thread is running, "thread_update" method is same - # to "update" method. Else, "thread_update" method waits to complete - # idletask operation on the eventloop-thread. + # If no eventloop-thread is running, "thread_update" method is same + # to "update" method. Else, "thread_update" method waits to complete + # idletask operation on the eventloop-thread. def Tk.thread_update(idle=nil) if idle tk_call_without_enc('thread_update', 'idletasks') @@ -2358,7 +2358,7 @@ module Tk def Tk.add_kinsoku(chars, mode='both') begin if /^8\.*/ === TK_VERSION && JAPANIZED_TK - tk_split_simplelist(tk_call('kinsoku', 'add', mode, + tk_split_simplelist(tk_call('kinsoku', 'add', mode, *(chars.split('')))) else [] @@ -2370,7 +2370,7 @@ module Tk def Tk.delete_kinsoku(chars, mode='both') begin if /^8\.*/ === TK_VERSION && JAPANIZED_TK - tk_split_simplelist(tk_call('kinsoku', 'delete', mode, + tk_split_simplelist(tk_call('kinsoku', 'delete', mode, *(chars.split('')))) end rescue @@ -2380,7 +2380,7 @@ module Tk def Tk.toUTF8(str, encoding = nil) _toUTF8(str, encoding) end - + def Tk.fromUTF8(str, encoding = nil) _fromUTF8(str, encoding) end @@ -2437,11 +2437,11 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) ENCODING_TABLE = TkCore::INTERP.encoding_table =begin ENCODING_TABLE = { - 'binary' => BINARY, - # 'UNKNOWN-8BIT' => UNKNOWN, + 'binary' => BINARY, + # 'UNKNOWN-8BIT' => UNKNOWN, } - list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], + list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], ENCNAMES_CMD[1]) TkCore::INTERP._split_tklist(list).each{|name| begin @@ -2489,7 +2489,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) end # Is it new ? - list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], + list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], ENCNAMES_CMD[1]) TkComm.simplelist(list).each{|name| if ((enc == RubyEncoding.find(name)) rescue false) @@ -2506,7 +2506,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) # Is it new ? if (enc_obj = (RubyEncoding.find(name) rescue false)) - list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], + list = TkCore::INTERP._invoke_without_enc(ENCNAMES_CMD[0], ENCNAMES_CMD[1]) if TkComm.simplelist(list).index(name) # Tk's encoding name ? @@ -2660,7 +2660,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) else str.instance_variable_set('@encoding', 'binary') end - ret = TkCore::INTERP._invoke_without_enc('encoding', 'convertfrom', + ret = TkCore::INTERP._invoke_without_enc('encoding', 'convertfrom', enc, str) if TkCore::WITH_ENCODING ret.force_encoding('utf-8') @@ -2674,7 +2674,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) def encoding_convertto(str, enc=nil) # str must be a UTF-8 string enc = encoding_system_name unless enc - ret = TkCore::INTERP._invoke_without_enc('encoding', 'convertto', + ret = TkCore::INTERP._invoke_without_enc('encoding', 'convertto', enc, str) #ret.instance_variable_set('@encoding', 'binary') if TkCore::WITH_ENCODING @@ -2758,7 +2758,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) enc_name ||= str.instance_variable_get(:@encoding) - enc_name ||= + enc_name ||= Tk::Encoding::ENCODING_TABLE.get_name(str.encoding) rescue nil if enc_name @@ -2775,7 +2775,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) end end - #enc_name ||= + #enc_name ||= # Tk::Encoding::ENCODING_TABLE.get_name(Tk.encoding) rescue nil enc_name ||= Tk::Encoding::ENCODING_TABLE.get_name(nil) @@ -2796,7 +2796,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) def _fromUTF8(str, enc = nil) # str must be UTF-8 or binary. enc_name = str.instance_variable_get(:@encoding) - enc_name ||= + enc_name ||= Tk::Encoding::ENCODING_TABLE.get_name(str.encoding) rescue nil # is 'binary' encoding? @@ -2986,7 +2986,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) end # estimate encoding - unless TkCore::WITH_ENCODING + unless TkCore::WITH_ENCODING case $KCODE when /^e/i # EUC Tk.encoding = 'euc-jp' @@ -3094,7 +3094,7 @@ if (/^(8\.[1-9]|9\.|[1-9][0-9])/ =~ Tk::TCL_VERSION && !Tk::JAPANIZED_TK) enc_name = nil rescue ArgumentError enc_name = nil - fail ArgumentError, + fail ArgumentError, "DEFAULT_TK_ENCODING has an unknown encoding #{default_def}" end @@ -3271,19 +3271,19 @@ module TkTreatFont if key pathname = [win, tag, key].join(';') - TkFont.used_on(pathname) || + TkFont.used_on(pathname) || TkFont.init_widget_font(pathname, *__confinfo_cmd) elsif optkeys.size == 1 pathname = [win, tag, optkeys[0]].join(';') - TkFont.used_on(pathname) || + TkFont.used_on(pathname) || TkFont.init_widget_font(pathname, *__confinfo_cmd) else fonts = {} optkeys.each{|key| key = key.to_s pathname = [win, tag, key].join(';') - fonts[key] = - TkFont.used_on(pathname) || + fonts[key] = + TkFont.used_on(pathname) || TkFont.init_widget_font(pathname, *__confinfo_cmd) } fonts @@ -3313,8 +3313,8 @@ module TkTreatFont next else if fnt - if (slot.key?(l_optkey) || - slot.key?(a_optkey) || + if (slot.key?(l_optkey) || + slot.key?(a_optkey) || slot.key?(k_optkey)) fnt = TkFont.new(fnt) @@ -3325,7 +3325,7 @@ module TkTreatFont fnt.latin_replace(lfnt) if lfnt fnt.kanji_replace(kfnt) if kfnt - fnt.call_font_configure([pathname, optkey], + fnt.call_font_configure([pathname, optkey], *(__config_cmd << {})) next else @@ -3350,7 +3350,7 @@ module TkTreatFont kfnt = slot.delete(k_optkey) if lfnt && kfnt - TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey], + TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey], *(__config_cmd << {})) elsif lfnt latinfont_configure([lfnt, optkey]) @@ -3508,7 +3508,7 @@ module TkTreatFont def latinfont_copy(win, wintag=nil, winkey=nil, targetkey=nil) if targetkey - fontobj(targetkey).dup.call_font_configure([__pathname, targetkey], + fontobj(targetkey).dup.call_font_configure([__pathname, targetkey], *(__config_cmd << {})) else fontobj.dup.call_font_configure(__pathname, *(__config_cmd << {})) @@ -3533,7 +3533,7 @@ module TkTreatFont def kanjifont_copy(win, wintag=nil, winkey=nil, targetkey=nil) if targetkey - fontobj(targetkey).dup.call_font_configure([__pathname, targetkey], + fontobj(targetkey).dup.call_font_configure([__pathname, targetkey], *(__config_cmd << {})) else fontobj.dup.call_font_configure(__pathname, *(__config_cmd << {})) @@ -3585,7 +3585,7 @@ module TkConfigMethod private :__confinfo_cmd def __configinfo_struct - {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, + {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, :default_value=>3, :current_value=>4} end private :__configinfo_struct @@ -3612,10 +3612,10 @@ module TkConfigMethod def __strval_optkeys [ - 'text', 'label', 'show', 'data', 'file', - 'activebackground', 'activeforeground', 'background', - 'disabledforeground', 'disabledbackground', 'foreground', - 'highlightbackground', 'highlightcolor', 'insertbackground', + 'text', 'label', 'show', 'data', 'file', + 'activebackground', 'activeforeground', 'background', + 'disabledforeground', 'disabledbackground', 'foreground', + 'highlightbackground', 'highlightcolor', 'insertbackground', 'selectbackground', 'selectforeground', 'troughcolor' ] end @@ -3704,7 +3704,7 @@ module TkConfigMethod def __cget_core(slot) orig_slot = slot slot = slot.to_s - + if slot.length == 0 fail ArgumentError, "Invalid option `#{orig_slot.inspect}'" end @@ -3931,12 +3931,12 @@ module TkConfigMethod def __configinfo_core(slot = nil) if TkComm::GET_CONFIGINFO_AS_ARRAY - if (slot && + if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/) fontkey = $2 # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")))) conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")), false, true) - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] if ( ! __configinfo_struct[:alias] \ || conf.size > __configinfo_struct[:alias] + 1 ) @@ -3948,7 +3948,7 @@ module TkConfigMethod elsif ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 \ && conf[__configinfo_struct[:alias]][0] == ?- ) - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end conf @@ -3998,7 +3998,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]]) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = number(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4006,7 +4006,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = number(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4019,11 +4019,11 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]]) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = num_or_str(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = num_or_str(conf[__configinfo_struct[:current_value]]) end @@ -4034,7 +4034,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]]) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = bool(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4042,7 +4042,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = bool(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4055,11 +4055,11 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]]) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = simplelist(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = simplelist(conf[__configinfo_struct[:current_value]]) end @@ -4070,12 +4070,12 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] \ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = list(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] \ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = list(conf[__configinfo_struct[:current_value]]) end @@ -4108,13 +4108,13 @@ module TkConfigMethod # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")))) conf = tk_split_list(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), 0, false, true) end - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] if ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 \ && conf[__configinfo_struct[:alias]][0] == ?- ) - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end @@ -4125,7 +4125,7 @@ module TkConfigMethod # conf = tk_split_simplelist(conflist) ret = tk_split_simplelist(tk_call_without_enc(*__confinfo_cmd), false, false).collect{|conflist| conf = tk_split_simplelist(conflist, false, true) - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] optkey = conf[__configinfo_struct[:key]] @@ -4161,7 +4161,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = number(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4169,7 +4169,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = number(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4179,11 +4179,11 @@ module TkConfigMethod when /^(#{__numstrval_optkeys.join('|')})$/ if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = num_or_str(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = num_or_str(conf[__configinfo_struct[:current_value]]) end @@ -4191,7 +4191,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = bool(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4199,7 +4199,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = bool(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4209,11 +4209,11 @@ module TkConfigMethod when /^(#{__listval_optkeys.join('|')})$/ if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = simplelist(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = simplelist(conf[__configinfo_struct[:current_value]]) end @@ -4221,12 +4221,12 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] \ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = list(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] \ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = list(conf[__configinfo_struct[:current_value]]) end @@ -4253,20 +4253,20 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) if conf[__configinfo_struct[:default_value]].index('{') - conf[__configinfo_struct[:default_value]] = - tk_split_list(conf[__configinfo_struct[:default_value]]) + conf[__configinfo_struct[:default_value]] = + tk_split_list(conf[__configinfo_struct[:default_value]]) else - conf[__configinfo_struct[:default_value]] = - tk_tcl2ruby(conf[__configinfo_struct[:default_value]]) + conf[__configinfo_struct[:default_value]] = + tk_tcl2ruby(conf[__configinfo_struct[:default_value]]) end end if conf[__configinfo_struct[:current_value]] if conf[__configinfo_struct[:current_value]].index('{') - conf[__configinfo_struct[:current_value]] = - tk_split_list(conf[__configinfo_struct[:current_value]]) + conf[__configinfo_struct[:current_value]] = + tk_split_list(conf[__configinfo_struct[:current_value]]) else - conf[__configinfo_struct[:current_value]] = - tk_tcl2ruby(conf[__configinfo_struct[:current_value]]) + conf[__configinfo_struct[:current_value]] = + tk_tcl2ruby(conf[__configinfo_struct[:current_value]]) end end end @@ -4274,7 +4274,7 @@ module TkConfigMethod if ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 \ && conf[__configinfo_struct[:alias]][0] == ?- ) - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end @@ -4305,12 +4305,12 @@ module TkConfigMethod end else # ! TkComm::GET_CONFIGINFO_AS_ARRAY - if (slot && + if (slot && slot.to_s =~ /^(|latin|ascii|kanji)(#{__font_optkeys.join('|')})$/) fontkey = $2 # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")))) conf = tk_split_simplelist(tk_call_without_enc(*(__confinfo_cmd << "-#{fontkey}")), false, true) - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] if ( ! __configinfo_struct[:alias] \ @@ -4324,7 +4324,7 @@ module TkConfigMethod elsif ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 ) if conf[__configinfo_struct[:alias]][0] == ?- - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end { conf[0] => conf[1] } @@ -4377,7 +4377,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = number(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4385,7 +4385,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = number(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4398,11 +4398,11 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = num_or_str(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = num_or_str(conf[__configinfo_struct[:current_value]]) end @@ -4413,7 +4413,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = bool(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4421,7 +4421,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = bool(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4434,11 +4434,11 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = simplelist(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = simplelist(conf[__configinfo_struct[:current_value]]) end @@ -4449,12 +4449,12 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] \ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = list(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] \ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = list(conf[__configinfo_struct[:current_value]]) end @@ -4486,13 +4486,13 @@ module TkConfigMethod # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")))) conf = tk_split_list(tk_call_without_enc(*(__confinfo_cmd << "-#{slot}")), 0, false, true) end - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] if ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 ) if conf[__configinfo_struct[:alias]][0] == ?- - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end { conf[0] => conf[1] } @@ -4506,7 +4506,7 @@ module TkConfigMethod # conf = tk_split_simplelist(conflist) tk_split_simplelist(tk_call_without_enc(*__confinfo_cmd), false, false).each{|conflist| conf = tk_split_simplelist(conflist, false, true) - conf[__configinfo_struct[:key]] = + conf[__configinfo_struct[:key]] = conf[__configinfo_struct[:key]][1..-1] optkey = conf[__configinfo_struct[:key]] @@ -4542,7 +4542,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = number(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4550,7 +4550,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = number(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4560,11 +4560,11 @@ module TkConfigMethod when /^(#{__numstrval_optkeys.join('|')})$/ if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = num_or_str(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = num_or_str(conf[__configinfo_struct[:current_value]]) end @@ -4572,7 +4572,7 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) begin - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = bool(conf[__configinfo_struct[:default_value]]) rescue conf[__configinfo_struct[:default_value]] = nil @@ -4580,7 +4580,7 @@ module TkConfigMethod end if ( conf[__configinfo_struct[:current_value]] ) begin - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = bool(conf[__configinfo_struct[:current_value]]) rescue conf[__configinfo_struct[:current_value]] = nil @@ -4590,11 +4590,11 @@ module TkConfigMethod when /^(#{__listval_optkeys.join('|')})$/ if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = simplelist(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = simplelist(conf[__configinfo_struct[:current_value]]) end @@ -4602,12 +4602,12 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] \ && conf[__configinfo_struct[:default_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:default_value]] = + conf[__configinfo_struct[:default_value]] = list(conf[__configinfo_struct[:default_value]]) end if ( conf[__configinfo_struct[:current_value]] \ && conf[__configinfo_struct[:current_value]] =~ /^[0-9]/ ) - conf[__configinfo_struct[:current_value]] = + conf[__configinfo_struct[:current_value]] = list(conf[__configinfo_struct[:current_value]]) end @@ -4634,20 +4634,20 @@ module TkConfigMethod if ( __configinfo_struct[:default_value] \ && conf[__configinfo_struct[:default_value]] ) if conf[__configinfo_struct[:default_value]].index('{') - conf[__configinfo_struct[:default_value]] = - tk_split_list(conf[__configinfo_struct[:default_value]]) + conf[__configinfo_struct[:default_value]] = + tk_split_list(conf[__configinfo_struct[:default_value]]) else - conf[__configinfo_struct[:default_value]] = - tk_tcl2ruby(conf[__configinfo_struct[:default_value]]) + conf[__configinfo_struct[:default_value]] = + tk_tcl2ruby(conf[__configinfo_struct[:default_value]]) end end if conf[__configinfo_struct[:current_value]] if conf[__configinfo_struct[:current_value]].index('{') - conf[__configinfo_struct[:current_value]] = - tk_split_list(conf[__configinfo_struct[:current_value]]) + conf[__configinfo_struct[:current_value]] = + tk_split_list(conf[__configinfo_struct[:current_value]]) else - conf[__configinfo_struct[:current_value]] = - tk_tcl2ruby(conf[__configinfo_struct[:current_value]]) + conf[__configinfo_struct[:current_value]] = + tk_tcl2ruby(conf[__configinfo_struct[:current_value]]) end end end @@ -4655,7 +4655,7 @@ module TkConfigMethod if ( __configinfo_struct[:alias] \ && conf.size == __configinfo_struct[:alias] + 1 ) if conf[__configinfo_struct[:alias]][0] == ?- - conf[__configinfo_struct[:alias]] = + conf[__configinfo_struct[:alias]] = conf[__configinfo_struct[:alias]][1..-1] end ret[conf[0]] = conf[1] @@ -4717,7 +4717,7 @@ module TkConfigMethod end slot = conf[__configinfo_struct[:alias]] end while(org_slot != slot) - fail RuntimeError, + fail RuntimeError, "there is a configure alias loop about '#{org_slot}'" else ret = {} @@ -4731,7 +4731,7 @@ module TkConfigMethod end else # ! TkComm::GET_CONFIGINFO_AS_ARRAY ret = {} - configinfo(slot).each{|key, conf| + configinfo(slot).each{|key, conf| ret[key] = conf[-1] if conf.kind_of?(Array) } ret @@ -4804,13 +4804,13 @@ class TkObject<TkKernel cget(name) rescue if self.kind_of?(TkWindow) - fail NameError, + fail NameError, "unknown option '#{id}' for #{self.inspect} (deleted widget?)" else super(id, *args) end -# fail NameError, -# "undefined local variable or method `#{name}' for #{self.to_s}", +# fail NameError, +# "undefined local variable or method `#{name}' for #{self.to_s}", # error_at end else @@ -4834,14 +4834,14 @@ class TkObject<TkKernel if context.kind_of?(TkEvent::Event) context.generate(self, ((keys)? keys: {})) elsif keys - #tk_call('event', 'generate', path, + #tk_call('event', 'generate', path, # "<#{tk_event_sequence(context)}>", *hash_kv(keys)) - tk_call_without_enc('event', 'generate', path, - "<#{tk_event_sequence(context)}>", + tk_call_without_enc('event', 'generate', path, + "<#{tk_event_sequence(context)}>", *hash_kv(keys, true)) else #tk_call('event', 'generate', path, "<#{tk_event_sequence(context)}>") - tk_call_without_enc('event', 'generate', path, + tk_call_without_enc('event', 'generate', path, "<#{tk_event_sequence(context)}>") end end @@ -4874,10 +4874,10 @@ class TkWindow<TkObject end TkCommandNames = [].freeze - ## ==> If TkCommandNames[0] is a string (not a null string), - ## assume the string is a Tcl/Tk's create command of the widget class. + ## ==> If TkCommandNames[0] is a string (not a null string), + ## assume the string is a Tcl/Tk's create command of the widget class. WidgetClassName = ''.freeze - # WidgetClassNames[WidgetClassName] = self + # WidgetClassNames[WidgetClassName] = self ## ==> If self is a widget class, entry to the WidgetClassNames table. def self.to_eval self::WidgetClassName @@ -4890,8 +4890,8 @@ class TkWindow<TkObject widgetname = keys.delete('widgetname') install_win(if parent then parent.path end, widgetname) without_creating = keys.delete('without_creating') - # if without_creating && !widgetname - # fail ArgumentError, + # if without_creating && !widgetname + # fail ArgumentError, # "if set 'without_creating' to true, need to define 'widgetname'" # end elsif keys @@ -4899,8 +4899,8 @@ class TkWindow<TkObject widgetname = keys.delete('widgetname') install_win(if parent then parent.path end, widgetname) without_creating = keys.delete('without_creating') - # if without_creating && !widgetname - # fail ArgumentError, + # if without_creating && !widgetname + # fail ArgumentError, # "if set 'without_creating' to true, need to define 'widgetname'" # end else @@ -4992,7 +4992,7 @@ class TkWindow<TkObject tk_call_without_enc('destroy', @path) rescue # cannot rescue options error - fail e + fail e else # re-create widget tk_call_without_enc(cmd, @path, *hash_kv(keys, true)) @@ -5297,7 +5297,7 @@ class TkWindow<TkObject # conf[0] = conf[0][1..-1] # conf #else - # tk_split_simplelist(tk_call('place', + # tk_split_simplelist(tk_call('place', # 'configure', epath)).collect{|conflist| # conf = tk_split_simplelist(conflist) # conf[0] = conf[0][1..-1] @@ -5507,7 +5507,7 @@ class TkWindow<TkObject taglist else list(tk_call('bindtags', path)).collect{|tag| - if tag.kind_of?(String) + if tag.kind_of?(String) if cls = WidgetClassNames[tag] cls elsif btag = TkBindTag.id2obj(tag) diff --git a/ext/tk/lib/tk/autoload.rb b/ext/tk/lib/tk/autoload.rb index 79b6e01eb8..df888eb927 100644 --- a/ext/tk/lib/tk/autoload.rb +++ b/ext/tk/lib/tk/autoload.rb @@ -250,69 +250,69 @@ autoload :TkXIM, 'tk/xim' module Tk @TOPLEVEL_ALIAS_TABLE = {} @TOPLEVEL_ALIAS_TABLE[:Tk] = { - :TkButton => 'tk/button', + :TkButton => 'tk/button', - :TkCanvas => 'tk/canvas', + :TkCanvas => 'tk/canvas', - :TkCheckButton => 'tk/checkbutton', - :TkCheckbutton => 'tk/checkbutton', + :TkCheckButton => 'tk/checkbutton', + :TkCheckbutton => 'tk/checkbutton', - # :TkDialog => 'tk/dialog', - # :TkDialog2 => 'tk/dialog', - # :TkDialogObj => 'tk/dialog', - # :TkWarning => 'tk/dialog', - # :TkWarning2 => 'tk/dialog', - # :TkWarningObj => 'tk/dialog', + # :TkDialog => 'tk/dialog', + # :TkDialog2 => 'tk/dialog', + # :TkDialogObj => 'tk/dialog', + # :TkWarning => 'tk/dialog', + # :TkWarning2 => 'tk/dialog', + # :TkWarningObj => 'tk/dialog', - :TkEntry => 'tk/entry', + :TkEntry => 'tk/entry', - :TkFrame => 'tk/frame', + :TkFrame => 'tk/frame', - :TkLabel => 'tk/label', + :TkLabel => 'tk/label', - :TkLabelFrame => 'tk/labelframe', - :TkLabelframe => 'tk/labelframe', + :TkLabelFrame => 'tk/labelframe', + :TkLabelframe => 'tk/labelframe', - :TkListbox => 'tk/listbox', + :TkListbox => 'tk/listbox', - :TkMacResource => 'tk/macpkg', + :TkMacResource => 'tk/macpkg', - :TkMenu => 'tk/menu', - :TkMenuClone => 'tk/menu', - :TkCloneMenu => 'tk/menu', - # :TkSystemMenu => 'tk/menu', - :TkSysMenu_Help => 'tk/menu', - :TkSysMenu_System => 'tk/menu', - :TkSysMenu_Apple => 'tk/menu', - :TkMenubutton => 'tk/menu', - :TkMenuButton => 'tk/menu', - :TkOptionMenubutton => 'tk/menu', - :TkOptionMenuButton => 'tk/menu', + :TkMenu => 'tk/menu', + :TkMenuClone => 'tk/menu', + :TkCloneMenu => 'tk/menu', + # :TkSystemMenu => 'tk/menu', + :TkSysMenu_Help => 'tk/menu', + :TkSysMenu_System => 'tk/menu', + :TkSysMenu_Apple => 'tk/menu', + :TkMenubutton => 'tk/menu', + :TkMenuButton => 'tk/menu', + :TkOptionMenubutton => 'tk/menu', + :TkOptionMenuButton => 'tk/menu', - :TkMessage => 'tk/message', + :TkMessage => 'tk/message', - :TkPanedWindow => 'tk/panedwindow', - :TkPanedwindow => 'tk/panedwindow', + :TkPanedWindow => 'tk/panedwindow', + :TkPanedwindow => 'tk/panedwindow', - :TkRadioButton => 'tk/radiobutton', - :TkRadiobutton => 'tk/radiobutton', + :TkRadioButton => 'tk/radiobutton', + :TkRadiobutton => 'tk/radiobutton', - # :TkRoot => 'tk/root', + # :TkRoot => 'tk/root', - :TkScale => 'tk/scale', + :TkScale => 'tk/scale', - :TkScrollbar => 'tk/scrollbar', - :TkXScrollbar => 'tk/scrollbar', - :TkYScrollbar => 'tk/scrollbar', + :TkScrollbar => 'tk/scrollbar', + :TkXScrollbar => 'tk/scrollbar', + :TkYScrollbar => 'tk/scrollbar', - :TkSpinbox => 'tk/spinbox', + :TkSpinbox => 'tk/spinbox', - :TkText => 'tk/text', + :TkText => 'tk/text', - :TkToplevel => 'tk/toplevel', + :TkToplevel => 'tk/toplevel', - :TkWinDDE => 'tk/winpkg', - :TkWinRegistry => 'tk/winpkg', + :TkWinDDE => 'tk/winpkg', + :TkWinRegistry => 'tk/winpkg', } @TOPLEVEL_ALIAS_OWNER = {} @@ -361,7 +361,7 @@ class << Tk # check already autoloaded if (table = @TOPLEVEL_ALIAS_TABLE[current = @current_default_widget_set]) table.each{|sym, file| - if !Object.autoload?(sym) && Object.const_defined?(sym) && + if !Object.autoload?(sym) && Object.const_defined?(sym) && @TOPLEVEL_ALIAS_TABLE[current][sym].kind_of?(String) # autoload -> class @TOPLEVEL_ALIAS_TABLE[current][sym] = Object.const_get(sym) @@ -399,9 +399,9 @@ Tk.default_widget_set = :Tk ############################################ # Ttk (Tile) support =begin -if major > 8 || - (major == 8 && minor > 5) || - (major == 8 && minor == 5 && type >= TclTkLib::RELEASE_TYPE::BETA) +if major > 8 || + (major == 8 && minor > 5) || + (major == 8 && minor == 5 && type >= TclTkLib::RELEASE_TYPE::BETA) # Tcl/Tk 8.5 beta or later Object.autoload :Ttk, 'tkextlib/tile' Tk.autoload :Tile, 'tkextlib/tile' diff --git a/ext/tk/lib/tk/canvas.rb b/ext/tk/lib/tk/canvas.rb index 36ea008a17..b05a619939 100644 --- a/ext/tk/lib/tk/canvas.rb +++ b/ext/tk/lib/tk/canvas.rb @@ -13,7 +13,7 @@ module TkCanvasItemConfig def __item_strval_optkeys(id) # maybe need to override super(id) + [ - 'fill', 'activefill', 'disabledfill', + 'fill', 'activefill', 'disabledfill', 'outline', 'activeoutline', 'disabledoutline' ] end @@ -117,7 +117,7 @@ class Tk::Canvas<TkWindow end def bbox(tagOrId, *tags) - list(tk_send_without_enc('bbox', tagid(tagOrId), + list(tk_send_without_enc('bbox', tagid(tagOrId), *tags.collect{|t| tagid(t)})) end @@ -181,7 +181,7 @@ class Tk::Canvas<TkWindow end def dchars(tag, first, last=None) - tk_send_without_enc('dchars', tagid(tag), + tk_send_without_enc('dchars', tagid(tag), _get_eval_enc_str(first), _get_eval_enc_str(last)) self end @@ -214,7 +214,7 @@ class Tk::Canvas<TkWindow alias deltag dtag def find(mode, *args) - list(tk_send_without_enc('find', mode, *args)).collect!{|id| + list(tk_send_without_enc('find', mode, *args)).collect!{|id| TkcItem.id2obj(self, id) } end @@ -270,7 +270,7 @@ class Tk::Canvas<TkWindow end def insert(tagOrId, index, string) - tk_send_without_enc('insert', tagid(tagOrId), index, + tk_send_without_enc('insert', tagid(tagOrId), index, _get_eval_enc_str(string)) self end @@ -300,7 +300,7 @@ class Tk::Canvas<TkWindow fnt end else - tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', tagid(tagOrId), + tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', tagid(tagOrId), "-#{option}"))) end end @@ -315,16 +315,16 @@ class Tk::Canvas<TkWindow || key['latinfont'] || key['asciifont'] ) tagfont_configure(tagid(tagOrId), key.dup) else - _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), + _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), *hash_kv(key, true))) end else if ( key == 'coords' || key == :coords ) self.coords(tagOrId, value) - elsif ( key == 'font' || key == :font || - key == 'kanjifont' || key == :kanjifont || - key == 'latinfont' || key == :latinfont || + elsif ( key == 'font' || key == :font || + key == 'kanjifont' || key == :kanjifont || + key == 'latinfont' || key == :latinfont || key == 'asciifont' || key == :asciifont ) if value == None tagfontobj(tagid(tagOrId)) @@ -332,7 +332,7 @@ class Tk::Canvas<TkWindow tagfont_configure(tagid(tagOrId), {key=>value}) end else - _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), + _fromUTF8(tk_send_without_enc('itemconfigure', tagid(tagOrId), "-#{key}", _get_eval_enc_str(value))) end end @@ -389,16 +389,16 @@ class Tk::Canvas<TkWindow else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -421,8 +421,8 @@ class Tk::Canvas<TkWindow when 'coords' {'coords' => ['', '', '', self.coords(tagOrId)]} when 'dash', 'activedash', 'disableddash' - conf = tk_split_simplelist(tk_send_without_enc('itemconfigure', - tagid(tagOrId), + conf = tk_split_simplelist(tk_send_without_enc('itemconfigure', + tagid(tagOrId), "-#{key}")) if conf[3] && conf[3] =~ /^[0-9]/ conf[3] = list(conf[3]) @@ -457,16 +457,16 @@ class Tk::Canvas<TkWindow else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -676,7 +676,7 @@ class TkcItem<TkObject fail RuntimeError, "#{self} is an abstract class" end args, fontkeys = _parse_create_args(args) - idnum = tk_call_without_enc(canvas.path, 'create', + idnum = tk_call_without_enc(canvas.path, 'create', self::CItemTypeName, *args) canvas.itemconfigure(idnum, fontkeys) unless fontkeys.empty? idnum.to_i # 'canvas item id' is an integer number diff --git a/ext/tk/lib/tk/canvastag.rb b/ext/tk/lib/tk/canvastag.rb index 49796d80b2..4e57a159bf 100644 --- a/ext/tk/lib/tk/canvastag.rb +++ b/ext/tk/lib/tk/canvastag.rb @@ -218,7 +218,7 @@ class TkcTag<TkObject CTagID_TBL.mutex.synchronize{ if CTagID_TBL[cpath] CTagID_TBL[cpath][id]? CTagID_TBL[cpath][id]: id - else + else id end } @@ -414,7 +414,7 @@ class TkcGroup<TkcTag include(*args) if args != [] end #private :create_self - + def include(*tags) for i in tags #i.addtag(@id) diff --git a/ext/tk/lib/tk/checkbutton.rb b/ext/tk/lib/tk/checkbutton.rb index b1186a87ed..c1c4905c5e 100644 --- a/ext/tk/lib/tk/checkbutton.rb +++ b/ext/tk/lib/tk/checkbutton.rb @@ -26,5 +26,5 @@ end Tk::Checkbutton = Tk::CheckButton #TkCheckButton = Tk::CheckButton unless Object.const_defined? :TkCheckButton #TkCheckbutton = Tk::Checkbutton unless Object.const_defined? :TkCheckbutton -Tk.__set_toplevel_aliases__(:Tk, Tk::CheckButton, +Tk.__set_toplevel_aliases__(:Tk, Tk::CheckButton, :TkCheckButton, :TkCheckbutton) diff --git a/ext/tk/lib/tk/composite.rb b/ext/tk/lib/tk/composite.rb index 883d43c3ea..9a4aafda18 100644 --- a/ext/tk/lib/tk/composite.rb +++ b/ext/tk/lib/tk/composite.rb @@ -1,5 +1,5 @@ # -# tk/composite.rb : +# tk/composite.rb : # require 'tk' @@ -358,7 +358,7 @@ module TkComposite opt, wins = tbl[0] next unless wins && wins[-1] if slot == opt - info_list.delete_if{|i| i[0] == slot} << + info_list.delete_if{|i| i[0] == slot} << wins[-1].configinfo(slot) else info = wins[-1].configinfo(opt) @@ -367,7 +367,7 @@ module TkComposite end else opt, wins = tbl[-1] - info_list.delete_if{|i| i[0] == slot} << + info_list.delete_if{|i| i[0] == slot} << [slot, '', '', '', wins[-1].cget(opt)] end } diff --git a/ext/tk/lib/tk/console.rb b/ext/tk/lib/tk/console.rb index 26ce262caa..64e257594c 100644 --- a/ext/tk/lib/tk/console.rb +++ b/ext/tk/lib/tk/console.rb @@ -28,7 +28,7 @@ module TkConsole # supports a Tcl script only # I have no idea to support a Ruby script seamlessly. # - _fromUTF8(tk_call_without_enc('console', 'eval', + _fromUTF8(tk_call_without_enc('console', 'eval', _get_eval_enc_str(tcl_script))) end def self.maininterp_eval(tcl_script) @@ -36,7 +36,7 @@ module TkConsole # supports a Tcl script only # I have no idea to support a Ruby script seamlessly. # - _fromUTF8(tk_call_without_enc('consoleinterp', 'eval', + _fromUTF8(tk_call_without_enc('consoleinterp', 'eval', _get_eval_enc_str(tcl_script))) end @@ -45,7 +45,7 @@ module TkConsole # supports a Tcl script only # I have no idea to support a Ruby script seamlessly. # - _fromUTF8(tk_call_without_enc('consoleinterp', 'record', + _fromUTF8(tk_call_without_enc('consoleinterp', 'record', _get_eval_enc_str(tcl_script))) end diff --git a/ext/tk/lib/tk/dialog.rb b/ext/tk/lib/tk/dialog.rb index 180da101e3..7ef7820699 100644 --- a/ext/tk/lib/tk/dialog.rb +++ b/ext/tk/lib/tk/dialog.rb @@ -18,11 +18,11 @@ class TkDialogObj < 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 " + + 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; ", + # @config << Kernel.format("%s.button%s configure %s; ", # @path, i, hash_kv(c).join(' ')) # @config << @path+'.button'+i.to_s+' configure '+hash_kv(c).join(' ')+'; ' @config << @path+'.button'+i.to_s+' configure '+ @@ -103,7 +103,7 @@ class TkDialogObj < TkWindow #end if @buttons.kind_of?(Array) - _set_button_config(@buttons.collect{|cfg| + _set_button_config(@buttons.collect{|cfg| (cfg.kind_of? Array)? cfg[1]: nil}) @buttons = @buttons.collect{|cfg| (cfg.kind_of? Array)? cfg[0]: cfg} end @@ -127,7 +127,7 @@ class TkDialogObj < TkWindow =end if @message_config.kind_of?(Hash) - # @config << Kernel.format("%s.msg configure %s;", + # @config << Kernel.format("%s.msg configure %s;", # @path, hash_kv(@message_config).join(' ')) # @config << @path+'.msg configure '+hash_kv(@message_config).join(' ')+';' @config << @path+'.msg configure '+ @@ -135,7 +135,7 @@ class TkDialogObj < TkWindow end if @msgframe_config.kind_of?(Hash) - # @config << Kernel.format("%s.top configure %s;", + # @config << Kernel.format("%s.top configure %s;", # @path, hash_kv(@msgframe_config).join(' ')) # @config << @path+'.top configure '+hash_kv(@msgframe_config).join(' ')+';' @config << @path+'.top configure '+ @@ -143,7 +143,7 @@ class TkDialogObj < TkWindow end if @btnframe_config.kind_of?(Hash) - # @config << Kernel.format("%s.bot configure %s;", + # @config << Kernel.format("%s.bot configure %s;", # @path, hash_kv(@btnframe_config).join(' ')) # @config << @path+'.bot configure '+hash_kv(@btnframe_config).join(' ')+';' @config << @path+'.bot configure '+ @@ -151,7 +151,7 @@ class TkDialogObj < TkWindow end if @bitmap_config.kind_of?(Hash) - # @config << Kernel.format("%s.bitmap configure %s;", + # @config << Kernel.format("%s.bitmap configure %s;", # @path, hash_kv(@bitmap_config).join(' ')) # @config << @path+'.bitmap configure '+hash_kv(@bitmap_config).join(' ')+';' @config << @path+'.bitmap configure '+ @@ -176,19 +176,19 @@ class TkDialogObj < TkWindow # default_button = '{}' if default_button == nil default_button = '' if default_button == nil #Tk.ip_eval('eval {global '+@var.id+';'+@config+ - # 'set '+@var.id+' [tk_dialog '+ + # '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 + ' ' + + # @val = Tk.ip_eval('tk_dialog ' + @path + ' ' + @title + + # ' {' + @message + '} ' + @bitmap + ' ' + # String(default_button) + ' ' + @buttons.join(' ')).to_i - # @val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' + - # @title + ' {' + @message + '} ' + @bitmap + ' ' + + # @val = Tk.ip_eval(self.class::TkCommandNames[0] + ' ' + @path + ' ' + + # @title + ' {' + @message + '} ' + @bitmap + ' ' + # String(default_button) + ' ' + @buttons.join(' ')).to_i @val = Tk.ip_eval(array2tk_list([ - self.class::TkCommandNames[0], - @path, @title, @message, @bitmap, + self.class::TkCommandNames[0], + @path, @title, @message, @bitmap, String(default_button) ].concat(@buttons))).to_i end @@ -226,7 +226,7 @@ class TkDialogObj < TkWindow return nil end def bitmap - # returns a bitmap name or a bitmap file path + # returns a bitmap name or a bitmap file path # (@ + path ; e.g. '@/usr/share/bitmap/sample.xbm') return "info" end diff --git a/ext/tk/lib/tk/encodedstr.rb b/ext/tk/lib/tk/encodedstr.rb index 02de0b0d85..59fbb1911d 100644 --- a/ext/tk/lib/tk/encodedstr.rb +++ b/ext/tk/lib/tk/encodedstr.rb @@ -67,11 +67,11 @@ module Tk def initialize(str, enc = nil) super(str) - # @encoding = ( enc || - # ((self.class::Encoding)? + # @encoding = ( enc || + # ((self.class::Encoding)? # self.class::Encoding : Tk.encoding_system) ) enc ||= (self.class::Encoding)? - self.class::Encoding : + self.class::Encoding : ((Tk.encoding)? Tk.encoding : Tk.encoding_system) if TkCore::WITH_ENCODING unless encobj = Tk::Encoding::ENCODING_TABLE.get_obj(enc) diff --git a/ext/tk/lib/tk/event.rb b/ext/tk/lib/tk/event.rb index d8aad6248b..d07b3b5a85 100644 --- a/ext/tk/lib/tk/event.rb +++ b/ext/tk/lib/tk/event.rb @@ -53,39 +53,39 @@ module TkEvent #-----+-------------------+------------------+-----------------------# # ID | const | group_flag | context_name # #-----+-------------------+------------------+-----------------------# - [ 2, :KeyPress, Grp::KEY, 'KeyPress', 'Key' ], - [ 3, :KeyRelease, Grp::KEY, 'KeyRelease' ], - [ 4, :ButtonPress, Grp::BUTTON, 'ButtonPress', 'Button' ], - [ 5, :ButtonRelease, Grp::BUTTON, 'ButtonRelease' ], - [ 6, :MotionNotify, Grp::MOTION, 'Motion' ], - [ 7, :EnterNotify, Grp::CROSSING, 'Enter' ], - [ 8, :LeaveNotify, Grp::CROSSING, 'Leave' ], - [ 9, :FocusIn, Grp::FOCUS, 'FocusIn' ], - [ 10, :FocusOut, Grp::FOCUS, 'FocusOut' ], - [ 11, :KeymapNotify, 0, ], - [ 12, :Expose, Grp::EXPOSE, 'Expose' ], - [ 13, :GraphicsExpose, Grp::EXPOSE, ], - [ 14, :NoExpose, 0, ], - [ 15, :VisibilityNotify, Grp::VISIBILITY, 'Visibility' ], - [ 16, :CreateNotify, Grp::CREATE, 'Create' ], - [ 17, :DestroyNotify, Grp::DESTROY, 'Destroy' ], - [ 18, :UnmapNotify, Grp::UNMAP, 'Unmap' ], - [ 19, :MapNotify, Grp::MAP, 'Map' ], - [ 20, :MapRequest, Grp::MAPREQ, 'MapRequest' ], - [ 21, :ReparentNotify, Grp::REPARENT, 'Reparent' ], - [ 22, :ConfigureNotify, Grp::CONFIG, 'Configure' ], - [ 23, :ConfigureRequest, Grp::CONFIGREQ, 'ConfigureRequest' ], - [ 24, :GravityNotify, Grp::GRAVITY, 'Gravity' ], - [ 25, :ResizeRequest, Grp::RESIZEREQ, 'ResizeRequest' ], - [ 26, :CirculateNotify, Grp::CIRC, 'Circulate' ], - [ 27, :CirculateRequest, 0, 'CirculateRequest' ], - [ 28, :PropertyNotify, Grp::PROP, 'Property' ], - [ 29, :SelectionClear, 0, ], - [ 30, :SelectionRequest, 0, ], - [ 31, :SelectionNotify, 0, ], - [ 32, :ColormapNotify, Grp::COLORMAP, 'Colormap' ], - [ 33, :ClientMessage, 0, ], - [ 34, :MappingNotify, 0, ], + [ 2, :KeyPress, Grp::KEY, 'KeyPress', 'Key' ], + [ 3, :KeyRelease, Grp::KEY, 'KeyRelease' ], + [ 4, :ButtonPress, Grp::BUTTON, 'ButtonPress', 'Button' ], + [ 5, :ButtonRelease, Grp::BUTTON, 'ButtonRelease' ], + [ 6, :MotionNotify, Grp::MOTION, 'Motion' ], + [ 7, :EnterNotify, Grp::CROSSING, 'Enter' ], + [ 8, :LeaveNotify, Grp::CROSSING, 'Leave' ], + [ 9, :FocusIn, Grp::FOCUS, 'FocusIn' ], + [ 10, :FocusOut, Grp::FOCUS, 'FocusOut' ], + [ 11, :KeymapNotify, 0, ], + [ 12, :Expose, Grp::EXPOSE, 'Expose' ], + [ 13, :GraphicsExpose, Grp::EXPOSE, ], + [ 14, :NoExpose, 0, ], + [ 15, :VisibilityNotify, Grp::VISIBILITY, 'Visibility' ], + [ 16, :CreateNotify, Grp::CREATE, 'Create' ], + [ 17, :DestroyNotify, Grp::DESTROY, 'Destroy' ], + [ 18, :UnmapNotify, Grp::UNMAP, 'Unmap' ], + [ 19, :MapNotify, Grp::MAP, 'Map' ], + [ 20, :MapRequest, Grp::MAPREQ, 'MapRequest' ], + [ 21, :ReparentNotify, Grp::REPARENT, 'Reparent' ], + [ 22, :ConfigureNotify, Grp::CONFIG, 'Configure' ], + [ 23, :ConfigureRequest, Grp::CONFIGREQ, 'ConfigureRequest' ], + [ 24, :GravityNotify, Grp::GRAVITY, 'Gravity' ], + [ 25, :ResizeRequest, Grp::RESIZEREQ, 'ResizeRequest' ], + [ 26, :CirculateNotify, Grp::CIRC, 'Circulate' ], + [ 27, :CirculateRequest, 0, 'CirculateRequest' ], + [ 28, :PropertyNotify, Grp::PROP, 'Property' ], + [ 29, :SelectionClear, 0, ], + [ 30, :SelectionRequest, 0, ], + [ 31, :SelectionNotify, 0, ], + [ 32, :ColormapNotify, Grp::COLORMAP, 'Colormap' ], + [ 33, :ClientMessage, 0, ], + [ 34, :MappingNotify, 0, ], [ 35, :VirtualEvent, Grp::VIRTUAL, ], [ 36, :ActivateNotify, Grp::ACTIVATE, 'Activate' ], [ 37, :DeactivateNotify, Grp::ACTIVATE, 'Deactivate' ], @@ -153,12 +153,12 @@ module TkEvent FIELD_FLAG = { # key => flag - 'above' => Grp::CONFIG, + 'above' => Grp::CONFIG, 'borderwidth' => (Grp::CREATE|Grp::CONFIG), - 'button' => Grp::BUTTON, - 'count' => Grp::EXPOSE, - 'data' => (Grp::VIRTUAL|Grp::STRING_DATA), - 'delta' => Grp::MWHEEL, + 'button' => Grp::BUTTON, + 'count' => Grp::EXPOSE, + 'data' => (Grp::VIRTUAL|Grp::STRING_DATA), + 'delta' => Grp::MWHEEL, 'detail' => (Grp::FOCUS|Grp::CROSSING), 'focus' => Grp::CROSSING, 'height' => (Grp::EXPOSE|Grp::CONFIG), @@ -191,23 +191,23 @@ module TkEvent } FIELD_OPERATION = { - 'root' => proc{|val| + 'root' => proc{|val| begin Tk.tk_call_without_enc('winfo', 'pathname', val) val rescue nil end - }, + }, - 'subwindow' => proc{|val| + 'subwindow' => proc{|val| begin Tk.tk_call_without_enc('winfo', 'pathname', val) val rescue nil end - }, + }, 'window' => proc{|val| nil} } @@ -280,7 +280,7 @@ module TkEvent Tk.event_generate(win, type_name, opts) else # If type is KEY event, focus should be set to target widget. - # If not set, original widget will get the same event. + # If not set, original widget will get the same event. # That will make infinite loop. w = Tk.tk_call_without_enc('focus') begin @@ -296,58 +296,58 @@ module TkEvent # [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>] KEY_TBL = [ - [ ?#, ?n, :serial ], - [ ?a, ?s, :above ], - [ ?b, ?n, :num ], - [ ?c, ?n, :count ], - [ ?d, ?s, :detail ], + [ ?#, ?n, :serial ], + [ ?a, ?s, :above ], + [ ?b, ?n, :num ], + [ ?c, ?n, :count ], + [ ?d, ?s, :detail ], # ?e - [ ?f, ?b, :focus ], + [ ?f, ?b, :focus ], # ?g - [ ?h, ?n, :height ], - [ ?i, ?s, :win_hex ], + [ ?h, ?n, :height ], + [ ?i, ?s, :win_hex ], # ?j - [ ?k, ?n, :keycode ], + [ ?k, ?n, :keycode ], # ?l - [ ?m, ?s, :mode ], + [ ?m, ?s, :mode ], # ?n - [ ?o, ?b, :override ], - [ ?p, ?s, :place ], + [ ?o, ?b, :override ], + [ ?p, ?s, :place ], # ?q # ?r - [ ?s, ?x, :state ], - [ ?t, ?n, :time ], + [ ?s, ?x, :state ], + [ ?t, ?n, :time ], # ?u - [ ?v, ?n, :value_mask ], - [ ?w, ?n, :width ], - [ ?x, ?n, :x ], - [ ?y, ?n, :y ], + [ ?v, ?n, :value_mask ], + [ ?w, ?n, :width ], + [ ?x, ?n, :x ], + [ ?y, ?n, :y ], # ?z - [ ?A, ?s, :char ], - [ ?B, ?n, :borderwidth ], + [ ?A, ?s, :char ], + [ ?B, ?n, :borderwidth ], # ?C - [ ?D, ?n, :wheel_delta ], - [ ?E, ?b, :send_event ], + [ ?D, ?n, :wheel_delta ], + [ ?E, ?b, :send_event ], # ?F # ?G # ?H # ?I # ?J - [ ?K, ?s, :keysym ], + [ ?K, ?s, :keysym ], # ?L # ?M - [ ?N, ?n, :keysym_num ], + [ ?N, ?n, :keysym_num ], # ?O - [ ?P, ?s, :property ], + [ ?P, ?s, :property ], # ?Q - [ ?R, ?s, :rootwin_id ], - [ ?S, ?s, :subwindow ], - [ ?T, ?n, :type ], + [ ?R, ?s, :rootwin_id ], + [ ?S, ?s, :subwindow ], + [ ?T, ?n, :type ], # ?U # ?V - [ ?W, ?w, :widget ], - [ ?X, ?n, :x_root ], - [ ?Y, ?n, :y_root ], + [ ?W, ?w, :widget ], + [ ?X, ?n, :x_root ], + [ ?Y, ?n, :y_root ], # ?Z nil ] @@ -356,16 +356,16 @@ module TkEvent # the subst-key string will be converted to a bytecode (128+idx). LONGKEY_TBL = [ # for example, for %CTT and %CST subst-key on tkdnd-2.0 - # ['CTT', ?l, :drop_target_type], - # ['CST', ?l, :drop_source_type], + # ['CTT', ?l, :drop_target_type], + # ['CST', ?l, :drop_source_type], ] # [ <proc type char>, <proc/method to convert tcl-str to ruby-obj>] PROC_TBL = [ - [ ?n, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?b, TkComm.method(:bool) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?b, TkComm.method(:bool) ], + [ ?w, TkComm.method(:window) ], [ ?x, proc{|val| begin @@ -374,7 +374,7 @@ module TkEvent val end } - ], + ], nil ] @@ -399,25 +399,25 @@ module TkEvent # setup tables to be used by scan_args, _get_subst_key, _get_all_subst_keys # - # _get_subst_key() and _get_all_subst_keys() generates key-string - # which describe how to convert callback arguments to ruby objects. - # When binding parameters are given, use _get_subst_key(). - # But when no parameters are given, use _get_all_subst_keys() to - # create a Event class object as a callback parameter. + # _get_subst_key() and _get_all_subst_keys() generates key-string + # which describe how to convert callback arguments to ruby objects. + # When binding parameters are given, use _get_subst_key(). + # But when no parameters are given, use _get_all_subst_keys() to + # create a Event class object as a callback parameter. # - # scan_args() is used when doing callback. It convert arguments - # ( which are Tcl strings ) to ruby objects based on the key string - # that is generated by _get_subst_key() or _get_all_subst_keys(). + # scan_args() is used when doing callback. It convert arguments + # ( which are Tcl strings ) to ruby objects based on the key string + # that is generated by _get_subst_key() or _get_all_subst_keys(). # _setup_subst_table(KEY_TBL, PROC_TBL) # _setup_subst_table(KEY_TBL, LONGKEY_TBL, PROC_TBL) # if use longname-keys # - # NOTE: The order of parameters which passed to callback procedure is + # NOTE: The order of parameters which passed to callback procedure is # <extra_arg>, <extra_arg>, ... , <subst_arg>, <subst_arg>, ... # - # If you need support extra arguments given by Tcl/Tk, + # If you need support extra arguments given by Tcl/Tk, # please override _get_extra_args_tbl # #def self._get_extra_args_tbl @@ -436,15 +436,15 @@ module TkEvent alias sendevent send_event =end ALIAS_TBL = { - :button => :num, - :data => :detail, - :delta => :wheel_delta, - :root => :rootwin_id, - :rootx => :x_root, - :root_x => :x_root, - :rooty => :y_root, - :root_y => :y_root, - :sendevent => :send_event, + :button => :num, + :data => :detail, + :delta => :wheel_delta, + :root => :rootwin_id, + :rootx => :x_root, + :root_x => :x_root, + :rooty => :y_root, + :root_y => :y_root, + :sendevent => :send_event, :window => :widget } diff --git a/ext/tk/lib/tk/font.rb b/ext/tk/lib/tk/font.rb index 62d628c132..da6482c122 100644 --- a/ext/tk/lib/tk/font.rb +++ b/ext/tk/lib/tk/font.rb @@ -20,7 +20,7 @@ class TkFont Tk_FontNameTBL = TkCore::INTERP.create_table Tk_FontUseTBL = TkCore::INTERP.create_table - TkCore::INTERP.init_ip_env{ + TkCore::INTERP.init_ip_env{ Tk_FontNameTBL.mutex.synchronize{ Tk_FontNameTBL.clear } Tk_FontUseTBL.mutex.synchronize{ Tk_FontUseTBL.clear } } @@ -66,8 +66,8 @@ class TkFont knj = 'defaultgui' when /Mincho:Helvetica-Bold-12/ # Tcl/Tk-JP for UNIX/X - ltn, knj = tk_split_simplelist(tk_call('font', 'configure', - 'Mincho:Helvetica-Bold-12', + ltn, knj = tk_split_simplelist(tk_call('font', 'configure', + 'Mincho:Helvetica-Bold-12', '-compound')) else # unknown Tcl/Tk-JP @@ -75,7 +75,7 @@ class TkFont platform = Tk::PLATFORM['platform'] case platform when 'unix' - ltn = {'family'=>'Helvetica'.freeze, + ltn = {'family'=>'Helvetica'.freeze, 'size'=>-12, 'weight'=>'bold'.freeze} #knj = 'k14' #knj = '-misc-fixed-medium-r-normal--14-*-*-*-c-*-jisx0208.1983-0' @@ -102,7 +102,7 @@ class TkFont platform = Tk::PLATFORM['platform'] case platform when 'unix' - ltn = {'family'=>'Helvetica'.freeze, + ltn = {'family'=>'Helvetica'.freeze, 'size'=>-12, 'weight'=>'bold'.freeze} when 'windows' ltn = {'family'=>'MS Sans Serif'.freeze, 'size'=>8} @@ -294,7 +294,7 @@ class TkFont end h = Hash[TkFont.metrics(fnt)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -331,7 +331,7 @@ class TkFont end h = Hash[TkFont.metrics_displayof(fnt, win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -459,7 +459,7 @@ class TkFont else begin compound = tk_split_simplelist( - Hash[*tk_split_simplelist(tk_call('font', 'configure', + Hash[*tk_split_simplelist(tk_call('font', 'configure', fnt))].collect{|k,v| [k[1..-1], v] }.assoc('compound')[1]) @@ -473,7 +473,7 @@ class TkFont TkFont.new(fnt).call_font_configure([path, key], *args) end else - TkFont.new(compound[0], + TkFont.new(compound[0], compound[1]).call_font_configure([path, key], *args) end end @@ -570,7 +570,7 @@ class TkFont if JAPANIZED_TK tk_call('font', 'create', @latinfont, '-charset', 'iso8859') tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983') - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont]) else tk_call('font', 'create', @latinfont) @@ -614,7 +614,7 @@ class TkFont # compound font check if Tk::TK_VERSION == '8.0' && JAPANIZED_TK begin - compound = tk_split_simplelist(tk_call('font', 'configure', + compound = tk_split_simplelist(tk_call('font', 'configure', ltn, '-compound')) if knj == nil if compound != [] @@ -624,7 +624,7 @@ class TkFont if compound != [] ltn = compound[0] end - compound = tk_split_simplelist(tk_call('font', 'configure', + compound = tk_split_simplelist(tk_call('font', 'configure', knj, '-compound')) if compound != [] knj = compound[1] @@ -639,7 +639,7 @@ class TkFont if Tk::TK_VERSION =~ /^4..*/ knj = DEFAULT_KANJI_FONT_NAME else - knj = ltn + knj = ltn end end else @@ -806,7 +806,7 @@ class TkFont if font[:charset] || font['charset'] tk_call('font', 'create', @latinfont, *hash_kv(font)) else - tk_call('font', 'create', @latinfont, + tk_call('font', 'create', @latinfont, '-charset', 'iso8859', *hash_kv(font)) end elsif font.kind_of? Array @@ -815,7 +815,7 @@ class TkFont elsif font.kind_of? TkFont 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') @@ -851,7 +851,7 @@ class TkFont if font[:charset] || font['charset'] tk_call('font', 'create', @kanjifont, *hash_kv(font)) else - tk_call('font', 'create', @kanjifont, + tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983', *hash_kv(font)) end elsif font.kind_of? Array @@ -860,7 +860,7 @@ class TkFont elsif font.kind_of? TkFont tk_call('font', 'create', @kanjifont, '-copy', font.kanji_font_id) elsif font - tk_call('font', 'create', @kanjifont, '-copy', font, + tk_call('font', 'create', @kanjifont, '-copy', font, '-charset', 'jisx0208.1983') else tk_call('font', 'create', @kanjifont, '-charset', 'jisx0208.1983') @@ -922,7 +922,7 @@ class TkFont @fontslot = {'font'=>@compoundfont} # @fontslot['font'] = @compoundfont begin - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) rescue RuntimeError => e if ltn == knj @@ -930,7 +930,7 @@ class TkFont tk_call('font', 'delete', @latinfont) create_latinfont(DEFAULT_LATIN_FONT_NAME) opts = [] - Hash[*(tk_split_simplelist(tk_call('font', 'configure', + Hash[*(tk_split_simplelist(tk_call('font', 'configure', @kanjifont)))].each{|k,v| case k when '-size', '-weight', '-slant', '-underline', '-overstrike' @@ -938,14 +938,14 @@ class TkFont end } tk_call('font', 'configure', @latinfont, *opts) - tk_call('font', 'create', @compoundfont, + 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', + Hash[*(tk_split_simplelist(tk_call('font', 'configure', @latinfont)))].each{|k,v| case k when '-size', '-weight', '-slant', '-underline', '-overstrike' @@ -953,7 +953,7 @@ class TkFont end } tk_call('font', 'configure', @kanjifont, *opts) - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) else @@ -1392,7 +1392,7 @@ class TkFont end h = Hash[metrics(option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1424,7 +1424,7 @@ class TkFont end h = Hash[metrics_displayof(win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1459,7 +1459,7 @@ class TkFont end h = Hash[latin_metrics(option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1495,7 +1495,7 @@ class TkFont end h = Hash[latin_metrics_displayof(win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1532,7 +1532,7 @@ class TkFont end h = Hash[kanji_metrics(option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1570,7 +1570,7 @@ class TkFont end h = Hash[kanji_metrics_displayof(win, option)] - h.keys.each{|k| + h.keys.each{|k| case TkFont::MetricsType[k.to_s] when ?n h[k] = TkComm::num_or_str(h[k]) @@ -1586,7 +1586,7 @@ class TkFont def reset_pointadjust begin if /^8\..*/ === Tk::TK_VERSION && JAPANIZED_TK - configure('pointadjust' => latin_actual.assoc('size')[1].to_f / + configure('pointadjust' => latin_actual.assoc('size')[1].to_f / kanji_actual.assoc('size')[1].to_f ) end rescue @@ -1659,8 +1659,8 @@ module TkFont::CoreMethods '' end else - [['family',''], ['size',0], ['weight',''], ['slant',''], - ['underline',false], ['overstrike',false], ['charset',''], + [['family',''], ['size',0], ['weight',''], ['slant',''], + ['underline',false], ['overstrike',false], ['charset',''], ['pointadjust',0]] end end @@ -1672,7 +1672,7 @@ module TkFont::CoreMethods "" elsif option if win - val = tk_call('font', 'actual', font, + val = tk_call('font', 'actual', font, "-displayof", win, "-#{option}") else val = tk_call('font', 'actual', font, "-#{option}") @@ -1687,7 +1687,7 @@ module TkFont::CoreMethods end else l = tk_split_simplelist(if win - tk_call('font', 'actual', font, + tk_call('font', 'actual', font, "-displayof", win) else tk_call('font', 'actual', font) @@ -1733,8 +1733,8 @@ module TkFont::CoreMethods '' end else - [['family',''], ['size',0], ['weight',''], ['slant',''], - ['underline',false], ['overstrike',false], ['charset',''], + [['family',''], ['size',0], ['weight',''], ['slant',''], + ['underline',false], ['overstrike',false], ['charset',''], ['pointadjust',1.0]] end else # ! TkComm::GET_CONFIGINFOwoRES_AS_ARRAY @@ -1753,8 +1753,8 @@ module TkFont::CoreMethods '' end else - {'family'=>'', 'size'=>0, 'weight'=>'', 'slant'=>'', - 'underline'=>false, 'overstrike'=>false, + {'family'=>'', 'size'=>0, 'weight'=>'', 'slant'=>'', + 'underline'=>false, 'overstrike'=>false, 'charset'=>false, 'pointadjust'=>1.0} end end @@ -1775,20 +1775,20 @@ module TkFont::CoreMethods configure_core_tk8x(font, 'family', slot.delete('family')) end - if ((slot.key?('size') || slot.key?(:size)) && + if ((slot.key?('size') || slot.key?(:size)) && padjust && !slot.key?('pointadjust') && !slot.key?(:pointadjust)) - tk_call('font', 'configure', font, + tk_call('font', 'configure', font, '-pointadjust', padjust, *hash_kv(slot)) else tk_call('font', 'configure', font, *hash_kv(slot)) end elsif (slot == 'size' || slot == :size) && padjust != nil - tk_call('font', 'configure', font, + tk_call('font', 'configure', font, "-#{slot}", value, '-pointadjust', padjust) elsif JAPANIZED_TK && (slot == 'family' || slot == :family) # coumpund font? begin - compound = tk_split_simplelist(tk_call('font', 'configure', + compound = tk_split_simplelist(tk_call('font', 'configure', font, '-compound')) rescue tk_call('font', 'configure', font, '-family', value) @@ -1819,7 +1819,7 @@ module TkFont::CoreMethods ensure tk_call('font', 'delete', kfnt) if kfnt != '' end - + else tk_call('font', 'configure', font, "-#{slot}", value) end @@ -2044,7 +2044,7 @@ module TkFont::CoreMethods keys = self.configinfo tk_call('font', 'delete', @compoundfont) begin - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) =begin latinkeys = {} @@ -2061,7 +2061,7 @@ module TkFont::CoreMethods tk_call('font', 'delete', @latinfont) if fnt_bup && fnt_bup != '' tk_call('font', 'create', @latinfont, '-copy', fnt_bup) - tk_call('font', 'create', @compoundfont, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) tk_call('font', 'delete', fnt_bup) else @@ -2082,7 +2082,7 @@ module TkFont::CoreMethods # not exist? (deleted?) -> create font tk_call('font', 'create', @compoundfont, *hash_kv(latinkeys)) end - end + end self end @@ -2112,20 +2112,20 @@ module TkFont::CoreMethods keys = self.configinfo tk_call('font', 'delete', @compoundfont) begin - tk_call('font', 'create', @compoundfont, + 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, + tk_call('font', 'create', @compoundfont, '-compound', [@latinfont, @kanjifont], *hash_kv(keys)) tk_call('font', 'delete', fnt_bup) else fail e end end - end + end self end @@ -2137,7 +2137,7 @@ module TkFont::CoreMethods font = '{}' if font == '' if win - number(tk_call('font', 'measure', font, + number(tk_call('font', 'measure', font, '-displayof', win, text)) else number(tk_call('font', 'measure', font, text)) @@ -2158,7 +2158,7 @@ module TkFont::CoreMethods if option if win - number(tk_call('font', 'metrics', font, + number(tk_call('font', 'metrics', font, "-displayof", win, "-#{option}")) else number(tk_call('font', 'metrics', font, "-#{option}")) @@ -2304,12 +2304,12 @@ end ####################################### # define system font names ####################################### -if Tk::TCL_MAJOR_VERSION > 8 || +if Tk::TCL_MAJOR_VERSION > 8 || (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) # add standard fonts of Tcl/Tk 8.5+ TkFont::SYSTEM_FONT_NAMES.add [ - 'TkDefaultFont', 'TkTextFont', 'TkFixedFont', 'TkMenuFont', - 'TkHeadingFont', 'TkCaptionFont', 'TkSmallCaptionFont', + 'TkDefaultFont', 'TkTextFont', 'TkFixedFont', 'TkMenuFont', + 'TkHeadingFont', 'TkCaptionFont', 'TkSmallCaptionFont', 'TkIconFont', 'TkTooltipFont' ] end @@ -2323,22 +2323,22 @@ TkFont::SYSTEM_FONT_NAMES.add [ # -- macintosh, macosx TkFont::SYSTEM_FONT_NAMES.add ['system', 'application'] -if Tk::TCL_MAJOR_VERSION > 8 || +if Tk::TCL_MAJOR_VERSION > 8 || (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) TkFont::SYSTEM_FONT_NAMES.add ['menu'] end # -- macosx (Aqua theme) -if Tk::TCL_MAJOR_VERSION > 8 || +if Tk::TCL_MAJOR_VERSION > 8 || (Tk::TCL_MAJOR_VERSION == 8 && Tk::TCL_MINOR_VERSION >= 5) TkFont::SYSTEM_FONT_NAMES.add [ - 'systemSystemFont', 'systemEmphasizedSystemFont', - 'systemSmallSystemFont', 'systemSmallEmphasizedSystemFont', - 'systemApplicationFont', 'systemLabelFont', 'systemViewsFont', - 'systemMenuTitleFont', 'systemMenuItemFont', 'systemMenuItemMarkFont', - 'systemMenuItemCmdKeyFont', 'systemWindowTitleFont', - 'systemPushButtonFont', 'systemUtilityWindowTitleFont', - 'systemAlertHeaderFont', 'systemToolbarFont', 'systemMiniSystemFont', + 'systemSystemFont', 'systemEmphasizedSystemFont', + 'systemSmallSystemFont', 'systemSmallEmphasizedSystemFont', + 'systemApplicationFont', 'systemLabelFont', 'systemViewsFont', + 'systemMenuTitleFont', 'systemMenuItemFont', 'systemMenuItemMarkFont', + 'systemMenuItemCmdKeyFont', 'systemWindowTitleFont', + 'systemPushButtonFont', 'systemUtilityWindowTitleFont', + 'systemAlertHeaderFont', 'systemToolbarFont', 'systemMiniSystemFont', 'systemDetailSystemFont', 'systemDetailEmphasizedSystemFont' ] end diff --git a/ext/tk/lib/tk/grid.rb b/ext/tk/lib/tk/grid.rb index 0dfd7263a7..ca476a6ab5 100644 --- a/ext/tk/lib/tk/grid.rb +++ b/ext/tk/lib/tk/grid.rb @@ -101,7 +101,7 @@ module TkGrid def columnconfigure(master, index, args) # master = master.epath if master.kind_of?(TkObject) master = _epath(master) - tk_call_without_enc("grid", 'columnconfigure', + tk_call_without_enc("grid", 'columnconfigure', master, index, *hash_kv(args)) end alias column columnconfigure @@ -119,15 +119,15 @@ module TkGrid if slot case slot when 'uniform', :uniform - tk_call_without_enc('grid', 'columnconfigure', + tk_call_without_enc('grid', 'columnconfigure', master, index, "-#{slot}") else - num_or_str(tk_call_without_enc('grid', 'columnconfigure', + 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', + ilist = simplelist(tk_call_without_enc('grid', 'columnconfigure', master, index)) info = {} while key = ilist.shift @@ -148,15 +148,15 @@ module TkGrid if slot case slot when 'uniform', :uniform - tk_call_without_enc('grid', 'rowconfigure', + tk_call_without_enc('grid', 'rowconfigure', master, index, "-#{slot}") else - num_or_str(tk_call_without_enc('grid', 'rowconfigure', + 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', + ilist = simplelist(tk_call_without_enc('grid', 'rowconfigure', master, index)) info = {} while key = ilist.shift diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb index dffdc19644..09f173909d 100644 --- a/ext/tk/lib/tk/image.rb +++ b/ext/tk/lib/tk/image.rb @@ -45,7 +45,7 @@ class TkImage<TkObject keys.delete('imagename') keys.delete('without_creating') obj.instance_eval{ - tk_call_without_enc('image', 'create', + tk_call_without_enc('image', 'create', @type, @path, *hash_kv(keys, true)) } end @@ -78,7 +78,7 @@ class TkImage<TkObject } end unless without_creating - tk_call_without_enc('image', 'create', + tk_call_without_enc('image', 'create', @type, @path, *hash_kv(keys, true)) end end diff --git a/ext/tk/lib/tk/itemconfig.rb b/ext/tk/lib/tk/itemconfig.rb index 9c6a98d0f8..cd05d7ea53 100644 --- a/ext/tk/lib/tk/itemconfig.rb +++ b/ext/tk/lib/tk/itemconfig.rb @@ -31,10 +31,10 @@ module TkItemConfigOptkeys def __item_strval_optkeys(id) # maybe need to override [ - 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile', - 'activebackground', 'activeforeground', 'background', - 'disabledforeground', 'disabledbackground', 'foreground', - 'highlightbackground', 'highlightcolor', 'insertbackground', + 'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile', + 'activebackground', 'activeforeground', 'background', + 'disabledforeground', 'disabledbackground', 'foreground', + 'highlightbackground', 'highlightcolor', 'insertbackground', 'selectbackground', 'selectforeground', 'troughcolor' ] end @@ -148,7 +148,7 @@ module TkItemConfigMethod def __item_configinfo_struct(id) # maybe need to override - {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, + {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, :default_value=>3, :current_value=>4} end private :__item_configinfo_struct @@ -402,7 +402,7 @@ module TkItemConfigMethod fontkey = $2 # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")))) conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")), false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + 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 ) @@ -414,7 +414,7 @@ module TkItemConfigMethod 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]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end conf @@ -464,7 +464,7 @@ module TkItemConfigMethod 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]] = + 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 @@ -472,7 +472,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + 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 @@ -485,11 +485,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -500,7 +500,7 @@ module TkItemConfigMethod 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]] = + 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 @@ -508,7 +508,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + 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 @@ -521,11 +521,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -536,12 +536,12 @@ module TkItemConfigMethod 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]] = + 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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -574,13 +574,13 @@ module TkItemConfigMethod # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))) conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true) end - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + 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]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end @@ -591,7 +591,7 @@ module TkItemConfigMethod # conf = tk_split_simplelist(conflist) ret = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false).collect{|conflist| conf = tk_split_simplelist(conflist, false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]] @@ -627,7 +627,7 @@ module TkItemConfigMethod 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]] = + 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 @@ -635,7 +635,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + 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 @@ -645,11 +645,11 @@ module TkItemConfigMethod 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]] = + 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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -657,7 +657,7 @@ module TkItemConfigMethod 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]] = + 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 @@ -665,7 +665,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + 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 @@ -675,11 +675,11 @@ module TkItemConfigMethod 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]] = + 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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -687,12 +687,12 @@ module TkItemConfigMethod 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]] = + 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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -719,20 +719,20 @@ module TkItemConfigMethod 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]]) + 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]]) + 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]]) + 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]]) + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end end end @@ -740,7 +740,7 @@ module TkItemConfigMethod 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]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end @@ -774,7 +774,7 @@ module TkItemConfigMethod fontkey = $2 # conf = tk_split_simplelist(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")))) conf = tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{fontkey}")), false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] if ( ! __item_configinfo_struct(tagid(tagOrId))[:alias] \ @@ -788,7 +788,7 @@ module TkItemConfigMethod 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]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end { conf[0] => conf[1] } @@ -841,7 +841,7 @@ module TkItemConfigMethod 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]] = + 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 @@ -849,7 +849,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + 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 @@ -862,11 +862,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -877,7 +877,7 @@ module TkItemConfigMethod 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]] = + 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 @@ -885,7 +885,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + 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 @@ -898,11 +898,11 @@ module TkItemConfigMethod if ( __item_configinfo_struct(tagid(tagOrId))[:default_value] \ && conf[__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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -913,12 +913,12 @@ module TkItemConfigMethod 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]] = + 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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -951,13 +951,13 @@ module TkItemConfigMethod # conf = tk_split_list(_fromUTF8(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")))) conf = tk_split_list(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)) << "-#{slot}")), 0, false, true) end - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + 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]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end { conf[0] => conf[1] } @@ -971,7 +971,7 @@ module TkItemConfigMethod # conf = tk_split_simplelist(conflist) tk_split_simplelist(tk_call_without_enc(*(__item_confinfo_cmd(tagid(tagOrId)))), false, false).each{|conflist| conf = tk_split_simplelist(conflist, false, true) - conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:key]] = conf[__item_configinfo_struct(tagid(tagOrId))[:key]][1..-1] optkey = conf[__item_configinfo_struct(tagid(tagOrId))[:key]] @@ -1007,7 +1007,7 @@ module TkItemConfigMethod 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]] = + 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 @@ -1015,7 +1015,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + 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 @@ -1025,11 +1025,11 @@ module TkItemConfigMethod 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]] = + 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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = num_or_str(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -1037,7 +1037,7 @@ module TkItemConfigMethod 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]] = + 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 @@ -1045,7 +1045,7 @@ module TkItemConfigMethod end if ( conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] ) begin - conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = + 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 @@ -1055,11 +1055,11 @@ module TkItemConfigMethod 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]] = + 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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = simplelist(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -1067,12 +1067,12 @@ module TkItemConfigMethod 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]] = + 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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = list(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end @@ -1099,19 +1099,19 @@ module TkItemConfigMethod 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]]) + 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]] = + 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]]) + 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]] = + conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]] = tk_tcl2ruby(conf[__item_configinfo_struct(tagid(tagOrId))[:current_value]]) end end @@ -1120,7 +1120,7 @@ module TkItemConfigMethod 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]] = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]][1..-1] end ret[conf[0]] = conf[1] @@ -1187,7 +1187,7 @@ module TkItemConfigMethod end slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] end while(org_slot != slot) - fail RuntimeError, + fail RuntimeError, "there is a configure alias loop about '#{org_slot}'" else ret = {} diff --git a/ext/tk/lib/tk/itemfont.rb b/ext/tk/lib/tk/itemfont.rb index 4c5c917c57..b5da4fa1ef 100644 --- a/ext/tk/lib/tk/itemfont.rb +++ b/ext/tk/lib/tk/itemfont.rb @@ -32,22 +32,22 @@ module TkTreatItemFont if key pathname = [win, tag, key].join(';') - TkFont.used_on(pathname) || - TkFont.init_widget_font(pathname, + TkFont.used_on(pathname) || + TkFont.init_widget_font(pathname, *(__item_confinfo_cmd(tagid(tagOrId)))) elsif optkeys.size == 1 pathname = [win, tag, optkeys[0]].join(';') - TkFont.used_on(pathname) || - TkFont.init_widget_font(pathname, + TkFont.used_on(pathname) || + TkFont.init_widget_font(pathname, *(__item_confinfo_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, + fonts[key] = + TkFont.used_on(pathname) || + TkFont.init_widget_font(pathname, *(__item_confinfo_cmd(tagid(tagOrId)))) } fonts @@ -73,13 +73,13 @@ module TkTreatItemFont slot.delete(a_optkey) slot.delete(k_optkey) - fnt.call_font_configure([pathname, 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) || + if (slot.key?(l_optkey) || + slot.key?(a_optkey) || slot.key?(k_optkey)) fnt = TkFont.new(fnt) @@ -90,7 +90,7 @@ module TkTreatItemFont fnt.latin_replace(lfnt) if lfnt fnt.kanji_replace(kfnt) if kfnt - fnt.call_font_configure([pathname, optkey], + fnt.call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {})) next else @@ -115,7 +115,7 @@ module TkTreatItemFont kfnt = slot.delete(k_optkey) if lfnt && kfnt - TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey], + TkFont.new(lfnt, kfnt).call_font_configure([pathname, optkey], *(__item_config_cmd(tagid(tagOrId)) << {})) elsif lfnt latintagfont_configure([lfnt, optkey]) @@ -264,10 +264,10 @@ module TkTreatItemFont end if targetkey - fnt.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], + fnt.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], *(__item_config_cmd(tagid(tagOrId)) << {})) else - fnt.call_font_configure(__item_pathname(tagid(tagOrId)), + fnt.call_font_configure(__item_pathname(tagid(tagOrId)), *(__item_config_cmd(tagid(tagOrId)) << {})) end self @@ -276,10 +276,10 @@ module TkTreatItemFont def latintagfont_copy(tagOrId, win, wintag=nil, winkey=nil, targetkey=nil) if targetkey - fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], + fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], *(__item_config_cmd(tagid(tagOrId)) << {})) else - fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), + fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), *(__item_config_cmd(tagid(tagOrId)) << {})) end @@ -302,10 +302,10 @@ module TkTreatItemFont def kanjifont_copy(tagOrId, win, wintag=nil, winkey=nil, targetkey=nil) if targetkey - fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], + fontobj(targetkey).dup.call_font_configure([__item_pathname(tagid(tagOrId)), targetkey], *(__item_config_cmd(tagid(tagOrId)) << {})) else - fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), + fontobj.dup.call_font_configure(__item_pathname(tagid(tagOrId)), *(__item_config_cmd(tagid(tagOrId)) << {})) end diff --git a/ext/tk/lib/tk/kinput.rb b/ext/tk/lib/tk/kinput.rb index a29dbcdb72..b63f756def 100644 --- a/ext/tk/lib/tk/kinput.rb +++ b/ext/tk/lib/tk/kinput.rb @@ -8,8 +8,8 @@ module TkKinput extend Tk TkCommandNames = [ - 'kinput_start'.freeze, - 'kinput_send_spot'.freeze, + 'kinput_start'.freeze, + 'kinput_send_spot'.freeze, 'kanjiInput'.freeze ].freeze @@ -47,7 +47,7 @@ module TkKinput def TkKinput.attribute_info(win, slot=nil) if slot - conf = tk_split_list(tk_call('kanjiInput', 'attribute', + conf = tk_split_list(tk_call('kanjiInput', 'attribute', win, "-#{slot}")) conf[0] = conf[0][1..-1] conf diff --git a/ext/tk/lib/tk/listbox.rb b/ext/tk/lib/tk/listbox.rb index bb039ffb0e..4357fafc27 100644 --- a/ext/tk/lib/tk/listbox.rb +++ b/ext/tk/lib/tk/listbox.rb @@ -92,7 +92,7 @@ class Tk::Listbox<TkTextWin fail ArgumentError, 'an Array is expected' end tk_send_without_enc('delete', '0', 'end') - tk_send_without_enc('insert', '0', + tk_send_without_enc('insert', '0', *(vals.collect{|v| _get_eval_enc_str(v)})) vals end @@ -110,7 +110,7 @@ class Tk::Listbox<TkTextWin _fromUTF8(tk_send_without_enc('itemcget', index, "-#{key}")) when 'font', 'kanjifont' #fnt = tk_tcl2ruby(tk_send('itemcget', index, "-#{key}")) - fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', index, + fnt = tk_tcl2ruby(_fromUTF8(tk_send_without_enc('itemcget', index, '-font'))) unless fnt.kind_of?(TkFont) fnt = tagfontobj(index, fnt) @@ -127,9 +127,9 @@ class Tk::Listbox<TkTextWin end def itemconfigure(index, key, val=None) if key.kind_of? Hash - if (key['font'] || key[:font] || - key['kanjifont'] || key[:kanjifont] || - key['latinfont'] || key[:latinfont] || + if (key['font'] || key[:font] || + key['kanjifont'] || key[:kanjifont] || + key['latinfont'] || key[:latinfont] || key['asciifont'] || key[:asciifont] ) tagfont_configure(index, _symbolkey2str(key)) else @@ -137,9 +137,9 @@ class Tk::Listbox<TkTextWin end else - if (key == 'font' || key == :font || - key == 'kanjifont' || key == :kanjifont || - key == 'latinfont' || key == :latinfont || + if (key == 'font' || key == :font || + key == 'kanjifont' || key == :kanjifont || + key == 'latinfont' || key == :latinfont || key == 'asciifont' || key == :asciifont ) if val == None tagfontobj(index) @@ -176,16 +176,16 @@ class Tk::Listbox<TkTextWin else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -224,16 +224,16 @@ class Tk::Listbox<TkTextWin else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end diff --git a/ext/tk/lib/tk/menu.rb b/ext/tk/lib/tk/menu.rb index 0e4f419e15..3e122e6987 100644 --- a/ext/tk/lib/tk/menu.rb +++ b/ext/tk/lib/tk/menu.rb @@ -155,13 +155,13 @@ class Tk::Menu<TkWindow _fromUTF8(tk_send_without_enc('invoke', _get_eval_enc_str(index))) end def insert(index, type, keys=nil) - tk_send_without_enc('insert', _get_eval_enc_str(index), + tk_send_without_enc('insert', _get_eval_enc_str(index), type, *hash_kv(keys, true)) self end def delete(first, last=nil) if last - tk_send_without_enc('delete', _get_eval_enc_str(first), + tk_send_without_enc('delete', _get_eval_enc_str(first), _get_eval_enc_str(last)) else tk_send_without_enc('delete', _get_eval_enc_str(first)) @@ -170,7 +170,7 @@ class Tk::Menu<TkWindow end def popup(x, y, index=nil) if index - tk_call_without_enc('tk_popup', path, x, y, + tk_call_without_enc('tk_popup', path, x, y, _get_eval_enc_str(index)) else tk_call_without_enc('tk_popup', path, x, y) @@ -214,7 +214,7 @@ class Tk::Menu<TkWindow def entrycget(index, key) case key.to_s when 'text', 'label', 'show' - _fromUTF8(tk_send_without_enc('entrycget', + _fromUTF8(tk_send_without_enc('entrycget', _get_eval_enc_str(index), "-#{key}")) when 'font', 'kanjifont' #fnt = tk_tcl2ruby(tk_send('entrycget', index, "-#{key}")) @@ -234,20 +234,20 @@ class Tk::Menu<TkWindow end def entryconfigure(index, key, val=None) if key.kind_of? Hash - if (key['font'] || key[:font] || - key['kanjifont'] || key[:kanjifont] || - key['latinfont'] || key[:latinfont] || + if (key['font'] || key[:font] || + key['kanjifont'] || key[:kanjifont] || + key['latinfont'] || key[:latinfont] || key['asciifont'] || key[:asciifont]) tagfont_configure(index, _symbolkey2str(key)) else - tk_send_without_enc('entryconfigure', _get_eval_enc_str(index), + 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 || + if (key == 'font' || key == :font || + key == 'kanjifont' || key == :kanjifont || + key == 'latinfont' || key == :latinfont || key == 'asciifont' || key == :asciifont ) if val == None tagfontobj(index) @@ -284,16 +284,16 @@ class Tk::Menu<TkWindow else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -331,16 +331,16 @@ class Tk::Menu<TkWindow else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -509,18 +509,18 @@ class Tk::Menubutton<Tk::Label if keys and keys != None unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ # tk_call_without_enc('menubutton', @path, *hash_kv(keys, true)) - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else begin - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) rescue tk_call_without_enc(self.class::TkCommandNames[0], @path) keys = __check_available_configure_options(keys) unless keys.empty? tk_call_without_enc('destroy', @path) rescue nil - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) end end @@ -571,7 +571,7 @@ class Tk::OptionMenubutton<Tk::Menubutton parent = nil if !args.empty? && (args[0].kind_of?(TkWindow) || args[0] == nil) keys.delete('parent') # ignore - parent = args.shift + parent = args.shift else parent = keys.delete('parent') end @@ -579,7 +579,7 @@ class Tk::OptionMenubutton<Tk::Menubutton @variable = nil if !args.empty? && (args[0].kind_of?(TkVariable) || args[0] == nil) keys.delete('variable') # ignore - @variable = args.shift + @variable = args.shift else @variable = keys.delete('variable') end @@ -593,7 +593,7 @@ class Tk::OptionMenubutton<Tk::Menubutton end install_win(if parent then parent.path end) - @menu = OptionMenu.new(tk_call('tk_optionMenu', + @menu = OptionMenu.new(tk_call('tk_optionMenu', @path, @variable.id, *args)) configure(keys) if keys @@ -612,7 +612,7 @@ class Tk::OptionMenubutton<Tk::Menubutton self end def add(value) - @menu.add('radiobutton', 'variable'=>@variable, + @menu.add('radiobutton', 'variable'=>@variable, 'label'=>value, 'value'=>value) self end @@ -623,7 +623,7 @@ class Tk::OptionMenubutton<Tk::Menubutton @menu.invoke(index) end def insert(index, value) - @menu.insert(index, 'radiobutton', 'variable'=>@variable, + @menu.insert(index, 'radiobutton', 'variable'=>@variable, 'label'=>value, 'value'=>value) self end @@ -677,5 +677,5 @@ end Tk::OptionMenuButton = Tk::OptionMenubutton #TkOptionMenubutton = Tk::OptionMenubutton unless Object.const_defined? :TkOptionMenubutton #TkOptionMenuButton = Tk::OptionMenuButton unless Object.const_defined? :TkOptionMenuButton -Tk.__set_toplevel_aliases__(:Tk, Tk::OptionMenubutton, +Tk.__set_toplevel_aliases__(:Tk, Tk::OptionMenubutton, :TkOptionMenubutton, :TkOptionMenuButton) diff --git a/ext/tk/lib/tk/menubar.rb b/ext/tk/lib/tk/menubar.rb index ef9da809b9..ac537cb4ec 100644 --- a/ext/tk/lib/tk/menubar.rb +++ b/ext/tk/lib/tk/menubar.rb @@ -2,7 +2,7 @@ # tk/menubar.rb # # Original version: -# Copyright (C) 1998 maeda shugo. All rights reserved. +# Copyright (C) 1998 maeda shugo. All rights reserved. # This file can be distributed under the terms of the Ruby. # Usage: @@ -52,18 +52,18 @@ # {:label=>'Open', :command=>proc{puts('Open clicked')}, :underline=>0}, # '---', # ['Check_A', TkVariable.new(true), 6], -# {:type=>'checkbutton', :label=>'Check_B', +# {:type=>'checkbutton', :label=>'Check_B', # :variable=>TkVariable.new, :underline=>6}, # '---', # ['Radio_X', [radio_var, 'x'], 6], # ['Radio_Y', [radio_var, 'y'], 6], # ['Radio_Z', [radio_var, 'z'], 6], # '---', -# ['cascade', [ -# ['sss', proc{p 'sss'}, 0], -# ['ttt', proc{p 'ttt'}, 0], -# ['uuu', proc{p 'uuu'}, 0], -# ['vvv', proc{p 'vvv'}, 0], +# ['cascade', [ +# ['sss', proc{p 'sss'}, 0], +# ['ttt', proc{p 'ttt'}, 0], +# ['uuu', proc{p 'uuu'}, 0], +# ['vvv', proc{p 'vvv'}, 0], # ], 0], # '---', # ['Quit', proc{exit}, 0]], @@ -92,7 +92,7 @@ require 'tk/menuspec' class TkMenubar<Tk::Frame include TkComposite include TkMenuSpec - + def initialize(parent = nil, spec = nil, options = nil) if parent.kind_of? Hash options = _symbolkey2str(parent) @@ -103,7 +103,7 @@ class TkMenubar<Tk::Frame end @menus = [] - + spec.each{|info| add_menu(info)} if spec options.each{|key, value| configure(key, value)} if options @@ -124,7 +124,7 @@ class TkMenubar<Tk::Frame delegate('font', mbtn, menu, *submenus) delegate('kanjifont', mbtn, menu, *submenus) end - + def [](index) return @menus[index] end diff --git a/ext/tk/lib/tk/menuspec.rb b/ext/tk/lib/tk/menuspec.rb index 2a2eb9ba3c..3f38ab5140 100644 --- a/ext/tk/lib/tk/menuspec.rb +++ b/ext/tk/lib/tk/menuspec.rb @@ -3,7 +3,7 @@ # Hidethoshi NAGAI (nagai@ai.kyutech.ac.jp) # # based on tkmenubar.rb : -# Copyright (C) 1998 maeda shugo. All rights reserved. +# Copyright (C) 1998 maeda shugo. All rights reserved. # This file can be distributed under the terms of the Ruby. # # The format of the menu_spec is: @@ -14,24 +14,24 @@ # [text, underline, configs], # menu button/entry (*1) # [label, command, underline, accelerator, configs], # command entry # [label, TkVar_obj, underline, accelerator, configs], # checkbutton entry -# [label, [TkVar_obj, value], +# [label, [TkVar_obj, value], # underline, accelerator, configs], # radiobutton entry -# [label, [[...menu_info...], [...menu_info...], ...], +# [label, [[...menu_info...], [...menu_info...], ...], # underline, accelerator, configs], # cascade entry (*2) # '---', # separator # ... # ] # -# underline, accelerator, and configs are optional pearameters. -# Hashes are OK instead of Arrays. Then the entry type ('command', +# underline, accelerator, and configs are optional pearameters. +# Hashes are OK instead of Arrays. Then the entry type ('command', # 'checkbutton', 'radiobutton' or 'cascade') is given by 'type' key # (e.g. :type=>'cascade'). When type is 'cascade', an array of menu_info # is acceptable for 'menu' key (then, create sub-menu). # # NOTE: (*1) -# If you want to make special menus (*.help for UNIX, *.system for Win, -# and *.apple for Mac), append 'menu_name'=>name (name is 'help' for UNIX, -# 'system' for Win, and 'apple' for Mac) option to the configs hash of +# If you want to make special menus (*.help for UNIX, *.system for Win, +# and *.apple for Mac), append 'menu_name'=>name (name is 'help' for UNIX, +# 'system' for Win, and 'apple' for Mac) option to the configs hash of # menu button/entry information. # # NOTE: (*2) @@ -39,7 +39,7 @@ # to the configs of the cascade entry. module TkMenuSpec - def _create_menu(parent, menu_info, menu_name = nil, + def _create_menu(parent, menu_info, menu_name = nil, tearoff = false, default_opts = nil) if tearoff.kind_of?(Hash) default_opts = tearoff @@ -80,7 +80,7 @@ module TkMenuSpec 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, + submenu = _create_menu(menu, options['menu'], menu_name, tearoff, menu_opts) options['menu'] = submenu end @@ -117,7 +117,7 @@ module TkMenuSpec menu_config = opts.delete('menu_config') || {} menu_opts.update(_symbolkey2str(menu_config)) end - submenu = _create_menu(menu, item_info[1], menu_name, + submenu = _create_menu(menu, item_info[1], menu_name, tearoff, menu_opts) options['menu'] = submenu end @@ -155,7 +155,7 @@ module TkMenuSpec def _use_menubar?(parent) use_menubar = false if parent.kind_of?(Tk::Root) || parent.kind_of?(Tk::Toplevel) - true + true elsif parent.current_configinfo.has_key?('menu') true else @@ -214,7 +214,7 @@ module TkMenuSpec keys = {:label=>btn_info} end - menu = _create_menu(mbar, menu_info[1..-1], menu_name, + menu = _create_menu(mbar, menu_info[1..-1], menu_name, tearoff, default_opts) menu.tearoff(tearoff) @@ -251,9 +251,9 @@ module TkMenuSpec mbtn.pack('side' => 'left') - menu = _create_menu(mbtn, menu_info[1..-1], menu_name, + menu = _create_menu(mbtn, menu_info[1..-1], menu_name, tearoff, default_opts) - + mbtn.menu(menu) [mbtn, menu] diff --git a/ext/tk/lib/tk/mngfocus.rb b/ext/tk/lib/tk/mngfocus.rb index 1a2049c8a8..a05fb94f8e 100644 --- a/ext/tk/lib/tk/mngfocus.rb +++ b/ext/tk/lib/tk/mngfocus.rb @@ -8,8 +8,8 @@ module TkManageFocus extend Tk TkCommandNames = [ - 'tk_focusFollowMouse'.freeze, - 'tk_focusNext'.freeze, + 'tk_focusFollowMouse'.freeze, + 'tk_focusNext'.freeze, 'tk_focusPrev'.freeze ].freeze diff --git a/ext/tk/lib/tk/msgcat.rb b/ext/tk/lib/tk/msgcat.rb index 162953f425..f90dbc5efa 100644 --- a/ext/tk/lib/tk/msgcat.rb +++ b/ext/tk/lib/tk/msgcat.rb @@ -11,13 +11,13 @@ class TkMsgCatalog < TkObject #extend TkMsgCatalog TkCommandNames = [ - '::msgcat::mc'.freeze, - '::msgcat::mcmax'.freeze, - '::msgcat::mclocale'.freeze, - '::msgcat::mcpreferences'.freeze, - '::msgcat::mcload'.freeze, - '::msgcat::mcset'.freeze, - '::msgcat::mcmset'.freeze, + '::msgcat::mc'.freeze, + '::msgcat::mcmax'.freeze, + '::msgcat::mclocale'.freeze, + '::msgcat::mcpreferences'.freeze, + '::msgcat::mcload'.freeze, + '::msgcat::mcset'.freeze, + '::msgcat::mcmset'.freeze, '::msgcat::mcunknown'.freeze ].freeze @@ -69,10 +69,10 @@ 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")) + + 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 >-------" if TkCore::WITH_ENCODING msg.force_encoding('utf-8') @@ -80,9 +80,9 @@ class TkMsgCatalog < TkObject msg.instance_variable_set(:@encoding, 'utf-8') end rescue Exception - msg = e.class.inspect + ': ' + e.message + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - e.backtrace.join("\n") + + 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) @@ -153,7 +153,7 @@ class TkMsgCatalog < TkObject end def translate(*args) dst = args.collect{|src| - @namespace.eval{tk_call_without_enc('::msgcat::mc', + @namespace.eval{tk_call_without_enc('::msgcat::mc', _get_eval_string(src, true))} } Tk.UTF8_String(sprintf(*dst)) @@ -229,29 +229,29 @@ class TkMsgCatalog < TkObject def self.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(tk_call_without_enc('::msgcat::mcset', - locale, - _get_eval_string(src_str, true), + Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset', + locale, + _get_eval_string(src_str, true), trans_str)) else - Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset', - locale, + Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset', + 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)) + 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), + 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, + tk_call_without_enc('::msgcat::mcset', + locale, _get_eval_string(src_str, true))}) end end @@ -261,7 +261,7 @@ class TkMsgCatalog < TkObject list = [] trans_list.each{|src, trans| if trans && trans != None - list << _get_eval_string(src, true) + list << _get_eval_string(src, true) list << Tk.UTF8_Stirng(_toUTF8(trans, enc)) else list << _get_eval_string(src, true) << '' @@ -274,7 +274,7 @@ class TkMsgCatalog < TkObject list = [] trans_list.each{|src, trans| if trans && trans != None - list << _get_eval_string(src, true) + list << _get_eval_string(src, true) list << Tk.UTF8_String(_toUTF8(trans, enc)) else list << _get_eval_string(src, true) << '' diff --git a/ext/tk/lib/tk/namespace.rb b/ext/tk/lib/tk/namespace.rb index 20a8d65215..dfb162cda8 100644 --- a/ext/tk/lib/tk/namespace.rb +++ b/ext/tk/lib/tk/namespace.rb @@ -8,7 +8,7 @@ class TkNamespace < TkObject extend Tk TkCommandNames = [ - 'namespace'.freeze, + 'namespace'.freeze, ].freeze Tk_Namespace_ID_TBL = TkCore::INTERP.create_table @@ -46,7 +46,7 @@ class TkNamespace < TkObject private :__config_cmd def __configinfo_struct - {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, + {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, :default_value=>nil, :current_value=>2} end private :__configinfo_struct @@ -122,8 +122,8 @@ class TkNamespace < TkObject if TkComm::GET_CONFIGINFO_AS_ARRAY Tk_Namespace_ID_TBL.mutex.synchronize{ - info.map!{|inf| - if inf[0] == 'namespace' && + info.map!{|inf| + if inf[0] == 'namespace' && TkNamespace::Tk_Namespace_ID_TBL.key?(inf[-1]) [inf[0], TkNamespace::Tk_Namespace_ID_TBL[inf[-1]]] else @@ -160,19 +160,19 @@ class TkNamespace < TkObject def tk_call(*args) #super('namespace', 'eval', @namespace, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @namespace, + super('namespace', 'eval', @namespace, 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, true))? s: ''} - super('namespace', 'eval', @namespace, + super('namespace', 'eval', @namespace, 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, true))? s: ''} - super('namespace', 'eval', @namespace, + super('namespace', 'eval', @namespace, TkCore::INTERP._merge_tklist(*args)) end @@ -223,19 +223,19 @@ class TkNamespace < TkObject def tk_call(*args) #super('namespace', 'eval', @fullname, *args) args = args.collect{|arg| (s = _get_eval_string(arg, true))? s: ''} - super('namespace', 'eval', @fullname, + super('namespace', 'eval', @fullname, 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, true))? s: ''} - super('namespace', 'eval', @fullname, + super('namespace', 'eval', @fullname, 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, true))? s: ''} - super('namespace', 'eval', @fullname, + super('namespace', 'eval', @fullname, TkCore::INTERP._merge_tklist(*args)) end alias ns_tk_call tk_call @@ -318,7 +318,7 @@ class TkNamespace < TkObject else fail ArgumentError, "String or Proc is expected" end - TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', + TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', _get_eval_string(cmd, false))) end =end @@ -350,8 +350,8 @@ class TkNamespace < TkObject else fail ArgumentError, "String or Proc is expected" end - TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', - _get_eval_string(cmd, false)), + TkNamespace::NsCode.new(tk_call_without_enc('namespace', 'code', + _get_eval_string(cmd, false)), true) end diff --git a/ext/tk/lib/tk/optiondb.rb b/ext/tk/lib/tk/optiondb.rb index 186811d37d..9d366c13ea 100644 --- a/ext/tk/lib/tk/optiondb.rb +++ b/ext/tk/lib/tk/optiondb.rb @@ -44,7 +44,7 @@ module TkOptionDB def read_entries(file, f_enc=nil) if TkCore::INTERP.safe? - fail SecurityError, + fail SecurityError, "can't call 'TkOptionDB.read_entries' on a safe interpreter" end @@ -86,7 +86,7 @@ module TkOptionDB ent end module_function :read_entries - + def read_with_encoding(file, f_enc=nil, pri=None) # try to read the file as an OptionDB file read_entries(file, f_enc).each{|pat, val| @@ -136,7 +136,7 @@ module TkOptionDB @@resource_proc_class.const_set(:CARRIER, '.'.freeze) - @@resource_proc_class.instance_variable_set('@method_tbl', + @@resource_proc_class.instance_variable_set('@method_tbl', TkCore::INTERP.create_table) @@resource_proc_class.instance_variable_set('@add_method', false) @@resource_proc_class.instance_variable_set('@safe_mode', 4) @@ -144,7 +144,7 @@ module TkOptionDB class << @@resource_proc_class private :new -=begin +=begin CARRIER = '.'.freeze METHOD_TBL = TkCore::INTERP.create_table ADD_METHOD = false @@ -171,7 +171,7 @@ module TkOptionDB def __check_proc_string__(str) # If you want to check the proc_string, do it in this method. - # Please define this in the block given to 'new_proc_class' method. + # Please define this in the block given to 'new_proc_class' method. str end @@ -186,20 +186,20 @@ module TkOptionDB unless TkComm._callback_entry?(res_proc) #if id == :new || !(self::METHOD_TBL.has_key?(id) || self::ADD_METHOD) if id == :new || !(@method_tbl.has_key?(id) || @add_method) - raise NoMethodError, + raise NoMethodError, "not support resource-proc '#{id.id2name}' for #{self.name}" end proc_str = proc_source proc_str = '{' + proc_str + '}' unless /\A\{.*\}\Z/ =~ proc_str #proc_str = __closed_block_check__(proc_str) proc_str = __check_proc_string__(proc_str) - res_proc = proc{ + 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:/, + raise SyntaxError, + TkCore::INTERP._toUTF8(err.message.gsub(/\(eval\):\d:/, "(#{id.id2name}):")) end }.call @@ -291,7 +291,7 @@ module TkOptionDB cmd_klass.instance_variable_set('@method_tbl', TkCore::INTERP.create_table) cmd_klass.instance_variable_set('@add_method', add) cmd_klass.instance_variable_set('@safe_mode', safe) - func.each{|f| + func.each{|f| cmd_klass.instance_variable_get('@method_tbl')[f.to_s.intern] = nil } =begin @@ -310,14 +310,14 @@ module TkOptionDB # for security, make these methods invalid 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?, - :instance_variable_get, :instance_variable_set, :instance_method, + [ :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?, + :instance_variable_get, :instance_variable_set, :instance_method, :instance_eval, :instance_exec, :instance_variables, :kind_of?, :is_a?, :private_methods, :protected_methods, :public_methods ].each{|m| alias_method(m, :__null_method) @@ -331,7 +331,7 @@ module TkOptionDB RAND_BASE_HEAD = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' RAND_BASE_CHAR = RAND_BASE_HEAD + 'abcdefghijklmnopqrstuvwxyz0123456789_' def __get_random_basename - name = '%s%03d' % [RAND_BASE_HEAD[rand(RAND_BASE_HEAD.size),1], + name = '%s%03d' % [RAND_BASE_HEAD[rand(RAND_BASE_HEAD.size),1], RAND_BASE_CNT[0]] len = RAND_BASE_CHAR.size (6+rand(10)).times{ @@ -344,9 +344,9 @@ module TkOptionDB private_class_method :__get_random_basename # define new proc class : - # If you want to modify the new class or create a new subclass, - # you must do such operation in the block parameter. - # Because the created class is flozen after evaluating the block. + # If you want to modify the new class or create a new subclass, + # you must do such operation in the block parameter. + # Because the created class is flozen after evaluating the block. def new_proc_class(klass, func, safe = 4, add = false, parent = nil, &b) new_klass = __create_new_class(klass, func, safe, add, parent) new_klass.class_eval(&b) if block_given? @@ -357,7 +357,7 @@ module TkOptionDB module_function :new_proc_class def eval_under_random_base(parent = nil, &b) - new_klass = __create_new_class(__get_random_basename(), + new_klass = __create_new_class(__get_random_basename(), [], 4, false, parent) ret = new_klass.class_eval(&b) if block_given? __remove_methods_of_proc_class(new_klass) diff --git a/ext/tk/lib/tk/optionobj.rb b/ext/tk/lib/tk/optionobj.rb index 8fe7e0ee5a..29b06da0eb 100644 --- a/ext/tk/lib/tk/optionobj.rb +++ b/ext/tk/lib/tk/optionobj.rb @@ -1,10 +1,10 @@ # # tk/optionobj.rb : control options for a group of widgets # -# NOTE: If you want to use key-only option (no value), -# use Tk::None for the value of the key-only option. +# NOTE: If you want to use key-only option (no value), +# use Tk::None for the value of the key-only option. # -# e.g. hash_kv({'aaa'=>1, 'bbb'=>Tk::None, 'ccc'=>3}) +# e.g. hash_kv({'aaa'=>1, 'bbb'=>Tk::None, 'ccc'=>3}) # => ["-aaa", 1, "-bbb", "-ccc", 3] # require 'tk' @@ -36,7 +36,7 @@ module Tk def _remove_win(win) if win.kind_of?(Array) widget, method = win - @observ.delete_if{|x| + @observ.delete_if{|x| if x.kind_of?(Array) x[0] == widget else @@ -56,15 +56,15 @@ module Tk private :_remove_win def assign(*wins) - # win := + # win := # widget #==> call widget.configure(hash) # [widget] #==> call widget.configure(hash) # [widget, nil, {src=>target, ... }] - # #==> call widget.configure(hash) + # #==> call widget.configure(hash) # with converting hash-key # [widget, method] #==> call widget.method(hash) # [widget, method, {src=>target, ... }] - # #==> call widget.method(hash) + # #==> call widget.method(hash) # with converting hash-key # [widget [receiver, method, arg, ... ]] # #==> call receiver.method(arg, ... , hash) @@ -74,7 +74,7 @@ module Tk # # src := option_name_on_optobj # - # target := + # target := # nil #==> not use the src # option_name_on_target_widget # [ option_name_on_target_widget, ... ] @@ -123,7 +123,7 @@ module Tk next unless key if key.kind_of?(Array) key.each{|k| hash[k] = val} - else + else hash[key] = val end } diff --git a/ext/tk/lib/tk/palette.rb b/ext/tk/lib/tk/palette.rb index 2d08d50f6a..9462bb0667 100644 --- a/ext/tk/lib/tk/palette.rb +++ b/ext/tk/lib/tk/palette.rb @@ -9,8 +9,8 @@ module TkPalette extend Tk TkCommandNames = [ - 'tk_setPalette'.freeze, - 'tk_bisque'.freeze, + 'tk_setPalette'.freeze, + 'tk_bisque'.freeze, 'tkDarken'.freeze ].freeze diff --git a/ext/tk/lib/tk/panedwindow.rb b/ext/tk/lib/tk/panedwindow.rb index 030144e677..4e70ede9bf 100644 --- a/ext/tk/lib/tk/panedwindow.rb +++ b/ext/tk/lib/tk/panedwindow.rb @@ -128,10 +128,10 @@ class Tk::PanedWindow<TkWindow # win = win.epath if win.kind_of?(TkObject) win = _epath(win) if key - #conf = tk_split_list(tk_send_without_enc('paneconfigure', + #conf = tk_split_list(tk_send_without_enc('paneconfigure', # win, "-#{key}")) - conf = tk_split_list(tk_send_without_enc('paneconfigure', - win, "-#{key}"), + conf = tk_split_list(tk_send_without_enc('paneconfigure', + win, "-#{key}"), false, true) conf[0] = conf[0][1..-1] if conf[0] == 'hide' @@ -140,10 +140,10 @@ class Tk::PanedWindow<TkWindow end conf else - #tk_split_simplelist(tk_send_without_enc('paneconfigure', + #tk_split_simplelist(tk_send_without_enc('paneconfigure', # win)).collect{|conflist| # conf = tk_split_simplelist(conflist) - tk_split_simplelist(tk_send_without_enc('paneconfigure', win), + tk_split_simplelist(tk_send_without_enc('paneconfigure', win), false, false).collect{|conflist| conf = tk_split_simplelist(conflist, false, true) conf[0] = conf[0][1..-1] @@ -151,18 +151,18 @@ class Tk::PanedWindow<TkWindow if conf[0] == 'hide' conf[3] = bool(conf[3]) unless conf[3].empty? elsif conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[0] == 'hide' conf[4] = bool(conf[4]) unless conf[4].empty? elsif conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end conf[1] = conf[1][1..-1] if conf.size == 2 # alias info @@ -173,10 +173,10 @@ class Tk::PanedWindow<TkWindow # win = win.epath if win.kind_of?(TkObject) win = _epath(win) if key - #conf = tk_split_list(tk_send_without_enc('paneconfigure', + #conf = tk_split_list(tk_send_without_enc('paneconfigure', # win, "-#{key}")) - conf = tk_split_list(tk_send_without_enc('paneconfigure', - win, "-#{key}"), + conf = tk_split_list(tk_send_without_enc('paneconfigure', + win, "-#{key}"), false, true) key = conf.shift[1..-1] if key == 'hide' @@ -186,10 +186,10 @@ class Tk::PanedWindow<TkWindow { key => conf } else ret = {} - #tk_split_simplelist(tk_send_without_enc('paneconfigure', + #tk_split_simplelist(tk_send_without_enc('paneconfigure', # win)).each{|conflist| # conf = tk_split_simplelist(conflist) - tk_split_simplelist(tk_send_without_enc('paneconfigure', win), + tk_split_simplelist(tk_send_without_enc('paneconfigure', win), false, false).each{|conflist| conf = tk_split_simplelist(conflist, false, true) key = conf.shift[1..-1] @@ -197,18 +197,18 @@ class Tk::PanedWindow<TkWindow if key == 'hide' conf[2] = bool(conf[2]) unless conf[2].empty? elsif conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if key == 'hide' conf[3] = bool(conf[3]) unless conf[3].empty? elsif conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf.size == 1 @@ -254,5 +254,5 @@ end Tk::Panedwindow = Tk::PanedWindow #TkPanedWindow = Tk::PanedWindow unless Object.const_defined? :TkPanedWindow #TkPanedwindow = Tk::Panedwindow unless Object.const_defined? :TkPanedwindow -Tk.__set_toplevel_aliases__(:Tk, Tk::PanedWindow, +Tk.__set_toplevel_aliases__(:Tk, Tk::PanedWindow, :TkPanedWindow, :TkPanedwindow) diff --git a/ext/tk/lib/tk/place.rb b/ext/tk/lib/tk/place.rb index f7ebdfcbd6..109d866fda 100644 --- a/ext/tk/lib/tk/place.rb +++ b/ext/tk/lib/tk/place.rb @@ -35,9 +35,9 @@ 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', + #conf = tk_split_list(tk_call_without_enc('place', 'configure', # win, "-#{slot}") ) - conf = tk_split_simplelist(tk_call_without_enc('place', 'configure', + conf = tk_split_simplelist(tk_call_without_enc('place', 'configure', win, "-#{slot}") ) conf[0] = conf[0][1..-1] conf[1] = tk_tcl2ruby(conf[1]) @@ -46,7 +46,7 @@ module TkPlace conf[4] = tk_tcl2ruby(conf[1]) conf else - tk_split_simplelist(tk_call_without_enc('place', 'configure', + tk_split_simplelist(tk_call_without_enc('place', 'configure', win)).collect{|conflist| #conf = list(conflist) conf = simplelist(conflist).collect!{|inf| tk_tcl2ruby(inf)} @@ -63,16 +63,16 @@ 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', + #conf = tk_split_list(tk_call_without_enc('place', 'configure', # win, "-#{slot}") ) - conf = tk_split_simplelist(tk_call_without_enc('place', 'configure', + conf = tk_split_simplelist(tk_call_without_enc('place', 'configure', 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', + tk_split_simplelist(tk_call_without_enc('place', 'configure', win)).each{|conf_list| #ret[conf[0][1..-1]] = conf[1] conf = simplelist(conf_list) diff --git a/ext/tk/lib/tk/radiobutton.rb b/ext/tk/lib/tk/radiobutton.rb index 1f864ec06b..1d75dc220d 100644 --- a/ext/tk/lib/tk/radiobutton.rb +++ b/ext/tk/lib/tk/radiobutton.rb @@ -67,5 +67,5 @@ end Tk::Radiobutton = Tk::RadioButton #TkRadioButton = Tk::RadioButton unless Object.const_defined? :TkRadioButton #TkRadiobutton = Tk::Radiobutton unless Object.const_defined? :TkRadiobutton -Tk.__set_toplevel_aliases__(:Tk, Tk::RadioButton, +Tk.__set_toplevel_aliases__(:Tk, Tk::RadioButton, :TkRadioButton, :TkRadiobutton) diff --git a/ext/tk/lib/tk/root.rb b/ext/tk/lib/tk/root.rb index 7237b4c614..ca6260927a 100644 --- a/ext/tk/lib/tk/root.rb +++ b/ext/tk/lib/tk/root.rb @@ -16,7 +16,7 @@ class Tk::Root<TkWindow def Root.new(keys=nil, &b) unless TkCore::INTERP.tk_windows['.'] - TkCore::INTERP.tk_windows['.'] = + TkCore::INTERP.tk_windows['.'] = super(:without_creating=>true, :widgetname=>'.'){} end root = TkCore::INTERP.tk_windows['.'] @@ -70,8 +70,8 @@ class Tk::Root<TkWindow def add_menu(menu_info, tearoff=false, opts=nil) # See tk/menuspec.rb for menu_info. - # opts is a hash of default configs for all of cascade menus. - # Configs of menu_info can override it. + # opts is a hash of default configs for all of cascade menus. + # Configs of menu_info can override it. if tearoff.kind_of?(Hash) opts = tearoff tearoff = false @@ -82,7 +82,7 @@ class Tk::Root<TkWindow def add_menubar(menu_spec, tearoff=false, opts=nil) # See tk/menuspec.rb for menu_spec. # opts is a hash of default configs for all of cascade menus. - # Configs of menu_spec can override it. + # Configs of menu_spec can override it. menu_spec.each{|info| add_menu(info, tearoff, opts)} self.menu end diff --git a/ext/tk/lib/tk/scale.rb b/ext/tk/lib/tk/scale.rb index 7e758d92f4..58283216b8 100644 --- a/ext/tk/lib/tk/scale.rb +++ b/ext/tk/lib/tk/scale.rb @@ -16,11 +16,11 @@ class Tk::Scale<TkWindow end unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ #tk_call_without_enc('scale', @path, *hash_kv(keys, true)) - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else begin - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) rescue tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -33,7 +33,7 @@ class Tk::Scale<TkWindow configure(keys) else # re-create widget - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) end end @@ -69,7 +69,7 @@ class Tk::Scale<TkWindow def configure(slot, value=None) if (slot == 'command' || slot == :command) configure('command'=>value) - elsif slot.kind_of?(Hash) && + elsif slot.kind_of?(Hash) && (slot.key?('command') || slot.key?(:command)) slot = _symbolkey2str(slot) slot['command'] = _wrap_command_arg(slot.delete('command')) diff --git a/ext/tk/lib/tk/scrollbar.rb b/ext/tk/lib/tk/scrollbar.rb index 87db46a9f9..decc4205c4 100644 --- a/ext/tk/lib/tk/scrollbar.rb +++ b/ext/tk/lib/tk/scrollbar.rb @@ -10,7 +10,7 @@ class Tk::Scrollbar<TkWindow def create_self(keys) @assigned = [] - @scroll_proc = proc{|*args| + @scroll_proc = proc{|*args| if self.orient == 'horizontal' @assigned.each{|w| w.xview(*args)} else # 'vertical' @@ -21,11 +21,11 @@ class Tk::Scrollbar<TkWindow if keys and keys != None unless TkConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__ #tk_call_without_enc('scrollbar', @path, *hash_kv(keys, true)) - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else begin - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) rescue tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -38,7 +38,7 @@ class Tk::Scrollbar<TkWindow configure(keys) else # re-create widget - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) end end diff --git a/ext/tk/lib/tk/selection.rb b/ext/tk/lib/tk/selection.rb index 5caa6ef8ef..ba0a6f49f9 100644 --- a/ext/tk/lib/tk/selection.rb +++ b/ext/tk/lib/tk/selection.rb @@ -18,7 +18,7 @@ module TkSelection end def self.clear_on_display(win, sel=nil) if sel - tk_call_without_enc('selection', 'clear', + tk_call_without_enc('selection', 'clear', '-displayof', win, '-selection', sel) else tk_call_without_enc('selection', 'clear', '-displayof', win) @@ -35,7 +35,7 @@ module TkSelection end 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', + _fromUTF8(tk_call_without_enc('selection', 'get', '-displayof', win, *hash_kv(keys))) end def get(keys=nil) @@ -65,7 +65,7 @@ module TkSelection end def self.get_owner_on_display(win, sel=nil) if sel - window(tk_call_without_enc('selection', 'own', + window(tk_call_without_enc('selection', 'own', '-displayof', win, '-selection', sel)) else window(tk_call_without_enc('selection', 'own', '-displayof', win)) diff --git a/ext/tk/lib/tk/spinbox.rb b/ext/tk/lib/tk/spinbox.rb index 34dc1904f7..2fcc916237 100644 --- a/ext/tk/lib/tk/spinbox.rb +++ b/ext/tk/lib/tk/spinbox.rb @@ -13,15 +13,15 @@ class Tk::Spinbox<Tk::Entry class SpinCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?d, ?s, :direction ], - [ ?s, ?e, :current ], - [ ?W, ?w, :widget ], + [ ?d, ?s, :direction ], + [ ?s, ?e, :current ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], [ ?e, proc{|val| #enc = Tk.encoding @@ -32,7 +32,7 @@ class Tk::Spinbox<Tk::Entry TkComm::string(val) end } - ], + ], nil ] diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb index 4ec82bed1d..42b8be475e 100644 --- a/ext/tk/lib/tk/text.rb +++ b/ext/tk/lib/tk/text.rb @@ -281,7 +281,7 @@ class Tk::Text<TkTextWin def create_self(keys) #if keys and keys != None # #tk_call_without_enc('text', @path, *hash_kv(keys, true)) - # tk_call_without_enc(self.class::TkCommandNames[0], @path, + # tk_call_without_enc(self.class::TkCommandNames[0], @path, # *hash_kv(keys, true)) #else # #tk_call_without_enc('text', @path) @@ -306,7 +306,7 @@ class Tk::Text<TkTextWin end def index(idx) - Tk::Text::IndexString.new(tk_send_without_enc('index', + Tk::Text::IndexString.new(tk_send_without_enc('index', _get_eval_enc_str(idx))) end @@ -375,7 +375,7 @@ class Tk::Text<TkTextWin def mark_gravity(mark, direction=nil) if direction - tk_send_without_enc('mark', 'gravity', + tk_send_without_enc('mark', 'gravity', _get_eval_enc_str(mark), direction) self else @@ -384,27 +384,27 @@ class Tk::Text<TkTextWin end def mark_set(mark, index) - tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark), + tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark), _get_eval_enc_str(index)) self end alias set_mark mark_set def mark_unset(*marks) - tk_send_without_enc('mark', 'unset', + tk_send_without_enc('mark', 'unset', *(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', + tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'next', _get_eval_enc_str(index)))) end alias next_mark mark_next def mark_previous(index) - tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous', + tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous', _get_eval_enc_str(index)))) end alias previous_mark mark_previous @@ -412,11 +412,11 @@ class Tk::Text<TkTextWin def image_cget_strict(index, slot) case slot.to_s when 'text', 'label', 'show', 'data', 'file' - _fromUTF8(tk_send_without_enc('image', 'cget', + _fromUTF8(tk_send_without_enc('image', 'cget', _get_eval_enc_str(index), "-#{slot}")) else - tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget', - _get_eval_enc_str(index), + tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget', + _get_eval_enc_str(index), "-#{slot}"))) end end @@ -445,13 +445,13 @@ class Tk::Text<TkTextWin def image_configure(index, slot, value=None) if slot.kind_of?(Hash) - _fromUTF8(tk_send_without_enc('image', 'configure', - _get_eval_enc_str(index), + _fromUTF8(tk_send_without_enc('image', 'configure', + _get_eval_enc_str(index), *hash_kv(slot, true))) else - _fromUTF8(tk_send_without_enc('image', 'configure', - _get_eval_enc_str(index), - "-#{slot}", + _fromUTF8(tk_send_without_enc('image', 'configure', + _get_eval_enc_str(index), + "-#{slot}", _get_eval_enc_str(value))) end self @@ -481,16 +481,16 @@ class Tk::Text<TkTextWin else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -522,16 +522,16 @@ class Tk::Text<TkTextWin else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -620,7 +620,7 @@ class Tk::Text<TkTextWin end def compare(idx1, op, idx2) - bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), + bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), op, _get_eval_enc_str(idx2))) end @@ -643,7 +643,7 @@ class Tk::Text<TkTextWin def count_info(idx1, idx2, update=true) # Tk8.5 feature opts = [ - :chars, :displaychars, :displayindices, :displaylines, + :chars, :displaychars, :displayindices, :displaylines, :indices, :lines, :xpixels, :ypixels ] if update @@ -737,8 +737,8 @@ class Tk::Text<TkTextWin end def tag_add(tag, index1, index2=None) - tk_send_without_enc('tag', 'add', _get_eval_enc_str(tag), - _get_eval_enc_str(index1), + tk_send_without_enc('tag', 'add', _get_eval_enc_str(tag), + _get_eval_enc_str(index1), _get_eval_enc_str(index2)) self end @@ -746,15 +746,15 @@ class Tk::Text<TkTextWin alias add_tag tag_add def tag_delete(*tags) - tk_send_without_enc('tag', 'delete', + tk_send_without_enc('tag', 'delete', *(tags.collect{|tag| _get_eval_enc_str(tag)})) TkTextTag::TTagID_TBL.mutex.synchronize{ if TkTextTag::TTagID_TBL[@path] tags.each{|tag| if tag.kind_of?(TkTextTag) - TkTextTag::TTagID_TBL[@path].delete(tag.id) + TkTextTag::TTagID_TBL[@path].delete(tag.id) else - TkTextTag::TTagID_TBL[@path].delete(tag) + TkTextTag::TTagID_TBL[@path].delete(tag) end } end @@ -807,7 +807,7 @@ class Tk::Text<TkTextWin def tag_cget(tag, key) case key.to_s when 'text', 'label', 'show', 'data', 'file' - tk_call_without_enc(@path, 'tag', 'cget', + tk_call_without_enc(@path, 'tag', 'cget', _get_eval_enc_str(tag), "-#{key}") when 'font', 'kanjifont' #fnt = tk_tcl2ruby(tk_send('tag', 'cget', tag, "-#{key}")) @@ -833,14 +833,14 @@ class Tk::Text<TkTextWin || key['latinfont'] || key['asciifont'] ) tagfont_configure(tag, key) else - tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag), + tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag), *hash_kv(key, true)) end else - if key == 'font' || key == :font || + 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) @@ -848,7 +848,7 @@ class Tk::Text<TkTextWin tagfont_configure(tag, {key=>val}) end else - tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag), + tk_send_without_enc('tag', 'configure', _get_eval_enc_str(tag), "-#{key}", _get_eval_enc_str(val)) end end @@ -878,16 +878,16 @@ class Tk::Text<TkTextWin else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -926,16 +926,16 @@ class Tk::Text<TkTextWin else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -980,19 +980,19 @@ class Tk::Text<TkTextWin =end def tag_raise(tag, above=None) - tk_send_without_enc('tag', 'raise', _get_eval_enc_str(tag), + tk_send_without_enc('tag', 'raise', _get_eval_enc_str(tag), _get_eval_enc_str(above)) self end def tag_lower(tag, below=None) - tk_send_without_enc('tag', 'lower', _get_eval_enc_str(tag), + tk_send_without_enc('tag', 'lower', _get_eval_enc_str(tag), _get_eval_enc_str(below)) self end def tag_remove(tag, *indices) - tk_send_without_enc('tag', 'remove', _get_eval_enc_str(tag), + tk_send_without_enc('tag', 'remove', _get_eval_enc_str(tag), *(indices.collect{|idx| _get_eval_enc_str(idx)})) self end @@ -1001,7 +1001,7 @@ class Tk::Text<TkTextWin #l = tk_split_simplelist(tk_send_without_enc('tag', 'ranges', # _get_eval_enc_str(tag))) l = tk_split_simplelist(tk_send_without_enc('tag', 'ranges', - _get_eval_enc_str(tag)), + _get_eval_enc_str(tag)), false, true) r = [] while key=l.shift @@ -1011,18 +1011,18 @@ class Tk::Text<TkTextWin end def tag_nextrange(tag, first, last=None) - simplelist(tk_send_without_enc('tag', 'nextrange', - _get_eval_enc_str(tag), - _get_eval_enc_str(first), + simplelist(tk_send_without_enc('tag', 'nextrange', + _get_eval_enc_str(tag), + _get_eval_enc_str(first), _get_eval_enc_str(last))).collect{|idx| Tk::Text::IndexString.new(idx) } end def tag_prevrange(tag, first, last=None) - simplelist(tk_send_without_enc('tag', 'prevrange', - _get_eval_enc_str(tag), - _get_eval_enc_str(first), + simplelist(tk_send_without_enc('tag', 'prevrange', + _get_eval_enc_str(tag), + _get_eval_enc_str(first), _get_eval_enc_str(last))).collect{|idx| Tk::Text::IndexString.new(idx) } @@ -1032,7 +1032,7 @@ class Tk::Text<TkTextWin def window_cget(index, slot) case slot.to_s when 'text', 'label', 'show', 'data', 'file' - _fromUTF8(tk_send_without_enc('window', 'cget', + _fromUTF8(tk_send_without_enc('window', 'cget', _get_eval_enc_str(index), "-#{slot}")) when 'font', 'kanjifont' #fnt = tk_tcl2ruby(tk_send('window', 'cget', index, "-#{slot}")) @@ -1076,12 +1076,12 @@ class Tk::Text<TkTextWin slot['create'] = install_cmd(proc{_epath(p_create.call)}) end end - tk_send_without_enc('window', 'configure', - _get_eval_enc_str(index), + tk_send_without_enc('window', 'configure', + _get_eval_enc_str(index), *hash_kv(slot, true)) else if slot == 'window' || slot == :window - # id = value + # id = value # value = id.epath if id.kind_of?(TkWindow) value = _epath(value) end @@ -1101,8 +1101,8 @@ class Tk::Text<TkTextWin value = install_cmd(proc{_epath(p_create.call)}) end end - tk_send_without_enc('window', 'configure', - _get_eval_enc_str(index), + tk_send_without_enc('window', 'configure', + _get_eval_enc_str(index), "-#{slot}", _get_eval_enc_str(value)) end end @@ -1129,16 +1129,16 @@ class Tk::Text<TkTextWin else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -1166,16 +1166,16 @@ class Tk::Text<TkTextWin else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -1231,11 +1231,11 @@ class Tk::Text<TkTextWin # $KCODE == 'NONE' if JAPANIZED_TK - tk_call_without_enc('kstring', 'length', + tk_call_without_enc('kstring', 'length', _get_eval_enc_str(txt)).to_i else begin - tk_call_without_enc('encoding', 'convertto', 'ascii', + tk_call_without_enc('encoding', 'convertto', 'ascii', _get_eval_enc_str(txt)).length rescue StandardError, NameError # sorry, I have no plan @@ -1324,11 +1324,11 @@ class Tk::Text<TkTextWin 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"), + return [index(start + " + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(match), match] end else @@ -1342,11 +1342,11 @@ class Tk::Text<TkTextWin 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"), + return [index(start + " + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(match), match] end else @@ -1357,7 +1357,7 @@ class Tk::Text<TkTextWin 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"), + return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index("1.0 + #{pos} chars"), $&.split('').length] @@ -1447,7 +1447,7 @@ class Tk::Text<TkTextWin idx = str.index(/ /, i) result.push str[i..(idx-1)] i = idx + 1 - + # retrieve value case result[-1] when 'text' @@ -1505,7 +1505,7 @@ class Tk::Text<TkTextWin break end end - + kvis = [] until result.empty? kvis.push [result.shift, result.shift, result.shift] diff --git a/ext/tk/lib/tk/textimage.rb b/ext/tk/lib/tk/textimage.rb index fb306a9c17..99027a06fb 100644 --- a/ext/tk/lib/tk/textimage.rb +++ b/ext/tk/lib/tk/textimage.rb @@ -16,19 +16,19 @@ 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', + @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', + @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', + @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', _get_eval_enc_str(index))) end @path.gravity = 'left' @index = @path.path - @id = tk_call_without_enc(@t.path, 'image', 'create', @index, + @id = tk_call_without_enc(@t.path, 'image', 'create', @index, *hash_kv(keys, true)).freeze @path.gravity = 'right' end @@ -78,7 +78,7 @@ class TkTextImage<TkObject end def image=(value) - tk_call_without_enc(@t.path, 'image', 'configure', @index, '-image', + tk_call_without_enc(@t.path, 'image', 'configure', @index, '-image', _get_eval_enc_str(value)) #self value diff --git a/ext/tk/lib/tk/textmark.rb b/ext/tk/lib/tk/textmark.rb index 72c1ce1ab4..e9743475e0 100644 --- a/ext/tk/lib/tk/textmark.rb +++ b/ext/tk/lib/tk/textmark.rb @@ -25,7 +25,7 @@ class TkTextMark<TkObject if TMarkID_TBL[tpath] TMarkID_TBL[tpath][id]? TMarkID_TBL[tpath][id]: id else - id + id end } end @@ -46,7 +46,7 @@ class TkTextMark<TkObject TMarkID_TBL[@tpath] = {} unless TMarkID_TBL[@tpath] TMarkID_TBL[@tpath][@id] = self } - tk_call_without_enc(@t.path, 'mark', 'set', @id, + tk_call_without_enc(@t.path, 'mark', 'set', @id, _get_eval_enc_str(index)) @t._addtag id, self end @@ -100,7 +100,7 @@ class TkTextMark<TkObject end def set(where) - tk_call_without_enc(@t.path, 'mark', 'set', @id, + tk_call_without_enc(@t.path, 'mark', 'set', @id, _get_eval_enc_str(where)) self end @@ -159,7 +159,7 @@ class TkTextNamedMark<TkTextMark end if obj && index - tk_call_without_enc(parent.path, 'mark', 'set', name, + tk_call_without_enc(parent.path, 'mark', 'set', name, _get_eval_enc_str(index)) end obj @@ -175,7 +175,7 @@ class TkTextNamedMark<TkTextMark @parent = @t = parent @tpath = parent.path @path = @id = name - tk_call_without_enc(@t.path, 'mark', 'set', @id, + tk_call_without_enc(@t.path, 'mark', 'set', @id, _get_eval_enc_str(index)) if index @t._addtag @id, self end diff --git a/ext/tk/lib/tk/texttag.rb b/ext/tk/lib/tk/texttag.rb index b08d923ea1..7bd59bf8ee 100644 --- a/ext/tk/lib/tk/texttag.rb +++ b/ext/tk/lib/tk/texttag.rb @@ -26,7 +26,7 @@ class TkTextTag<TkObject TTagID_TBL.mutex.synchronize{ if TTagID_TBL[tpath] TTagID_TBL[tpath][id]? TTagID_TBL[tpath][id]: id - else + else id end } @@ -84,13 +84,13 @@ class TkTextTag<TkObject end def add(*indices) - tk_call_without_enc(@t.path, 'tag', 'add', @id, + tk_call_without_enc(@t.path, 'tag', 'add', @id, *(indices.collect{|idx| _get_eval_enc_str(idx)})) self end def remove(*indices) - tk_call_without_enc(@t.path, 'tag', 'remove', @id, + tk_call_without_enc(@t.path, 'tag', 'remove', @id, *(indices.collect{|idx| _get_eval_enc_str(idx)})) self end @@ -105,16 +105,16 @@ class TkTextTag<TkObject end def nextrange(first, last=None) - simplelist(tk_call_without_enc(@t.path, 'tag', 'nextrange', @id, - _get_eval_enc_str(first), + simplelist(tk_call_without_enc(@t.path, 'tag', 'nextrange', @id, + _get_eval_enc_str(first), _get_eval_enc_str(last))).collect{|idx| Tk::Text::IndexString.new(idx) } end def prevrange(first, last=None) - simplelist(tk_call_without_enc(@t.path, 'tag', 'prevrange', @id, - _get_eval_enc_str(first), + simplelist(tk_call_without_enc(@t.path, 'tag', 'prevrange', @id, + _get_eval_enc_str(first), _get_eval_enc_str(last))).collect{|idx| Tk::Text::IndexString.new(idx) } @@ -142,7 +142,7 @@ class TkTextTag<TkObject _fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', @id, "-#{key}")) 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', + fnt = tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', @id, '-font'))) unless fnt.kind_of?(TkFont) fnt = tagfontobj(@id, fnt) @@ -154,7 +154,7 @@ class TkTextTag<TkObject fnt end else - tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', + tk_tcl2ruby(_fromUTF8(tk_call_without_enc(@t.path, 'tag', 'cget', @id, "-#{key}"))) end end @@ -227,13 +227,13 @@ class TkTextTag<TkObject end def raise(above=None) - tk_call_without_enc(@t.path, 'tag', 'raise', @id, + tk_call_without_enc(@t.path, 'tag', 'raise', @id, _get_eval_enc_str(above)) self end def lower(below=None) - tk_call_without_enc(@t.path, 'tag', 'lower', @id, + tk_call_without_enc(@t.path, 'tag', 'lower', @id, _get_eval_enc_str(below)) self end diff --git a/ext/tk/lib/tk/textwindow.rb b/ext/tk/lib/tk/textwindow.rb index 004422e4f3..49327b2c81 100644 --- a/ext/tk/lib/tk/textwindow.rb +++ b/ext/tk/lib/tk/textwindow.rb @@ -13,14 +13,14 @@ class TkTextWindow<TkObject #end @t = parent if index == 'end' || index == :end - @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', + @path = TkTextMark.new(@t, tk_call_without_enc(@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', + @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', + @path = TkTextMark.new(@t, tk_call_without_enc(@t.path, 'index', index.path)) end else @@ -49,7 +49,7 @@ class TkTextWindow<TkObject keys['create'] = install_cmd(proc{@id = @p_create.call; _epath(@id)}) end end - tk_call_without_enc(@t.path, 'window', 'create', @index, + tk_call_without_enc(@t.path, 'window', 'create', @index, *hash_kv(keys, true)) @path.gravity = 'right' end @@ -80,7 +80,7 @@ class TkTextWindow<TkObject if slot.kind_of?(Hash) slot = _symbolkey2str(slot) if slot['window'] - @id = slot['window'] + @id = slot['window'] # slot['window'] = @id.epath if @id.kind_of?(TkWindow) slot['window'] = _epath(@id) if @id end @@ -88,19 +88,19 @@ class TkTextWindow<TkObject self.create=slot.delete('create') end if slot.size > 0 - tk_call_without_enc(@t.path, 'window', 'configure', @index, + tk_call_without_enc(@t.path, 'window', 'configure', @index, *hash_kv(slot, true)) end else if slot == 'window' || slot == :window - @id = value + @id = value # value = @id.epath if @id.kind_of?(TkWindow) value = _epath(@id) if @id end if slot == 'create' || slot == :create self.create=value else - tk_call_without_enc(@t.path, 'window', 'configure', @index, + tk_call_without_enc(@t.path, 'window', 'configure', @index, "-#{slot}", _get_eval_enc_str(value)) end end @@ -123,7 +123,7 @@ class TkTextWindow<TkObject @id = value # value = @id.epath if @id.kind_of?(TkWindow) value = _epath(@id) if @id - tk_call_without_enc(@t.path, 'window', 'configure', @index, + tk_call_without_enc(@t.path, 'window', 'configure', @index, '-window', _get_eval_enc_str(value)) value end @@ -145,7 +145,7 @@ class TkTextWindow<TkObject end }) end - tk_call_without_enc(@t.path, 'window', 'configure', @index, + tk_call_without_enc(@t.path, 'window', 'configure', @index, '-create', _get_eval_enc_str(value)) value end diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb index 91840d0575..686d4bd483 100644 --- a/ext/tk/lib/tk/timer.rb +++ b/ext/tk/lib/tk/timer.rb @@ -76,7 +76,7 @@ class TkTimer rescue Interrupt exit!(1) rescue Exception => e - if @cancel_on_exception && + if @cancel_on_exception && @cancel_on_exception.find{|exc| e.kind_of?(exc)} cancel @return_value = e @@ -180,12 +180,12 @@ class TkTimer @after_script = nil @cancel_on_exception = DEFAULT_IGNORE_EXCEPTIONS - # Unless @cancel_on_exception, Ruby/Tk shows an error dialog box when - # an excepsion is raised on TkTimer callback procedure. - # If @cancel_on_exception is an array of exception classes and the raised - # exception is included in the array, Ruby/Tk cancels executing TkTimer - # callback procedures silently (TkTimer#cancel is called and no dialog is - # shown). + # Unless @cancel_on_exception, Ruby/Tk shows an error dialog box when + # an excepsion is raised on TkTimer callback procedure. + # If @cancel_on_exception is an array of exception classes and the raised + # exception is included in the array, Ruby/Tk cancels executing TkTimer + # callback procedures silently (TkTimer#cancel is called and no dialog is + # shown). if b case args.size @@ -229,7 +229,7 @@ class TkTimer end def current_status - [@running, @current_sleep, @current_proc, @current_args, + [@running, @current_sleep, @current_proc, @current_args, @do_loop, @cancel_on_exception] end @@ -484,11 +484,11 @@ class TkTimer def at_end(*arg, &b) if arg.empty? - if b + if b @at_end_proc = b - else + else # no proc - return @at_end_proc + return @at_end_proc end else fail ArgumentError, "wrong number of arguments" if arg.length != 1 || b @@ -504,17 +504,17 @@ 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 @wait_var.wait(on_thread, check_root) if @return_value.kind_of?(Exception) - fail @return_value + fail @return_value else - @return_value + @return_value end end def eventloop_wait(check_root = false) @@ -628,12 +628,12 @@ class TkRTTimer < TkTimer if @est_time @est_time = Time.at(@est_time.to_i, @est_time.usec + sleep*1000) else - @est_time = Time.at(@cb_start_time.to_i, + @est_time = Time.at(@cb_start_time.to_i, @cb_start_time.usec + sleep*1000) end now = Time.now - real_sleep = ((@est_time.to_i - now.to_i + @offset_s)*1000.0 + + real_sleep = ((@est_time.to_i - now.to_i + @offset_s)*1000.0 + (@est_time.usec - now.usec + @offset_u)/1000.0).round if real_sleep <= 0 real_sleep = 0 @@ -653,7 +653,7 @@ class TkRTTimer < TkTimer if @current_sleep == 0 @offset_list.push([ - @offset_s - @cb_start_time.to_i, + @offset_s - @cb_start_time.to_i, @offset_u - @cb_start_time.usec ]) else diff --git a/ext/tk/lib/tk/toplevel.rb b/ext/tk/lib/tk/toplevel.rb index bd6e8307f5..917264aef7 100644 --- a/ext/tk/lib/tk/toplevel.rb +++ b/ext/tk/lib/tk/toplevel.rb @@ -38,7 +38,7 @@ class Tk::Toplevel<TkWindow # s << "-class" << @classname if @classname # s << "-colormap" << @colormap if @colormap # s << "-container" << @container if @container -# s << "-screen" << @screen if @screen +# s << "-screen" << @screen if @screen # s << "-use" << @use if @use # s << "-visual" << @visual if @visual # tk_call 'toplevel', @path, *s @@ -113,7 +113,7 @@ class Tk::Toplevel<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 @@ -127,7 +127,7 @@ class Tk::Toplevel<TkWindow end keys, cmds = _wm_command_option_chk(keys) super(keys) - cmds.each{|k,v| + cmds.each{|k,v| if v.kind_of? Array self.__send__(k,*v) else @@ -162,7 +162,7 @@ class Tk::Toplevel<TkWindow keys = {} end 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 @@ -176,7 +176,7 @@ class Tk::Toplevel<TkWindow end keys, cmds = _wm_command_option_chk(keys) super(parent, keys) - cmds.each{|k,v| + cmds.each{|k,v| if v.kind_of? Array self.send(k,*v) else @@ -200,8 +200,8 @@ class Tk::Toplevel<TkWindow def add_menu(menu_info, tearoff=false, opts=nil) # See tk/menuspec.rb for menu_info. - # opts is a hash of default configs for all of cascade menus. - # Configs of menu_info can override it. + # opts is a hash of default configs for all of cascade menus. + # Configs of menu_info can override it. if tearoff.kind_of?(Hash) opts = tearoff tearoff = false @@ -212,7 +212,7 @@ class Tk::Toplevel<TkWindow def add_menubar(menu_spec, tearoff=false, opts=nil) # See tk/menuspec.rb for menu_spec. # opts is a hash of default configs for all of cascade menus. - # Configs of menu_spec can override it. + # Configs of menu_spec can override it. menu_spec.each{|info| add_menu(info, tearoff, opts)} self.menu end diff --git a/ext/tk/lib/tk/ttk_selector.rb b/ext/tk/lib/tk/ttk_selector.rb index 72ed637a38..7a0dd34038 100644 --- a/ext/tk/lib/tk/ttk_selector.rb +++ b/ext/tk/lib/tk/ttk_selector.rb @@ -5,53 +5,53 @@ # toplevel classes/modules module Tk @TOPLEVEL_ALIAS_TABLE[:Ttk] = { - :TkButton => 'tkextlib/tile/tbutton', + :TkButton => 'tkextlib/tile/tbutton', - :TkCheckbutton => 'tkextlib/tile/tcheckbutton', - :TkCheckButton => 'tkextlib/tile/tcheckbutton', + :TkCheckbutton => 'tkextlib/tile/tcheckbutton', + :TkCheckButton => 'tkextlib/tile/tcheckbutton', - # :TkDialog => 'tkextlib/tile/dialog', + # :TkDialog => 'tkextlib/tile/dialog', - :TkEntry => 'tkextlib/tile/tentry', + :TkEntry => 'tkextlib/tile/tentry', - :TkCombobox => 'tkextlib/tile/tcombobox', + :TkCombobox => 'tkextlib/tile/tcombobox', - :TkFrame => 'tkextlib/tile/tframe', + :TkFrame => 'tkextlib/tile/tframe', - :TkLabel => 'tkextlib/tile/tlabel', + :TkLabel => 'tkextlib/tile/tlabel', - :TkLabelframe => 'tkextlib/tile/tlabelframe', - :TkLabelFrame => 'tkextlib/tile/tlabelframe', + :TkLabelframe => 'tkextlib/tile/tlabelframe', + :TkLabelFrame => 'tkextlib/tile/tlabelframe', - :TkMenubutton => 'tkextlib/tile/tmenubutton', - :TkMenuButton => 'tkextlib/tile/tmenubutton', + :TkMenubutton => 'tkextlib/tile/tmenubutton', + :TkMenuButton => 'tkextlib/tile/tmenubutton', - :TkNotebook => 'tkextlib/tile/tnotebook', + :TkNotebook => 'tkextlib/tile/tnotebook', - # :TkPaned => 'tkextlib/tile/tpaned', - :TkPanedwindow => 'tkextlib/tile/tpaned', - :TkPanedWindow => 'tkextlib/tile/tpaned', + # :TkPaned => 'tkextlib/tile/tpaned', + :TkPanedwindow => 'tkextlib/tile/tpaned', + :TkPanedWindow => 'tkextlib/tile/tpaned', - :TkProgressbar => 'tkextlib/tile/tprogressbar', + :TkProgressbar => 'tkextlib/tile/tprogressbar', - :TkRadiobutton => 'tkextlib/tile/tradiobutton', - :TkRadioButton => 'tkextlib/tile/tradiobutton', + :TkRadiobutton => 'tkextlib/tile/tradiobutton', + :TkRadioButton => 'tkextlib/tile/tradiobutton', - :TkScale => 'tkextlib/tile/tscale', - # :TkProgress => 'tkextlib/tile/tscale', + :TkScale => 'tkextlib/tile/tscale', + # :TkProgress => 'tkextlib/tile/tscale', - :TkScrollbar => 'tkextlib/tile/tscrollbar', - :TkXScrollbar => 'tkextlib/tile/tscrollbar', - :TkYScrollbar => 'tkextlib/tile/tscrollbar', + :TkScrollbar => 'tkextlib/tile/tscrollbar', + :TkXScrollbar => 'tkextlib/tile/tscrollbar', + :TkYScrollbar => 'tkextlib/tile/tscrollbar', - :TkSeparator => 'tkextlib/tile/tseparator', + :TkSeparator => 'tkextlib/tile/tseparator', - :TkSizeGrip => 'tkextlib/tile/sizegrip', - :TkSizegrip => 'tkextlib/tile/sizegrip', + :TkSizeGrip => 'tkextlib/tile/sizegrip', + :TkSizegrip => 'tkextlib/tile/sizegrip', - # :TkSquare => 'tkextlib/tile/tsquare', + # :TkSquare => 'tkextlib/tile/tsquare', - :TkTreeview => 'tkextlib/tile/treeview', + :TkTreeview => 'tkextlib/tile/treeview', } @TOPLEVEL_ALIAS_TABLE[:Tile] = @TOPLEVEL_ALIAS_TABLE[:Ttk] @@ -66,9 +66,9 @@ module Tk ################################################ - @TOPLEVEL_ALIAS_SETUP_PROC[:Tile] = + @TOPLEVEL_ALIAS_SETUP_PROC[:Tile] = @TOPLEVEL_ALIAS_SETUP_PROC[:Ttk] = proc{|mod| - unless Tk.autoload?(:Tile) || Tk.const_defined?(:Tile) + unless Tk.autoload?(:Tile) || Tk.const_defined?(:Tile) Object.autoload :Ttk, 'tkextlib/tile' Tk.autoload :Tile, 'tkextlib/tile' end diff --git a/ext/tk/lib/tk/validation.rb b/ext/tk/lib/tk/validation.rb index 60bd433cdc..0ebd5c51b7 100644 --- a/ext/tk/lib/tk/validation.rb +++ b/ext/tk/lib/tk/validation.rb @@ -211,21 +211,21 @@ class TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?d, ?n, :action ], - [ ?i, ?x, :index ], - [ ?s, ?e, :current ], - [ ?v, ?s, :type ], - [ ?P, ?e, :value ], - [ ?S, ?e, :string ], - [ ?V, ?s, :triggered ], - [ ?W, ?w, :widget ], + [ ?d, ?n, :action ], + [ ?i, ?x, :index ], + [ ?s, ?e, :current ], + [ ?v, ?s, :type ], + [ ?P, ?e, :value ], + [ ?S, ?e, :string ], + [ ?V, ?s, :triggered ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], [ ?e, proc{|val| #enc = Tk.encoding @@ -236,7 +236,7 @@ class TkValidateCommand TkComm::string(val) end } - ], + ], [ ?x, proc{|val| idx = TkComm::number(val) @@ -246,7 +246,7 @@ class TkValidateCommand idx end } - ], + ], nil ] @@ -272,7 +272,7 @@ class TkValidateCommand _setup_subst_table(KEY_TBL, PROC_TBL); # - # NOTE: The order of parameters which passed to callback procedure is + # NOTE: The order of parameters which passed to callback procedure is # <extra_arg>, <extra_arg>, ... , <subst_arg>, <subst_arg>, ... # diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb index b73a4677da..bdd441705b 100644 --- a/ext/tk/lib/tk/variable.rb +++ b/ext/tk/lib/tk/variable.rb @@ -29,7 +29,7 @@ class TkVariable major, minor, type, patchlevel = TclTkLib.get_version USE_OLD_TRACE_OPTION_STYLE = (major < 8) || (major == 8 && minor < 4) - #TkCore::INTERP.add_tk_procs('rb_var', 'args', + #TkCore::INTERP.add_tk_procs('rb_var', '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} { @@ -65,10 +65,10 @@ class TkVariable 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")) + + 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 >-------" if TkCore::WITH_ENCODING msg.force_encoding('utf-8') @@ -76,9 +76,9 @@ class TkVariable msg.instance_variable_set(:@encoding, 'utf-8') end rescue Exception - msg = e.class.inspect + ': ' + e.message + "\n" + - "\n---< backtrace of Ruby side >-----\n" + - e.backtrace.join("\n") + + 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) @@ -94,7 +94,7 @@ class TkVariable _get_eval_string(TkVar_CB_TBL[name1].trace_callback(name2,op)) rescue trace = $!.backtrace - raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" + + raise $!, "\n#{trace[0]}: #{$!.message} (#{$!.class})\n" + "\tfrom #{trace[1..pos].join("\n\tfrom ")}" end =end @@ -112,7 +112,7 @@ class TkVariable end # - # default_value is available only when the variable is an assoc array. + # default_value is available only when the variable is an assoc array. # def default_value(val=nil, &b) if b @@ -322,7 +322,7 @@ class TkVariable =begin if val == [] - # INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)', + # INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)', # @id, @id, @id)) elsif val.kind_of?(Array) a = [] @@ -370,7 +370,7 @@ class TkVariable else INTERP._thread_vwait(@id) end - else + else if check_root INTERP._invoke_without_enc('tkwait', 'variable', @id) else @@ -421,7 +421,7 @@ class TkVariable else # array index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',') - TkComm.bool(tk_call('info', 'exist', "#{@id}")) && + TkComm.bool(tk_call('info', 'exist', "#{@id}")) && TkComm.bool(tk_call('info', 'exist', "#{@id}(#{index})")) end end @@ -433,7 +433,7 @@ class TkVariable #tk_split_simplelist(INTERP._eval("global #{@id}; array get #{@id}")) INTERP._invoke_without_enc('global', @id) #tk_split_simplelist(INTERP._fromUTF8(INTERP._invoke_without_enc('array', 'names', @id))) - tk_split_simplelist(INTERP._invoke_without_enc('array', 'names', @id), + tk_split_simplelist(INTERP._invoke_without_enc('array', 'names', @id), false, true) end @@ -484,9 +484,9 @@ 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)), + #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), + INTERP._set_global_var2(@id, _get_eval_string(k, true), _get_eval_string(v, true)) } self.value @@ -494,11 +494,11 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS =begin 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 | + #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::APPEND_VALUE | TclTkLib::VarAccessFlag::LIST_ELEMENT) } self.value @@ -535,9 +535,9 @@ if USE_TCLs_SET_VARIABLE_FUNCTIONS val = val._value if !type && type != :variable && val.kind_of?(TkVariable) 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)), + #_fromUTF8(INTERP._set_global_var2(@id, _toUTF8(_get_eval_string(index)), # _toUTF8(_get_eval_string(val)))) - #_fromUTF8(INTERP._set_global_var2(@id, _get_eval_string(index, true), + #_fromUTF8(INTERP._set_global_var2(@id, _get_eval_string(index, true), # _get_eval_string(val, true))) end @@ -562,7 +562,7 @@ else #INTERP._eval(Kernel.format('set %s', @id)) #INTERP._invoke_without_enc('set', @id) rescue - if INTERP._eval(Kernel.format('global %s; array exists %s', + if INTERP._eval(Kernel.format('global %s; array exists %s', @id, @id)) != "1" #if INTERP._eval(Kernel.format('array exists %s', @id)) != "1" #if INTERP._invoke_without_enc('array', 'exists', @id) != "1" @@ -583,7 +583,7 @@ else #INTERP._eval(Kernel.format('set %s %s', @id, s)) #_fromUTF8(INTERP._invoke_without_enc('set', @id, _toUTF8(s))) rescue - if INTERP._eval(Kernel.format('global %s; array exists %s', + if INTERP._eval(Kernel.format('global %s; array exists %s', @id, @id)) != "1" #if INTERP._eval(Kernel.format('array exists %s', @id)) != "1" #if INTERP._invoke_without_enc('array', 'exists', @id) != "1" @@ -591,7 +591,7 @@ else 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)', + #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) @@ -601,9 +601,9 @@ else val.each_with_index{|e,i| a.push(i); a.push(array2tk_list(e, true))} #s = '"' + a.join(" ").gsub(/[\[\]$"]/, '\\\\\&') + '"' s = '"' + a.join(" ").gsub(/[\[\]$"\\]/, '\\\\\&') + '"' - INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s', + 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', + #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))) @@ -612,9 +612,9 @@ else # .gsub(/[\[\]$"]/, '\\\\\&') + '"' s = '"' + val.to_a.collect{|e| array2tk_list(e, true)}.join(" ")\ .gsub(/[\[\]$\\"]/, '\\\\\&') + '"' - INTERP._eval(Kernel.format('global %s; unset %s; array set %s %s', + 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', + #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))) @@ -640,7 +640,7 @@ else end end #INTERP._eval(Kernel.format('global %s; set %s(%s)', @id, @id, index)) - #INTERP._eval(Kernel.format('global %s; set %s(%s)', + #INTERP._eval(Kernel.format('global %s; set %s(%s)', # @id, @id, _get_eval_string(index))) #INTERP._eval(Kernel.format('set %s(%s)', @id, _get_eval_string(index))) #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ')') @@ -651,13 +651,13 @@ else type = default_element_value_type(args) val = val._value if !type && type != :variable && val.kind_of?(TkVariable) index = args.collect{|idx| _get_eval_string(idx)}.join(',') - INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id, + INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id, index, _get_eval_string(val))) - #INTERP._eval(Kernel.format('global %s; set %s(%s) %s', @id, @id, + #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, + #INTERP._eval(Kernel.format('set %s(%s) %s', @id, # _get_eval_string(index), _get_eval_string(val))) - #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ') ' + + #INTERP._eval('set ' + @id + '(' + _get_eval_string(index) + ') ' + # _get_eval_string(val)) end @@ -669,7 +669,7 @@ else else index = elems.collect{|idx| _get_eval_string(idx, true)}.join(',') INTERP._eval(Kernel.format('global %s; unset %s(%s)', @id, @id, index)) - #INTERP._eval(Kernel.format('global %s; unset %s(%s)', + #INTERP._eval(Kernel.format('global %s; unset %s(%s)', # @id, @id, _get_eval_string(elem))) #INTERP._eval(Kernel.format('unset %s(%s)', @id, tk_tcl2ruby(elem))) #INTERP._eval('unset ' + @id + '(' + _get_eval_string(elem) + ')') @@ -1348,10 +1348,10 @@ end TkVar_CB_TBL[@id] = self @trace_opts = opts if USE_OLD_TRACE_OPTION_STYLE - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) else - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else @@ -1359,19 +1359,19 @@ end if USE_OLD_TRACE_OPTION_STYLE opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} if newopts != @trace_opts - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else newopts |= opts unless (newopts - @trace_opts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1382,7 +1382,7 @@ end def trace_element(elem, opts, cmd = Proc.new) if @elem - fail(RuntimeError, + fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end @@ -1394,10 +1394,10 @@ end TkVar_CB_TBL[@id] = self @trace_opts = opts if USE_OLD_TRACE_OPTION_STYLE - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) else - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else @@ -1405,19 +1405,19 @@ end if USE_OLD_TRACE_OPTION_STYLE opts.each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} if newopts != @trace_opts - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end else newopts |= opts unless (newopts - @trace_opts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1434,7 +1434,7 @@ end def trace_info_for_element(elem) if @elem - fail(RuntimeError, + fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end return [] unless @trace_elem @@ -1468,7 +1468,7 @@ end else newopts = [] @trace_var.each_with_index{|e, i| - if idx < 0 && e[1] == cmd && + if idx < 0 && e[1] == cmd && e[0].size == opts.size && (e[0] - opts).empty? # find idx = i @@ -1479,7 +1479,7 @@ end end if idx >= 0 - @trace_var.delete_at(idx) + @trace_var.delete_at(idx) else return self end @@ -1498,21 +1498,21 @@ end diff = false @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))} if diff - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end else unless (@trace_opts - newopts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1525,7 +1525,7 @@ end def trace_remove_for_element(elem,opts,cmd) if @elem - fail(RuntimeError, + fail(RuntimeError, "invalid for a TkVariable which denotes an element of Tcl's array") end return self unless @trace_elem.kind_of? Hash @@ -1550,7 +1550,7 @@ end } else @trace_elem[elem].each_with_index{|e, i| - if idx < 0 && e[1] == cmd && + if idx < 0 && e[1] == cmd && e[0].size == opts.size && (e[0] - opts).empty? # find idx = i @@ -1567,7 +1567,7 @@ end if USE_OLD_TRACE_OPTION_STYLE newopts = '' - @trace_var.each{|e| + @trace_var.each{|e| e[0].each_byte{|c| newopts.concat(c.chr) unless newopts.index(c.chr)} } @trace_elem.each{|elem| @@ -1591,21 +1591,21 @@ end diff = false @trace_opts.each_byte{|c| break if (diff = ! newopts.index(c))} if diff - Tk.tk_call_without_enc('trace', 'vdelete', + Tk.tk_call_without_enc('trace', 'vdelete', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'variable', + Tk.tk_call_without_enc('trace', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end else unless (@trace_opts - newopts).empty? - Tk.tk_call_without_enc('trace', 'remove', 'variable', + Tk.tk_call_without_enc('trace', 'remove', 'variable', @id, @trace_opts, 'rb_var ' << @id) @trace_opts.replace(newopts) unless @trace_opts.empty? - Tk.tk_call_without_enc('trace', 'add', 'variable', + Tk.tk_call_without_enc('trace', 'add', 'variable', @id, @trace_opts, 'rb_var ' << @id) end end @@ -1621,7 +1621,7 @@ class TkVarAccess<TkVariable def self.new(name, *args) if name.kind_of?(TkVariable) name.value = args[0] unless args.empty? - return name + return name end name = name.to_s @@ -1649,7 +1649,7 @@ class TkVarAccess<TkVariable fail ArgumentError, "already exist as a scalar variable" end name.value = args[0] unless args.empty? - return name + return name end name = name.to_s diff --git a/ext/tk/lib/tk/virtevent.rb b/ext/tk/lib/tk/virtevent.rb index ae31ac1f8f..ba771da647 100644 --- a/ext/tk/lib/tk/virtevent.rb +++ b/ext/tk/lib/tk/virtevent.rb @@ -80,8 +80,8 @@ class TkVirtualEvent<TkObject def _add_sequences(seq_ary) unless seq_ary.empty? - tk_call_without_enc('event', 'add', "<#{@id}>", - *(seq_ary.collect{|seq| + tk_call_without_enc('event', 'add', "<#{@id}>", + *(seq_ary.collect{|seq| "<#{tk_event_sequence(seq)}>" }) ) end @@ -106,8 +106,8 @@ class TkVirtualEvent<TkObject TkVirtualEventTBL.delete(@id) } else - tk_call_without_enc('event', 'delete', "<#{@id}>", - *(sequences.collect{|seq| + tk_call_without_enc('event', 'delete', "<#{@id}>", + *(sequences.collect{|seq| "<#{tk_event_sequence(seq)}>" }) ) if tk_call_without_enc('event','info',"<#{@id}>").empty? diff --git a/ext/tk/lib/tk/winfo.rb b/ext/tk/lib/tk/winfo.rb index c649b4a0c9..b10cfe6760 100644 --- a/ext/tk/lib/tk/winfo.rb +++ b/ext/tk/lib/tk/winfo.rb @@ -14,7 +14,7 @@ module TkWinfo def TkWinfo.atom(name, win=nil) if win - number(tk_call_without_enc('winfo', 'atom', '-displayof', win, + number(tk_call_without_enc('winfo', 'atom', '-displayof', win, _get_eval_enc_str(name))) else number(tk_call_without_enc('winfo', 'atom', _get_eval_enc_str(name))) @@ -26,7 +26,7 @@ module TkWinfo def TkWinfo.atomname(id, win=nil) if win - _fromUTF8(tk_call_without_enc('winfo', 'atomname', + _fromUTF8(tk_call_without_enc('winfo', 'atomname', '-displayof', win, id)) else _fromUTF8(tk_call_without_enc('winfo', 'atomname', id)) @@ -67,7 +67,7 @@ module TkWinfo def TkWinfo.containing(rootX, rootY, win=nil) if win - window(tk_call_without_enc('winfo', 'containing', + window(tk_call_without_enc('winfo', 'containing', '-displayof', win, rootX, rootY)) else window(tk_call_without_enc('winfo', 'containing', rootX, rootY)) @@ -128,7 +128,7 @@ module TkWinfo false, true) else #tk_split_simplelist(tk_call_without_enc('winfo', 'interps')) - tk_split_simplelist(tk_call_without_enc('winfo', 'interps'), + tk_split_simplelist(tk_call_without_enc('winfo', 'interps'), false, true) end end @@ -303,7 +303,7 @@ module TkWinfo def TkWinfo.visualsavailable(win, includeids=false) if includeids - list(tk_call_without_enc('winfo', 'visualsavailable', + list(tk_call_without_enc('winfo', 'visualsavailable', win, "includeids")) else list(tk_call_without_enc('winfo', 'visualsavailable', win)) diff --git a/ext/tk/lib/tk/winpkg.rb b/ext/tk/lib/tk/winpkg.rb index 89fb391c77..a131731560 100644 --- a/ext/tk/lib/tk/winpkg.rb +++ b/ext/tk/lib/tk/winpkg.rb @@ -45,7 +45,7 @@ module Tk::WinDDE elsif args.size == 0 tk_call('dde', 'servername', force, exact, *hash_kv(keys)) else - tk_call('dde', 'servername', force, exact, + tk_call('dde', 'servername', force, exact, *((hash_kv(keys) << '--') + args)) end else @@ -86,7 +86,7 @@ module Tk::WinDDE tk_call('dde', 'eval', -async, topic, cmd, *args) end - module_function :servername, :execute, :async_execute, + module_function :servername, :execute, :async_execute, :poke, :request, :services, :eval end diff --git a/ext/tk/lib/tk/wm.rb b/ext/tk/lib/tk/wm.rb index 0394296189..b1a2ed886a 100644 --- a/ext/tk/lib/tk/wm.rb +++ b/ext/tk/lib/tk/wm.rb @@ -123,7 +123,7 @@ module Tk TOPLEVEL_METHODCALL_OPTKEYS['focusmodel'] = 'focusmodel' def Wm.forget(win) - # Tcl/Tk 8.5+ + # Tcl/Tk 8.5+ # work with dockable frames tk_call_without_enc('wm', 'forget', win.epath) win @@ -200,7 +200,7 @@ module Tk if imgs.empty? win.instance_eval{ @wm_iconphoto = nil unless defined? @wm_iconphoto - return @wm_iconphoto + return @wm_iconphoto } end @@ -308,10 +308,10 @@ module Tk def Wm.manage(win, use_id = nil) # Tcl/Tk 8.5+ feature # -------------------------------------------------------------- - # In the future release, I want to support to embed the 'win' + # In the future release, I want to support to embed the 'win' # into the container which has window-id 'use-id'. - # It may give users frexibility on controlling their GUI. - # However, it may be difficult for current Tcl/Tk (Tcl/Tk8.5.1), + # It may give users frexibility on controlling their GUI. + # However, it may be difficult for current Tcl/Tk (Tcl/Tk8.5.1), # because it seems to require to modify Tcl/Tk's source code. # -------------------------------------------------------------- if use_id diff --git a/ext/tk/lib/tk/xim.rb b/ext/tk/lib/tk/xim.rb index 0ac8559bb9..c0126c5175 100644 --- a/ext/tk/lib/tk/xim.rb +++ b/ext/tk/lib/tk/xim.rb @@ -12,14 +12,14 @@ module TkXIM def TkXIM.useinputmethods(value = None, win = nil) if value == None if win - bool(tk_call_without_enc('tk', 'useinputmethods', + bool(tk_call_without_enc('tk', 'useinputmethods', '-displayof', win)) else bool(tk_call_without_enc('tk', 'useinputmethods')) end else if win - bool(tk_call_without_enc('tk', 'useinputmethods', + bool(tk_call_without_enc('tk', 'useinputmethods', '-displayof', win, value)) else bool(tk_call_without_enc('tk', 'useinputmethods', value)) diff --git a/ext/tk/lib/tkextlib/ICONS/icons.rb b/ext/tk/lib/tkextlib/ICONS/icons.rb index b430bae55d..bd3180aa55 100644 --- a/ext/tk/lib/tkextlib/ICONS/icons.rb +++ b/ext/tk/lib/tkextlib/ICONS/icons.rb @@ -34,10 +34,10 @@ module Tk def self.create(*args) # icon, icon, ..., ?option=>value, ...? if args[-1].kind_of?(Hash) keys = args.pop - icons = simplelist(tk_call('::icons::icons', 'create', + icons = simplelist(tk_call('::icons::icons', 'create', *(hash_kv(keys) << (args.flatten)))) else - icons = simplelist(tk_call('::icons::icons', 'create', + icons = simplelist(tk_call('::icons::icons', 'create', args.flatten)) end @@ -66,7 +66,7 @@ module Tk def self.query(*args) # icon, icon, ..., ?option=>value, ...? if args[-1].kind_of?(Hash) keys = args.pop - simplelist(tk_call('::icons::icons', 'query', + simplelist(tk_call('::icons::icons', 'query', *(hash_kv(keys) << (args.flatten)))) else simplelist(tk_call('::icons::icons', 'query', args.flatten)) @@ -121,7 +121,7 @@ module Tk end def query(keys={}) - list(simplelist(tk_call('::icons::icons', 'query', + list(simplelist(tk_call('::icons::icons', 'query', *(hash_kv(keys) << @name)) )[0]) end diff --git a/ext/tk/lib/tkextlib/ICONS/setup.rb b/ext/tk/lib/tkextlib/ICONS/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/ICONS/setup.rb +++ b/ext/tk/lib/tkextlib/ICONS/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/blt/barchart.rb b/ext/tk/lib/tkextlib/blt/barchart.rb index cb481c5889..8e71c3f5e0 100644 --- a/ext/tk/lib/tkextlib/blt/barchart.rb +++ b/ext/tk/lib/tkextlib/blt/barchart.rb @@ -22,7 +22,7 @@ module Tk::BLT private :__boolval_optkeys def __strval_optkeys - ['text', 'label', 'title', 'file', + ['text', 'label', 'title', 'file', 'background', 'plotbackground'] end private :__strval_optkeys diff --git a/ext/tk/lib/tkextlib/blt/component.rb b/ext/tk/lib/tkextlib/blt/component.rb index b2005b2f2b..74cbcb56ae 100644 --- a/ext/tk/lib/tkextlib/blt/component.rb +++ b/ext/tk/lib/tkextlib/blt/component.rb @@ -22,15 +22,15 @@ module Tk::BLT private :__item_numstrval_optkeys def __item_boolval_optkeys(id) - ['hide', 'under', 'descending', 'logscale', 'loose', 'showticks', - 'titlealternate', 'scalesymbols', 'minor', 'raised', + ['hide', 'under', 'descending', 'logscale', 'loose', 'showticks', + 'titlealternate', 'scalesymbols', 'minor', 'raised', 'center', 'decoration', 'landscape', 'maxpect'] end private :__item_boolval_optkeys def __item_strval_optkeys(id) - ['text', 'label', 'limits', 'title', - 'show', 'file', 'maskdata', 'maskfile', + ['text', 'label', 'limits', 'title', + 'show', 'file', 'maskdata', 'maskfile', 'color', 'titlecolor', 'fill', 'outline', 'offdash'] end private :__item_strval_optkeys @@ -94,7 +94,7 @@ module Tk::BLT value = None slot = _symbolkey2str(slot) if cmd = slot.delete('command') - slot['command'] = proc{|w, tick| + slot['command'] = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -103,7 +103,7 @@ module Tk::BLT slot = args.pop if slot == :command || slot == 'command' cmd = value - value = proc{|w, tick| + value = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -520,7 +520,7 @@ module Tk::BLT def name @axis end - + def transform(val) @chart.axis_transform(@id, val) end @@ -1221,7 +1221,7 @@ module Tk::BLT fail RuntimeError, "#{self} is an abstract class" end args, fontkeys = _parse_create_args(keys) - idnum = tk_call_without_enc(chart.path, 'marker', 'create', + idnum = tk_call_without_enc(chart.path, 'marker', 'create', self::MarkerTypeName, *args) chart.marker_configure(idnum, fontkeys) unless fontkeys.empty? idnum.to_i # 'item id' is an integer number @@ -1229,7 +1229,7 @@ module Tk::BLT def self.create_type(chart, type, keys={}) args, fontkeys = _parse_create_args(keys) - idnum = tk_call_without_enc(chart.path, 'marker', 'create', + idnum = tk_call_without_enc(chart.path, 'marker', 'create', type, *args) chart.marker_configure(idnum, fontkeys) unless fontkeys.empty? id = idnum.to_i # 'item id' is an integer number @@ -1486,7 +1486,7 @@ module Tk::BLT list(tk_send('axis', 'limits', tagid(id))) end def axis_names(*pats) - simplelist(tk_send('axis', 'names', + simplelist(tk_send('axis', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|axis| Tk::BLT::PlotComponent::Axis.id2obj(self, axis) } @@ -1500,11 +1500,11 @@ module Tk::BLT end def axis_use(id, target=nil) if target - Tk::BLT::PlotComponent::Axis.id2obj(self, - tk_send('axis', 'use', + Tk::BLT::PlotComponent::Axis.id2obj(self, + tk_send('axis', 'use', tagid(id), tagid(target))) else - Tk::BLT::PlotComponent::Axis.id2obj(self, + Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('axis', 'use', tagid(id))) end end @@ -1544,10 +1544,10 @@ module Tk::BLT def element_closest(x, y, var, *args) if args[-1].kind_of?(Hash) keys = args.pop - bool(tk_send('element', 'closest', x, y, var, + bool(tk_send('element', 'closest', x, y, var, *(hash_kv(keys).concat(args.collect{|id| tagid(id)})))) else - bool(tk_send('element', 'closest', x, y, var, + bool(tk_send('element', 'closest', x, y, var, *(args.collect{|id| tagid(id)}))) end end @@ -1563,7 +1563,7 @@ module Tk::BLT bool(tk_send('element', 'exists', tagid(id))) end def element_names(*pats) - simplelist(tk_send('element', 'names', + simplelist(tk_send('element', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|elem| Tk::BLT::PlotComponent::Element.id2obj(self, elem) } @@ -1601,10 +1601,10 @@ module Tk::BLT def bar_closest(x, y, var, *args) if args[-1].kind_of?(Hash) keys = args.pop - bool(tk_send('bar', 'closest', x, y, var, + bool(tk_send('bar', 'closest', x, y, var, *(hash_kv(keys).concat(args.collect{|id| tagid(id)})))) else - bool(tk_send('bar', 'closest', x, y, var, + bool(tk_send('bar', 'closest', x, y, var, *(args.collect{|id| tagid(id)}))) end end @@ -1620,7 +1620,7 @@ module Tk::BLT bool(tk_send('bar', 'exists', tagid(id))) end def bar_names(*pats) - simplelist(tk_send('bar', 'names', + simplelist(tk_send('bar', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|elem| Tk::BLT::PlotComponent::Element.id2obj(self, elem) } @@ -1658,10 +1658,10 @@ module Tk::BLT def line_closest(x, y, var, *args) if args[-1].kind_of?(Hash) keys = args.pop - bool(tk_send('line', 'closest', x, y, var, + bool(tk_send('line', 'closest', x, y, var, *(hash_kv(keys).concat(args.collect{|id| tagid(id)})))) else - bool(tk_send('line', 'closest', x, y, var, + bool(tk_send('line', 'closest', x, y, var, *(args.collect{|id| tagid(id)}))) end end @@ -1677,7 +1677,7 @@ module Tk::BLT bool(tk_send('line', 'exists', tagid(id))) end def line_names(*pats) - simplelist(tk_send('line', 'names', + simplelist(tk_send('line', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|elem| Tk::BLT::PlotComponent::Element.id2obj(self, elem) } @@ -1723,7 +1723,7 @@ module Tk::BLT keys.delete('without_creating') end - legend = self.class.new(parent, :without_creating=>true, + legend = self.class.new(parent, :without_creating=>true, :widgetname=>widgetname) class << legend def __destroy_hook__ @@ -1740,24 +1740,24 @@ module Tk::BLT end def legend_activate(*pats) - list(tk_send('legend', 'activate', + list(tk_send('legend', 'activate', *(pats.collect{|pat| tagid(pat)}))).collect{|elem| Tk::BLT::PlotComponent::Element.id2obj(self, elem) } end def legend_deactivate(*pats) - list(tk_send('legend', 'deactivate', + list(tk_send('legend', 'deactivate', *(pats.collect{|pat| tagid(pat)}))).collect{|elem| Tk::BLT::PlotComponent::Element.id2obj(self, elem) } end def legend_get(pos, y=nil) if y - Tk::BLT::PlotComponent::Element.id2obj(self, - tk_send('legend', 'get', + Tk::BLT::PlotComponent::Element.id2obj(self, + tk_send('legend', 'get', _at(pos, y))) else - Tk::BLT::PlotComponent::Element.id2obj(self, + Tk::BLT::PlotComponent::Element.id2obj(self, tk_send('legend', 'get', pos)) end end @@ -1773,7 +1773,7 @@ module Tk::BLT self end def pen_names(*pats) - simplelist(tk_send('pen', 'names', + simplelist(tk_send('pen', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|pen| Tk::BLT::PlotComponent::Pen.id2obj(self, pen) } @@ -1843,7 +1843,7 @@ module Tk::BLT bool(tk_send('marker', 'exists', tagid(id))) end def marker_names(*pats) - simplelist(tk_send('marker', 'names', + simplelist(tk_send('marker', 'names', *(pats.collect{|pat| tagid(pat)}))).collect{|id| Tk::BLT::PlotComponent::Marker.id2obj(self, id) } @@ -1864,13 +1864,13 @@ module Tk::BLT if slot.kind_of?(Hash) slot = _symbolkey2str(slot) if cmd = slot.delete('command') - slot['command'] = proc{|w, tick| + slot['command'] = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end elsif slot == :command || slot == 'command' cmd = value - value = proc{|w, tick| + value = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -1918,8 +1918,8 @@ module Tk::BLT end def xaxis_use(target=nil) if target - Tk::BLT::PlotComponent::Axis.id2obj(self, - tk_send('xaxis', 'use', + Tk::BLT::PlotComponent::Axis.id2obj(self, + tk_send('xaxis', 'use', tagid(target))) else Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('xaxis', 'use')) @@ -1936,13 +1936,13 @@ module Tk::BLT if slot.kind_of?(Hash) slot = _symbolkey2str(slot) if cmd = slot.delete('command') - slot['command'] = proc{|w, tick| + slot['command'] = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end elsif slot == :command || slot == 'command' cmd = value - value = proc{|w, tick| + value = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -1990,8 +1990,8 @@ module Tk::BLT end def x2axis_use(target=nil) if target - Tk::BLT::PlotComponent::Axis.id2obj(self, - tk_send('x2axis', 'use', + Tk::BLT::PlotComponent::Axis.id2obj(self, + tk_send('x2axis', 'use', tagid(target))) else Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('x2axis', 'use')) @@ -2008,13 +2008,13 @@ module Tk::BLT if slot.kind_of?(Hash) slot = _symbolkey2str(slot) if cmd = slot.delete('command') - slot['command'] = proc{|w, tick| + slot['command'] = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end elsif slot == :command || slot == 'command' cmd = value - value = proc{|w, tick| + value = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -2062,8 +2062,8 @@ module Tk::BLT end def yaxis_use(target=nil) if target - Tk::BLT::PlotComponent::Axis.id2obj(self, - tk_send('yaxis', 'use', + Tk::BLT::PlotComponent::Axis.id2obj(self, + tk_send('yaxis', 'use', tagid(target))) else Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('yaxis', 'use')) @@ -2080,13 +2080,13 @@ module Tk::BLT if slot.kind_of?(Hash) slot = _symbolkey2str(slot) if cmd = slot.delete('command') - slot['command'] = proc{|w, tick| + slot['command'] = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end elsif slot == :command || slot == 'command' cmd = value - value = proc{|w, tick| + value = proc{|w, tick| cmd.call(TkComm.window(w), TkComm.num_or_str(tick)) } end @@ -2134,8 +2134,8 @@ module Tk::BLT end def y2axis_use(target=nil) if target - Tk::BLT::PlotComponent::Axis.id2obj(self, - tk_send('y2axis', 'use', + Tk::BLT::PlotComponent::Axis.id2obj(self, + tk_send('y2axis', 'use', tagid(target))) else Tk::BLT::PlotComponent::Axis.id2obj(self, tk_send('y2axis', 'use')) diff --git a/ext/tk/lib/tkextlib/blt/dragdrop.rb b/ext/tk/lib/tkextlib/blt/dragdrop.rb index 201548504a..d11d8bc41a 100644 --- a/ext/tk/lib/tkextlib/blt/dragdrop.rb +++ b/ext/tk/lib/tkextlib/blt/dragdrop.rb @@ -77,7 +77,7 @@ module Tk::BLT ] PROC_TBL = [ - [ ?w, TkComm.method(:window) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -120,8 +120,8 @@ module Tk::BLT ] PROC_TBL = [ - [ ?b, TkComm.method(:bool) ], - [ ?w, TkComm.method(:window) ], + [ ?b, TkComm.method(:bool) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -175,9 +175,9 @@ module Tk::BLT ] PROC_TBL = [ - [ ?i, TkComm.method(:string) ], - [ ?v, TkComm.method(:tk_tcl2ruby) ], - [ ?w, TkComm.method(:window) ], + [ ?i, TkComm.method(:string) ], + [ ?v, TkComm.method(:tk_tcl2ruby) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -203,14 +203,14 @@ module Tk::BLT end def self.source_handler(win, datatype, cmd=Proc.new, *args) - _bind_for_event_class(DnD_Handle, - ['::blt::drag&drop', 'source', win, 'handler'], + _bind_for_event_class(DnD_Handle, + ['::blt::drag&drop', 'source', win, 'handler'], cmd, *args) end def self.target_handler(win, datatype, cmd=Proc.new, *args) - _bind_for_event_class(DnD_Handle, - ['::blt::drag&drop', 'target', win, 'handler'], + _bind_for_event_class(DnD_Handle, + ['::blt::drag&drop', 'target', win, 'handler'], cmd, *args) end diff --git a/ext/tk/lib/tkextlib/blt/setup.rb b/ext/tk/lib/tkextlib/blt/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/blt/setup.rb +++ b/ext/tk/lib/tkextlib/blt/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/blt/stripchart.rb b/ext/tk/lib/tkextlib/blt/stripchart.rb index fe5afbb095..a6b0f354e2 100644 --- a/ext/tk/lib/tkextlib/blt/stripchart.rb +++ b/ext/tk/lib/tkextlib/blt/stripchart.rb @@ -22,7 +22,7 @@ module Tk::BLT private :__boolval_optkeys def __strval_optkeys - ['text', 'label', 'title', 'file', + ['text', 'label', 'title', 'file', 'background', 'plotbackground'] end private :__strval_optkeys diff --git a/ext/tk/lib/tkextlib/blt/tabnotebook.rb b/ext/tk/lib/tkextlib/blt/tabnotebook.rb index 510352ba48..738ba7c601 100644 --- a/ext/tk/lib/tkextlib/blt/tabnotebook.rb +++ b/ext/tk/lib/tkextlib/blt/tabnotebook.rb @@ -99,7 +99,7 @@ module Tk::BLT pos = nil end pos = 'end' if pos.nil? - Tk::BLT::Tabnotebook::Tab.new(self, nil, + Tk::BLT::Tabnotebook::Tab.new(self, nil, tk_send('insert', tagindex(pos), keys)) end diff --git a/ext/tk/lib/tkextlib/blt/tree.rb b/ext/tk/lib/tkextlib/blt/tree.rb index 77b85f1717..605a64daa6 100644 --- a/ext/tk/lib/tkextlib/blt/tree.rb +++ b/ext/tk/lib/tkextlib/blt/tree.rb @@ -182,7 +182,7 @@ module Tk::BLT def move(dest, keys={}) @tree.keys(@id, dest, keys) self - end + end def next() @tree.next(@id) @@ -397,10 +397,10 @@ module Tk::BLT NotifyID_TBL.mutex.synchronize{ if tree.kind_of?(Array) # not create - tpath = tree[0].path + tpath = tree[0].path NotifyID_TBL[tpath] ||= {} unless (obj = NotifyID_TBL[tpath][tree[1]]) - (NotifyID_TBL[tpath][tree[1]] = + (NotifyID_TBL[tpath][tree[1]] = obj = self.allocate).instance_eval{ @parent = @tree = tree[0] @tpath = @parent.path @@ -438,7 +438,7 @@ module Tk::BLT args = args.collect{|arg| '-' << arg.to_s} args << proc{|id, type| - cmd.call(Tk::BLT::Tree::Node.id2obj(@tree, id), + cmd.call(Tk::BLT::Tree::Node.id2obj(@tree, id), ((type[0] == ?-)? type[1..-1]: type)) } @@ -509,7 +509,7 @@ module Tk::BLT tpath = tree[0].path TraceID_TBL[tpath] ||= {} unless (obj = TraceID_TBL[tpath][tree[1]]) - (TraceID_TBL[tpath][tree[1]] = + (TraceID_TBL[tpath][tree[1]] = obj = self.allocate).instance_eval{ @parent = @tree = tree @tpath = @parent.path @@ -541,8 +541,8 @@ module Tk::BLT end end - @path = @id = tk_call(@tpath, 'trace', 'create', node, key, opts, - proc{|t, id, k, ops| + @path = @id = tk_call(@tpath, 'trace', 'create', node, key, opts, + proc{|t, id, k, ops| tobj = Tk::BLT::Tree.id2obj(t) if tobj.kind_of?(Tk::BLT::Tree) nobj = Tk::BLT::Tree::Node.id2obj(tobj, id) @@ -599,8 +599,8 @@ module Tk::BLT 'recurse'=>nil, 'tags'=>nil, # sort command - 'ascii'=>nil, 'decreasing'=>nil, 'disctionary'=>nil, - 'integer'=>nil, 'real'=>nil, 'recurse'=>nil, 'reorder'=>nil, + 'ascii'=>nil, 'decreasing'=>nil, 'disctionary'=>nil, + 'integer'=>nil, 'real'=>nil, 'recurse'=>nil, 'reorder'=>nil, } end @@ -624,7 +624,7 @@ module Tk::BLT def self.new(name = nil) TreeID_TBL.mutex.synchronize{ if name && TreeID_TBL[name] - TreeID_TBL[name] + TreeID_TBL[name] else (obj = self.allocate).instance_eval{ initialize(name) @@ -680,7 +680,7 @@ module Tk::BLT end def ancestor(node1, node2) - Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'ancestor', + Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'ancestor', tagid(node1), tagid(node2))) end @@ -701,14 +701,14 @@ module Tk::BLT end def copy(src, parent, keys={}) - id = tk_call('::blt::tree', 'copy', tagid(src), tagid(parent), + id = tk_call('::blt::tree', 'copy', tagid(src), tagid(parent), __conv_keyonly_opts(keys)) Tk::BLT::Tree::Node.new(self, nil, 'node'=>id) end def copy_to(src, dest_tree, parent, keys={}) return copy(src, parent, keys={}) unless dest_tree - id = tk_call('::blt::tree', 'copy', tagid(src), dest_tree, + id = tk_call('::blt::tree', 'copy', tagid(src), dest_tree, tagid(parent), __conv_keyonly_opts(keys)) Tk::BLT::Tree::Node.new(dest_tree, nil, 'node'=>id) end @@ -751,7 +751,7 @@ module Tk::BLT end def find(node, keys={}) - simplelist(tk_call('::blt::tree', 'find', tagid(node), + simplelist(tk_call('::blt::tree', 'find', tagid(node), __conv_keyonly_opts(keys))).collect{|n| Tk::BLT::Tree::Node.id2obj(self, n) } @@ -775,7 +775,7 @@ module Tk::BLT end def index(node) - Tk::BLT::Tree::Node.id2obj(self, + Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'index', tagid(node))) end @@ -785,11 +785,11 @@ module Tk::BLT end def ancestor?(node1, node2) - bool(tk_call('::blt::tree', 'is', 'ancestor', + bool(tk_call('::blt::tree', 'is', 'ancestor', tagid(node1), tagid(node2))) end def before?(node1, node2) - bool(tk_call('::blt::tree', 'is', 'before', + bool(tk_call('::blt::tree', 'is', 'before', tagid(node1), tagid(node2))) end def leaf?(node) @@ -806,7 +806,7 @@ module Tk::BLT if nodes.empty? simplelist(tk_call('blt::tree', 'keys', tagid(node))) else - simplelist(tk_call('blt::tree', 'keys', tagid(node), + simplelist(tk_call('blt::tree', 'keys', tagid(node), *(nodes.collect{|n| tagid(n)}))).collect{|lst| simplelist(lst) } @@ -828,7 +828,7 @@ module Tk::BLT end def link(parent, node, keys={}) - ret = tk_call('::blt::tree', 'link', tagid(parent), tagid(node), + ret = tk_call('::blt::tree', 'link', tagid(parent), tagid(node), __conv_keyonly_opts(keys)) (ret == '-1')? nil: Tk::BLT::Tree::Node.id2obj(self, ret) end @@ -902,7 +902,7 @@ module Tk::BLT end def restore(node, str, keys={}) - tk_call('::blt::tree', 'restore', tagid(node), str, + tk_call('::blt::tree', 'restore', tagid(node), str, __conv_keyonly_opts(keys)) self end @@ -915,7 +915,7 @@ module Tk::BLT end def restore_from_file(node, file, keys={}) - tk_call('::blt::tree', 'restorefile', tagid(node), file, + tk_call('::blt::tree', 'restorefile', tagid(node), file, __conv_keyonly_opts(keys)) self end @@ -923,13 +923,13 @@ module Tk::BLT keys = __conv_keyonly_opts(keys) keys.delete('overwrite') keys.delete(:overwrite) - tk_call('::blt::tree', 'restorefile', tagid(node), file, + tk_call('::blt::tree', 'restorefile', tagid(node), file, '-overwrite', keys) self end def root(node=None) - Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'root', + Tk::BLT::Tree::Node.id2obj(self, tk_call('::blt::tree', 'root', tagid(node))) end @@ -958,7 +958,7 @@ module Tk::BLT end def tag_delete(tag, *nodes) - tk_call(@path, 'tag', 'delete', tagid(tag), + tk_call(@path, 'tag', 'delete', tagid(tag), *(nodes.collect{|n| tagid(n)})) self end @@ -973,7 +973,7 @@ module Tk::BLT end def tag_get(node, *patterns) - simplelist(tk_call(@tpath, 'tag', 'get', tagid(node), + simplelist(tk_call(@tpath, 'tag', 'get', tagid(node), *(patterns.collect{|pat| tagid(pat)}))).collect{|str| Tk::BLT::Tree::Tag.id2obj(self, str) } @@ -997,7 +997,7 @@ module Tk::BLT end def tag_unset(node, *tags) - tk_call(@path, 'tag', 'unset', tagid(node), + tk_call(@path, 'tag', 'unset', tagid(node), *(tags.collect{|t| tagid(t)})) self end diff --git a/ext/tk/lib/tkextlib/blt/treeview.rb b/ext/tk/lib/tkextlib/blt/treeview.rb index c5a5697186..550422ee2e 100644 --- a/ext/tk/lib/tkextlib/blt/treeview.rb +++ b/ext/tk/lib/tkextlib/blt/treeview.rb @@ -230,7 +230,7 @@ class Tk::BLT::Treeview ######################## def __boolval_optkeys - ['autocreate', 'allowduplicates', 'exportselection', 'flat', 'hideroot', + ['autocreate', 'allowduplicates', 'exportselection', 'flat', 'hideroot', 'newtags', 'showtitles', 'sortselection'] end private :__boolval_optkeys @@ -245,17 +245,17 @@ class Tk::BLT::Treeview class OpenCloseCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?W, ?w, :widget ], - [ ?p, ?s, :name ], - [ ?P, ?s, :fullpath ], - [ ?#, ?x, :node_id ], + [ ?W, ?w, :widget ], + [ ?p, ?s, :name ], + [ ?P, ?s, :fullpath ], + [ ?#, ?x, :node_id ], nil ] PROC_TBL = [ - [ ?x, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?x, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -463,7 +463,7 @@ class Tk::BLT::Treeview self end def entry_children(tag, first=None, last=None) - simplelist(tk_send('entry', 'children', tagid(tag), + simplelist(tk_send('entry', 'children', tagid(tag), first, last)).collect{|id| tagid2obj(id)} end def entry_delete(tag, first=None, last=None) @@ -500,17 +500,17 @@ class Tk::BLT::Treeview class FindExecFlagValue < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?W, ?w, :widget ], - [ ?p, ?s, :name ], - [ ?P, ?s, :fullpath ], - [ ?#, ?x, :node_id ], + [ ?W, ?w, :widget ], + [ ?p, ?s, :name ], + [ ?P, ?s, :fullpath ], + [ ?#, ?x, :node_id ], nil ] PROC_TBL = [ - [ ?x, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?x, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -646,7 +646,7 @@ class Tk::BLT::Treeview } end def range_open(first, last) - simplelist(tk_send('range', '-open', + simplelist(tk_send('range', '-open', tagid(first), tagid(last))).collect{|id| tagid2obj(id) } @@ -1118,7 +1118,7 @@ class Tk::BLT::Treeview::Node < TkObject at = keys.delete['at'] if parent - if parent.kind_of?(Tk::BLT::Treeview::Node) || + if parent.kind_of?(Tk::BLT::Treeview::Node) || parent.kind_of?(Tk::BLT::Treeview::Tag) path = [get_full(parent.id)[0], name] at = nil # ignore 'at' option diff --git a/ext/tk/lib/tkextlib/blt/vector.rb b/ext/tk/lib/tkextlib/blt/vector.rb index 97fb1b96ff..742e901d3e 100644 --- a/ext/tk/lib/tkextlib/blt/vector.rb +++ b/ext/tk/lib/tkextlib/blt/vector.rb @@ -49,10 +49,10 @@ module Tk::BLT size = size.join(':') end if size - @id = TkCore::INTERP._invoke('::blt::vector', 'create', + @id = TkCore::INTERP._invoke('::blt::vector', 'create', "#auto(#{size})", *hash_kv(keys)) else - @id = TkCore::INTERP._invoke('::blt::vector', 'create', + @id = TkCore::INTERP._invoke('::blt::vector', 'create', "#auto", *hash_kv(keys)) end diff --git a/ext/tk/lib/tkextlib/blt/winop.rb b/ext/tk/lib/tkextlib/blt/winop.rb index e371d28ab7..03bdb60810 100644 --- a/ext/tk/lib/tkextlib/blt/winop.rb +++ b/ext/tk/lib/tkextlib/blt/winop.rb @@ -38,7 +38,7 @@ class << Tk::BLT::Winop tk_call('::blt::winop', 'image', 'readjpeg', file, photo) end def image_resample(src, dest, horiz_filter=None, vert_filter=None) - tk_call('::blt::winop', 'image', 'resample', + tk_call('::blt::winop', 'image', 'resample', src, dest, horiz_filter, vert_filter) end def image_rotate(src, dest, angle) @@ -47,9 +47,9 @@ class << Tk::BLT::Winop def image_snap(win, photo, width=None, height=None) tk_call('::blt::winop', 'image', 'snap', win, photo, width, height) end - def image_subsample(src, dest, x, y, width, height, + def image_subsample(src, dest, x, y, width, height, horiz_filter=None, vert_filter=None) - tk_call('::blt::winop', 'image', 'subsample', + tk_call('::blt::winop', 'image', 'subsample', src, dest, x, y, width, height, horiz_filter, vert_filter) end @@ -66,13 +66,13 @@ class << Tk::BLT::Winop end def resample(src, dest, horiz_filter=None, vert_filter=None) - tk_call('::blt::winop', 'resample', + tk_call('::blt::winop', 'resample', src, dest, horiz_filter, vert_filter) end - def subsample(src, dest, x, y, width, height, + def subsample(src, dest, x, y, width, height, horiz_filter=None, vert_filter=None) - tk_call('::blt::winop', 'subsample', + tk_call('::blt::winop', 'subsample', src, dest, x, y, width, height, horiz_filter, vert_filter) end diff --git a/ext/tk/lib/tkextlib/bwidget/dialog.rb b/ext/tk/lib/tkextlib/bwidget/dialog.rb index 291ca4a962..13527f96ad 100644 --- a/ext/tk/lib/tkextlib/bwidget/dialog.rb +++ b/ext/tk/lib/tkextlib/bwidget/dialog.rb @@ -52,7 +52,7 @@ class Tk::BWidget::Dialog def create_self(keys) cmd = self.class::TkCommandNames[0] if keys and keys != None - tk_call_without_enc(cmd, @path, '-parent', @relative, + tk_call_without_enc(cmd, @path, '-parent', @relative, *hash_kv(keys, true)) else tk_call_without_enc(cmd, @path, '-parent', @relative) diff --git a/ext/tk/lib/tkextlib/bwidget/listbox.rb b/ext/tk/lib/tkextlib/bwidget/listbox.rb index 093fcb6fb3..33b69b408a 100644 --- a/ext/tk/lib/tkextlib/bwidget/listbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/listbox.rb @@ -11,7 +11,7 @@ module Tk module BWidget class ListBox < TkWindow # is NOT a subclass of a listbox widget class. - # because it constructed on a canvas widget. + # because it constructed on a canvas widget. class Item < TkObject end @@ -29,7 +29,7 @@ class Tk::BWidget::ListBox class Event_for_Items < TkEvent::Event def self._get_extra_args_tbl - [ + [ TkComm.method(:string) # item idenfier ] end @@ -60,7 +60,7 @@ class Tk::BWidget::ListBox else cmd = Proc.new end - _bind_for_event_class(Event_for_Items, [path, 'bindImage'], + _bind_for_event_class(Event_for_Items, [path, 'bindImage'], context, cmd, *args) self end @@ -76,7 +76,7 @@ class Tk::BWidget::ListBox else cmd = Proc.new end - _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], + _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], context, cmd, *args) self end @@ -101,7 +101,7 @@ class Tk::BWidget::ListBox else cmd = Proc.new end - _bind_for_event_class(Event_for_Items, [path, 'bindText'], + _bind_for_event_class(Event_for_Items, [path, 'bindText'], context, cmd, *args) self end @@ -117,7 +117,7 @@ class Tk::BWidget::ListBox else cmd = Proc.new end - _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], + _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], context, cmd, *args) self end @@ -183,19 +183,19 @@ class Tk::BWidget::ListBox end def selection_set(*args) - tk_send_without_enc('selection', 'set', + tk_send_without_enc('selection', 'set', *(args.collect{|item| tagid(item)})) self end def selection_add(*args) - tk_send_without_enc('selection', 'add', + tk_send_without_enc('selection', 'add', *(args.collect{|item| tagid(item)})) self end def selection_remove(*args) - tk_send_without_enc('selection', 'remove', + tk_send_without_enc('selection', 'remove', *(args.collect{|item| tagid(item)})) self end @@ -237,7 +237,7 @@ class Tk::BWidget::ListBox::Item if lbox.kind_of?(Tk::BWidget::ListBox) @listbox = lbox else - fail RuntimeError, + fail RuntimeError, "expect Tk::BWidget::ListBox or Tk::BWidget::ListBox::Item for 1st argument" end diff --git a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb index b88461baf7..9b46532934 100644 --- a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb @@ -185,7 +185,7 @@ class Tk::BWidget::MessageDlg def create # return the index of the pressed button, or nil if it is destroyed - ret = num_or_str(tk_call(self.class::TkCommandNames[0], + ret = num_or_str(tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys))) (ret < 0)? nil: ret end diff --git a/ext/tk/lib/tkextlib/bwidget/notebook.rb b/ext/tk/lib/tkextlib/bwidget/notebook.rb index 423943619c..6101fa93e5 100644 --- a/ext/tk/lib/tkextlib/bwidget/notebook.rb +++ b/ext/tk/lib/tkextlib/bwidget/notebook.rb @@ -23,7 +23,7 @@ class Tk::BWidget::NoteBook class Event_for_Tabs < TkEvent::Event def self._get_extra_args_tbl - [ + [ TkComm.method(:string) # page idenfier ] end @@ -57,7 +57,7 @@ class Tk::BWidget::NoteBook else cmd = Proc.new end - _bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'], + _bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'], context, cmd, *args) self end @@ -73,7 +73,7 @@ class Tk::BWidget::NoteBook else cmd = Proc.new end - _bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'], + _bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'], context, cmd, *args) self end diff --git a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb index 0b635d97bb..2c7153333c 100644 --- a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb @@ -20,7 +20,7 @@ class Tk::BWidget::PasswdDlg WidgetClassNames[WidgetClassName] = self def __strval_optkeys - super() << 'loginhelptext' << 'loginlabel' << 'logintext' << + super() << 'loginhelptext' << 'loginlabel' << 'logintext' << 'passwdlabel' << 'passwdtext' end private :__strval_optkeys @@ -31,13 +31,13 @@ class Tk::BWidget::PasswdDlg private :__boolval_optkeys def __tkvariable_optkeys - super() << 'loginhelpvar' << 'logintextvariable' << + super() << 'loginhelpvar' << 'logintextvariable' << 'passwdhelpvar' << 'passwdtextvariable' end private :__tkvariable_optkeys def create - login, passwd = simplelist(tk_call(self.class::TkCommandNames[0], + login, passwd = simplelist(tk_call(self.class::TkCommandNames[0], @path, *hash_kv(@keys))) [login, passwd] end diff --git a/ext/tk/lib/tkextlib/bwidget/selectcolor.rb b/ext/tk/lib/tkextlib/bwidget/selectcolor.rb index 0f9014f8de..82bd05eb13 100644 --- a/ext/tk/lib/tkextlib/bwidget/selectcolor.rb +++ b/ext/tk/lib/tkextlib/bwidget/selectcolor.rb @@ -57,7 +57,7 @@ class Tk::BWidget::SelectColor::Dialog def create @keys['type'] = 'dialog' # 'dialog' type returns color - tk_call(Tk::BWidget::SelectColor::TkCommandNames[0], + tk_call(Tk::BWidget::SelectColor::TkCommandNames[0], @path, *hash_kv(@keys)) end end @@ -67,7 +67,7 @@ class Tk::BWidget::SelectColor::Menubutton keys = {} unless keys keys = _symbolkey2str(keys) keys['type'] = 'menubutton' # 'toolbar' type returns widget path - window(tk_call(Tk::BWidget::SelectColor::TkCommandNames[0], + window(tk_call(Tk::BWidget::SelectColor::TkCommandNames[0], @path, *hash_kv(keys))) end end diff --git a/ext/tk/lib/tkextlib/bwidget/selectfont.rb b/ext/tk/lib/tkextlib/bwidget/selectfont.rb index e53eb3b5bc..71b1afded3 100644 --- a/ext/tk/lib/tkextlib/bwidget/selectfont.rb +++ b/ext/tk/lib/tkextlib/bwidget/selectfont.rb @@ -80,7 +80,7 @@ class Tk::BWidget::SelectFont::Toolbar keys = {} unless keys keys = _symbolkey2str(keys) keys['type'] = 'toolbar' # 'toolbar' type returns widget path - window(tk_call(Tk::BWidget::SelectFont::TkCommandNames[0], + window(tk_call(Tk::BWidget::SelectFont::TkCommandNames[0], @path, *hash_kv(keys))) end end diff --git a/ext/tk/lib/tkextlib/bwidget/setup.rb b/ext/tk/lib/tkextlib/bwidget/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/bwidget/setup.rb +++ b/ext/tk/lib/tkextlib/bwidget/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/bwidget/tree.rb b/ext/tk/lib/tkextlib/bwidget/tree.rb index aed4512a73..86074ab6f4 100644 --- a/ext/tk/lib/tkextlib/bwidget/tree.rb +++ b/ext/tk/lib/tkextlib/bwidget/tree.rb @@ -26,7 +26,7 @@ class Tk::BWidget::Tree class Event_for_Items < TkEvent::Event def self._get_extra_args_tbl - [ + [ TkComm.method(:string) # item idenfier ] end @@ -38,7 +38,7 @@ class Tk::BWidget::Tree private :__strval_optkeys def __boolval_optkeys - super() << 'dragenabled' << 'dropenabled' << + super() << 'dragenabled' << 'dropenabled' << 'redraw' << 'selectfill' << 'showlines' end private :__boolval_optkeys @@ -68,7 +68,7 @@ class Tk::BWidget::Tree else cmd = Proc.new end - _bind_for_event_class(Event_for_Items, [path, 'bindImage'], + _bind_for_event_class(Event_for_Items, [path, 'bindImage'], context, cmd, *args) self end @@ -84,7 +84,7 @@ class Tk::BWidget::Tree else cmd = Proc.new end - _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], + _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], context, cmd, *args) self end @@ -109,7 +109,7 @@ class Tk::BWidget::Tree else cmd = Proc.new end - _bind_for_event_class(Event_for_Items, [path, 'bindText'], + _bind_for_event_class(Event_for_Items, [path, 'bindText'], context, cmd, *args) self end @@ -125,7 +125,7 @@ class Tk::BWidget::Tree else cmd = Proc.new end - _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], + _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], context, cmd, *args) self end @@ -206,7 +206,7 @@ class Tk::BWidget::Tree end def selection_add(*args) - tk_send_without_enc('selection', 'add', + tk_send_without_enc('selection', 'add', *(args.collect{|node| tagid(node)})) self end @@ -221,30 +221,30 @@ class Tk::BWidget::Tree end def selection_include?(*args) - bool(tk_send_without_enc('selection', 'get', + bool(tk_send_without_enc('selection', 'get', *(args.collect{|node| tagid(node)}))) end def selection_range(*args) - tk_send_without_enc('selection', 'range', + tk_send_without_enc('selection', 'range', *(args.collect{|node| tagid(node)})) self end def selection_remove(*args) - tk_send_without_enc('selection', 'remove', + tk_send_without_enc('selection', 'remove', *(args.collect{|node| tagid(node)})) self end def selection_set(*args) - tk_send_without_enc('selection', 'set', + tk_send_without_enc('selection', 'set', *(args.collect{|node| tagid(node)})) self end def selection_toggle(*args) - tk_send_without_enc('selection', 'toggle', + tk_send_without_enc('selection', 'toggle', *(args.collect{|node| tagid(node)})) self end @@ -298,7 +298,7 @@ class Tk::BWidget::Tree::Node @tree = tree.tree parent = tree.parent else - fail RuntimeError, + fail RuntimeError, "expect Tk::BWidget::Tree or Tk::BWidget::Tree::Node for 1st argument" end diff --git a/ext/tk/lib/tkextlib/itcl/setup.rb b/ext/tk/lib/tkextlib/itcl/setup.rb index 5be0588703..70b38e4916 100644 --- a/ext/tk/lib/tkextlib/itcl/setup.rb +++ b/ext/tk/lib/tkextlib/itcl/setup.rb @@ -2,8 +2,8 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/itk/incr_tk.rb b/ext/tk/lib/tkextlib/itk/incr_tk.rb index e06deb552c..8772f21b49 100644 --- a/ext/tk/lib/tkextlib/itk/incr_tk.rb +++ b/ext/tk/lib/tkextlib/itk/incr_tk.rb @@ -99,7 +99,7 @@ module Tk def itk_option_define(name, resource, klass, init, config=None) tk_call('itk_option', 'define', name, resource, klass, init, config) end - + def itk_option_remove(*args) tk_call('itk_option', 'remove', *args) end @@ -192,7 +192,7 @@ module Tk ComponentID_TBL.mutex.synchronize{ if ComponentID_TBL.key?(master) if ComponentID_TBL[master].key?(component) - return ComponentID_TBL[master][component] + return ComponentID_TBL[master][component] end else ComponentID_TBL[master] = {} diff --git a/ext/tk/lib/tkextlib/itk/setup.rb b/ext/tk/lib/tkextlib/itk/setup.rb index e47b64adae..544926efe0 100644 --- a/ext/tk/lib/tkextlib/itk/setup.rb +++ b/ext/tk/lib/tkextlib/itk/setup.rb @@ -2,8 +2,8 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/iwidgets/calendar.rb b/ext/tk/lib/tkextlib/iwidgets/calendar.rb index 8495f0e29b..e85d6e4e51 100644 --- a/ext/tk/lib/tkextlib/iwidgets/calendar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/calendar.rb @@ -20,7 +20,7 @@ class Tk::Iwidgets::Calendar def __strval_optkeys super() + [ - 'buttonforeground', 'outline', 'selectcolor', + 'buttonforeground', 'outline', 'selectcolor', 'weekdaybackground', 'weekendbackground' ] end diff --git a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb index d53df216bf..6e1cd0053b 100644 --- a/ext/tk/lib/tkextlib/iwidgets/entryfield.rb +++ b/ext/tk/lib/tkextlib/iwidgets/entryfield.rb @@ -30,16 +30,16 @@ class Tk::Iwidgets::Entryfield class EntryfieldValidate < TkValidateCommand #class CalCmdArgs < TkUtil::CallbackSubst class ValidateArgs < TkUtil::CallbackSubst - KEY_TBL = [ - [ ?c, ?s, :char ], - [ ?P, ?s, :post ], - [ ?S, ?s, :current ], - [ ?W, ?w, :widget ], + KEY_TBL = [ + [ ?c, ?s, :char ], + [ ?P, ?s, :post ], + [ ?S, ?s, :current ], + [ ?W, ?w, :widget ], nil ] - PROC_TBL = [ - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + PROC_TBL = [ + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] diff --git a/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb index 501f4c90a0..526dae1123 100644 --- a/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb @@ -20,7 +20,7 @@ class Tk::Iwidgets::Extfileselectionbox def __strval_optkeys super() + [ - 'dirslabel', 'fileslabel', 'filterlabel', 'mask', 'nomatchstring', + 'dirslabel', 'fileslabel', 'filterlabel', 'mask', 'nomatchstring', 'selectionlabel' ] end diff --git a/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb index 7b331d0b40..eb4dde484f 100644 --- a/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb @@ -20,7 +20,7 @@ class Tk::Iwidgets::Fileselectionbox def __strval_optkeys super() + [ - 'directory', 'dirslabel', 'fileslabel', 'filterlabel', 'mask', + 'directory', 'dirslabel', 'fileslabel', 'filterlabel', 'mask', 'nomatchstring', 'selectionlabel' ] end diff --git a/ext/tk/lib/tkextlib/iwidgets/finddialog.rb b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb index 75e219c37e..c46b972214 100644 --- a/ext/tk/lib/tkextlib/iwidgets/finddialog.rb +++ b/ext/tk/lib/tkextlib/iwidgets/finddialog.rb @@ -20,7 +20,7 @@ class Tk::Iwidgets::Finddialog def __strval_optkeys super() + [ - 'patternbackground', 'patternforeground', + 'patternbackground', 'patternforeground', 'searchbackground', 'searchforeground' ] end diff --git a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb index d9220fecbf..fa16d9aad8 100644 --- a/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb +++ b/ext/tk/lib/tkextlib/iwidgets/hierarchy.rb @@ -64,15 +64,15 @@ class Tk::Iwidgets::Hierarchy class IndicatorCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst - KEY_TBL = [ - [ ?n, ?s, :node ], - [ ?s, ?b, :status ], + KEY_TBL = [ + [ ?n, ?s, :node ], + [ ?s, ?b, :status ], nil ] - PROC_TBL = [ - [ ?s, TkComm.method(:string) ], - [ ?b, TkComm.method(:bool) ], + PROC_TBL = [ + [ ?s, TkComm.method(:string) ], + [ ?b, TkComm.method(:bool) ], nil ] @@ -109,9 +109,9 @@ class Tk::Iwidgets::Hierarchy class IconCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst - KEY_TBL = [ - [ ?n, ?s, :node ], - [ ?i, ?s, :icon ], + KEY_TBL = [ + [ ?n, ?s, :node ], + [ ?i, ?s, :icon ], nil ] PROC_TBL = [ [ ?s, TkComm.method(:string) ], nil ] @@ -270,7 +270,7 @@ class Tk::Iwidgets::Hierarchy end def compare(idx1, op, idx2) - bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), + bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), op, _get_eval_enc_str(idx2))) end diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb index 67ad67d07e..42368f5a56 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb @@ -103,7 +103,7 @@ class Tk::Iwidgets::Scrolledcanvas end def bbox(tagOrId, *tags) - list(tk_send_without_enc('bbox', tagid(tagOrId), + list(tk_send_without_enc('bbox', tagid(tagOrId), *tags.collect{|t| tagid(t)})) end @@ -165,7 +165,7 @@ class Tk::Iwidgets::Scrolledcanvas end def dchars(tag, first, last=None) - tk_send_without_enc('dchars', tagid(tag), + tk_send_without_enc('dchars', tagid(tag), _get_eval_enc_str(first), _get_eval_enc_str(last)) self end @@ -176,7 +176,7 @@ class Tk::Iwidgets::Scrolledcanvas tbl = TkcItem::CItemID_TBL[self.path] } if tbl - find('withtag', *args).each{|item| + find('withtag', *args).each{|item| if item.kind_of?(TkcItem) TkcItem::CItemID_TBL.mutex.synchronize{ tbl.delete(item.id) @@ -195,7 +195,7 @@ class Tk::Iwidgets::Scrolledcanvas end def find(mode, *args) - list(tk_send_without_enc('find', mode, *args)).collect!{|id| + list(tk_send_without_enc('find', mode, *args)).collect!{|id| TkcItem.id2obj(self, id) } end @@ -251,7 +251,7 @@ class Tk::Iwidgets::Scrolledcanvas end def insert(tagOrId, index, string) - tk_send_without_enc('insert', tagid(tagOrId), index, + tk_send_without_enc('insert', tagid(tagOrId), index, _get_eval_enc_str(string)) self end diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb index 7543d557e3..7e63633a1d 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb @@ -141,7 +141,7 @@ class Tk::Iwidgets::Scrolledlistbox def get(first, last=nil) if last # tk_split_simplelist(_fromUTF8(tk_send_without_enc('get', first, last))) - tk_split_simplelist(tk_send_without_enc('get', first, last), + tk_split_simplelist(tk_send_without_enc('get', first, last), false, true) else _fromUTF8(tk_send_without_enc('get', first)) diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb index d6436d202a..674298ff80 100644 --- a/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb +++ b/ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb @@ -86,7 +86,7 @@ class Tk::Iwidgets::Scrolledtext list(tk_send('bbox', index)) end def compare(idx1, op, idx2) - bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), + bool(tk_send_without_enc('compare', _get_eval_enc_str(idx1), op, _get_eval_enc_str(idx2))) end @@ -119,11 +119,11 @@ class Tk::Iwidgets::Scrolledtext def image_cget_strict(index, slot) case slot.to_s when 'text', 'label', 'show', 'data', 'file' - _fromUTF8(tk_send_without_enc('image', 'cget', + _fromUTF8(tk_send_without_enc('image', 'cget', _get_eval_enc_str(index), "-#{slot}")) else - tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget', - _get_eval_enc_str(index), + tk_tcl2ruby(_fromUTF8(tk_send_without_enc('image', 'cget', + _get_eval_enc_str(index), "-#{slot}"))) end end @@ -151,13 +151,13 @@ class Tk::Iwidgets::Scrolledtext def image_configure(index, slot, value=None) if slot.kind_of? Hash - _fromUTF8(tk_send_without_enc('image', 'configure', - _get_eval_enc_str(index), + _fromUTF8(tk_send_without_enc('image', 'configure', + _get_eval_enc_str(index), *hash_kv(slot, true))) else - _fromUTF8(tk_send_without_enc('image', 'configure', - _get_eval_enc_str(index), - "-#{slot}", + _fromUTF8(tk_send_without_enc('image', 'configure', + _get_eval_enc_str(index), + "-#{slot}", _get_eval_enc_str(value))) end self @@ -187,16 +187,16 @@ class Tk::Iwidgets::Scrolledtext else if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end end @@ -228,16 +228,16 @@ class Tk::Iwidgets::Scrolledtext else if conf[2] if conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end end @@ -298,7 +298,7 @@ class Tk::Iwidgets::Scrolledtext def mark_gravity(mark, direction=nil) if direction - tk_send_without_enc('mark', 'gravity', + tk_send_without_enc('mark', 'gravity', _get_eval_enc_str(mark), direction) self else @@ -307,27 +307,27 @@ class Tk::Iwidgets::Scrolledtext end def mark_set(mark, index) - tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark), + tk_send_without_enc('mark', 'set', _get_eval_enc_str(mark), _get_eval_enc_str(index)) self end alias set_mark mark_set def mark_unset(*marks) - tk_send_without_enc('mark', 'unset', + tk_send_without_enc('mark', 'unset', *(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', + tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'next', _get_eval_enc_str(index)))) end alias next_mark mark_next def mark_previous(index) - tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous', + tagid2obj(_fromUTF8(tk_send_without_enc('mark', 'previous', _get_eval_enc_str(index)))) end alias previous_mark mark_previous @@ -354,11 +354,11 @@ class Tk::Iwidgets::Scrolledtext # $KCODE == 'NONE' if JAPANIZED_TK - tk_call_without_enc('kstring', 'length', + tk_call_without_enc('kstring', 'length', _get_eval_enc_str(txt)).to_i else begin - tk_call_without_enc('encoding', 'convertto', 'ascii', + tk_call_without_enc('encoding', 'convertto', 'ascii', _get_eval_enc_str(txt)).length rescue StandardError, NameError # sorry, I have no plan @@ -419,11 +419,11 @@ class Tk::Iwidgets::Scrolledtext 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"), + return [index(start + " + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(match), match] end else @@ -437,11 +437,11 @@ class Tk::Iwidgets::Scrolledtext 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"), + return [index(start + " + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index(start + " + #{pos} chars"), $&.split('').length] - return [index(start + " + #{pos} chars"), + return [index(start + " + #{pos} chars"), _ktext_length(match), match] end else @@ -452,7 +452,7 @@ class Tk::Iwidgets::Scrolledtext 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"), + return [index("1.0 + #{pos} chars"), _ktext_length(pat), pat.dup] else #return [index("1.0 + #{pos} chars"), $&.split('').length] diff --git a/ext/tk/lib/tkextlib/iwidgets/setup.rb b/ext/tk/lib/tkextlib/iwidgets/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/iwidgets/setup.rb +++ b/ext/tk/lib/tkextlib/iwidgets/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/iwidgets/spinner.rb b/ext/tk/lib/tkextlib/iwidgets/spinner.rb index aeee5c9038..f2d9caae21 100644 --- a/ext/tk/lib/tkextlib/iwidgets/spinner.rb +++ b/ext/tk/lib/tkextlib/iwidgets/spinner.rb @@ -25,16 +25,16 @@ class Tk::Iwidgets::Spinner class EntryfieldValidate < TkValidateCommand #class CalCmdArgs < TkUtil::CallbackSubst class ValidateArgs < TkUtil::CallbackSubst - KEY_TBL = [ - [ ?c, ?s, :char ], - [ ?P, ?s, :post ], - [ ?S, ?s, :current ], - [ ?W, ?w, :widget ], + KEY_TBL = [ + [ ?c, ?s, :char ], + [ ?P, ?s, :post ], + [ ?S, ?s, :current ], + [ ?W, ?w, :widget ], nil ] - PROC_TBL = [ - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + PROC_TBL = [ + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] diff --git a/ext/tk/lib/tkextlib/iwidgets/tabset.rb b/ext/tk/lib/tkextlib/iwidgets/tabset.rb index 300ba9dee0..c1a1b29268 100644 --- a/ext/tk/lib/tkextlib/iwidgets/tabset.rb +++ b/ext/tk/lib/tkextlib/iwidgets/tabset.rb @@ -116,9 +116,9 @@ class Tk::Iwidgets::Tabset return end tabs_size = @canvas.winfo_width - tab_start, tab_end = @canvas . - find_overlapping(head, 0, head + delta, @canvas.winfo_height) . - find_all{|id| @canvas.itemtype(id) == TkcPolygon} . + tab_start, tab_end = @canvas . + find_overlapping(head, 0, head + delta, @canvas.winfo_height) . + find_all{|id| @canvas.itemtype(id) == TkcPolygon} . map!{|id| bbox = @canvas.bbox(id); [bbox[0], bbox[2]]} . max when 'e', 'w' @@ -127,9 +127,9 @@ class Tk::Iwidgets::Tabset return end tabs_size = @canvas.winfo_height - tab_start, tab_end = @canvas . - find_overlapping(0, head, @canvas.winfo_width, head + delta) . - find_all{|id| @canvas.itemtype(id) == TkcPolygon} . + tab_start, tab_end = @canvas . + find_overlapping(0, head, @canvas.winfo_width, head + delta) . + find_all{|id| @canvas.itemtype(id) == TkcPolygon} . map!{|id| bbox = @canvas.bbox(id); [bbox[1], bbox[3]]} . max end diff --git a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb index 17cfa62156..c9f1753c70 100644 --- a/ext/tk/lib/tkextlib/iwidgets/toolbar.rb +++ b/ext/tk/lib/tkextlib/iwidgets/toolbar.rb @@ -105,7 +105,7 @@ class Tk::Iwidgets::Toolbar else tag = Tk::Itk::Component.new(self) end - window(tk_call(@path, 'insert', index(idx), type, + window(tk_call(@path, 'insert', index(idx), type, tagid(tag), *hash_kv(keys))) tag end diff --git a/ext/tk/lib/tkextlib/iwidgets/watch.rb b/ext/tk/lib/tkextlib/iwidgets/watch.rb index ab2b687cf9..dd96d4f953 100644 --- a/ext/tk/lib/tkextlib/iwidgets/watch.rb +++ b/ext/tk/lib/tkextlib/iwidgets/watch.rb @@ -24,7 +24,7 @@ class Tk::Iwidgets::Watch private :__boolval_optkeys def __strval_optkeys - super() << 'clockcolor' << 'hourcolor' << 'minutecolor' << + super() << 'clockcolor' << 'hourcolor' << 'minutecolor' << 'pivotcolor' << 'secondcolor' << 'tickcolor' end private :__strval_optkeys diff --git a/ext/tk/lib/tkextlib/pkg_checker.rb b/ext/tk/lib/tkextlib/pkg_checker.rb index 5002ed7ff8..ecc6bfa131 100755 --- a/ext/tk/lib/tkextlib/pkg_checker.rb +++ b/ext/tk/lib/tkextlib/pkg_checker.rb @@ -151,7 +151,7 @@ def subdir_check(dir, verbose=false) if err.empty? print 'Ready : ', path, ' : require->', suc.inspect, "\n" else - print '*LACK : ', path, ' : require->', suc.inspect, + print '*LACK : ', path, ' : require->', suc.inspect, ' FAIL->', err.inspect, "\n" end end @@ -176,7 +176,7 @@ Dir.chdir(dir) if err.empty? print 'Ready : ', f, ' : require->', suc.inspect, "\n" else - print '*LACK : ', f, ' : require->', suc.inspect, + print '*LACK : ', f, ' : require->', suc.inspect, ' FAIL->', err.inspect, "\n" end diff --git a/ext/tk/lib/tkextlib/setup.rb b/ext/tk/lib/tkextlib/setup.rb index 12867e8f9c..79facc5ee3 100644 --- a/ext/tk/lib/tkextlib/setup.rb +++ b/ext/tk/lib/tkextlib/setup.rb @@ -1,8 +1,8 @@ # # setup.rb -- setup script before using Tk extension libraries # -# If you need some setup operations for Tk extensions (for example, -# modify the dynamic library path) required, please write the setup -# operations in this file. This file is required at the last of -# "require 'tk'". +# If you need some setup operations for Tk extensions (for example, +# modify the dynamic library path) required, please write the setup +# operations in this file. This file is required at the last of +# "require 'tk'". # diff --git a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb index 7db3c2e2b7..2def59bf73 100644 --- a/ext/tk/lib/tkextlib/tcllib/autoscroll.rb +++ b/ext/tk/lib/tkextlib/tcllib/autoscroll.rb @@ -7,20 +7,20 @@ # # (The following is the original description of the library.) # -# This package allows scrollbars to be mapped and unmapped as needed -# depending on the size and content of the scrollbars scrolled widget. -# The scrollbar must be managed by either pack or grid, other geometry +# This package allows scrollbars to be mapped and unmapped as needed +# depending on the size and content of the scrollbars scrolled widget. +# The scrollbar must be managed by either pack or grid, other geometry # managers are not supported. # -# When managed by pack, any geometry changes made in the scrollbars parent -# between the time a scrollbar is unmapped, and when it is mapped will be -# lost. It is an error to destroy any of the scrollbars siblings while the -# scrollbar is unmapped. When managed by grid, if anything becomes gridded -# in the same row and column the scrollbar occupied it will be replaced by +# When managed by pack, any geometry changes made in the scrollbars parent +# between the time a scrollbar is unmapped, and when it is mapped will be +# lost. It is an error to destroy any of the scrollbars siblings while the +# scrollbar is unmapped. When managed by grid, if anything becomes gridded +# in the same row and column the scrollbar occupied it will be replaced by # the scrollbar when remapped. # -# This package may be used on any scrollbar-like widget as long as it -# supports the set subcommand in the same style as scrollbar. If the set +# This package may be used on any scrollbar-like widget as long as it +# supports the set subcommand in the same style as scrollbar. If the set # subcommand is not used then this package will have no effect. # @@ -110,14 +110,14 @@ end class Tk::Scrollbar def autoscroll - # Arranges for the already existing scrollbar to be mapped + # Arranges for the already existing scrollbar to be mapped # and unmapped as needed. #tk_call_without_enc('::autoscroll::autoscroll', @path) Tk::Tcllib::Autoscroll.autoscroll(self) self end def unautoscroll - # Returns the scrollbar to its original static state. + # Returns the scrollbar to its original static state. #tk_call_without_enc('::autoscroll::unautoscroll', @path) Tk::Tcllib::Autoscroll.unautoscroll(self) self diff --git a/ext/tk/lib/tkextlib/tcllib/ctext.rb b/ext/tk/lib/tkextlib/tcllib/ctext.rb index 9014037f3d..21d6438b48 100644 --- a/ext/tk/lib/tkextlib/tcllib/ctext.rb +++ b/ext/tk/lib/tkextlib/tcllib/ctext.rb @@ -39,7 +39,7 @@ class Tk::Tcllib::CText def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -48,7 +48,7 @@ class Tk::Tcllib::CText private :create_self def __strval_optkeys - super() << 'linemapfg' << 'linemapbg' << + super() << 'linemapfg' << 'linemapbg' << 'linemap_select_fg' << 'linemap_select_bg' end private :__strval_optkeys @@ -96,19 +96,19 @@ class Tk::Tcllib::CText end def add_highlight_class_for_special_chars(klass, col, *chrs) - tk_call('ctext::addHighlightClassForSpecialChars', + tk_call('ctext::addHighlightClassForSpecialChars', @path, klass, col, chrs.join('')) self end def add_highlight_class_for_regexp(klass, col, tcl_regexp) - tk_call('ctext::addHighlightClassForRegexp', + tk_call('ctext::addHighlightClassForRegexp', @path, klass, col, tcl_regexp) self end def add_highlight_class_with_only_char_start(klass, col, chr) - tk_call('ctext::addHighlightClassWithOnlyCharStart', + tk_call('ctext::addHighlightClassWithOnlyCharStart', @path, klass, col, chr) self end diff --git a/ext/tk/lib/tkextlib/tcllib/cursor.rb b/ext/tk/lib/tkextlib/tcllib/cursor.rb index 9bb828e8dd..5c47f9709b 100644 --- a/ext/tk/lib/tkextlib/tcllib/cursor.rb +++ b/ext/tk/lib/tkextlib/tcllib/cursor.rb @@ -44,8 +44,8 @@ module Tk end def self.cursor_display(parent=None) - # Pops up a dialog with a listbox containing all the cursor names. - # Selecting a cursor name will display it in that dialog. + # Pops up a dialog with a listbox containing all the cursor names. + # Selecting a cursor name will display it in that dialog. # This is simply for viewing any available cursors on the platform . #tk_call_without_enc('::cursor::display', parent) Tk::Tcllib::Cursor.cursor_display(parent) @@ -54,15 +54,15 @@ end class TkWindow def cursor_propagate(cursor) - # Sets the cursor for self and all its descendants to cursor. + # Sets the cursor for self and all its descendants to cursor. #tk_call_without_enc('::cursor::propagate', @path, cursor) Tk::Tcllib::Cursor.cursor_propagate(self, cursor) end def cursor_restore(cursor = None) - # Restore the original or previously set cursor for self and all its - # descendants. If cursor is specified, that will be used if on any - # widget that did not have a preset cursor (set by a previous call - # to TkWindow#cursor_propagate). + # Restore the original or previously set cursor for self and all its + # descendants. If cursor is specified, that will be used if on any + # widget that did not have a preset cursor (set by a previous call + # to TkWindow#cursor_propagate). #tk_call_without_enc('::cursor::restore', @path, cursor) Tk::Tcllib::Cursor.cursor_restore(self, cursor) end diff --git a/ext/tk/lib/tkextlib/tcllib/datefield.rb b/ext/tk/lib/tkextlib/tcllib/datefield.rb index 2244dd7a9a..4c2eae741e 100644 --- a/ext/tk/lib/tkextlib/tcllib/datefield.rb +++ b/ext/tk/lib/tkextlib/tcllib/datefield.rb @@ -7,12 +7,12 @@ # # (The following is the original description of the library.) # -# The datefield package provides the datefield widget which is an enhanced -# text entry widget for the purpose of date entry. Only valid dates of the +# The datefield package provides the datefield widget which is an enhanced +# text entry widget for the purpose of date entry. Only valid dates of the # form MM/DD/YYYY can be entered. -# -# The datefield widget is, in fact, just an entry widget with specialized -# bindings. This means all the command and options for an entry widget apply +# +# The datefield widget is, in fact, just an entry widget with specialized +# bindings. This means all the command and options for an entry widget apply # equally here. require 'tk' @@ -47,7 +47,7 @@ class Tk::Tcllib::Datefield def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/dialog.rb b/ext/tk/lib/tkextlib/tcllib/dialog.rb index 825621b5a1..86a0ef2269 100644 --- a/ext/tk/lib/tkextlib/tcllib/dialog.rb +++ b/ext/tk/lib/tkextlib/tcllib/dialog.rb @@ -41,7 +41,7 @@ class Tk::Tcllib::Widget::Dialog def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/getstring.rb b/ext/tk/lib/tkextlib/tcllib/getstring.rb index fc5d8b26d9..ab45c9b1ea 100644 --- a/ext/tk/lib/tkextlib/tcllib/getstring.rb +++ b/ext/tk/lib/tkextlib/tcllib/getstring.rb @@ -74,7 +74,7 @@ class Tk::Tcllib::GetString_Dialog def show @variable.value = '' - @status = bool(tk_call(self.class::TkCommandNames[0], + @status = bool(tk_call(self.class::TkCommandNames[0], @path, @variable, @text, *hash_kv(@keys))) end alias display show diff --git a/ext/tk/lib/tkextlib/tcllib/ico.rb b/ext/tk/lib/tkextlib/tcllib/ico.rb index 8c92926a4c..538f7b5408 100644 --- a/ext/tk/lib/tkextlib/tcllib/ico.rb +++ b/ext/tk/lib/tkextlib/tcllib/ico.rb @@ -50,23 +50,23 @@ class Tk::Tcllib::ICO def self.get_data(file, index, keys={}) keys['format'] = 'data' - tk_split_list(tk_call_without_enc('::ico::getIcon', file, index, + tk_split_list(tk_call_without_enc('::ico::getIcon', file, index, *hash_kv(keys, true))) end def self.write(file, index, depth, data, keys=nil) - tk_call_without_enc('::ico::writeIcon', file, index, depth, data, + tk_call_without_enc('::ico::writeIcon', file, index, depth, data, *hash_kv(keys, true)) end def self.copy(from_file, from_index, to_file, to_index, keys=nil) - tk_call_without_enc('::ico::copyIcon', - from_file, from_index, to_file, to_index, + tk_call_without_enc('::ico::copyIcon', + from_file, from_index, to_file, to_index, *hash_kv(keys, true)) end def self.exe_to_ico(exe_file, ico_file, keys=nil) - tk_call_without_enc('::ico::copyIcon', exe_file, ico_file, + tk_call_without_enc('::ico::copyIcon', exe_file, ico_file, *hash_kv(keys, true)) end @@ -76,7 +76,7 @@ class Tk::Tcllib::ICO def self.transparent_color(image, color) if image.kind_of?(Array) - tk_split_list(tk_call_without_enc('::ico::transparentColor', + tk_split_list(tk_call_without_enc('::ico::transparentColor', image, color)) else tk_call_without_enc('::ico::transparentColor', image, color) @@ -99,7 +99,7 @@ class Tk::Tcllib::ICO Tk_Image_ID[1].succ! } end - tk_call_without_enc('::ico::getIcon', file, index, '-name', @path, + tk_call_without_enc('::ico::getIcon', file, index, '-name', @path, '-format', 'image', *hash_kv(keys, true)) Tk_IMGTBL[@path] = self end diff --git a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb index c4b8240c04..a8a33f1cad 100644 --- a/ext/tk/lib/tkextlib/tcllib/ip_entry.rb +++ b/ext/tk/lib/tkextlib/tcllib/ip_entry.rb @@ -7,7 +7,7 @@ # # (The following is the original description of the library.) # -# This package provides a widget for the entering of a IP address. +# This package provides a widget for the entering of a IP address. # It guarantees a valid address at all times. require 'tk' @@ -43,7 +43,7 @@ class Tk::Tcllib::IP_Entry def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/panelframe.rb b/ext/tk/lib/tkextlib/tcllib/panelframe.rb index 2a4562e779..9086ad78d2 100644 --- a/ext/tk/lib/tkextlib/tcllib/panelframe.rb +++ b/ext/tk/lib/tkextlib/tcllib/panelframe.rb @@ -37,7 +37,7 @@ class Tk::Tcllib::Widget::PanelFrame def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/plotchart.rb b/ext/tk/lib/tkextlib/tcllib/plotchart.rb index 06ab20f3e6..25a574efbc 100644 --- a/ext/tk/lib/tkextlib/tcllib/plotchart.rb +++ b/ext/tk/lib/tkextlib/tcllib/plotchart.rb @@ -7,10 +7,10 @@ # # (The following is the original description of the library.) # -# Plotchart is a Tcl-only package that focuses on the easy creation of -# xy-plots, barcharts and other common types of graphical presentations. -# The emphasis is on ease of use, rather than flexibility. The procedures -# that create a plot use the entire canvas window, making the layout of the +# Plotchart is a Tcl-only package that focuses on the easy creation of +# xy-plots, barcharts and other common types of graphical presentations. +# The emphasis is on ease of use, rather than flexibility. The procedures +# that create a plot use the entire canvas window, making the layout of the # plot completely automatic. # # This results in the creation of an xy-plot in, say, ten lines of code: @@ -32,27 +32,27 @@ # $s title "Data series" # -------------------------------------------------------------------- # -# A drawback of the package might be that it does not do any data management. -# So if the canvas that holds the plot is to be resized, the whole plot must -# be redrawn. The advantage, though, is that it offers a number of plot and +# A drawback of the package might be that it does not do any data management. +# So if the canvas that holds the plot is to be resized, the whole plot must +# be redrawn. The advantage, though, is that it offers a number of plot and # chart types: # # * XY-plots like the one shown above with any number of data series. -# * Stripcharts, a kind of XY-plots where the horizontal axis is adjusted -# automatically. The result is a kind of sliding window on the data +# * Stripcharts, a kind of XY-plots where the horizontal axis is adjusted +# automatically. The result is a kind of sliding window on the data # series. # * Polar plots, where the coordinates are polar instead of cartesian. -# * Isometric plots, where the scale of the coordinates in the two -# directions is always the same, i.e. a circle in world coordinates +# * Isometric plots, where the scale of the coordinates in the two +# directions is always the same, i.e. a circle in world coordinates # appears as a circle on the screen. -# You can zoom in and out, as well as pan with these plots (Note: this -# works best if no axes are drawn, the zooming and panning routines do -# not distinguish the axes), using the mouse buttons with the control +# You can zoom in and out, as well as pan with these plots (Note: this +# works best if no axes are drawn, the zooming and panning routines do +# not distinguish the axes), using the mouse buttons with the control # key and the arrow keys with the control key. # * Piecharts, with automatic scaling to indicate the proportions. -# * Barcharts, with either vertical or horizontal bars, stacked bars or +# * Barcharts, with either vertical or horizontal bars, stacked bars or # bars side by side. -# * Timecharts, where bars indicate a time period and milestones or other +# * Timecharts, where bars indicate a time period and milestones or other # important moments in time are represented by triangles. # * 3D plots (both for displaying surfaces and 3D bars) # @@ -91,13 +91,13 @@ module Tk::Tcllib::Plotchart end def self.world_coordinates(w, *args) # args := xmin, ymin, xmax, ymax - tk_call_without_enc('::Plotchart::worldCoordinates', + tk_call_without_enc('::Plotchart::worldCoordinates', w.path, *(args.flatten)) end - def self.world_3D_coordinates(w, *args) + def self.world_3D_coordinates(w, *args) # args := xmin, ymin, zmin, xmax, ymax, zmax - tk_call_without_enc('::Plotchart::world3DCoordinates', + tk_call_without_enc('::Plotchart::world3DCoordinates', w.path, *(args.flatten)) end @@ -157,7 +157,7 @@ module Tk::Tcllib::Plotchart if key.kind_of?(Hash) tk_call_without_enc(@chart, 'xconfig', *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'xconfig', + tk_call_without_enc(@chart, 'xconfig', "-#{key}", _get_eval_enc_str(value)) end self @@ -167,7 +167,7 @@ module Tk::Tcllib::Plotchart if key.kind_of?(Hash) tk_call_without_enc(@chart, 'yconfig', *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'yconfig', + tk_call_without_enc(@chart, 'yconfig', "-#{key}", _get_eval_enc_str(value)) end self @@ -180,14 +180,14 @@ module Tk::Tcllib::Plotchart end def world_coordinates(*args) # args := xmin, ymin, xmax, ymax - tk_call_without_enc('::Plotchart::worldCoordinates', + tk_call_without_enc('::Plotchart::worldCoordinates', @path, *(args.flatten)) self end - def world_3D_coordinates(*args) + def world_3D_coordinates(*args) # args := xmin, ymin, zmin, xmax, ymax, zmax - tk_call_without_enc('::Plotchart::world3DCoordinates', + tk_call_without_enc('::Plotchart::world3DCoordinates', @path, *(args.flatten)) self end @@ -229,7 +229,7 @@ module Tk::Tcllib::Plotchart include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createXYPlot'.freeze ].freeze @@ -259,7 +259,7 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, + tk_call_without_enc(self.class::TkCommandNames[1], @path, array2tk_list(@xaxis), array2tk_list(@yaxis)) end private :_create_chart @@ -324,7 +324,7 @@ module Tk::Tcllib::Plotchart if key.kind_of?(Hash) tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'dataconfig', series, + tk_call_without_enc(@chart, 'dataconfig', series, "-#{key}", _get_eval_enc_str(value)) end end @@ -333,7 +333,7 @@ module Tk::Tcllib::Plotchart ############################ class Stripchart < XYPlot TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createStripchart'.freeze ].freeze end @@ -343,7 +343,7 @@ module Tk::Tcllib::Plotchart include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createPolarplot'.freeze ].freeze @@ -370,7 +370,7 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, + tk_call_without_enc(self.class::TkCommandNames[1], @path, array2tk_list(@radius_data)) end private :_create_chart @@ -382,7 +382,7 @@ module Tk::Tcllib::Plotchart end def plot(series, radius, angle) - tk_call_without_enc(@chart, 'plot', _get_eval_enc_str(series), + tk_call_without_enc(@chart, 'plot', _get_eval_enc_str(series), radius, angle) self end @@ -391,7 +391,7 @@ module Tk::Tcllib::Plotchart if key.kind_of?(Hash) tk_call_without_enc(@chart, 'dataconfig', series, *hash_kv(key, true)) else - tk_call_without_enc(@chart, 'dataconfig', series, + tk_call_without_enc(@chart, 'dataconfig', series, "-#{key}", _get_eval_enc_str(value)) end end @@ -403,7 +403,7 @@ module Tk::Tcllib::Plotchart include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createIsometricPlot'.freeze ].freeze @@ -446,8 +446,8 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, - array2tk_list(@xaxis), array2tk_list(@yaxis), + tk_call_without_enc(self.class::TkCommandNames[1], @path, + array2tk_list(@xaxis), array2tk_list(@yaxis), @stepsize) end private :_create_chart @@ -483,7 +483,7 @@ module Tk::Tcllib::Plotchart include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::create3DPlot'.freeze ].freeze @@ -516,9 +516,9 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, - array2tk_list(@xaxis), - array2tk_list(@yaxis), + tk_call_without_enc(self.class::TkCommandNames[1], @path, + array2tk_list(@xaxis), + array2tk_list(@yaxis), array2tk_list(@zaxis)) end private :_create_chart @@ -542,10 +542,10 @@ module Tk::Tcllib::Plotchart end def plot_data(dat) - # dat has to be provided as a 2 level array. - # 1st level contains rows, drawn in y-direction, - # and each row is an array whose elements are drawn in x-direction, - # for the columns. + # dat has to be provided as a 2 level array. + # 1st level contains rows, drawn in y-direction, + # and each row is an array whose elements are drawn in x-direction, + # for the columns. tk_call_without_enc(@chart, 'plotdata', dat) self end @@ -565,7 +565,7 @@ module Tk::Tcllib::Plotchart include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createPiechart'.freeze ].freeze @@ -596,11 +596,11 @@ module Tk::Tcllib::Plotchart include ChartMethod TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createBarchart'.freeze ].freeze - def initialize(*args) + def initialize(*args) # args := ([parent,] xlabels, ylabels [, series] [, keys]) # xlabels, ylabels := labels | axis ( depend on normal or horizontal ) # labels := Array of [label, label, ...] @@ -642,8 +642,8 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, - array2tk_list(@xlabels), array2tk_list(@ylabels), + tk_call_without_enc(self.class::TkCommandNames[1], @path, + array2tk_list(@xlabels), array2tk_list(@ylabels), @series_size) end private :_create_chart @@ -672,7 +672,7 @@ module Tk::Tcllib::Plotchart ############################ class HorizontalBarchart < Barchart TkCommandNames = [ - 'canvas'.freeze, + 'canvas'.freeze, '::Plotchart::createHorizontalBarchart'.freeze ].freeze end @@ -717,7 +717,7 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, + tk_call_without_enc(self.class::TkCommandNames[1], @path, @time_begin, @time_end, @items) end private :_create_chart @@ -790,13 +790,13 @@ module Tk::Tcllib::Plotchart def _create_chart p self.class::TkCommandNames[1] if $DEBUG - tk_call_without_enc(self.class::TkCommandNames[1], @path, + tk_call_without_enc(self.class::TkCommandNames[1], @path, @time_begin, @time_end, @items, @text_width) end private :_create_chart def task(txt, time_begin, time_end, completed=0.0) - list(tk_call_without_enc(@chart, 'task', txt, time_begin, time_end, + list(tk_call_without_enc(@chart, 'task', txt, time_begin, time_end, completed)).collect!{|id| TkcItem.id2obj(self, id) } diff --git a/ext/tk/lib/tkextlib/tcllib/ruler.rb b/ext/tk/lib/tkextlib/tcllib/ruler.rb index 88ffb2c912..d22dafa053 100644 --- a/ext/tk/lib/tkextlib/tcllib/ruler.rb +++ b/ext/tk/lib/tkextlib/tcllib/ruler.rb @@ -46,7 +46,7 @@ class Tk::Tcllib::Widget::Ruler def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/screenruler.rb b/ext/tk/lib/tkextlib/tcllib/screenruler.rb index 1b4067e2f0..75fa36b66d 100644 --- a/ext/tk/lib/tkextlib/tcllib/screenruler.rb +++ b/ext/tk/lib/tkextlib/tcllib/screenruler.rb @@ -47,7 +47,7 @@ class Tk::Tcllib::Widget::ScreenRuler def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/scrollwin.rb b/ext/tk/lib/tkextlib/tcllib/scrollwin.rb index 717728e34a..c9f6062fef 100644 --- a/ext/tk/lib/tkextlib/tcllib/scrollwin.rb +++ b/ext/tk/lib/tkextlib/tcllib/scrollwin.rb @@ -42,7 +42,7 @@ class Tk::Tcllib::Widget::ScrolledWindow def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/setup.rb b/ext/tk/lib/tkextlib/tcllib/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tcllib/setup.rb +++ b/ext/tk/lib/tkextlib/tcllib/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tcllib/superframe.rb b/ext/tk/lib/tkextlib/tcllib/superframe.rb index 35da37efbf..adc9c4adbd 100644 --- a/ext/tk/lib/tkextlib/tcllib/superframe.rb +++ b/ext/tk/lib/tkextlib/tcllib/superframe.rb @@ -37,7 +37,7 @@ class Tk::Tcllib::Widget::SuperFrame def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tcllib/swaplist.rb b/ext/tk/lib/tkextlib/tcllib/swaplist.rb index 1c813e36da..bb4c71cd5f 100644 --- a/ext/tk/lib/tkextlib/tcllib/swaplist.rb +++ b/ext/tk/lib/tkextlib/tcllib/swaplist.rb @@ -44,7 +44,7 @@ class Tk::Tcllib::Swaplist_Dialog self.show(*args) end - def initialize(*args) + def initialize(*args) # args = (parent=nil, complete_list=[], selected_list=[], keys=nil) keys = args.pop if keys.kind_of?(Hash) @@ -74,9 +74,9 @@ class Tk::Tcllib::Swaplist_Dialog def show @variable.value = '' - @status = bool(tk_call(self.class::TkCommandNames[0], - @path, @variable, - @complete_list, @selected_list, + @status = bool(tk_call(self.class::TkCommandNames[0], + @path, @variable, + @complete_list, @selected_list, *hash_kv(@keys))) end alias display show diff --git a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb index d7a6c97210..c99f62f2dc 100644 --- a/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb +++ b/ext/tk/lib/tkextlib/tcllib/tablelist_core.rb @@ -4,7 +4,7 @@ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # # * Part of tcllib extension -# * This file is required by 'tkextlib/tcllib/tablelist.rb' or +# * This file is required by 'tkextlib/tcllib/tablelist.rb' or # 'tkextlib/tcllib/tablelist_tile.rb'. # @@ -54,7 +54,7 @@ module Tk::Tcllib::TablelistItemConfig elsif idx =~ /([^,]+),([^,]+)/ row = $1, column = $2 [num_or_str(row), num_or_str(column)] - else + else num_or_str(idx) end end @@ -144,7 +144,7 @@ class Tk::Tcllib::Tablelist def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -166,8 +166,8 @@ class Tk::Tcllib::Tablelist def __boolval_optkeys super() + [ - 'forceeditendcommand', 'movablecolumns', 'movablerows', - 'protecttitlecolumns', 'resizablecolumns', + 'forceeditendcommand', 'movablecolumns', 'movablerows', + 'protecttitlecolumns', 'resizablecolumns', 'showarrow', 'showlabels', 'showseparators' ] end @@ -194,7 +194,7 @@ class Tk::Tcllib::Tablelist # The method is used to convert a ruby's object to a opt-value. # When set the value of the option "key", "proc.call(value)" is called. # That is, "-#{key} #{proc.call(value)}". - super().update('stretch'=>proc{|v| + super().update('stretch'=>proc{|v| (v.kind_of?(Array))? v.collect{|e| _to_idx(e)}: v }) end @@ -218,7 +218,7 @@ class Tk::Tcllib::Tablelist def __item_boolval_optkeys(id) super(id) + [ - 'editable', 'hide', 'resizable', 'showarrow', 'stretchable', + 'editable', 'hide', 'resizable', 'showarrow', 'stretchable', ] end private :__item_boolval_optkeys @@ -249,7 +249,7 @@ class Tk::Tcllib::Tablelist tk_send('activatecell', _to_idx(index)) self end - alias activatecell activate_cell + alias activatecell activate_cell def get_attrib(name=nil) if name && name != None @@ -280,7 +280,7 @@ class Tk::Tcllib::Tablelist TkBindTag.new_by_name(tk_send('bodytag')) end - def cancel_editing + def cancel_editing tk_send('cancelediting') self end @@ -338,7 +338,7 @@ class Tk::Tcllib::Tablelist idx = _from_idx(tk_send('containingcell', x, y)) if idx.kind_of?(Array) [ - ((idx[0].kind_of?(Fixnum) && idx[0] < 0)? nil: idx[0]), + ((idx[0].kind_of?(Fixnum) && idx[0] < 0)? nil: idx[0]), ((idx[1].kind_of?(Fixnum) && idx[1] < 0)? nil: idx[1]) ] else @@ -698,7 +698,7 @@ class << Tk::Tcllib::Tablelist ############################################################ - # with the BWidget package + # with the BWidget package def addBWidgetEntry(name=None) Tk.tk_call('::tablelist::addBWidgetEntry', name) end @@ -713,7 +713,7 @@ class << Tk::Tcllib::Tablelist ############################################################ - # with the Iwidgets ([incr Widgets]) package + # with the Iwidgets ([incr Widgets]) package def addIncrEntryfield(name=None) Tk.tk_call('::tablelist::addIncrEntry', name) end diff --git a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb index b366e0198b..2f6e4b44fc 100644 --- a/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb +++ b/ext/tk/lib/tkextlib/tcllib/tkpiechart.rb @@ -52,7 +52,7 @@ module Tk::Tcllib::Tkpiechart private :__config_cmd def __configinfo_struct - {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, + {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, :default_value=>1, :current_value=>2} end private :__configinfo_struct @@ -63,7 +63,7 @@ module Tk::Tcllib::Tkpiechart private :__boolval_optkeys def __strval_optkeys - super() << 'bordercolor' << 'textbackground' << + super() << 'bordercolor' << 'textbackground' << 'widestvaluetext' << 'title' end private :__strval_optkeys @@ -90,7 +90,7 @@ module Tk::Tcllib::Tkpiechart def create_self(x, y, width, height, keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', 'pie', + @tag_key = tk_call_without_enc('::stooop::new', 'pie', @c, x, y, *hash_kv(keys, true)) else @tag_key = tk_call_without_enc('::stooop::new', 'pie', @c, x, y) @@ -148,7 +148,7 @@ module Tk::Tcllib::Tkpiechart end def selected_slices - tk_split_simplelist(tk_call_without_enc('pie::selectedSlices', + tk_split_simplelist(tk_call_without_enc('pie::selectedSlices', @tag_key)).collect{|slice| @slice_tbl[slice] || Slice.new(:no_create, self, slice) } @@ -212,7 +212,7 @@ module Tk::Tcllib::Tkpiechart end def size(share, disp=None) - tk_call_without_enc('pie::sizeSlice', + tk_call_without_enc('pie::sizeSlice', @pie.tag_key, @tag_key, share, disp) self end @@ -236,7 +236,7 @@ module Tk::Tcllib::Tkpiechart def create_self(keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler', + @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler', *hash_kv(keys, true)) else @tag_key = tk_call_without_enc('::stooop::new', 'pieBoxLabeler') @@ -268,8 +268,8 @@ module Tk::Tcllib::Tkpiechart def create_self(keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', - 'piePeripheralLabeler', + @tag_key = tk_call_without_enc('::stooop::new', + 'piePeripheralLabeler', *hash_kv(keys, true)) else @tag_key = tk_call_without_enc('::stooop::new', 'piePeripheralLabeler') @@ -296,11 +296,11 @@ module Tk::Tcllib::Tkpiechart def create_self(x, y, keys=None) if keys and keys != None - @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', - @c, x, y, width, height, + @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', + @c, x, y, width, height, *hash_kv(keys, true)) else - @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', + @tag_key = tk_call_without_enc('::stooop::new', 'canvasLabel', @c, x, y, width, height) end diff --git a/ext/tk/lib/tkextlib/tcllib/tooltip.rb b/ext/tk/lib/tkextlib/tcllib/tooltip.rb index 4301b39fd3..73b7df0c22 100644 --- a/ext/tk/lib/tkextlib/tcllib/tooltip.rb +++ b/ext/tk/lib/tkextlib/tcllib/tooltip.rb @@ -3,7 +3,7 @@ # by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) # # * Part of tcllib extension -# * Provides tooltips, a small text message that is displayed when the +# * Provides tooltips, a small text message that is displayed when the # mouse hovers over a widget. # diff --git a/ext/tk/lib/tkextlib/tclx/setup.rb b/ext/tk/lib/tkextlib/tclx/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tclx/setup.rb +++ b/ext/tk/lib/tkextlib/tclx/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tile.rb b/ext/tk/lib/tkextlib/tile.rb index 60ea012cc0..09cf49faa6 100644 --- a/ext/tk/lib/tkextlib/tile.rb +++ b/ext/tk/lib/tkextlib/tile.rb @@ -16,7 +16,7 @@ require 'tkextlib/tile/setup.rb' # TkPackage.require('tile', '0.4') # TkPackage.require('tile', '0.6') # TkPackage.require('tile', '0.7') -if Tk::TK_MAJOR_VERSION > 8 || +if Tk::TK_MAJOR_VERSION > 8 || (Tk::TK_MAJOR_VERSION == 8 && Tk::TK_MINOR_VERSION >= 5) TkPackage.require('tile') # for compatibility (version check of 'tile') verstr = TkPackage.require('Ttk') @@ -105,17 +105,17 @@ module Tk def self.__define_LoadImages_proc_for_compatibility__! # Ttk 8.5 (Tile 0.8) lost 'LoadImages' utility procedure. - # So, some old scripts doen't work, because those scripts use the - # procedure to define local styles. - # Of course, rewriting such Tcl/Tk scripts isn't difficult for - # Tcl/Tk users. However, it may be troublesome for Ruby/Tk users + # So, some old scripts doen't work, because those scripts use the + # procedure to define local styles. + # Of course, rewriting such Tcl/Tk scripts isn't difficult for + # Tcl/Tk users. However, it may be troublesome for Ruby/Tk users # who use such Tcl/Tk scripts as it is. - # This method may help Ruby/Tk users who don't want to modify old + # This method may help Ruby/Tk users who don't want to modify old # Tcl/Tk scripts for the latest version of Ttk (Tile) extension. - # This method defines a comaptible 'LoadImages' procedure on the - # Tcl/Tk interpreter working under Ruby/Tk. - # Please give attention to use this method. It may conflict with - # some definitions on Tcl/Tk scripts. + # This method defines a comaptible 'LoadImages' procedure on the + # Tcl/Tk interpreter working under Ruby/Tk. + # Please give attention to use this method. It may conflict with + # some definitions on Tcl/Tk scripts. klass_name = self.name proc_name = 'LoadImages' if Tk::Tile::USE_TTK_NAMESPACE @@ -140,7 +140,7 @@ module Tk next end TkNamespace.eval(ns){ - TkCore::INTERP.add_tk_procs(proc_name, 'imgdir {patterns {*.gif}}', + TkCore::INTERP.add_tk_procs(proc_name, 'imgdir {patterns {*.gif}}', <<-'EOS') foreach pattern $patterns { foreach file [glob -directory $imgdir $pattern] { @@ -166,7 +166,7 @@ module Tk pat ||= TkComm::None images = Hash[*TkComm.simplelist(Tk.tk_call(cmd, imgdir, pat))] images.keys.each{|k| - images[k] = TkPhotoImage.new(:imagename=>images[k], + images[k] = TkPhotoImage.new(:imagename=>images[k], :without_creating=>true) } else ## TILE_SPEC_VERSION_ID >= 8 @@ -181,7 +181,7 @@ module Tk Dir.glob(pat).each{|f| img = File.basename(f, '.*') unless TkComm.bool(Tk.info('exists', "images(#{img})")) - Tk.tk_call('set', "images(#{img})", + Tk.tk_call('set', "images(#{img})", Tk.tk_call('image', 'create', 'photo', '-file', f)) end } @@ -189,7 +189,7 @@ module Tk } images = Hash[*TkComm.simplelist(Tk.tk_call('array', 'get', 'images'))] images.keys.each{|k| - images[k] = TkPhotoImage.new(:imagename=>images[k], + images[k] = TkPhotoImage.new(:imagename=>images[k], :without_creating=>true) } end @@ -213,8 +213,8 @@ module Tk begin TkComm.simplelist(Tk.tk_call_without_enc(*cmd)) rescue - TkComm.simplelist(Tk.tk_call('lsearch', '-all', '-inline', - Tk::Tile::Style.theme_names, + TkComm.simplelist(Tk.tk_call('lsearch', '-all', '-inline', + Tk::Tile::Style.theme_names, glob_ptn)) end end @@ -264,8 +264,8 @@ module Tk Icon = 'TkIconFont' TkFont::SYSTEM_FONT_NAMES.add [ - 'TkDefaultFont', 'TkTextFont', 'TkHeadingFont', - 'TkCaptionFont', 'TkTooltipFont', 'TkFixedFont', + 'TkDefaultFont', 'TkTextFont', 'TkHeadingFont', + 'TkCaptionFont', 'TkTooltipFont', 'TkFixedFont', 'TkMenuFont', 'TkSmallCaptionFont', 'TkIconFont' ] end @@ -280,7 +280,7 @@ module Tk until lst.empty? if lst[0][0] == ?- k = lst.shift[1..-1] - children = lst.shift + children = lst.shift children = _style_layout(children) if children.kind_of?(Array) keys[k] = children else @@ -332,7 +332,7 @@ module Tk end alias tile_identify ttk_identify - # remove instate/state/identify method + # remove instate/state/identify method # to avoid the conflict with widget options if Tk.const_defined?(:USE_OBSOLETE_TILE_STATE_METHOD) && Tk::USE_OBSOLETE_TILE_STATE_METHOD alias instate ttk_instate diff --git a/ext/tk/lib/tkextlib/tile/setup.rb b/ext/tk/lib/tkextlib/tile/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tile/setup.rb +++ b/ext/tk/lib/tkextlib/tile/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb index ca7ee99c32..26d79d378b 100644 --- a/ext/tk/lib/tkextlib/tile/style.rb +++ b/ext/tk/lib/tkextlib/tile/style.rb @@ -21,16 +21,16 @@ class << Tk::Tile::Style TkCommandNames = ['style'.freeze].freeze # --- Tk::Tile::Style.__define_wrapper_proc_for_compatibility__! --- - # On Ttk (Tile) extension, 'style' command has imcompatible changes - # depend on the version of the extention. It requires modifying the - # Tcl/Tk scripts to define local styles. The rule for modification - # is a simple one. But, if users want to keep compatibility between - # versions of the extension, they will have to contrive to do that. + # On Ttk (Tile) extension, 'style' command has imcompatible changes + # depend on the version of the extention. It requires modifying the + # Tcl/Tk scripts to define local styles. The rule for modification + # is a simple one. But, if users want to keep compatibility between + # versions of the extension, they will have to contrive to do that. # It may be troublesome, especially for Ruby/Tk users. - # This method may help such work. This method make some definitions - # on the Tcl/Tk interpreter to work with different version of style - # command format. Please give attention to use this method. It may - # conflict with some definitions on Tcl/Tk scripts. + # This method may help such work. This method make some definitions + # on the Tcl/Tk interpreter to work with different version of style + # command format. Please give attention to use this method. It may + # conflict with some definitions on Tcl/Tk scripts. if Tk::Tile::TILE_SPEC_VERSION_ID < 7 def __define_wrapper_proc_for_compatibility__! __define_themes_and_setTheme_proc__! @@ -210,7 +210,7 @@ class << Tk::Tile::Style end def lookup(style, opt, state=None, fallback_value=None) - tk_call(TkCommandNames[0], 'lookup', style, + tk_call(TkCommandNames[0], 'lookup', style, '-' << opt.to_s, state, fallback_value) end @@ -253,7 +253,7 @@ class << Tk::Tile::Style # probably, command format is tile 0.8+ (Tcl/Tk8.5+) style if Tk::Tile::TILE_SPEC_VERSION_ID >= 8 if opts - tk_call(TkCommandNames[0], + tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec, opts) else tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec) @@ -262,7 +262,7 @@ class << Tk::Tile::Style fail ArgumentError, 'illegal arguments' if opts.key?('map') base = spec.shift opts['map'] = spec - tk_call(TkCommandNames[0], + tk_call(TkCommandNames[0], 'element', 'create', name, 'image', base, opts) end else @@ -271,7 +271,7 @@ class << Tk::Tile::Style spec = [spec, *(opts.delete('map'))] if opts.key?('map') end if opts - tk_call(TkCommandNames[0], + tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec, opts) else tk_call(TkCommandNames[0], 'element', 'create', name, 'image', spec) diff --git a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb index 172225fcec..ca79d89e58 100644 --- a/ext/tk/lib/tkextlib/tile/tcheckbutton.rb +++ b/ext/tk/lib/tkextlib/tile/tcheckbutton.rb @@ -15,7 +15,7 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Checkbutton, +Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Checkbutton, :TkCheckbutton, :TkCheckButton) diff --git a/ext/tk/lib/tkextlib/tile/tlabelframe.rb b/ext/tk/lib/tkextlib/tile/tlabelframe.rb index cff66d8658..9f4a11990c 100644 --- a/ext/tk/lib/tkextlib/tile/tlabelframe.rb +++ b/ext/tk/lib/tkextlib/tile/tlabelframe.rb @@ -15,7 +15,7 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Labelframe, +Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Labelframe, :TkLabelframe, :TkLabelFrame) diff --git a/ext/tk/lib/tkextlib/tile/tmenubutton.rb b/ext/tk/lib/tkextlib/tile/tmenubutton.rb index 7c6ab28e52..5612fb47eb 100644 --- a/ext/tk/lib/tkextlib/tile/tmenubutton.rb +++ b/ext/tk/lib/tkextlib/tile/tmenubutton.rb @@ -15,7 +15,7 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Menubutton, +Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Menubutton, :TkMenubutton, :TkMenuButton) diff --git a/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb index 4d65e363da..d02e05b211 100644 --- a/ext/tk/lib/tkextlib/tile/tnotebook.rb +++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb @@ -19,7 +19,7 @@ Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Notebook, :TkNotebook) class Tk::Tile::TNotebook < TkWindow ################################ include TkItemConfigMethod - + def __item_cget_cmd(id) [self.path, 'tab', id] end @@ -109,7 +109,7 @@ class Tk::Tile::TNotebook < TkWindow def forget(idx) tk_send('forget', idx) self - end + end def index(idx) number(tk_send('index', idx)) diff --git a/ext/tk/lib/tkextlib/tile/tpaned.rb b/ext/tk/lib/tkextlib/tile/tpaned.rb index d96ff43973..aff6cac4bb 100644 --- a/ext/tk/lib/tkextlib/tile/tpaned.rb +++ b/ext/tk/lib/tkextlib/tile/tpaned.rb @@ -13,7 +13,7 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Panedwindow, +Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Panedwindow, :TkPanedwindow, :TkPanedWindow) @@ -127,7 +127,7 @@ class Tk::Tile::TPaned < TkWindow end conf else - tk_split_simplelist(tk_send_without_enc('pane', + tk_split_simplelist(tk_send_without_enc('pane', win)).collect{|conflist| conf = tk_split_simplelist(conflist) conf[0] = conf[0][1..-1] @@ -135,18 +135,18 @@ class Tk::Tile::TPaned < TkWindow if conf[0] == 'hide' conf[3] = bool(conf[3]) unless conf[3].empty? elsif conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf[4] if conf[0] == 'hide' conf[4] = bool(conf[4]) unless conf[4].empty? elsif conf[4].index('{') - conf[4] = tk_split_list(conf[4]) + conf[4] = tk_split_list(conf[4]) else - conf[4] = tk_tcl2ruby(conf[4]) + conf[4] = tk_tcl2ruby(conf[4]) end end conf[1] = conf[1][1..-1] if conf.size == 2 # alias info @@ -165,7 +165,7 @@ class Tk::Tile::TPaned < TkWindow { key => conf } else ret = {} - tk_split_simplelist(tk_send_without_enc('pane', + tk_split_simplelist(tk_send_without_enc('pane', win)).each{|conflist| conf = tk_split_simplelist(conflist) key = conf.shift[1..-1] @@ -173,18 +173,18 @@ class Tk::Tile::TPaned < TkWindow if key == 'hide' conf[2] = bool(conf[2]) unless conf[2].empty? elsif conf[2].index('{') - conf[2] = tk_split_list(conf[2]) + conf[2] = tk_split_list(conf[2]) else - conf[2] = tk_tcl2ruby(conf[2]) + conf[2] = tk_tcl2ruby(conf[2]) end end if conf[3] if key == 'hide' conf[3] = bool(conf[3]) unless conf[3].empty? elsif conf[3].index('{') - conf[3] = tk_split_list(conf[3]) + conf[3] = tk_split_list(conf[3]) else - conf[3] = tk_tcl2ruby(conf[3]) + conf[3] = tk_tcl2ruby(conf[3]) end end if conf.size == 1 diff --git a/ext/tk/lib/tkextlib/tile/tradiobutton.rb b/ext/tk/lib/tkextlib/tile/tradiobutton.rb index d653a6d256..72e72170cb 100644 --- a/ext/tk/lib/tkextlib/tile/tradiobutton.rb +++ b/ext/tk/lib/tkextlib/tile/tradiobutton.rb @@ -15,7 +15,7 @@ module Tk end end -Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Radiobutton, +Tk.__set_toplevel_aliases__(:Ttk, Tk::Tile::Radiobutton, :TkRadiobutton, :TkRadioButton) diff --git a/ext/tk/lib/tkextlib/tile/treeview.rb b/ext/tk/lib/tkextlib/tile/treeview.rb index 566e48def3..2046be8a69 100644 --- a/ext/tk/lib/tkextlib/tile/treeview.rb +++ b/ext/tk/lib/tkextlib/tile/treeview.rb @@ -20,7 +20,7 @@ module Tk::Tile::TreeviewConfig def __item_configinfo_struct(id) # maybe need to override - {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, + {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, :default_value=>nil, :current_value=>1} end private :__item_configinfo_struct @@ -451,7 +451,7 @@ module Tk::Tile::TreeviewConfig def __item_val2ruby_optkeys(id) case id[0] when :item, 'item' - { + { 'tags'=>proc{|arg_id, val| simplelist(val).collect{|tag| Tk::Tile::Treeview::Tag.id2obj(self, tag) @@ -498,7 +498,7 @@ module Tk::Tile::TreeviewConfig end slot = conf[__item_configinfo_struct(tagid(tagOrId))[:alias]] end while(org_slot != slot) - fail RuntimeError, + fail RuntimeError, "there is a configure alias loop about '#{org_slot}'" else ret = {} @@ -707,7 +707,7 @@ class Tk::Tile::Treeview::Item < TkObject keys = _symbolkey2str(keys) id = keys.delete('id') if id - num_or_str(tk_call(tree, 'insert', + num_or_str(tk_call(tree, 'insert', parent_item, idx, '-id', id, *hash_kv(keys))) else num_or_str(tk_call(tree, 'insert', parent_item, idx, *hash_kv(keys))) @@ -1030,7 +1030,7 @@ class Tk::Tile::Treeview < TkWindow end def tagid(id) - if id.kind_of?(Tk::Tile::Treeview::Item) || + if id.kind_of?(Tk::Tile::Treeview::Item) || id.kind_of?(Tk::Tile::Treeview::Tag) id.id elsif id.kind_of?(Array) @@ -1055,7 +1055,7 @@ class Tk::Tile::Treeview < TkWindow } end def set_children(item, *items) - tk_send_without_enc('children', item, + tk_send_without_enc('children', item, array2tk_list(items.flatten, true)) self end diff --git a/ext/tk/lib/tkextlib/tkDND/setup.rb b/ext/tk/lib/tkextlib/tkDND/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tkDND/setup.rb +++ b/ext/tk/lib/tkextlib/tkDND/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb index 9a9b2dc42c..97cdfc7f1c 100644 --- a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb +++ b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb @@ -30,30 +30,30 @@ module Tk class DND_Subst < TkUtil::CallbackSubst KEY_TBL = [ - [ ?a, ?l, :actions ], - [ ?A, ?s, :action ], - [ ?b, ?L, :codes ], - [ ?c, ?s, :code ], - [ ?d, ?l, :descriptions ], - [ ?D, ?l, :data ], - [ ?L, ?l, :source_types ], - [ ?m, ?l, :modifiers ], - [ ?t, ?l, :types ], - [ ?T, ?s, :type ], - [ ?W, ?w, :widget ], - [ ?x, ?n, :x ], - [ ?X, ?n, :x_root ], - [ ?y, ?n, :y ], - [ ?Y, ?n, :y_root ], + [ ?a, ?l, :actions ], + [ ?A, ?s, :action ], + [ ?b, ?L, :codes ], + [ ?c, ?s, :code ], + [ ?d, ?l, :descriptions ], + [ ?D, ?l, :data ], + [ ?L, ?l, :source_types ], + [ ?m, ?l, :modifiers ], + [ ?t, ?l, :types ], + [ ?T, ?s, :type ], + [ ?W, ?w, :widget ], + [ ?x, ?n, :x ], + [ ?X, ?n, :x_root ], + [ ?y, ?n, :y ], + [ ?Y, ?n, :y_root ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?l, TkComm.method(:list) ], - [ ?L, TkComm.method(:simplelist) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?l, TkComm.method(:list) ], + [ ?L, TkComm.method(:simplelist) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -101,11 +101,11 @@ module Tk #def dnd_bindtarget(type, event, cmd=Proc.new, prior=50, *args) # event = tk_event_sequence(event) # if prior.kind_of?(Numeric) - # tk_call('dnd', 'bindtarget', @path, type, event, - # install_bind_for_event_class(DND_Subst, cmd, *args), + # tk_call('dnd', 'bindtarget', @path, type, event, + # install_bind_for_event_class(DND_Subst, cmd, *args), # prior) # else - # tk_call('dnd', 'bindtarget', @path, type, event, + # tk_call('dnd', 'bindtarget', @path, type, event, # install_bind_for_event_class(DND_Subst, cmd, prior, *args)) # end # self @@ -123,11 +123,11 @@ module Tk event = tk_event_sequence(event) if prior.kind_of?(Numeric) - tk_call('dnd', 'bindtarget', @path, type, event, - install_bind_for_event_class(DND_Subst, cmd, *args), + tk_call('dnd', 'bindtarget', @path, type, event, + install_bind_for_event_class(DND_Subst, cmd, *args), prior) else - tk_call('dnd', 'bindtarget', @path, type, event, + tk_call('dnd', 'bindtarget', @path, type, event, install_bind_for_event_class(DND_Subst, cmd, prior, *args)) end self diff --git a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb index d893a83cf2..522ebfb92c 100644 --- a/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb +++ b/ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb @@ -73,7 +73,7 @@ class Tk::HTML_Widget::ClippingWindow ppath = ppath2 end - + parent = TkComm._genobj_for_tkwidget(ppath) unless parent.kind_of?(Tk::HTML_Widget) fail ArgumentError, "parent must be a Tk::HTML_Widget instance" @@ -105,7 +105,7 @@ class Tk::HTML_Widget def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) diff --git a/ext/tk/lib/tkextlib/tkHTML/setup.rb b/ext/tk/lib/tkextlib/tkHTML/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tkHTML/setup.rb +++ b/ext/tk/lib/tkextlib/tkHTML/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tkimg/setup.rb b/ext/tk/lib/tkextlib/tkimg/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tkimg/setup.rb +++ b/ext/tk/lib/tkextlib/tkimg/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tktable/setup.rb b/ext/tk/lib/tkextlib/tktable/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tktable/setup.rb +++ b/ext/tk/lib/tkextlib/tktable/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/tktable/tktable.rb b/ext/tk/lib/tkextlib/tktable/tktable.rb index f6cf24b40f..12a2dd75bf 100644 --- a/ext/tk/lib/tkextlib/tktable/tktable.rb +++ b/ext/tk/lib/tkextlib/tktable/tktable.rb @@ -282,21 +282,21 @@ class Tk::TkTable class BrowseCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :column ], - [ ?C, ?s, :index ], - [ ?i, ?x, :cursor ], - [ ?r, ?n, :row ], - [ ?s, ?s, :last_index ], - [ ?S, ?s, :new_index ], - [ ?W, ?w, :widget ], + [ ?c, ?n, :column ], + [ ?C, ?s, :index ], + [ ?i, ?x, :cursor ], + [ ?r, ?n, :row ], + [ ?s, ?s, :last_index ], + [ ?S, ?s, :new_index ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?x, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:number) ], + [ ?x, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -333,21 +333,21 @@ class Tk::TkTable class CellCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :column ], - [ ?C, ?s, :index ], - [ ?i, ?m, :rw_mode ], - [ ?r, ?n, :row ], - [ ?s, ?v, :value ], - [ ?W, ?w, :widget ], + [ ?c, ?n, :column ], + [ ?C, ?s, :index ], + [ ?i, ?m, :rw_mode ], + [ ?r, ?n, :row ], + [ ?s, ?v, :value ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], - [ ?m, proc{|val| (val == '0')? (:r) : (:w)} ], - [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], + [ ?m, proc{|val| (val == '0')? (:r) : (:w)} ], + [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], nil ] @@ -384,19 +384,19 @@ class Tk::TkTable class SelectionCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :sel_columns ], - [ ?C, ?s, :sel_area ], - [ ?i, ?n, :total ], - [ ?r, ?n, :sel_rows ], - [ ?s, ?s, :value ], - [ ?W, ?w, :widget ], + [ ?c, ?n, :sel_columns ], + [ ?C, ?s, :sel_area ], + [ ?i, ?n, :total ], + [ ?r, ?n, :sel_rows ], + [ ?s, ?s, :value ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], nil ] @@ -433,22 +433,22 @@ class Tk::TkTable class ValidateCommand < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?c, ?n, :column ], - [ ?C, ?s, :index ], - [ ?i, ?x, :cursor ], - [ ?r, ?n, :row ], - [ ?s, ?v, :current_value ], - [ ?S, ?v, :new_value ], - [ ?W, ?w, :widget ], + [ ?c, ?n, :column ], + [ ?C, ?s, :index ], + [ ?i, ?x, :cursor ], + [ ?r, ?n, :row ], + [ ?s, ?v, :current_value ], + [ ?S, ?v, :new_value ], + [ ?W, ?w, :widget ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?x, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?w, TkComm.method(:window) ], - [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], + [ ?n, TkComm.method(:number) ], + [ ?x, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?w, TkComm.method(:window) ], + [ ?v, proc{|val| TkComm.tk_tcl2ruby(val, true, false)} ], nil ] @@ -481,7 +481,7 @@ class Tk::TkTable ################################# def __validation_class_list - super() << + super() << BrowseCommand << CellCommand << SelectionCommand << ValidateCommand end @@ -597,7 +597,7 @@ class Tk::TkTable def hidden_list simplelist(tk_send('hidden')) - end + end def hidden?(idx, *args) if args.empty? if (ret = tk_send('hidden', tagid(idx))) == '' @@ -701,7 +701,7 @@ class Tk::TkTable self end - def set(*pairs) # idx, val, idx, val, ... + def set(*pairs) # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -710,7 +710,7 @@ class Tk::TkTable tk_send('set', *args) self end - def set_row(*pairs) # idx, val, idx, val, ... + def set_row(*pairs) # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -719,7 +719,7 @@ class Tk::TkTable tk_send('set', 'row', *args) self end - def set_col(*pairs) # idx, val, idx, val, ... + def set_col(*pairs) # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -736,7 +736,7 @@ class Tk::TkTable pairs.each{|idx, val| args << tagid(idx) << val } tk_send('set', *args) else - # idx, val, idx, val, ... + # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -753,7 +753,7 @@ class Tk::TkTable pairs.each{|idx, val| args << tagid(idx) << val } tk_send('set', 'row', *args) else - # idx, val, idx, val, ... + # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -770,7 +770,7 @@ class Tk::TkTable pairs.each{|idx, val| args << idx << val } tk_send('set', 'col', *args) else - # idx, val, idx, val, ... + # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -798,7 +798,7 @@ class Tk::TkTable [idx [rows, cols]] end def set_spans(*pairs) - # idx, val, idx, val, ... + # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -827,7 +827,7 @@ class Tk::TkTable } tk_send('spans', *args) else - # idx, val, idx, val, ... + # idx, val, idx, val, ... args = [] 0.step(pairs.size-1, 2){|i| args << tagid(pairs[i]) @@ -894,9 +894,9 @@ class Tk::TkTable Tk::TkTable::CellTag::CellTagID_TBL.mutex.synchronize{ if Tk::TkTable::CellTag::CellTagID_TBL[@path] if tag.kind_of? Tk::TkTable::CellTag - Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag.id) + Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag.id) else - Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag) + Tk::TkTable::CellTag::CellTagID_TBL[@path].delete(tag) end end } diff --git a/ext/tk/lib/tkextlib/tktrans/setup.rb b/ext/tk/lib/tkextlib/tktrans/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/tktrans/setup.rb +++ b/ext/tk/lib/tkextlib/tktrans/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/treectrl/setup.rb b/ext/tk/lib/tkextlib/treectrl/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/treectrl/setup.rb +++ b/ext/tk/lib/tkextlib/treectrl/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb index e10e6e299e..0c3de94baa 100644 --- a/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb +++ b/ext/tk/lib/tkextlib/treectrl/tktreectrl.rb @@ -32,14 +32,14 @@ module Tk end end - HasColumnCreateCommand = + HasColumnCreateCommand = (TkPackage.vcompare(self.package_version, '1.1') >= 0) - # dummy :: - # pkgIndex.tcl of TreeCtrl-1.0 doesn't support auto_load for - # 'loupe' command (probably it is bug, I think). - # So, calling a 'treectrl' command for loading the dll with - # the auto_load facility. + # dummy :: + # pkgIndex.tcl of TreeCtrl-1.0 doesn't support auto_load for + # 'loupe' command (probably it is bug, I think). + # So, calling a 'treectrl' command for loading the dll with + # the auto_load facility. begin tk_call('treectrl') rescue @@ -48,7 +48,7 @@ module Tk # NOTE: platform == 'unix' only # img => TkPhotoImage - # x, y => screen coords + # x, y => screen coords # w, h => magnifier width and height # zoom => zooming rate Tk.tk_call_without_enc('loupe', img, x, y, w, h, zoom) @@ -76,28 +76,28 @@ end class Tk::TreeCtrl::NotifyEvent # [ <'%' subst-key char>, <proc type char>, <instance var (accessor) name>] KEY_TBL = [ - [ ?c, ?n, :item_num ], - [ ?d, ?s, :detail ], - [ ?D, ?l, :items ], - [ ?e, ?e, :event ], - [ ?I, ?n, :id ], - [ ?l, ?n, :lower_bound ], - [ ?p, ?n, :active_id ], - [ ?P, ?e, :pattern ], - [ ?S, ?l, :sel_items ], - [ ?T, ?w, :widget ], - [ ?u, ?n, :upper_bound ], - [ ?W, ?o, :object ], - [ ??, ?x, :parm_info ], + [ ?c, ?n, :item_num ], + [ ?d, ?s, :detail ], + [ ?D, ?l, :items ], + [ ?e, ?e, :event ], + [ ?I, ?n, :id ], + [ ?l, ?n, :lower_bound ], + [ ?p, ?n, :active_id ], + [ ?P, ?e, :pattern ], + [ ?S, ?l, :sel_items ], + [ ?T, ?w, :widget ], + [ ?u, ?n, :upper_bound ], + [ ?W, ?o, :object ], + [ ??, ?x, :parm_info ], nil ] # [ <proc type char>, <proc/method to convert tcl-str to ruby-obj>] PROC_TBL = [ - [ ?n, TkComm.method(:num_or_str) ], - [ ?s, TkComm.method(:string) ], - [ ?l, TkComm.method(:list) ], - [ ?w, TkComm.method(:window) ], + [ ?n, TkComm.method(:num_or_str) ], + [ ?s, TkComm.method(:string) ], + [ ?l, TkComm.method(:list) ], + [ ?w, TkComm.method(:window) ], [ ?e, proc{|val| case val @@ -109,9 +109,9 @@ class Tk::TreeCtrl::NotifyEvent val end } - ], + ], - [ ?o, proc{|val| TkComm.tk_tcl2ruby(val)} ], + [ ?o, proc{|val| TkComm.tk_tcl2ruby(val)} ], [ ?x, proc{|val| begin @@ -132,7 +132,7 @@ class Tk::TreeCtrl::NotifyEvent rescue val end - } ], + } ], nil ] @@ -157,15 +157,15 @@ class Tk::TreeCtrl::NotifyEvent # setup tables to be used by scan_args, _get_subst_key, _get_all_subst_keys # - # _get_subst_key() and _get_all_subst_keys() generates key-string - # which describe how to convert callback arguments to ruby objects. - # When binding parameters are given, use _get_subst_key(). - # But when no parameters are given, use _get_all_subst_keys() to - # create a Event class object as a callback parameter. + # _get_subst_key() and _get_all_subst_keys() generates key-string + # which describe how to convert callback arguments to ruby objects. + # When binding parameters are given, use _get_subst_key(). + # But when no parameters are given, use _get_all_subst_keys() to + # create a Event class object as a callback parameter. # - # scan_args() is used when doing callback. It convert arguments - # ( which are Tcl strings ) to ruby objects based on the key string - # that is generated by _get_subst_key() or _get_all_subst_keys(). + # scan_args() is used when doing callback. It convert arguments + # ( which are Tcl strings ) to ruby objects based on the key string + # that is generated by _get_subst_key() or _get_all_subst_keys(). # _setup_subst_table(KEY_TBL, PROC_TBL); end @@ -185,7 +185,7 @@ module Tk::TreeCtrl::ConfigMethod if (obj.kind_of?(Tk::TreeCtrl::Column) || obj.kind_of?(Tk::TreeCtrl::Element) || obj.kind_of?(Tk::TreeCtrl::Item) || - obj.kind_of?(Tk::TreeCtrl::Style)) + obj.kind_of?(Tk::TreeCtrl::Style)) obj = obj.id end @@ -236,7 +236,7 @@ module Tk::TreeCtrl::ConfigMethod def __item_cget_cmd(mixed_id) if mixed_id[0] == 'column' && mixed_id[1] == 'drag' return [self.path, 'column', 'dragcget'] - end + end if mixed_id[1].kind_of?(Array) id = mixed_id[1] @@ -255,7 +255,7 @@ module Tk::TreeCtrl::ConfigMethod def __item_config_cmd(mixed_id) if mixed_id[0] == 'column' && mixed_id[1] == 'drag' return [self.path, 'column', 'dragconfigure'] - end + end if mixed_id[1].kind_of?(Array) id = mixed_id[1] @@ -291,10 +291,10 @@ module Tk::TreeCtrl::ConfigMethod def __item_configinfo_struct(id) if id.kind_of?(Array) && id[0].to_s == 'notify' - {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, + {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil, :default_value=>nil, :current_value=>1} else - {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, + {:key=>0, :alias=>1, :db_name=>1, :db_class=>2, :default_value=>3, :current_value=>4} end end @@ -302,7 +302,7 @@ module Tk::TreeCtrl::ConfigMethod def __item_font_optkeys(id) - if id.kind_of?(Array) && (id[0] == 'element' || + if id.kind_of?(Array) && (id[0] == 'element' || (id[0].kind_of?(Array) && id[0][1] == 'element')) [] else @@ -335,7 +335,7 @@ module Tk::TreeCtrl::ConfigMethod if id[1] == 'drag' ['enable'] else - ['button', 'expand', 'resize', 'squeeze', 'sunken', + ['button', 'expand', 'resize', 'squeeze', 'sunken', 'visible', 'widthhack'] end when 'element' @@ -403,12 +403,12 @@ module Tk::TreeCtrl::ConfigMethod def __item_keyonly_optkeys(id) # { def_key=>(undef_key|nil), ... } { - 'notreally'=>nil, + 'notreally'=>nil, 'increasing'=>'decreasing', - 'decreasing'=>'increasing', + 'decreasing'=>'increasing', 'ascii'=>nil, - 'dictionary'=>nil, - 'integer'=>nil, + 'dictionary'=>nil, + 'integer'=>nil, 'real'=>nil } end @@ -629,8 +629,8 @@ class Tk::TreeCtrl def __boolval_optkeys [ - 'itemwidthequal', 'usetheme', - 'showbuttons', 'showheader', 'showlines', 'showroot', + 'itemwidthequal', 'usetheme', + 'showbuttons', 'showheader', 'showlines', 'showroot', 'showrootbutton', 'showrootlines', ] end @@ -651,7 +651,7 @@ class Tk::TreeCtrl def create_self(keys) if keys and keys != None - tk_call_without_enc(self.class::TkCommandNames[0], @path, + tk_call_without_enc(self.class::TkCommandNames[0], @path, *hash_kv(keys, true)) else tk_call_without_enc(self.class::TkCommandNames[0], @path) @@ -680,7 +680,7 @@ class Tk::TreeCtrl end def collapse_recurse(*dsc) - tk_send_without_enc('collapse', '-recurse', + tk_send_without_enc('collapse', '-recurse', *(dsc.map!{|d| _get_eval_string(d, true)})) self end @@ -931,7 +931,7 @@ class Tk::TreeCtrl end def item_collapse_recurse(item) - tk_send_without_enc('item', 'collapse', + tk_send_without_enc('item', 'collapse', _get_eval_string(item, true), '-recurse') self end @@ -941,8 +941,8 @@ class Tk::TreeCtrl end def item_complex(item, *args) - tk_send_without_enc('item', 'complex', - _get_eval_string(item, true), + tk_send_without_enc('item', 'complex', + _get_eval_string(item, true), *(args.map!{|arg| _get_eval_string(arg, true)})) self end @@ -1008,12 +1008,12 @@ class Tk::TreeCtrl def item_firstchild(parent, child=nil) if child - tk_send_without_enc('item', 'firstchild', - _get_eval_string(parent, true), + tk_send_without_enc('item', 'firstchild', + _get_eval_string(parent, true), _get_eval_string(child, true)) self else - id = num_or_str(tk_send_without_enc('item', 'firstchild', + id = num_or_str(tk_send_without_enc('item', 'firstchild', _get_eval_string(parent, true))) Tk::TreeCtrl::Item.id2obj(self, id) end @@ -1022,11 +1022,11 @@ class Tk::TreeCtrl def item_hasbutton(item, st=None) if st == None - bool(tk_send_without_enc('item', 'hasbutton', + bool(tk_send_without_enc('item', 'hasbutton', _get_eval_string(item, true))) else - tk_send_without_enc('item', 'hasbutton', - _get_eval_string(item, true), + tk_send_without_enc('item', 'hasbutton', + _get_eval_string(item, true), _get_eval_string(st)) self end @@ -1086,12 +1086,12 @@ class Tk::TreeCtrl def item_lastchild(parent, child=nil) if child - tk_send_without_enc('item', 'lastchild', + tk_send_without_enc('item', 'lastchild', _get_eval_string(parent, true), _get_eval_string(child, true)) self else - id = num_or_str(tk_send_without_enc('item', 'lastchild', + id = num_or_str(tk_send_without_enc('item', 'lastchild', _get_eval_string(parent, true))) Tk::TreeCtrl::Item.id2obj(self, id) end @@ -1110,7 +1110,7 @@ class Tk::TreeCtrl alias item_next_sibling item_nextsibling def item_numchildren(item) - number(tk_send_without_enc('item', 'numchildren', + number(tk_send_without_enc('item', 'numchildren', _get_eval_string(item, true))) end alias item_num_children item_numchildren @@ -1271,20 +1271,20 @@ class Tk::TreeCtrl def item_style_set(item, column=nil, *args) if args.empty? if column - id = tk_send_without_enc('item', 'style', 'set', - _get_eval_string(item, true), + id = tk_send_without_enc('item', 'style', 'set', + _get_eval_string(item, true), _get_eval_string(column, true)) Tk::TreeCtrl::Style.id2obj(self, id) else - list(tk_send_without_enc('item', 'style', 'set', + list(tk_send_without_enc('item', 'style', 'set', _get_eval_string(item, true))).collect!{|id| Tk::TreeCtrl::Style.id2obj(self, id) } end else - tk_send_without_enc('item', 'style', 'set', - _get_eval_string(item, true), - _get_eval_string(column, true), + tk_send_without_enc('item', 'style', 'set', + _get_eval_string(item, true), + _get_eval_string(column, true), *(args.flatten.map!{|arg| _get_eval_string(arg, true) })) @@ -1640,8 +1640,8 @@ class Tk::TreeCtrl tk_send('style', 'layout', style, elem, *hash_kv(keys)) self else - _conv_style_layout_val(keys, - tk_send('style', 'layout', + _conv_style_layout_val(keys, + tk_send('style', 'layout', style, elem, "-#{keys}")) end else @@ -1717,7 +1717,7 @@ class Tk::TreeCtrl::Column < TkObject keys = _symbolkey2str(keys) Tk::TreeCtrl::Column::TreeCtrlColumnID.mutex.synchronize{ - @path = @id = + @path = @id = keys.delete('tag') || Tk::TreeCtrl::Column::TreeCtrlColumnID.join(TkCore::INTERP._ip_id_) Tk::TreeCtrl::Column::TreeCtrlColumnID[1].succ! @@ -1726,7 +1726,7 @@ class Tk::TreeCtrl::Column < TkObject keys['tag'] = @id Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL.mutex.synchronize{ - Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[@tpath] ||= {} + Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[@tpath] ||= {} Tk::TreeCtrl::Column::TreeCtrlColumnID_TBL[@tpath][@id] = self } @@ -1823,13 +1823,13 @@ class Tk::TreeCtrl::Element < TkObject @tpath = parent.path @type = type.to_s Tk::TreeCtrl::Element::TreeCtrlElementID.mutex.synchronize{ - @path = @id = + @path = @id = Tk::TreeCtrl::Element::TreeCtrlElementID.join(TkCore::INTERP._ip_id_) Tk::TreeCtrl::Element::TreeCtrlElementID[1].succ! } Tk::TreeCtrl::Element::TreeCtrlElementID_TBL.mutex.synchronize{ - Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[@tpath] ||= {} + Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[@tpath] ||= {} Tk::TreeCtrl::Element::TreeCtrlElementID_TBL[@tpath][@id] = self } @@ -1938,7 +1938,7 @@ class Tk::TreeCtrl::Item < TkObject @path = @id = @tree.item_create(keys) Tk::TreeCtrl::Item::TreeCtrlItemID_TBL.mutex.synchronize{ - Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath] ||= {} + Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath] ||= {} Tk::TreeCtrl::Item::TreeCtrlItemID_TBL[@tpath][@id] = self } end @@ -2247,13 +2247,13 @@ class Tk::TreeCtrl::Style < TkObject @tpath = parent.path Tk::TreeCtrl::Style::TreeCtrlStyleID.mutex.synchronize{ - @path = @id = + @path = @id = Tk::TreeCtrl::Style::TreeCtrlStyleID.join(TkCore::INTERP._ip_id_) Tk::TreeCtrl::Style::TreeCtrlStyleID[1].succ! } Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL.mutex.synchronize{ - Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[@tpath] ||= {} + Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[@tpath] ||= {} Tk::TreeCtrl::Style::TreeCtrlStyleID_TBL[@tpath][@id] = self } diff --git a/ext/tk/lib/tkextlib/trofs/setup.rb b/ext/tk/lib/tkextlib/trofs/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/trofs/setup.rb +++ b/ext/tk/lib/tkextlib/trofs/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/vu/bargraph.rb b/ext/tk/lib/tkextlib/vu/bargraph.rb index 27ff3c7cd0..1bcafc2887 100644 --- a/ext/tk/lib/tkextlib/vu/bargraph.rb +++ b/ext/tk/lib/tkextlib/vu/bargraph.rb @@ -30,10 +30,10 @@ class Tk::Vu::Bargraph < TkWindow def __strval_optkeys super() + [ - 'title', - 'barbackground', 'barcolor', 'barcolour', - 'tickcolor', 'tickcolour', - 'textcolor', 'textcolour', + 'title', + 'barbackground', 'barcolor', 'barcolour', + 'tickcolor', 'tickcolour', + 'textcolor', 'textcolour', ] end private :__strval_optkeys diff --git a/ext/tk/lib/tkextlib/vu/charts.rb b/ext/tk/lib/tkextlib/vu/charts.rb index ee4298fa1c..8569ac5541 100644 --- a/ext/tk/lib/tkextlib/vu/charts.rb +++ b/ext/tk/lib/tkextlib/vu/charts.rb @@ -18,7 +18,7 @@ module Tk private :__item_boolval_optkeys def __item_strval_optkeys(id) - super(id) << 'bar' << 'color' << 'outline' << + super(id) << 'bar' << 'color' << 'outline' << 'fill' << 'scaleline' << 'stripline' end private :__item_strval_optkeys diff --git a/ext/tk/lib/tkextlib/vu/setup.rb b/ext/tk/lib/tkextlib/vu/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/vu/setup.rb +++ b/ext/tk/lib/tkextlib/vu/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/vu/spinbox.rb b/ext/tk/lib/tkextlib/vu/spinbox.rb index a7e40ea319..7d6104f4d1 100644 --- a/ext/tk/lib/tkextlib/vu/spinbox.rb +++ b/ext/tk/lib/tkextlib/vu/spinbox.rb @@ -7,7 +7,7 @@ # require 'tk' -if (Tk::TK_MAJOR_VERSION < 8 || +if (Tk::TK_MAJOR_VERSION < 8 || (Tk::TK_MAJOR_VERSION == 8 && Tk::TK_MINOR_VERSION < 4)) # call setup script -- <libdir>/tkextlib/vu.rb require 'tkextlib/vu.rb' diff --git a/ext/tk/lib/tkextlib/winico/setup.rb b/ext/tk/lib/tkextlib/winico/setup.rb index ce0f0bd4d4..ee406c6ca0 100644 --- a/ext/tk/lib/tkextlib/winico/setup.rb +++ b/ext/tk/lib/tkextlib/winico/setup.rb @@ -2,7 +2,7 @@ # setup.rb -- setup script before calling TkPackage.require() # # If you need some setup operations (for example, add a library path -# to the library search path) before using Tcl/Tk library packages -# wrapped by Ruby scripts in this directory, please write the setup +# to the library search path) before using Tcl/Tk library packages +# wrapped by Ruby scripts in this directory, please write the setup # operations in this file. # diff --git a/ext/tk/lib/tkextlib/winico/winico.rb b/ext/tk/lib/tkextlib/winico/winico.rb index 00316fd441..9160c2960f 100644 --- a/ext/tk/lib/tkextlib/winico/winico.rb +++ b/ext/tk/lib/tkextlib/winico/winico.rb @@ -46,7 +46,7 @@ class Tk::Winico end def self.info - simplelist(Tk.tk_call('winico', 'info')).collect{|id| + simplelist(Tk.tk_call('winico', 'info')).collect{|id| Tk::Winico.id2obj(id) } end @@ -82,7 +82,7 @@ class Tk::Winico elsif winico_id @id = winico_id else - fail ArgumentError, + fail ArgumentError, "must be given proper information from where loading icons" end @path = @id @@ -96,7 +96,7 @@ class Tk::Winico end def set_window(win_id, *opts) # opts := ?'big'|'small'?, ?pos? - # NOTE:: the window, which is denoted by win_id, MUST BE MAPPED. + # NOTE:: the window, which is denoted by win_id, MUST BE MAPPED. # If not, then this may fail or crash. tk_call('winico', 'setwindow', win_id, @id, *opts) end @@ -119,22 +119,22 @@ class Tk::Winico class Winico_callback < TkValidateCommand class ValidateArgs < TkUtil::CallbackSubst KEY_TBL = [ - [ ?m, ?s, :message ], - [ ?i, ?x, :icon ], - [ ?x, ?n, :x ], - [ ?y, ?n, :y ], - [ ?X, ?n, :last_x ], - [ ?Y, ?n, :last_y ], - [ ?t, ?n, :tickcount ], - [ ?w, ?n, :icon_idnum ], - [ ?l, ?n, :msg_idnum ], + [ ?m, ?s, :message ], + [ ?i, ?x, :icon ], + [ ?x, ?n, :x ], + [ ?y, ?n, :y ], + [ ?X, ?n, :last_x ], + [ ?Y, ?n, :last_y ], + [ ?t, ?n, :tickcount ], + [ ?w, ?n, :icon_idnum ], + [ ?l, ?n, :msg_idnum ], nil ] PROC_TBL = [ - [ ?n, TkComm.method(:number) ], - [ ?s, TkComm.method(:string) ], - [ ?x, proc{|id| + [ ?n, TkComm.method(:number) ], + [ ?s, TkComm.method(:string) ], + [ ?x, proc{|id| Tk::Winico::WinicoID_TBL.mutex.synchronize{ if Tk::Winico::WinicoID_TBL.key?(id) obj = Tk::Winico::WinicoID_TBL[id] @@ -146,7 +146,7 @@ class Tk::Winico end obj } - } ], + } ], nil ] diff --git a/ext/tk/sample/24hr_clock.rb b/ext/tk/sample/24hr_clock.rb index 60d8072c57..29f84e0b40 100644 --- a/ext/tk/sample/24hr_clock.rb +++ b/ext/tk/sample/24hr_clock.rb @@ -19,7 +19,7 @@ class Clock @mark_color = 'black' @submark_color = 'gray50' - @c = TkCanvas.new(:width=>2*@size, :height=>2*@size, + @c = TkCanvas.new(:width=>2*@size, :height=>2*@size, :scrollregion=>[-@size, -@size, @size, @size] ).pack(:fill=>:both, :expand=>true) @@ -59,26 +59,26 @@ class Clock def _create_marks @mark_tag = TkcTag.new(@c) - TkcLine.new(@c, 0, -0.90*@size, 0, -0.85*@size, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, 0, -0.90*@size, 0, -0.85*@size, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, 0.90*@size, 0, 0.85*@size, 0, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, 0.90*@size, 0, 0.85*@size, 0, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, 0, 0.90*@size, 0, 0.85*@size, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, 0, 0.90*@size, 0, 0.85*@size, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, -0.90*@size, 0, -0.85*@size, 0, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, -0.90*@size, 0, -0.85*@size, 0, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcText.new(@c, [0, -0.92*@size], :text=>0, + TkcText.new(@c, [0, -0.92*@size], :text=>0, :anchor=>'s', :fill=>@mark_color) - TkcText.new(@c, [0.92*@size, 0], :text=>@clock.div(4), + TkcText.new(@c, [0.92*@size, 0], :text=>@clock.div(4), :anchor=>'w', :fill=>@mark_color) - TkcText.new(@c, [0, 0.92*@size], :text=>@clock.div(2), + TkcText.new(@c, [0, 0.92*@size], :text=>@clock.div(2), :anchor=>'n', :fill=>@mark_color) - TkcText.new(@c, [-0.92*@size, 0], :text=>@clock.div(4)*3, + TkcText.new(@c, [-0.92*@size, 0], :text=>@clock.div(4)*3, :anchor=>'e', :fill=>@mark_color) [30.0, 60.0].each{|angle| @@ -92,17 +92,17 @@ class Clock x2 = 0.85*x_base y2 = 0.85*y_base - TkcLine.new(@c, x1, y1, x2, y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, x1, y1, x2, y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, x1, -y1, x2, -y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, x1, -y1, x2, -y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, -x1, y1, -x2, y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, -x1, y1, -x2, y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) - TkcLine.new(@c, -x1, -y1, -x2, -y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, -x1, -y1, -x2, -y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@mark_color) x3 = 0.92*x_base @@ -114,13 +114,13 @@ class Clock dh = angle.to_i/30 end - TkcText.new(@c, x3, -y3, :text=>dh, + TkcText.new(@c, x3, -y3, :text=>dh, :anchor=>'sw', :fill=>@mark_color) - TkcText.new(@c, x3, y3, :text=>@clock.div(2)-dh, + TkcText.new(@c, x3, y3, :text=>@clock.div(2)-dh, :anchor=>'nw', :fill=>@mark_color) - TkcText.new(@c, -x3, y3, :text=>@clock.div(2)+dh, + TkcText.new(@c, -x3, y3, :text=>@clock.div(2)+dh, :anchor=>'ne', :fill=>@mark_color) - TkcText.new(@c, -x3, -y3, :text=>@clock-dh, + TkcText.new(@c, -x3, -y3, :text=>@clock-dh, :anchor=>'se', :fill=>@mark_color) } @@ -136,17 +136,17 @@ class Clock x2 = 0.875*x_base y2 = 0.875*y_base - TkcLine.new(@c, x1, y1, x2, y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, x1, y1, x2, y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@submark_color) - TkcLine.new(@c, x1, -y1, x2, -y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, x1, -y1, x2, -y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@submark_color) - TkcLine.new(@c, -x1, y1, -x2, y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, -x1, y1, -x2, y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@submark_color) - TkcLine.new(@c, -x1, -y1, -x2, -y2, - :tags=>[@tag, @mark_tag], + TkcLine.new(@c, -x1, -y1, -x2, -y2, + :tags=>[@tag, @mark_tag], :width=>@mark_width, :fill=>@submark_color) } end @@ -162,48 +162,48 @@ class Clock second_hand_width = 1 # 0.4*@cdot_size @hour_hand_coords = [ - [0, -0.5*@cdot_size], - [hour_hand_width, -0.5*@cdot_size-hour_hand_width], - [hour_hand_width, -hour_hand_len+hour_hand_width], - [0, -hour_hand_len], - [-hour_hand_width, -hour_hand_len+hour_hand_width], - [-hour_hand_width, -0.5*@cdot_size-hour_hand_width], + [0, -0.5*@cdot_size], + [hour_hand_width, -0.5*@cdot_size-hour_hand_width], + [hour_hand_width, -hour_hand_len+hour_hand_width], + [0, -hour_hand_len], + [-hour_hand_width, -hour_hand_len+hour_hand_width], + [-hour_hand_width, -0.5*@cdot_size-hour_hand_width], ] @minute_hand_coords = [ - [0, -0.5*@cdot_size], - [minute_hand_width, -0.5*@cdot_size - minute_hand_width], - [minute_hand_width, -minute_hand_len+minute_hand_width], - [0, -minute_hand_len], - [-minute_hand_width, -minute_hand_len+minute_hand_width], - [-minute_hand_width, -0.5*@cdot_size-minute_hand_width], + [0, -0.5*@cdot_size], + [minute_hand_width, -0.5*@cdot_size - minute_hand_width], + [minute_hand_width, -minute_hand_len+minute_hand_width], + [0, -minute_hand_len], + [-minute_hand_width, -minute_hand_len+minute_hand_width], + [-minute_hand_width, -0.5*@cdot_size-minute_hand_width], ] @second_hand_coords = [ - [0, -0.5*@cdot_size], - [second_hand_width, -0.5*@cdot_size - second_hand_width], - [second_hand_width, -second_hand_len+second_hand_width], - [0, -second_hand_len], - [-second_hand_width, -second_hand_len+second_hand_width], - [-second_hand_width, -0.5*@cdot_size-second_hand_width], + [0, -0.5*@cdot_size], + [second_hand_width, -0.5*@cdot_size - second_hand_width], + [second_hand_width, -second_hand_len+second_hand_width], + [0, -second_hand_len], + [-second_hand_width, -second_hand_len+second_hand_width], + [-second_hand_width, -0.5*@cdot_size-second_hand_width], ] - @hour_hand = TkcPolygon.new(@c, @hour_hand_coords, - :tags=>[@tag, @hand_tag], - :outline=>@hour_hand_color, + @hour_hand = TkcPolygon.new(@c, @hour_hand_coords, + :tags=>[@tag, @hand_tag], + :outline=>@hour_hand_color, :fill=>@hour_hand_color) - @minute_hand = TkcPolygon.new(@c, @minute_hand_coords, - :tags=>[@tag, @hand_tag], - :outline=>@minute_hand_color, + @minute_hand = TkcPolygon.new(@c, @minute_hand_coords, + :tags=>[@tag, @hand_tag], + :outline=>@minute_hand_color, :fill=>@minute_hand_color) - @second_hand = TkcPolygon.new(@c, @second_hand_coords, - :tags=>[@tag, @hand_tag], - :outline=>@second_hand_color, + @second_hand = TkcPolygon.new(@c, @second_hand_coords, + :tags=>[@tag, @hand_tag], + :outline=>@second_hand_color, :fill=>@second_hand_color) - @center_dot = TkcOval.new(@c, - [-@cdot_size, -@cdot_size], - [@cdot_size, @cdot_size], + @center_dot = TkcOval.new(@c, + [-@cdot_size, -@cdot_size], + [@cdot_size, @cdot_size], :outline=>@cdot_color, :fill=>@cdot_color) end private :_create_hands @@ -269,8 +269,8 @@ class Clock extent = -span/2.0 end - pie = TkcArc.new(@c, @circle_coords, :tags=>[@tag], - :outline=>'black', 'fill'=>color, + pie = TkcArc.new(@c, @circle_coords, :tags=>[@tag], + :outline=>'black', 'fill'=>color, :start=>start, :extent=>extent) _raise_hands _raise_marks diff --git a/ext/tk/sample/binding_sample.rb b/ext/tk/sample/binding_sample.rb index 693cc7de2f..3c2eb5e1cb 100644 --- a/ext/tk/sample/binding_sample.rb +++ b/ext/tk/sample/binding_sample.rb @@ -43,7 +43,7 @@ class Button_clone < TkLabel def invoke if @command - @command.call + @command.call else '' end @@ -53,7 +53,7 @@ end TkLabel.new(:text=><<EOT).pack This is a sample of 'event binding'. The first button is a normal button widget. -And the second one is a normal label widget +And the second one is a normal label widget but with some bindings like a button widget. EOT @@ -66,7 +66,7 @@ TkFrame.new{|f| TkLabel.new(f, :textvariable=>v).pack(:side=>:left) }.pack -TkButton.new(:text=>'normal Button widget', +TkButton.new(:text=>'normal Button widget', :command=>proc{ puts 'button is clicked!!' lbl.text 'button is clicked!!' @@ -75,7 +75,7 @@ TkButton.new(:text=>'normal Button widget', pack(:fill=>:x, :expand=>true) } -Button_clone.new(:text=>'Label with Button binding', +Button_clone.new(:text=>'Label with Button binding', :command=>proc{ puts 'label is clicked!!' lbl.text 'label is clicked!!' diff --git a/ext/tk/sample/bindtag_sample.rb b/ext/tk/sample/bindtag_sample.rb index 8c93b4a260..b13364bb68 100644 --- a/ext/tk/sample/bindtag_sample.rb +++ b/ext/tk/sample/bindtag_sample.rb @@ -2,18 +2,18 @@ require 'tk' TkLabel.new(:text=><<EOT, :justify=>:left).pack -This is a sample of bindtags and usage of -Tk.callback_break/Tk.callback_continue. -Please check the work of following buttons -(attend the difference between before/after - pressing the bottom button), and see the +This is a sample of bindtags and usage of +Tk.callback_break/Tk.callback_continue. +Please check the work of following buttons +(attend the difference between before/after + pressing the bottom button), and see the source code. EOT def set_class_bind - TkButton.bind('ButtonPress-1', + TkButton.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of TkButton class'}) - TkButton.bind('ButtonRelease-1', + TkButton.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of TkButton class'}) end @@ -23,21 +23,21 @@ r.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of root widget'}) r.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of root widget'}) # set 'all' binding -TkBindTag::ALL.bind('ButtonPress-1', +TkBindTag::ALL.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of the tag "all"'}) -TkBindTag::ALL.bind('ButtonRelease-1', +TkBindTag::ALL.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of the tag "all"'}) # create buttons -b1 = TkButton.new(:text=>'button-1', +b1 = TkButton.new(:text=>'button-1', :command=>proc{puts "command of button-1"}).pack -b2 = TkButton.new(:text=>'button-2', +b2 = TkButton.new(:text=>'button-2', :command=>proc{puts "command of button-2"}).pack -b3 = TkButton.new(:text=>'button-3', +b3 = TkButton.new(:text=>'button-3', :command=>proc{puts "command of button-3"}).pack -b4 = TkButton.new(:text=>'button-4', +b4 = TkButton.new(:text=>'button-4', :command=>proc{puts "command of button-4"}).pack -b5 = TkButton.new(:text=>'button-5', +b5 = TkButton.new(:text=>'button-5', :command=>proc{puts "command of button-5"}).pack # set button binding @@ -62,14 +62,14 @@ tag1.bind('ButtonPress-1', proc{puts 'bind "ButtonPress-1" of tag1'}) tag1.bind('ButtonRelease-1', proc{puts 'bind "ButtonRelease-1" of tag1'}) tag2 = TkBindTag.new -tag2.bind('ButtonPress-1', +tag2.bind('ButtonPress-1', proc{ puts 'bind "ButtonPress-1" of tag2' puts 'call Tk.callback_continue' Tk.callback_continue puts 'never see this message' }) -tag2.bind('ButtonRelease-1', +tag2.bind('ButtonRelease-1', proc{ puts 'bind "ButtonRelease-1" of tag2' puts 'call Tk.callback_continue' @@ -78,14 +78,14 @@ tag2.bind('ButtonRelease-1', }) tag3 = TkBindTag.new -tag3.bind('ButtonPress-1', +tag3.bind('ButtonPress-1', proc{ puts 'bind "ButtonPress-1" of tag3' puts 'call Tk.callback_break' Tk.callback_break puts 'never see this message' }) -tag3.bind('ButtonRelease-1', +tag3.bind('ButtonRelease-1', proc{ puts 'bind "ButtonRelease-1" of tag3' puts 'call Tk.callback_break' @@ -117,7 +117,7 @@ p b4.bindtags b5.bindtags([tag1, TkButton, tag2, b5]) # create button to set button class binding -TkButton.new(:text=>'set binding to TkButton class', +TkButton.new(:text=>'set binding to TkButton class', :command=>proc{ puts 'call "set_class_bind"' set_class_bind diff --git a/ext/tk/sample/binstr_usage.rb b/ext/tk/sample/binstr_usage.rb index be8399ba51..fa81f98b5e 100644 --- a/ext/tk/sample/binstr_usage.rb +++ b/ext/tk/sample/binstr_usage.rb @@ -13,7 +13,7 @@ However, when treats a binary sequence, the convert process makes troubles. Tk::BinaryString class (subclass of Tk::EncodedString class) is the class \ to avoid such troubles. Please see the source code of this sample. \ -A Tk::BinaryString instance is used to create the image for the center button. +A Tk::BinaryString instance is used to create the image for the center button. EOM ImgFile=[File.dirname(__FILE__), 'images','tcllogo.gif'].join(File::Separator) diff --git a/ext/tk/sample/cd_timer.rb b/ext/tk/sample/cd_timer.rb index 9154e89bfe..e2611fbf23 100644 --- a/ext/tk/sample/cd_timer.rb +++ b/ext/tk/sample/cd_timer.rb @@ -7,23 +7,23 @@ require 'tk' if ARGV.empty? - $stderr.puts 'Error:: No time arguments for counting down' + $stderr.puts 'Error:: No time arguments for counting down' exit(1) end width = 10 -TkButton.new(:text=>'exit', +TkButton.new(:text=>'exit', :command=>proc{exit}).pack(:side=>:bottom, :fill=>:x) b = TkButton.new(:text=>'start').pack(:side=>:top, :fill=>:x) f = TkFrame.new(:relief=>:ridge, :borderwidth=>2).pack(:fill=>:x) -TkLabel.new(f, :relief=>:flat, :pady=>3, - :background=>'black', :foreground=>'white', +TkLabel.new(f, :relief=>:flat, :pady=>3, + :background=>'black', :foreground=>'white', :text=>' elapsed: ').pack(:fill=>:x, :side=>:left, :expand=>true) -now = TkLabel.new(f, :width=>width, :relief=>:flat, :pady=>3, :anchor=>:w, - :background=>'black', :foreground=>'white', +now = TkLabel.new(f, :width=>width, :relief=>:flat, :pady=>3, :anchor=>:w, + :background=>'black', :foreground=>'white', :text=>'%4d:%02d.00' % [0, 0]).pack(:side=>:right) timers = [ TkRTTimer.new(10){|tm| @@ -41,9 +41,9 @@ timers = [ TkRTTimer.new(10){|tm| ARGV.collect{|arg| (Float(arg) * 60).to_i}.sort.each_with_index{|time, idx| f = TkFrame.new(:relief=>:ridge, :borderwidth=>2).pack(:fill=>:x) - TkLabel.new(f, :relief=>:flat, :pady=>3, + TkLabel.new(f, :relief=>:flat, :pady=>3, :text=>' %4d:%02d --> ' % (time.divmod(60))).pack(:side=>:left) - l = TkLabel.new(f, :width=>width, :relief=>:flat, :pady=>3, :anchor=>:w, + l = TkLabel.new(f, :width=>width, :relief=>:flat, :pady=>3, :anchor=>:w, :text=>'%4d:%02d' % (time.divmod(60))).pack(:side=>:right) timers << TkRTTimer.new(1000){|tm| t = (tm.return_value || time) - 1 diff --git a/ext/tk/sample/cmd_res_test.rb b/ext/tk/sample/cmd_res_test.rb index 6e954f26ee..8df2e61af7 100644 --- a/ext/tk/sample/cmd_res_test.rb +++ b/ext/tk/sample/cmd_res_test.rb @@ -1,5 +1,5 @@ require 'tk' -TkOptionDB.readfile(File.expand_path('cmd_resource', +TkOptionDB.readfile(File.expand_path('cmd_resource', File.dirname(__FILE__))) f = TkFrame.new(:class=>'BtnFrame').pack b = TkButton.new(:parent=>f, :widgetname=>'hello').pack diff --git a/ext/tk/sample/demos-en/anilabel.rb b/ext/tk/sample/demos-en/anilabel.rb index 0b9bc7357e..ebd84accd2 100644 --- a/ext/tk/sample/demos-en/anilabel.rb +++ b/ext/tk/sample/demos-en/anilabel.rb @@ -4,7 +4,7 @@ # based on Tcl/Tk8.5a2 widget demos if defined?($anilabel_demo) && $anilabel_demo - $anilabel_demo.destroy + $anilabel_demo.destroy $anilabel_demo = nil end @@ -47,7 +47,7 @@ TkFrame.new(base_frame) {|frame| # create frame for label demo f_left = TkLabelFrame.new(base_frame, :text=>'Scrolling Texts') f_right = TkLabelFrame.new(base_frame, :text=>'GIF Image') -Tk.pack(f_left, f_right, 'side'=>'left', 'expand'=>'yes', 'fill'=>'both', +Tk.pack(f_left, f_right, 'side'=>'left', 'expand'=>'yes', 'fill'=>'both', 'padx'=>10, 'pady'=>10) # animated label @@ -85,7 +85,7 @@ class AnimatedImageLabel < AnimatedTextLabel @btag.bind_append('Destroy'){ if @destroy_image begin - self.image.delete + self.image.delete rescue end end @@ -121,13 +121,13 @@ class AnimatedImageLabel < AnimatedTextLabel end # create labels -l1 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:ridge, +l1 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:ridge, :font=>{:family=>'Courier', :size=>10}) -l2 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:groove, +l2 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:groove, :font=>{:family=>'Courier', :size=>10}) -l3 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:flat, +l3 = AnimatedTextLabel.new(f_left, :borderwidth=>4, :relief=>:flat, :font=>{:family=>'Courier', :size=>10}, :width=>18) -Tk.pack(l1, l2, l3, +Tk.pack(l1, l2, l3, :side=>:top, :expand=>true, :anchor=>:w, :padx=>10, :pady=>10) limg = AnimatedImageLabel.new(f_right, :borderwidth=>0) diff --git a/ext/tk/sample/demos-en/aniwave.rb b/ext/tk/sample/demos-en/aniwave.rb index 63a04a7b98..57d58193f6 100644 --- a/ext/tk/sample/demos-en/aniwave.rb +++ b/ext/tk/sample/demos-en/aniwave.rb @@ -5,7 +5,7 @@ # destroy toplevel widget for this demo script if defined?($aniwave_demo) && $aniwave_demo - $aniwave_demo.destroy + $aniwave_demo.destroy $aniwave_demo = nil end @@ -51,11 +51,11 @@ class AnimatedWaveDemo @direction = dir # create canvas widget - @c = TkCanvas.new(frame, :width=>300, :height=>200, + @c = TkCanvas.new(frame, :width=>300, :height=>200, :background=>'black') @c.pack(:padx=>10, :pady=>10, :expand=>true) - # Creates a coordinates list of a wave. + # Creates a coordinates list of a wave. @waveCoords = [] @backupCoords = [] n = 0 @@ -67,10 +67,10 @@ class AnimatedWaveDemo # Create a smoothed line and arrange for its coordinates to be the # contents of the variable waveCoords. - @line = TkcLine.new(@c, @waveCoords, + @line = TkcLine.new(@c, @waveCoords, :width=>1, :fill=>'green', :smooth=>true) - # Main animation "loop". + # Main animation "loop". # Theoretically 100 frames-per-second (==10ms between frames) @timer = TkTimer.new(10){ basicMotion; reverser } diff --git a/ext/tk/sample/demos-en/arrow.rb b/ext/tk/sample/demos-en/arrow.rb index 055cd2af3c..452153d010 100644 --- a/ext/tk/sample/demos-en/arrow.rb +++ b/ext/tk/sample/demos-en/arrow.rb @@ -28,65 +28,65 @@ def arrowSetup(c) # Create the arrow and outline. c.delete('all') - TkcLine.new(c, v.x1, v.y, v.x2, v.y, - { 'width'=>10 * v.width, - 'arrowshape'=>[10*v.a, 10*v.b, 10*v.c], - 'arrow'=>'last' + TkcLine.new(c, v.x1, v.y, v.x2, v.y, + { 'width'=>10 * v.width, + 'arrowshape'=>[10*v.a, 10*v.b, 10*v.c], + 'arrow'=>'last' }.update(v.bigLineStyle) ) xtip = v.x2 - 10*v.b deltaY = 10*v.c + 5*v.width - TkcLine.new(c, v.x2, v.y, xtip, v.y + deltaY, - v.x2 - 10*v.a, v.y, xtip, v.y - deltaY, v.x2, v.y, + TkcLine.new(c, v.x2, v.y, xtip, v.y + deltaY, + v.x2 - 10*v.a, v.y, xtip, v.y - deltaY, v.x2, v.y, 'width'=>2, 'capstyle'=>'round', 'joinstyle'=>'round') # Create the boxes for reshaping the line and arrowhead. - TkcRectangle.new(c, v.x2-10*v.a-5, v.y-5, v.x2-10*v.a+5, v.y+5, + TkcRectangle.new(c, v.x2-10*v.a-5, v.y-5, v.x2-10*v.a+5, v.y+5, {'tags'=>['box1', $arrowTag_box]}.update(v.boxStyle) ) - TkcRectangle.new(c, xtip-5, v.y-deltaY-5, xtip+5, v.y-deltaY+5, + TkcRectangle.new(c, xtip-5, v.y-deltaY-5, xtip+5, v.y-deltaY+5, {'tags'=>['box2', $arrowTag_box]}.update(v.boxStyle) ) - TkcRectangle.new(c, v.x1-5, v.y-5*v.width-5, v.x1+5, v.y-5*v.width+5, + TkcRectangle.new(c, v.x1-5, v.y-5*v.width-5, v.x1+5, v.y-5*v.width+5, {'tags'=>['box3', $arrowTag_box]}.update(v.boxStyle) ) c.itemconfigure cur, v.activeStyle if cur # Create three arrows in actual size with the same parameters TkcLine.new(c, v.x2+50, 0, v.x2+50, 1000, 'width'=>2) tmp = v.x2+100 - TkcLine.new(c, tmp, v.y-125, tmp, v.y-75, 'width'=>v.width, + TkcLine.new(c, tmp, v.y-125, tmp, v.y-75, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - TkcLine.new(c, tmp-25, v.y, tmp+25, v.y, 'width'=>v.width, + TkcLine.new(c, tmp-25, v.y, tmp+25, v.y, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - TkcLine.new(c, tmp-25, v.y+75, tmp+25, v.y+125, 'width'=>v.width, + TkcLine.new(c, tmp-25, v.y+75, tmp+25, v.y+125, 'width'=>v.width, 'arrow'=>'both', 'arrowshape'=>[v.a, v.b, v.c]) - # Create a bunch of other arrows and text items showing the + # Create a bunch of other arrows and text items showing the # current dimensions. tmp = v.x2+10 - TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y-deltaY, + TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y-deltaY, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2+15, v.y-deltaY+5*v.c, 'text'=>v.c, 'anchor'=>'w') tmp = v.x1-10 - TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y+5*v.width, + TkcLine.new(c, tmp, v.y-5*v.width, tmp, v.y+5*v.width, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x1-15, v.y, 'text'=>v.width, 'anchor'=>'e') tmp = v.y+5*v.width+10*v.c+10 - TkcLine.new(c, v.x2-10*v.a, tmp, v.x2, tmp, + TkcLine.new(c, v.x2-10*v.a, tmp, v.x2, tmp, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2-5*v.a, tmp+5, 'text'=>v.a, 'anchor'=>'n') tmp = tmp+25 - TkcLine.new(c, v.x2-10*v.b, tmp, v.x2, tmp, + TkcLine.new(c, v.x2-10*v.b, tmp, v.x2, tmp, 'arrow'=>'both', 'arrowshape'=>v.smallTips) TkcText.new(c, v.x2-5*v.b, tmp+5, 'text'=>v.b, 'anchor'=>'n') if $tk_version =~ /^4.*/ - TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', + TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*') - TkcText.new(c, v.x1, 330, + TkcText.new(c, v.x1, 330, 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]",'anchor'=>'w', 'font'=>'-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*') else - TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', + TkcText.new(c, v.x1, 310, 'text'=>"'width'=>#{v.width}", 'anchor'=>'w', 'font'=>'Helvetica 18') - TkcText.new(c, v.x1, 330, + TkcText.new(c, v.x1, 330, 'text'=>"'arrowshape'=>[#{v.a}, #{v.b}, #{v.c}]", 'anchor'=>'w', 'font'=>'Helvetica 18') end @@ -96,7 +96,7 @@ end # toplevel widget if defined?($arrow_demo) && $arrow_demo - $arrow_demo.destroy + $arrow_demo.destroy $arrow_demo = nil end @@ -110,7 +110,7 @@ $arrow_demo = TkToplevel.new {|w| base_frame = TkFrame.new($arrow_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', +TkLabel.new(base_frame, 'font'=>$font, 'wraplength'=>'5i', 'justify'=>'left', 'text'=>"This widget allows you to experiment with different widths and arrowhead shapes for lines in canvases. To change the line width or the shape of the arrowhead, drag any of the three boxes attached to the oversized arrow. The arrows on the right give examples at normal scale. The text at the bottom shows the configuration options as you'd enter them for a canvas line item."){ pack('side'=>'top') } @@ -133,15 +133,15 @@ $arrow_buttons = TkFrame.new(base_frame) {|frame| } $arrow_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# canvas -$arrow_canvas = TkCanvas.new(base_frame, 'width'=>500, 'height'=>350, +# canvas +$arrow_canvas = TkCanvas.new(base_frame, 'width'=>500, 'height'=>350, 'relief'=>'sunken', 'borderwidth'=>2) $arrow_canvas.pack('expand'=>'yes', 'fill'=>'both') -# +# unless Struct.const_defined?("ArrowInfo") - $demo_arrowInfo = Struct.new("ArrowInfo", :a, :b, :c, :width, :motionProc, - :x1, :x2, :y, :smallTips, :count, + $demo_arrowInfo = Struct.new("ArrowInfo", :a, :b, :c, :width, :motionProc, + :x1, :x2, :y, :smallTips, :count, :bigLineStyle, :boxStyle, :activeStyle).new end $demo_arrowInfo.a = 8 @@ -159,7 +159,7 @@ if TkWinfo.depth($arrow_canvas) > 1 $demo_arrowInfo.boxStyle = {'fill'=>'', 'outline'=>'black', 'width'=>1} $demo_arrowInfo.activeStyle = {'fill'=>'red', 'outline'=>'black', 'width'=>1} else - $demo_arrowInfo.bigLineStyle = {'fill'=>'black', + $demo_arrowInfo.bigLineStyle = {'fill'=>'black', 'stipple'=>'@'+[$demo_dir,'..','images','grey.25'].join(File::Separator)} $demo_arrowInfo.boxStyle = {'fill'=>'', 'outline'=>'black', 'width'=>1} $demo_arrowInfo.activeStyle = {'fill'=>'black','outline'=>'black','width'=>1} @@ -170,16 +170,16 @@ $arrowTag_box.bind('Enter', proc{$arrow_canvas.itemconfigure('current', $demo_ar $arrowTag_box.bind('Leave', proc{$arrow_canvas.itemconfigure('current', $demo_arrowInfo.boxStyle)}) $arrowTag_box.bind('B1-Enter', proc{}) $arrowTag_box.bind('B1-Leave', proc{}) -$arrow_canvas.itembind('box1', '1', +$arrow_canvas.itembind('box1', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove1 $arrow_canvas, x, y}}) -$arrow_canvas.itembind('box2', '1', +$arrow_canvas.itembind('box2', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove2 $arrow_canvas, x, y}}) -$arrow_canvas.itembind('box3', '1', +$arrow_canvas.itembind('box3', '1', proc{$demo_arrowInfo.motionProc \ = proc{|x,y| arrowMove3 $arrow_canvas, x, y}}) -$arrowTag_box.bind('B1-Motion', +$arrowTag_box.bind('B1-Motion', proc{|x,y| $demo_arrowInfo.motionProc.call(x,y)}, "%x %y") $arrow_canvas.bind('Any-ButtonRelease-1', proc{arrowSetup $arrow_canvas}) diff --git a/ext/tk/sample/demos-en/bind.rb b/ext/tk/sample/demos-en/bind.rb index 665592a2bc..c291e4730a 100644 --- a/ext/tk/sample/demos-en/bind.rb +++ b/ext/tk/sample/demos-en/bind.rb @@ -8,7 +8,7 @@ # toplevel widget if defined?($bind_demo) && $bind_demo - $bind_demo.destroy + $bind_demo.destroy $bind_demo = nil end @@ -38,15 +38,15 @@ TkFrame.new(base_frame) {|frame| }.pack('side'=>'left', 'expand'=>'yes') }.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# bind +# bind def tag_binding_for_bind_demo(tag, enter_style, leave_style) tag.bind('Any-Enter', proc{tag.configure enter_style}) tag.bind('Any-Leave', proc{tag.configure leave_style}) end -# text +# text txt = TkText.new(base_frame){|t| - # + # setgrid 'true' #width 60 #height 24 @@ -59,9 +59,9 @@ txt = TkText.new(base_frame){|t| } pack('expand'=>'yes', 'fill'=>'both') - # + # if TkWinfo.depth($root).to_i > 1 - tagstyle_bold = {'background'=>'#43ce80', 'relief'=>'raised', + tagstyle_bold = {'background'=>'#43ce80', 'relief'=>'raised', 'borderwidth'=>1} tagstyle_normal = {'background'=>'', 'relief'=>'flat'} else @@ -77,44 +77,44 @@ txt = TkText.new(base_frame){|t| insert('end', "\n\n") insert('end', '2. A simple two-dimensional plot that allows you to adjust the positions of the data points.', (d2 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '3. Anchoring and justification modes for text items.', + insert('end', '3. Anchoring and justification modes for text items.', (d3 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '4. An editor for arrow-head shapes for line items.', + insert('end', '4. An editor for arrow-head shapes for line items.', (d4 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', '5. A ruler with facilities for editing tab stops.', + insert('end', '5. A ruler with facilities for editing tab stops.', (d5 = TkTextTag.new(t)) ) insert('end', "\n\n") - insert('end', - '6. A grid that demonstrates how canvases can be scrolled.', + insert('end', + '6. A grid that demonstrates how canvases can be scrolled.', (d6 = TkTextTag.new(t)) ) # binding [d1, d2, d3, d4, d5, d6].each{|tag| tag_binding_for_bind_demo(tag, tagstyle_bold, tagstyle_normal) } - d1.bind('1', + d1.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'items.rb'].join(File::Separator)}`, 'items.rb') }) - d2.bind('1', + d2.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'plot.rb'].join(File::Separator)}`, 'plot.rb') }) - d3.bind('1', + d3.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'ctext.rb'].join(File::Separator)}`, 'ctext.rb') }) - d4.bind('1', + d4.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'arrow.rb'].join(File::Separator)}`, 'arrow.rb') }) - d5.bind('1', + d5.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'ruler.rb'].join(File::Separator)}`, 'ruler.rb') }) - d6.bind('1', + d6.bind('1', proc{ eval_samplecode(`cat #{[$demo_dir,'cscroll.rb'].join(File::Separator)}`, 'cscroll.rb') }) diff --git a/ext/tk/sample/demos-en/bitmap.rb b/ext/tk/sample/demos-en/bitmap.rb index 133adb0543..858d067d0d 100644 --- a/ext/tk/sample/demos-en/bitmap.rb +++ b/ext/tk/sample/demos-en/bitmap.rb @@ -17,7 +17,7 @@ def bitmapRow(w,*args) TkFrame.new(w){|row| pack('side'=>'top', 'fill'=>'both') - for bitmap in args + for bitmap in args TkFrame.new(row){|base| pack('side'=>'left', 'fill'=>'both', 'pady'=>'.25c', 'padx'=>'.25c') TkLabel.new(base, 'text'=>bitmap, 'width'=>9).pack('side'=>'bottom') @@ -29,7 +29,7 @@ end # toplevel widget if defined?($bitmap_demo) && $bitmap_demo - $bitmap_demo.destroy + $bitmap_demo.destroy $bitmap_demo = nil end @@ -43,7 +43,7 @@ $bitmap_demo = TkToplevel.new {|w| base_frame = TkFrame.new($bitmap_demo).pack(:fill=>:both, :expand=>true) # label -TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left', +TkLabel.new(base_frame,'font'=>$font,'wraplength'=>'4i','justify'=>'left', 'text'=>"This window displays all of Tk's built-in bitmaps, along with the names you can use for them in Tcl scripts."){ pack('side'=>'top') } @@ -66,7 +66,7 @@ $bitmap_buttons = TkFrame.new(base_frame) {|frame| } $bitmap_buttons.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m') -# frame +# frame TkFrame.new(base_frame){|f| bitmapRow(f,'error','gray25','gray50','hourglass') bitmapRow(f,'info','question','questhead','w |